diff options
451 files changed, 2467 insertions, 8618 deletions
diff --git a/.qmake.conf b/.qmake.conf index 7121ac2008..e6301f2d22 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -5,4 +5,4 @@ CONFIG += warning_clean QT_SOURCE_TREE = $$PWD QT_BUILD_TREE = $$shadowed($$PWD) -MODULE_VERSION = 5.7.0 +MODULE_VERSION = 5.8.0 diff --git a/config.tests/common/c++default/c++default.cpp b/config.tests/common/c++default/c++default.cpp deleted file mode 100644 index 018963beb3..0000000000 --- a/config.tests/common/c++default/c++default.cpp +++ /dev/null @@ -1 +0,0 @@ -__cplusplus diff --git a/config.tests/common/c++default/c++default.pro b/config.tests/common/c++default/c++default.pro deleted file mode 100644 index 7e6bcefe69..0000000000 --- a/config.tests/common/c++default/c++default.pro +++ /dev/null @@ -1,14 +0,0 @@ -TEMPLATE = aux -CONFIG -= qt c++11 -PREPROCESSOR_SOURCES += c++default.cpp - -preprocessor.commands = $(CXX) $(CXXFLAGS) $(INCPATH) -o $@ -E $< -msvc:preprocessor.commands = $(CXX) $(CXXFLAGS) $(INCPATH) -E ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT} -preprocessor.output = ${QMAKE_FILE_BASE}.ii -preprocessor.input = PREPROCESSOR_SOURCES -preprocessor.variable_out = GENERATED_FILES -QMAKE_EXTRA_COMPILERS += preprocessor - -all.target = all -all.depends += c++default.ii -QMAKE_EXTRA_TARGETS += all diff --git a/config.tests/unix/openvg/openvg.pro b/config.tests/unix/openvg/openvg.pro deleted file mode 100644 index 4bbde99230..0000000000 --- a/config.tests/unix/openvg/openvg.pro +++ /dev/null @@ -1,19 +0,0 @@ -SOURCES += openvg.cpp - -!isEmpty(QMAKE_INCDIR_OPENVG): INCLUDEPATH += $$QMAKE_INCDIR_OPENVG -!isEmpty(QMAKE_LIBDIR_OPENVG): LIBS += -L$$QMAKE_LIBDIR_OPENVG -!isEmpty(QMAKE_LIBS_OPENVG): LIBS += $$QMAKE_LIBS_OPENVG - -# Some OpenVG engines (e.g. ShivaVG) are implemented on top of OpenGL. -# Add the extra includes and libraries for that case. -openvg_on_opengl { - !isEmpty(QMAKE_INCDIR_OPENGL): INCLUDEPATH += $$QMAKE_INCDIR_OPENGL - !isEmpty(QMAKE_LIBDIR_OPENGL): LIBS += -L$$QMAKE_LIBDIR_OPENGL - !isEmpty(QMAKE_LIBS_OPENGL): LIBS += $$QMAKE_LIBS_OPENGL -} - -lower_case_includes { - DEFINES += QT_LOWER_CASE_VG_INCLUDES -} - -CONFIG -= qt diff --git a/config.tests/unix/shivavg/shivavg.pro b/config.tests/unix/shivavg/shivavg.pro deleted file mode 100644 index 39d7bcc78a..0000000000 --- a/config.tests/unix/shivavg/shivavg.pro +++ /dev/null @@ -1,11 +0,0 @@ -SOURCES += shivavg.cpp - -!isEmpty(QMAKE_INCDIR_OPENVG): INCLUDEPATH += $$QMAKE_INCDIR_OPENVG -!isEmpty(QMAKE_LIBDIR_OPENVG): LIBS += -L$$QMAKE_LIBDIR_OPENVG -!isEmpty(QMAKE_LIBS_OPENVG): LIBS += $$QMAKE_LIBS_OPENVG - -!isEmpty(QMAKE_INCDIR_OPENGL): INCLUDEPATH += $$QMAKE_INCDIR_OPENGL -!isEmpty(QMAKE_LIBDIR_OPENGL): LIBS += -L$$QMAKE_LIBDIR_OPENGL -!isEmpty(QMAKE_LIBS_OPENGL): LIBS += $$QMAKE_LIBS_OPENGL - -CONFIG -= qt @@ -622,7 +622,7 @@ CFG_SM=auto CFG_XSHAPE=auto CFG_XSYNC=auto CFG_XFIXES=runtime -CFG_ZLIB=auto +CFG_SYSTEM_ZLIB=auto CFG_MTDEV=auto CFG_JOURNALD=no CFG_SYSLOG=no @@ -637,10 +637,6 @@ CFG_XRANDR=runtime CFG_XRENDER=auto CFG_MITSHM=auto CFG_OPENGL=auto -CFG_OPENVG=auto -CFG_OPENVG_LC_INCLUDES=no -CFG_OPENVG_SHIVA=auto -CFG_OPENVG_ON_OPENGL=auto CFG_EGL=auto CFG_EGL_X=auto CFG_DOUBLECONVERSION=auto @@ -666,7 +662,7 @@ CFG_SYSTEM_PROXIES=no CFG_ANDROID_STYLE_ASSETS=yes CFG_GSTREAMER=auto CFG_GSTREAMER_VERSION="" -CFG_ATOMIC64=auto +CFG_STD_ATOMIC64=auto # Target architecture CFG_ARCH= @@ -1000,16 +996,6 @@ while [ "$#" -gt 0 ]; do VAL=$1 fi ;; - -openvg) - VAR=openvg - # this option may or may not be followed by an argument - if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then - VAL=yes - else - shift; - VAL=$1 - fi - ;; -gstreamer) VAR=gstreamer # this option may or may not be followed by an argument @@ -1284,13 +1270,6 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; - openvg) - if [ "$VAL" = "auto" ] || [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then - CFG_OPENVG="$VAL" - else - UNKNOWN_OPT=yes - fi - ;; nomake) if [ -n "${QT_ALL_BUILD_PARTS%%* $VAL *}" ]; then echo "Unknown part $VAL passed to -nomake." >&2 @@ -1684,9 +1663,10 @@ while [ "$#" -gt 0 ]; do fi ;; zlib) - [ "$VAL" = "qt" ] && VAL=yes - if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then - CFG_ZLIB="$VAL" + if [ "$VAL" = "system" ]; then + CFG_SYSTEM_ZLIB="yes" + elif [ "$VAL" = "qt" ]; then + CFG_SYSTEM_ZLIB="no" else UNKNOWN_OPT=yes fi @@ -2156,18 +2136,9 @@ while [ "$#" -gt 0 ]; do VAL="`echo $VAL |tr a-z A-Z`" eval "CFG_$VAL=$OPT" continue - fi - - if [ "$OPT" = "plugin" ] || [ "$OPT" = "qt" ]; then - if [ "$OPT" = "plugin" ]; then - VAR="${VAR}-${OPT}" - fi - QMakeVar add "${VAR}s" "${VAL}" - elif [ "$OPT" = "no" ]; then - PLUG_VAR="${VAR}-plugin" - IN_VAR="${VAR}" - QMakeVar del "${IN_VAR}s" "$VAL" - QMakeVar del "${PLUG_VAR}s" "$VAL" + else + echo "Internal error resolving command line arguments." + exit 1 fi ;; v|verbose) @@ -4452,28 +4423,13 @@ if $stdcxx_error && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then exit 101 fi -# Detect which edition of the C++ standard the compiler defaults to -CFG_STDCXX_DEFAULT=199711 -if compileTest common/c++default "default C++ standard edition"; then - if [ -e "$outpath/config.tests/common/c++default/c++default.ii" ]; then - CFG_STDCXX_DEFAULT=`sed -n '/^[0-9]/s/L//p' "$outpath/config.tests/common/c++default/c++default.ii"` - else - if [ "$OPT_VERBOSE" = "yes" ]; then - echo "Failed to run the preprocessor, something is wrong with your compiler" - fi - if [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then - exit 101 - fi - fi -fi - # Detect whether 64-bit std::atomic works -- some 32-bit platforms require extra library support if compileTest common/atomic64 "64-bit std::atomic"; then - CFG_ATOMIC64=yes + CFG_STD_ATOMIC64=yes elif compileTest common/atomic64 "64-bit std::atomic in -latomic" -latomic; then - CFG_ATOMIC64=libatomic + CFG_STD_ATOMIC64=libatomic else - CFG_ATOMIC64=no + CFG_STD_ATOMIC64=no fi # detect sse2 support @@ -4663,21 +4619,6 @@ if ! compileTest unix/ipc_sysv "ipc_sysv" ; then fi fi -# detect zlib -if [ "$CFG_ZLIB" = "no" ]; then - # Note: Qt no longer support builds without zlib - # So we force a "no" to be "auto" here. - # If you REALLY really need no zlib support, you can still disable - # it by doing the following: - # add "no-zlib" to mkspecs/qconfig.pri - # #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h) - # - # There's no guarantee that Qt will build under those conditions - - CFG_ZLIB=auto - ZLIB_FORCED=yes -fi - if [ "$XPLATFORM_QNX" = "yes" ]; then if [ "$CFG_SLOG2" != "no" ]; then if compileTest unix/slog2 "slog2"; then @@ -4720,11 +4661,12 @@ if [ "$XPLATFORM_INTEGRITY" = "yes" ]; then CFG_LARGEFILE=no fi -if [ "$CFG_ZLIB" = "auto" ]; then +# detect zlib +if [ "$CFG_SYSTEM_ZLIB" = "auto" ]; then if compileTest unix/zlib "zlib"; then - CFG_ZLIB=system + CFG_SYSTEM_ZLIB=yes else - CFG_ZLIB=yes + CFG_SYSTEM_ZLIB=no fi fi @@ -6210,44 +6152,6 @@ if [ "$CFG_PCRE" != "qt" ]; then fi fi -# detect OpenVG support -if [ "$CFG_OPENVG" != "no" ]; then - if compileTest unix/openvg "OpenVG"; then - if [ "$CFG_OPENVG" = "auto" ]; then - CFG_OPENVG=yes - fi - elif compileTest unix/openvg "OpenVG" -config openvg_on_opengl; then - if [ "$CFG_OPENVG" = "auto" ]; then - CFG_OPENVG=yes - fi - CFG_OPENVG_ON_OPENGL=yes - elif compileTest unix/openvg "OpenVG (lc includes)" -config lower_case_includes; then - if [ "$CFG_OPENVG" = "auto" ]; then - CFG_OPENVG=yes - fi - CFG_OPENVG_LC_INCLUDES=yes - elif compileTest unix/openvg "OpenVG (lc includes)" -config "openvg_on_opengl lower_case_includes"; then - if [ "$CFG_OPENVG" = "auto" ]; then - CFG_OPENVG=yes - fi - CFG_OPENVG_LC_INCLUDES=yes - CFG_OPENVG_ON_OPENGL=yes - else - if [ "$CFG_OPENVG" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then - echo "$CFG_OPENVG was specified for OpenVG but cannot be enabled due to functionality tests!" - echo " Turn on verbose messaging (-v) to $0 to see the final report." - echo " If you believe this message is in error you may use the continue" - echo " switch (-continue) to $0 to continue." - exit 101 - else - CFG_OPENVG=no - fi - fi - if [ "$CFG_OPENVG" = "yes" ] && compileTest unix/shivavg "ShivaVG"; then - CFG_OPENVG_SHIVA=yes - fi -fi - if [ "$CFG_ALSA" = "auto" ]; then if compileTest unix/alsa "alsa"; then CFG_ALSA=yes @@ -6314,7 +6218,7 @@ if [ "$CFG_STDCXX" != "c++11" ]; then fi fi -if [ "$CFG_ATOMIC64" = "libatomic" ]; then +if [ "$CFG_STD_ATOMIC64" = "libatomic" ]; then QMAKE_CONFIG="$QMAKE_CONFIG atomic64-libatomic" fi @@ -6372,23 +6276,6 @@ if [ "$CFG_EGLFS_VIV" = "yes" ]; then fi fi -# enable openvg -if [ "$CFG_OPENVG" = "no" ]; then - QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENVG" -else - QT_CONFIG="$QT_CONFIG openvg" - if [ "$CFG_OPENVG_LC_INCLUDES" = "yes" ]; then - QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LOWER_CASE_VG_INCLUDES" - fi - if [ "$CFG_OPENVG_ON_OPENGL" = "yes" ]; then - QT_CONFIG="$QT_CONFIG openvg_on_opengl" - fi - if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then - QT_CONFIG="$QT_CONFIG shivavg" - QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SHIVAVG" - fi -fi - # enable opengl if [ "$CFG_OPENGL" = "no" ]; then QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENGL" @@ -6543,11 +6430,9 @@ fi if [ "$XPLATFORM_MAC" = "yes" ]; then #On Mac we implicitly link against libz, so we #never use the 3rdparty stuff. - [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system" + CFG_SYSTEM_ZLIB=yes fi -if [ "$CFG_ZLIB" = "yes" ]; then - QT_CONFIG="$QT_CONFIG zlib" -elif [ "$CFG_ZLIB" = "system" ]; then +if [ "$CFG_SYSTEM_ZLIB" = "yes" ]; then QT_CONFIG="$QT_CONFIG system-zlib" fi @@ -6658,137 +6543,8 @@ if [ "$CFG_PCRE" = "qt" ]; then QMAKE_CONFIG="$QMAKE_CONFIG pcre" fi -# -# Some Qt modules are too advanced in C++ for some old compilers -# Detect here the platforms where they are known to work. -# -# See Qt documentation for more information on which features are -# supported and on which compilers. -# -canBuildQtConcurrent="yes" - -case "$XPLATFORM" in - hpux-g++*) - # PA-RISC's assembly is too limited - # gcc 3.4 on that platform can't build QtXmlPatterns - # the assembly it generates cannot be compiled - - # Check gcc's version - case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in - 4*) - ;; - 3.4*) - canBuildQtXmlPatterns="no" - ;; - *) - canBuildWebKit="no" - canBuildQtXmlPatterns="no" - ;; - esac - ;; - unsupported/vxworks-*-g++*) - canBuildWebKit="no" - ;; - unsupported/vxworks-*-dcc*) - canBuildWebKit="no" - canBuildQtXmlPatterns="no" - ;; - *-g++*) - # Check gcc's version - case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in - 4*|3.4*) - ;; - 3.3*) - canBuildWebKit="no" - ;; - *) - canBuildWebKit="no" - canBuildQtXmlPatterns="no" - ;; - esac - ;; - solaris-cc*) - # Check the compiler version - case `${QMAKE_CONF_COMPILER} -V 2>&1 | $AWK '{print $4}'` in - 5.[012345678]) - canBuildWebKit="no" - canBuildQtXmlPatterns="no" - canBuildQtConcurrent="no" - ;; - 5.*) - canBuildWebKit="no" - canBuildQtConcurrent="no" - ;; - esac - ;; - hpux-acc*) - canBuildWebKit="no" - canBuildQtXmlPatterns="no" - canBuildQtConcurrent="no" - ;; - hpuxi-acc*) - canBuildWebKit="no" - ;; - aix-xlc*) - # Get the xlC version - cat > xlcver.c <<EOF -#include <stdio.h> -int main() -{ - printf("%d.%d\n", __xlC__ >> 8, __xlC__ & 0xFF); - return 0; -} -EOF - xlcver= - if ${QMAKE_CONF_COMPILER} -o xlcver xlcver.c >/dev/null 2>/dev/null; then - xlcver=`./xlcver 2>/dev/null` - rm -f ./xlcver - fi - if [ "$OPT_VERBOSE" = "yes" ]; then - if [ -n "$xlcver" ]; then - echo Found IBM xlC version: $xlcver. - else - echo Could not determine IBM xlC version, assuming oldest supported. - fi - fi - - case "$xlcver" in - [123456].*) - canBuildWebKit="no" - canBuildQtXmlPatterns="no" - canBuildQtConcurrent="no" - ;; - *) - canBuildWebKit="no" - canBuildQtConcurrent="no" - ;; - esac - ;; - irix-cc*) - canBuildWebKit="no" - canBuildQtConcurrent="no" - ;; -esac - -if [ "$CFG_GUI" = "no" ]; then - # WebKit requires Qt GUI - canBuildWebKit="no" -fi - -if [ "$CFG_SHARED" = "no" ]; then - echo - echo "WARNING: Using static linking will disable the WebKit module." - echo - canBuildWebKit="no" -fi - CFG_CONCURRENT="yes" -if [ "$canBuildQtConcurrent" = "no" ]; then - QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CONCURRENT" - CFG_CONCURRENT="no" -else - QT_CONFIG="$QT_CONFIG concurrent" -fi +QT_CONFIG="$QT_CONFIG concurrent" # ### Vestige if [ "$CFG_AUDIO_BACKEND" = "yes" ]; then @@ -6904,7 +6660,7 @@ if [ "$CFG_FRAMEWORK" = "yes" ]; then echo "#define QT_MAC_FRAMEWORK_BUILD" fi -if [ "$CFG_ATOMIC64" = "no" ]; then +if [ "$CFG_STD_ATOMIC64" = "no" ]; then echo "#define QT_NO_STD_ATOMIC64" fi @@ -6961,7 +6717,6 @@ QMakeVar set sql-plugins "$SQL_PLUGINS" [ "$CFG_GIF" = "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_BUILTIN_GIF_READER=1" [ "$CFG_PNG" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_PNG" [ "$CFG_JPEG" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_JPEG" -[ "$CFG_ZLIB" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ZLIB" [ "$CFG_DBUS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS" [ "$CFG_LIBPROXY" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_LIBPROXY" @@ -7175,7 +6930,6 @@ if [ -n "$CFG_SYSROOT" ] && [ "$CFG_GCC_SYSROOT" = "yes" ]; then echo "}" echo fi -echo "QT_COMPILER_STDCXX = $CFG_STDCXX_DEFAULT" if [ -n "$QT_GCC_MAJOR_VERSION" ]; then echo "QT_GCC_MAJOR_VERSION = $QT_GCC_MAJOR_VERSION" echo "QT_GCC_MINOR_VERSION = $QT_GCC_MINOR_VERSION" @@ -7451,7 +7205,6 @@ report_support " NIS ...................." "$CFG_NIS" report_support " OpenGL / OpenVG:" report_support " EGL .................." "$CFG_EGL" report_support " OpenGL ..............." "$CFG_OPENGL" yes "Desktop OpenGL" es2 "OpenGL ES 2.0+" -report_support " OpenVG ..............." "$CFG_OPENVG-$CFG_OPENVG_SHIVA" yes-yes "ShivaVG" yes-no "native" report_support " PCRE ..................." "$CFG_PCRE" yes "system library" qt "bundled copy" if [ -n "$PKG_CONFIG" ]; then report_support " pkg-config ............. yes" @@ -7510,7 +7263,7 @@ report_support " tslib .................." "$CFG_TSLIB" report_support " udev ..................." "$CFG_LIBUDEV" report_support " xkbcommon-x11..........." "$CFG_XKBCOMMON" system "system library" qt "bundled copy, XKB config root: $CFG_XKB_CONFIG_ROOT" report_support " xkbcommon-evdev........." "$CFG_XKBCOMMON_EVDEV" -report_support " zlib ..................." "$CFG_ZLIB" system "system library" yes "bundled copy" +report_support " zlib ..................." "$CFG_SYSTEM_ZLIB" yes "system library" no "bundled copy" echo @@ -7608,26 +7361,6 @@ EOF fi #------------------------------------------------------------------------------- -# check if the user passed the -no-zlib option, which is no longer supported -#------------------------------------------------------------------------------- -if [ -n "$ZLIB_FORCED" ]; then - which_zlib="supplied" - if [ "$CFG_ZLIB" = "system" ]; then - which_zlib="system" - fi - -cat <<EOF - - NOTICE: The -no-zlib option was supplied but is no longer - supported. - - Qt now requires zlib support in all builds, so the -no-zlib - option was ignored. Qt will be built using the $which_zlib - zlib. -EOF -fi - -#------------------------------------------------------------------------------- # check if the user passed the obsoleted -wayland or -no-wayland flag #------------------------------------------------------------------------------- if [ "$CFG_OBSOLETE_WAYLAND" = "yes" ]; then diff --git a/examples/corelib/ipc/ipc.pro b/examples/corelib/ipc/ipc.pro index 65ee98a2cf..4cc5f3be56 100644 --- a/examples/corelib/ipc/ipc.pro +++ b/examples/corelib/ipc/ipc.pro @@ -3,4 +3,4 @@ requires(qtHaveModule(widgets)) TEMPLATE = subdirs # no QSharedMemory !vxworks:!integrity: SUBDIRS = sharedmemory -!wince:qtHaveModule(network): SUBDIRS += localfortuneserver localfortuneclient +qtHaveModule(network): SUBDIRS += localfortuneserver localfortuneclient diff --git a/examples/network/bearermonitor/bearermonitor.pro b/examples/network/bearermonitor/bearermonitor.pro index f364fabf2d..d75e021834 100644 --- a/examples/network/bearermonitor/bearermonitor.pro +++ b/examples/network/bearermonitor/bearermonitor.pro @@ -12,8 +12,7 @@ FORMS = bearermonitor_240_320.ui \ bearermonitor_640_480.ui \ sessionwidget.ui -win32:!wince: LIBS += -lws2_32 -wince: LIBS += -lws2 +win32:LIBS += -lws2_32 CONFIG += console diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf index ad3c638a6f..d0bb9561cc 100644 --- a/mkspecs/common/mac.conf +++ b/mkspecs/common/mac.conf @@ -6,6 +6,10 @@ QMAKE_PLATFORM += mac darwin +MAKEFILE_GENERATOR = UNIX +CONFIG += app_bundle incremental global_init_link_order lib_version_first plugin_no_soname sdk +QMAKE_INCREMENTAL_STYLE = sublib + include(unix.conf) QMAKE_RESOURCE = /Developer/Tools/Rez diff --git a/mkspecs/common/wince/qmake.conf b/mkspecs/common/wince/qmake.conf deleted file mode 100644 index fa1a72a1b9..0000000000 --- a/mkspecs/common/wince/qmake.conf +++ /dev/null @@ -1,84 +0,0 @@ -# -# qmake configuration for common Windows CE -# - -include(../angle.conf) - -MAKEFILE_GENERATOR = MSVC.NET -QMAKE_PLATFORM += wince win32 -CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target - -DEFINES += UNDER_CE WINCE _WINDOWS _UNICODE UNICODE _WIN32 QT_NO_PRINTER QT_NO_PRINTDIALOG - -QMAKE_COMPILER_DEFINES += _MSC_VER=1400 - -QMAKE_COMPILER = msvc - -QMAKE_CC = cl -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = bison -y -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t- -QMAKE_CFLAGS_WARN_ON = -W3 -QMAKE_CFLAGS_WARN_OFF = -W0 -QMAKE_CFLAGS_RELEASE = -O2 -MD -QMAKE_CFLAGS_LTCG = -GL -QMAKE_CFLAGS_DEBUG = -DDEBUG -D_DEBUG -Zi -MDd -QMAKE_CFLAGS_YACC = - -# Uncomment the following lines to reduce library sizes -# with potential cost of performance -# QMAKE_CFLAGS += -Os -# QMAKE_CFLAGS_RELEASE += -Os - -QMAKE_CXX = $$QMAKE_CC -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w34100 -w34189 -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_STL_ON = -EHsc -QMAKE_CXXFLAGS_STL_OFF = -QMAKE_CXXFLAGS_RTTI_ON = -GR -QMAKE_CXXFLAGS_RTTI_OFF = -QMAKE_CXXFLAGS_EXCEPTIONS_ON = -EHsc -QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -EHs-c- - -QMAKE_INCDIR = - -QMAKE_RUN_CC = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$obj $src -QMAKE_RUN_CC_IMP = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ $< -QMAKE_RUN_CC_IMP_BATCH = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ @<< -QMAKE_RUN_CXX = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$obj $src -QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ $< -QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<< - -QMAKE_LINK = link -QMAKE_LFLAGS = /NOLOGO /NODEFAULTLIB:OLDNAMES.LIB -QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO -QMAKE_LFLAGS_DEBUG = /DEBUG -QMAKE_LFLAGS_LTCG = /LTCG -QMAKE_LIBS_NETWORK = ws2.lib -QMAKE_LIBS_OPENGL = -QMAKE_LIBS_COMPAT = -QMAKE_PREFIX_SHLIB = -QMAKE_EXTENSION_SHLIB = dll -QMAKE_PREFIX_STATICLIB = -QMAKE_EXTENSION_STATICLIB = lib - -QMAKE_LIBS_EGL = $${LIBEGL_NAME}.lib -QMAKE_LIBS_OPENGL_ES2 = $${LIBGLESV2_NAME}.lib - -QMAKE_LIBS_QT_ENTRY = -lqtmain - -QMAKE_IDL = midl -QMAKE_LIB = lib -QMAKE_RC = rc - -VCPROJ_EXTENSION = .vcproj -VCSOLUTION_EXTENSION = .sln -VCPROJ_KEYWORD = Qt4VSv1.0 -load(qt_config) diff --git a/mkspecs/common/wince/qplatformdefs.h b/mkspecs/common/wince/qplatformdefs.h deleted file mode 100644 index 92f5013231..0000000000 --- a/mkspecs/common/wince/qplatformdefs.h +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -#ifdef UNICODE -#ifndef _UNICODE -#define _UNICODE -#endif -#endif - -// Get Qt defines/settings - -#include "qglobal.h" -#include "qfunctions_wince.h" - -#define _POSIX_ -#include <limits.h> -#undef _POSIX_ - -#include <tchar.h> -#include <stdio.h> -#include <stdlib.h> - -#ifdef QT_LARGEFILE_SUPPORT -#define QT_STATBUF struct _stati64 // non-ANSI defs -#define QT_STATBUF4TSTAT struct _stati64 // non-ANSI defs -#define QT_STAT ::_stati64 -#define QT_FSTAT ::_fstati64 -#else -#define QT_STATBUF struct stat // non-ANSI defs -#define QT_STATBUF4TSTAT struct stat // non-ANSI defs -#define QT_STAT ::qt_wince_stat -#define QT_FSTAT ::qt_wince__fstat -#endif -#define QT_STAT_REG _S_IFREG -#define QT_STAT_DIR _S_IFDIR -#define QT_STAT_MASK _S_IFMT -#if defined(_S_IFLNK) -# define QT_STAT_LNK _S_IFLNK -#endif -#define QT_FILENO ::qt_wince___fileno -#define QT_OPEN ::qt_wince_open -#define QT_CLOSE ::qt_wince__close -#ifdef QT_LARGEFILE_SUPPORT -#define QT_LSEEK ::_lseeki64 -#define QT_TSTAT ::_tstati64 -#else -#define QT_LSEEK ::qt_wince__lseek -#define QT_TSTAT ::_tstat -#endif -#define QT_READ ::qt_wince__read -#define QT_WRITE ::qt_wince__write -#define QT_ACCESS ::qt_wince__access -#define QT_GETCWD ::_getcwd -#define QT_CHDIR ::_chdir -#define QT_MKDIR ::qt_wince__mkdir -#define QT_RMDIR ::qt_wince__rmdir -#define QT_OPEN_LARGEFILE 0 -#define QT_OPEN_RDONLY _O_RDONLY -#define QT_OPEN_WRONLY _O_WRONLY -#define QT_OPEN_RDWR _O_RDWR -#define QT_OPEN_CREAT _O_CREAT -#define QT_OPEN_TRUNC _O_TRUNC -#define QT_OPEN_APPEND _O_APPEND -# define QT_OPEN_TEXT _O_TEXT -# define QT_OPEN_BINARY _O_BINARY - -#define QT_FOPEN ::fopen -#define QT_FSEEK ::fseek -#define QT_FTELL ::ftell -#define QT_FGETPOS ::fgetpos -#define QT_FSETPOS ::fsetpos -#define QT_MMAP ::mmap -#define QT_FPOS_T fpos_t -#define QT_OFF_T long - -#define QT_SIGNAL_ARGS int - -#define QT_VSNPRINTF(buffer, count, format, arg) \ - _vsnprintf(buffer, count, format, arg) - -#define QT_SNPRINTF ::_snprintf - -# define F_OK 0 -# define X_OK 1 -# define W_OK 2 -# define R_OK 4 - -typedef int mode_t; - -#endif // QPLATFORMDEFS_H diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf index 11fb52a0b1..78356b4437 100644 --- a/mkspecs/features/create_cmake.prf +++ b/mkspecs/features/create_cmake.prf @@ -78,7 +78,7 @@ contains(CMAKE_PLUGIN_DIR, "^\\.\\./.*") { CMAKE_PLUGIN_DIR_IS_ABSOLUTE = True } -win32:!wince:!static:!staticlib { +win32:!static:!staticlib { CMAKE_DLL_DIR = $$cmakeRelativePath($$[QT_INSTALL_BINS], $$[QT_INSTALL_PREFIX]) contains(CMAKE_DLL_DIR, "^\\.\\./.*") { CMAKE_DLL_DIR = $$[QT_INSTALL_BINS]/ diff --git a/mkspecs/features/default_pre.prf b/mkspecs/features/default_pre.prf index a247b46a72..cb348a1036 100644 --- a/mkspecs/features/default_pre.prf +++ b/mkspecs/features/default_pre.prf @@ -8,7 +8,7 @@ CONFIG = \ testcase_targets import_plugins import_qpa_plugin \ $$CONFIG -contains(QT_CONFIG, c++11):lessThan(QT_COMPILER_STDCXX, 201103): CONFIG += c++11 +CONFIG += c++11 !build_pass:defined(QT_EDITION, var):!equals(QT_EDITION, "OpenSource"):!equals(QT_EDITION, "Preview") { # diff --git a/mkspecs/features/no_debug_info.prf b/mkspecs/features/no_debug_info.prf index 1307679a39..da14b7bb27 100644 --- a/mkspecs/features/no_debug_info.prf +++ b/mkspecs/features/no_debug_info.prf @@ -1,5 +1,4 @@ - -win32-msvc2*|wince*msvc* { +msvc { QMAKE_CFLAGS -= -Zi QMAKE_CFLAGS_DEBUG -= -Zi QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -= -Zi diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index e54841a678..873f914610 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -356,7 +356,7 @@ for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) { # The following block is currently broken, because qt_plugin_XXX.prf files # are not generated for dynamic builds. - false:isEqual(QT_CURRENT_VERIFY, DEPLOYMENT_PLUGIN):shared:if(wince*|winrt) { + false:isEqual(QT_CURRENT_VERIFY, DEPLOYMENT_PLUGIN):shared:winrt { QT_ITEM = debug: QT_ITEM = $${QTPLUG}d4.dll else: QT_ITEM = $${QTPLUG}4.dll diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index aefd3aee1c..d14e1b8dde 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -74,7 +74,7 @@ header_module { TEMPLATE = lib } DESTDIR = $$MODULE_BASE_OUTDIR/lib -win32:!wince:!prefix_build: DLLDESTDIR = $$MODULE_BASE_OUTDIR/bin +win32:!prefix_build: DLLDESTDIR = $$MODULE_BASE_OUTDIR/bin CONFIG += qmake_cache target_qt @@ -113,10 +113,13 @@ lib_bundle { CONFIG += sliced_bundle header_module { CONFIG += bundle + QMAKE_BUNDLE_NAME = $$TARGET QMAKE_BUNDLE_EXTENSION = .framework QMAKE_INFO_PLIST = $$QMAKESPEC/Info.plist.lib } - !debug_and_release|!build_all|CONFIG(release, debug|release) { + !build_all| \ + if(if(!debug_and_release|CONFIG(release, debug|release)): \ + if(!simulator_and_device|CONFIG(device, simulator|device))) { FRAMEWORK_HEADERS.version = Versions FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES FRAMEWORK_HEADERS.path = Headers diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf index 220f11bd75..ccd66f4510 100644 --- a/mkspecs/features/qt_plugin.prf +++ b/mkspecs/features/qt_plugin.prf @@ -91,5 +91,4 @@ CONFIG += create_cmake load(qt_targets) load(qt_common) -wince: LIBS += $$QMAKE_LIBS_GUI QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF diff --git a/mkspecs/features/win32/console.prf b/mkspecs/features/win32/console.prf index 629f3af59b..e04367e20b 100644 --- a/mkspecs/features/win32/console.prf +++ b/mkspecs/features/win32/console.prf @@ -1,6 +1,5 @@ CONFIG -= windows QMAKE_LFLAGS += $$replace(QMAKE_LFLAGS_CONSOLE, @QMAKE_SUBSYSTEM_SUFFIX@, $$QMAKE_SUBSYSTEM_SUFFIX) contains(TEMPLATE, ".*app") { - wince: QMAKE_LFLAGS += /ENTRY:mainACRTStartup QMAKE_LFLAGS += $$QMAKE_LFLAGS_EXE } diff --git a/mkspecs/features/win32/opengl.prf b/mkspecs/features/win32/opengl.prf index 8173348bc4..c26ab62f50 100644 --- a/mkspecs/features/win32/opengl.prf +++ b/mkspecs/features/win32/opengl.prf @@ -1,32 +1,23 @@ -# WinCE does not have a platform directory for .prf files, and the -# win32 directory is searched for .prfs by qmake on WinCE. Ideally -# there should be a features/wince/opengl.prf which contains the wince -# block below. - -wince* { - include(../unix/opengl.prf) -} else { - contains(QT_CONFIG, opengles2) { -# For Desktop, use the ANGLE library location passed on from configure. - INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2 - CONFIG(debug, debug|release) { - QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2_DEBUG - contains(QT_CONFIG, angle) { - LIBS += $$QMAKE_LIBS_OPENGL_ES2_DEBUG - } else { - LIBS += $$QMAKE_LIBS_OPENGL_ES2 - } +contains(QT_CONFIG, opengles2) { +# For Desktop, use the ANGLE library location passed on from configure. + INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2 + CONFIG(debug, debug|release) { + QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2_DEBUG + contains(QT_CONFIG, angle) { + LIBS += $$QMAKE_LIBS_OPENGL_ES2_DEBUG } else { LIBS += $$QMAKE_LIBS_OPENGL_ES2 - QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2_RELEASE } - DEFINES += QT_OPENGL_ES_2 QT_OPENGL_ES_2_ANGLE - contains(QT_CONFIG, static): DEFINES += QT_OPENGL_ES_2_ANGLE_STATIC GL_APICALL= EGLAPI= - QT_CONFIG -= opengl } else { - !contains(QT_CONFIG, dynamicgl) { - QMAKE_LIBS += $$QMAKE_LIBS_OPENGL - QMAKE_LFLAGS += $$QMAKE_LFLAGS_OPENGL - } + LIBS += $$QMAKE_LIBS_OPENGL_ES2 + QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2_RELEASE + } + DEFINES += QT_OPENGL_ES_2 QT_OPENGL_ES_2_ANGLE + contains(QT_CONFIG, static): DEFINES += QT_OPENGL_ES_2_ANGLE_STATIC GL_APICALL= EGLAPI= + QT_CONFIG -= opengl +} else { + !contains(QT_CONFIG, dynamicgl) { + QMAKE_LIBS += $$QMAKE_LIBS_OPENGL + QMAKE_LFLAGS += $$QMAKE_LFLAGS_OPENGL } } diff --git a/mkspecs/macx-clang-32/qmake.conf b/mkspecs/macx-clang-32/qmake.conf index ec33c02e93..3b1099c808 100644 --- a/mkspecs/macx-clang-32/qmake.conf +++ b/mkspecs/macx-clang-32/qmake.conf @@ -2,10 +2,6 @@ # qmake configuration for 32-bit Clang on OS X # -MAKEFILE_GENERATOR = UNIX -CONFIG += app_bundle incremental global_init_link_order lib_version_first plugin_no_soname -QMAKE_INCREMENTAL_STYLE = sublib - include(../common/macx.conf) include(../common/gcc-base-mac.conf) include(../common/clang.conf) diff --git a/mkspecs/macx-clang/qmake.conf b/mkspecs/macx-clang/qmake.conf index d14b11179a..0e236ce459 100644 --- a/mkspecs/macx-clang/qmake.conf +++ b/mkspecs/macx-clang/qmake.conf @@ -2,10 +2,6 @@ # qmake configuration for Clang on OS X # -MAKEFILE_GENERATOR = UNIX -CONFIG += app_bundle incremental global_init_link_order lib_version_first plugin_no_soname -QMAKE_INCREMENTAL_STYLE = sublib - include(../common/macx.conf) include(../common/gcc-base-mac.conf) include(../common/clang.conf) diff --git a/mkspecs/macx-ios-clang/Info.plist.lib b/mkspecs/macx-ios-clang/Info.plist.lib index 2a44d1721e..7cbdb9af12 100644 --- a/mkspecs/macx-ios-clang/Info.plist.lib +++ b/mkspecs/macx-ios-clang/Info.plist.lib @@ -14,6 +14,8 @@ <string>@TYPEINFO@</string> <key>CFBundleExecutable</key> <string>@LIBRARY@</string> + <key>CFBundleIdentifier</key> + <string>@BUNDLEIDENTIFIER@</string> <key>NOTE</key> <string>Please, do NOT change this file -- It was generated by Qt/QMake.</string> </dict> diff --git a/mkspecs/macx-ios-clang/qmake.conf b/mkspecs/macx-ios-clang/qmake.conf index d5e5840902..deb76123f0 100644 --- a/mkspecs/macx-ios-clang/qmake.conf +++ b/mkspecs/macx-ios-clang/qmake.conf @@ -2,10 +2,6 @@ # qmake configuration for macx-ios-clang # -MAKEFILE_GENERATOR = UNIX -CONFIG += app_bundle reduce_exports incremental global_init_link_order lib_version_first plugin_no_soname sdk -QMAKE_INCREMENTAL_STYLE = sublib - QMAKE_MACOSX_DEPLOYMENT_TARGET = QMAKE_IOS_DEPLOYMENT_TARGET = 6.0 diff --git a/mkspecs/wince60standard-armv4i-msvc2005/qmake.conf b/mkspecs/wince60standard-armv4i-msvc2005/qmake.conf deleted file mode 100644 index fb16348487..0000000000 --- a/mkspecs/wince60standard-armv4i-msvc2005/qmake.conf +++ /dev/null @@ -1,27 +0,0 @@ -# -# qmake configuration for wince-msvc2005 -# -# Written for Microsoft VS 2005 for WindowsCE 6.0 (ARMV4I) -# This is just a template for creating Windows CE 6 mkspecs. -# - -include(../common/wince/qmake.conf) - -CE_SDK = STANDARDSDK_600 # replace with actual SDK name -CE_ARCH = ARMV4I - -DEFINES += STANDARDSHELL_UI_MODEL _WIN32_WCE=0x600 $$CE_ARCH _ARMV4I_ armv4i _ARM_ ARM _M_ARM ARM _WIN32 __arm__ - -QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:THUMB -QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:THUMB -QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:THUMB /DLL /SAFESEH:NO -QMAKE_LIBFLAGS_RELEASE = /LTCG -QMAKE_LIBS = corelibc.lib coredll.lib -QMAKE_LIBS_CORE = libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib -QMAKE_LIBS_GUI = ceshell.lib ole32.lib $$QMAKE_LIBS_CORE -QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI -QMAKE_LIBS_OPENGL = -QMAKE_LIBS_COMPAT = - -QMAKE_RC = rc /DUNDER_CE=600 /D_WIN32_WCE=0x600 - diff --git a/mkspecs/wince60standard-armv4i-msvc2005/qplatformdefs.h b/mkspecs/wince60standard-armv4i-msvc2005/qplatformdefs.h deleted file mode 100644 index 780b7ef124..0000000000 --- a/mkspecs/wince60standard-armv4i-msvc2005/qplatformdefs.h +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../common/wince/qplatformdefs.h" - diff --git a/mkspecs/wince60standard-x86-msvc2005/qmake.conf b/mkspecs/wince60standard-x86-msvc2005/qmake.conf deleted file mode 100644 index 417de0d688..0000000000 --- a/mkspecs/wince60standard-x86-msvc2005/qmake.conf +++ /dev/null @@ -1,27 +0,0 @@ -# -# qmake configuration for wince-msvc2005 -# -# Written for Microsoft VS 2005 for WindowsCE 6.0 (x86) -# This is just a template for creating Windows CE 6 mkspecs. -# - -include(../common/wince/qmake.conf) - -CE_SDK = STANDARDSDK_600 # replace with actual SDK name -CE_ARCH = x86 - -DEFINES += STANDARDSHELL_UI_MODEL _WIN32_WCE=0x600 $$CE_ARCH _X86_ _M_IX86 - -QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:X86 -QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:X86 -QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:X86 /DLL /SAFESEH:NO -QMAKE_LIBFLAGS_RELEASE = /LTCG -QMAKE_LIBS = corelibc.lib coredll.lib -QMAKE_LIBS_CORE = corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib -QMAKE_LIBS_GUI = ceshell.lib ole32.lib $$QMAKE_LIBS_CORE -QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI -QMAKE_LIBS_OPENGL = -QMAKE_LIBS_COMPAT = - -QMAKE_RC = rc /DUNDER_CE=600 /D_WIN32_WCE=0x600 - diff --git a/mkspecs/wince60standard-x86-msvc2005/qplatformdefs.h b/mkspecs/wince60standard-x86-msvc2005/qplatformdefs.h deleted file mode 100644 index 780b7ef124..0000000000 --- a/mkspecs/wince60standard-x86-msvc2005/qplatformdefs.h +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../common/wince/qplatformdefs.h" - diff --git a/mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf b/mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf deleted file mode 100644 index 860fbc0e6a..0000000000 --- a/mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf +++ /dev/null @@ -1,29 +0,0 @@ -# qmake configuration for Windows Embedded Compact 7 with VS2008 on ARM targets -# -# This is just a template for creating WEC7 mkspecs for ARM targets -# Replace the SDK name with actual SDK name. - -include(../common/wince/qmake.conf) - -CE_SDK = WEC7_SDK_NAME # replace with actual SDK name -CE_ARCH = armv4i - -DEFINES += QT_NO_CLIPBOARD QT_NO_ACCESSIBILITY QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x700 $$CE_ARCH _AMRV7_ armv7 _ARM_ - -QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB -QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB -QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB /DLL /SAFESEH:NO -QMAKE_LIBFLAGS_RELEASE = /LTCG -QMAKE_LIBS = corelibc.lib coredll.lib -QMAKE_LIBS_CORE = corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib -QMAKE_LIBS_GUI = ceshell.lib ole32.lib $$QMAKE_LIBS_CORE -QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI -QMAKE_LIBS_OPENGL = -QMAKE_LIBS_COMPAT = -QMAKE_LIBS_OPENVG = libopenvg.lib -QMAKE_LIBS_OPENGL_ES2 = $${LIBEGL_NAME}.lib $${LIBGLESV2_NAME}.lib - -QMAKE_RC = rc - -QMAKE_COMPILER_DEFINES -= _MSC_VER=1400 -QMAKE_COMPILER_DEFINES += _MSC_VER=1500 diff --git a/mkspecs/wince70embedded-armv4i-msvc2008/qplatformdefs.h b/mkspecs/wince70embedded-armv4i-msvc2008/qplatformdefs.h deleted file mode 100644 index 780b7ef124..0000000000 --- a/mkspecs/wince70embedded-armv4i-msvc2008/qplatformdefs.h +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../common/wince/qplatformdefs.h" - diff --git a/mkspecs/wince70embedded-x86-msvc2008/qmake.conf b/mkspecs/wince70embedded-x86-msvc2008/qmake.conf deleted file mode 100644 index 4d995db332..0000000000 --- a/mkspecs/wince70embedded-x86-msvc2008/qmake.conf +++ /dev/null @@ -1,27 +0,0 @@ -# qmake configuration for Windows Embedded Compact 7 with VS2008 platform builder target -# -# - -include(../common/wince/qmake.conf) - -CE_SDK = Platform Builder -CE_ARCH = _TGTCPU - -DEFINES += QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x700 $$CE_ARCH _X86_ _M_IX86 - -QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:X86 -QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:X86 -QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:X86 /DLL /SAFESEH:NO -QMAKE_LIBFLAGS_RELEASE = /LTCG -QMAKE_LIBS = corelibc.lib coredll.lib -QMAKE_LIBS_CORE = corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib -QMAKE_LIBS_GUI = ceshell.lib ole32.lib $$QMAKE_LIBS_CORE -QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI -QMAKE_LIBS_OPENGL = -QMAKE_LIBS_COMPAT = -QMAKE_LIBS_OPENVG = libopenvg.lib - -QMAKE_RC = rc - -QMAKE_COMPILER_DEFINES -= _MSC_VER=1400 -QMAKE_COMPILER_DEFINES += _MSC_VER=1500 diff --git a/mkspecs/wince70embedded-x86-msvc2008/qplatformdefs.h b/mkspecs/wince70embedded-x86-msvc2008/qplatformdefs.h deleted file mode 100644 index 780b7ef124..0000000000 --- a/mkspecs/wince70embedded-x86-msvc2008/qplatformdefs.h +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../common/wince/qplatformdefs.h" - diff --git a/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf b/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf deleted file mode 100644 index 3712c94778..0000000000 --- a/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf +++ /dev/null @@ -1,44 +0,0 @@ -# qmake configuration for Windows Embedded Compact 2013 with VS2012 on ARM targets -# -# This is just a template for creating WEC2013 mkspecs for ARM targets -# Replace the SDK name with actual SDK name. - -include(../common/wince/qmake.conf) - -CE_SDK = Toradex_CE800 # replace with actual SDK name -CE_ARCH = ARMV7 -QT_CONFIG -= accessibility - -DEFINES += QT_NO_CLIPBOARD QT_NO_ACCESSIBILITY QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x800 $$CE_ARCH _AMRV7_ armv7 _ARM_ UNDER_CE WINCE ARM QT_NO_WINCE_SHELLSDK QT_NO_WINCE_NUIOUSER - -#QMAKE_CXXFLAGS += /P -QMAKE_CFLAGS_RELEASE += -O2 -MT -QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi -QMAKE_CFLAGS_DEBUG += -Zi -MTd -QMAKE_CFLAGS_RELEASE -= -MD -QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -= -MD -QMAKE_CFLAGS_DEBUG -= -MDd -QMAKE_CXXFLAGS_RELEASE -= -MD -QMAKE_CXXFLAGS_RELEASE += -MT -QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -MT -QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -MD -QMAKE_CXXFLAGS_DEBUG -= -MDd -QMAKE_CXXFLAGS_DEBUG += -MTd -QMAKE_INCDIR_OPENGL_ES2 += $$(NV_WINCE_T2_PLAT)/include -QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,8.00 /MACHINE:ARM -QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,8.00 /MACHINE:ARM -QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,8.00 /MACHINE:ARM /DLL /SAFESEH:NO -QMAKE_LIBFLAGS_RELEASE = /LTCG -QMAKE_LIBS = coredll.lib -QMAKE_LIBS_CORE = ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib -QMAKE_LIBS_GUI = ole32.lib $$QMAKE_LIBS_CORE -QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI -QMAKE_LIBS_OPENGL_ES2 = $${LIBEGL_NAME}.lib $${LIBGLESV2_NAME}.lib - -MAKEFILE_GENERATOR = MSBUILD -VCPROJ_EXTENSION = .vcxproj - -QMAKE_RC = rc - -QMAKE_COMPILER_DEFINES -= _MSC_VER=1400 -QMAKE_COMPILER_DEFINES += _MSC_VER=1700 diff --git a/mkspecs/wince80colibri-armv7-msvc2012/qplatformdefs.h b/mkspecs/wince80colibri-armv7-msvc2012/qplatformdefs.h deleted file mode 100644 index 780b7ef124..0000000000 --- a/mkspecs/wince80colibri-armv7-msvc2012/qplatformdefs.h +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../common/wince/qplatformdefs.h" - diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index 405bbf9212..4ce6b7a59e 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -8,8 +8,7 @@ OBJS=project.o option.o property.o main.o ioutils.o proitems.o \ makefile.o unixmake2.o unixmake.o \ mingw_make.o winmakefile.o projectgenerator.o \ meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \ - msvc_vcproj.o msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o \ - cesdkhandler.o + msvc_vcproj.o msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o #qt code QOBJS=qtextcodec.o qutfcodec.o qstring.o qstring_compat.o qstringbuilder.o qtextstream.o qiodevice.o \ @@ -36,7 +35,7 @@ DEPEND_SRC = \ $(QMKGENSRC)/mac/pbuilder_pbx.cpp \ $(QMKGENSRC)/win32/winmakefile.cpp \ $(QMKGENSRC)/win32/mingw_make.cpp $(QMKGENSRC)/win32/msvc_nmake.cpp \ - $(QMKGENSRC)/win32/cesdkhandler.cpp $(QMKGENSRC)/mac/xmloutput.cpp \ + $(QMKGENSRC)/mac/xmloutput.cpp \ $(QMKGENSRC)/win32/msvc_vcproj.cpp $(QMKGENSRC)/win32/msvc_vcxproj.cpp \ $(QMKGENSRC)/win32/msvc_objectmodel.cpp $(QMKGENSRC)/win32/msbuild_objectmodel.cpp \ $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp \ @@ -207,9 +206,6 @@ msvc_vcxproj.o: $(QMKSRC)/generators/win32/msvc_vcxproj.cpp msvc_nmake.o: $(QMKSRC)/generators/win32/msvc_nmake.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< -cesdkhandler.o: $(QMKSRC)/generators/win32/cesdkhandler.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $< - pbuilder_pbx.o: $(QMKSRC)/generators/mac/pbuilder_pbx.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 1d50f872d9..432d6eb5e8 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -67,8 +67,7 @@ OBJS = project.obj main.obj ioutils.obj proitems.obj qmakevfs.obj \ option.obj winmakefile.obj projectgenerator.obj property.obj meta.obj \ makefiledeps.obj metamakefile.obj xmloutput.obj \ msvc_nmake.obj msvc_vcproj.obj msvc_vcxproj.obj \ - msvc_objectmodel.obj msbuild_objectmodel.obj registry.obj \ - cesdkhandler.obj + msvc_objectmodel.obj msbuild_objectmodel.obj registry.obj #qt code QTOBJS= \ diff --git a/qmake/generators/win32/cesdkhandler.cpp b/qmake/generators/win32/cesdkhandler.cpp deleted file mode 100644 index f45cbf74a9..0000000000 --- a/qmake/generators/win32/cesdkhandler.cpp +++ /dev/null @@ -1,368 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "cesdkhandler.h" - -#include <qfile.h> -#include <qfileinfo.h> -#include <qdebug.h> -#include <qxmlstream.h> -#include <qsettings.h> -#include <qtextstream.h> - -QT_BEGIN_NAMESPACE - -struct PropertyContainer -{ - void clear() { name.clear(); value.clear(); properties.clear(); } - QString name; - QString value; - QMap<QString, PropertyContainer> properties; -}; -Q_DECLARE_TYPEINFO(PropertyContainer, Q_MOVABLE_TYPE); - -CeSdkInfo::CeSdkInfo() : m_major(0) , m_minor(0) -{ -} - -CeSdkHandler::CeSdkHandler() -{ -} - -struct ContainsPathKey -{ - bool operator()(const QString &val) const - { - return !(val.endsWith(QLatin1String("MSBuildToolsPath")) - || val.endsWith(QLatin1String("MSBuildToolsRoot"))); - } -}; - -struct ValueFromKey -{ - explicit ValueFromKey(const QSettings *settings) : settings(settings) {} - QString operator()(const QString &key) const - { - return settings->value(key).toString(); - } - - const QSettings *settings; -}; - -bool CeSdkHandler::parseMsBuildFile(QFile *file, CeSdkInfo *info) -{ - bool result = file->open(QFile::ReadOnly | QFile::Text); - const QString IncludePath = QStringLiteral("IncludePath"); - const QString LibraryPath = QStringLiteral("LibraryPath"); - const QString PreprocessorDefinitions = QStringLiteral("PreprocessorDefinitions"); - const QString SdkRootPathString = QStringLiteral("SdkRootPath"); - const QString ExecutablePath = QStringLiteral("ExecutablePath"); - enum ParserState{Not, Include, Lib, Define, BinDir, SdkRootPath}; - QString includePath; - QString libraryPath; - QString defines; - QString binDirs; - QString sdkRootPath; - ParserState state = Not; - if (result) { - QXmlStreamReader xml(file); - while (!xml.atEnd()) { - if (xml.isStartElement()) { - if (xml.name() == IncludePath) - state = Include; - else if (xml.name() == LibraryPath) - state = Lib; - else if (xml.name() == PreprocessorDefinitions) - state = Define; - else if (xml.name() == SdkRootPathString) - state = SdkRootPath; - else if (xml.name() == ExecutablePath) - state = BinDir; - else - state = Not; - } else if (xml.isEndElement()) { - state = Not; - } else if (xml.isCharacters()) { - switch (state) { - case Include: - includePath += xml.text(); - break; - case Lib: - libraryPath += xml.text(); - break; - case Define: - defines += xml.text(); - break; - case SdkRootPath: - sdkRootPath = xml.text().toString(); - break; - case BinDir: - binDirs += xml.text(); - case(Not): - break; - } - } - xml.readNext(); - } - } - file->close(); - const bool success = result && !includePath.isEmpty() && !libraryPath.isEmpty() && - !defines.isEmpty() && !sdkRootPath.isEmpty(); - if (success) { - const QString startPattern = QStringLiteral("$(Registry:"); - const int startIndex = sdkRootPath.indexOf(startPattern); - const int endIndex = sdkRootPath.lastIndexOf(QLatin1Char(')')); - const QString regString = sdkRootPath.mid(startIndex + startPattern.size(), - endIndex - startIndex - startPattern.size()); - QSettings sdkRootPathRegistry(regString, QSettings::NativeFormat); - const QString erg = sdkRootPathRegistry.value(QStringLiteral(".")).toString(); - const QString fullSdkRootPath = erg + sdkRootPath.mid(endIndex + 1); - const QLatin1String rootString("$(SdkRootPath)"); - - includePath = includePath.replace(rootString, fullSdkRootPath); - libraryPath = libraryPath.replace(rootString, fullSdkRootPath); - binDirs = binDirs.replace(rootString, fullSdkRootPath); - info->m_include = includePath + ";$(INCLUDE)"; - info->m_lib = libraryPath; - info->m_bin = binDirs; - } - return success; -} - -QStringList CeSdkHandler::getMsBuildToolPaths() const -{ - QSettings msbuildEntries("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\MSBuild\\ToolsVersions", - QSettings::NativeFormat); - const QStringList allKeys = msbuildEntries.allKeys(); - QStringList toolVersionKeys; - toolVersionKeys.push_back(QStringLiteral("c:\\Program Files\\MSBuild\\")); - std::remove_copy_if(allKeys.cbegin(), allKeys.cend(), - std::back_inserter(toolVersionKeys), ContainsPathKey()); - QStringList toolVersionValues; - std::transform(toolVersionKeys.constBegin(), toolVersionKeys.constEnd(), - std::back_inserter(toolVersionValues), - ValueFromKey(&msbuildEntries)); - return toolVersionValues; -} - -QStringList CeSdkHandler::filterMsBuildToolPaths(const QStringList &paths) const -{ - QStringList result; - for (const QString &path : paths) { - QDir dirVC110(path); - if (path.endsWith(QLatin1String("bin"))) - dirVC110.cdUp(); - QDir dirVC120 = dirVC110; - if (dirVC110.cd(QStringLiteral("Microsoft.Cpp\\v4.0\\V110\\Platforms"))) - result << dirVC110.absolutePath(); - if (dirVC120.cd(QStringLiteral("Microsoft.Cpp\\v4.0\\V120\\Platforms"))) - result << dirVC120.absolutePath(); - } - return result; -} - -bool CeSdkHandler::retrieveEnvironment(const QStringList &relativePaths, - const QStringList &toolPaths, - CeSdkInfo *info) -{ - bool result = false; - for (const QString &path : toolPaths) { - const QDir dir(path); - for (const QString &filePath : relativePaths) { - QFile file(dir.absoluteFilePath(filePath)); - if (file.exists()) - result = parseMsBuildFile(&file, info) || result; - } - } - - return result; -} - -void CeSdkHandler::retrieveWEC2013SDKs() -{ - const QStringList toolPaths = getMsBuildToolPaths(); - const QStringList filteredToolPaths = filterMsBuildToolPaths(toolPaths); - QSettings settings("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows CE Tools\\SDKs", QSettings::NativeFormat); - const QStringList keys = settings.allKeys(); - for (const QString &key : keys) { - if (key.contains(QLatin1String("SDKInformation")) || key.contains(QLatin1Char('.'))) { - QFile sdkPropertyFile(settings.value(key).toString()); - if (!sdkPropertyFile.exists()) - continue; - QFileInfo info(sdkPropertyFile); - if (info.isDir()) { - const QDir dir = info.absoluteFilePath(); - QFileInfo fInfo(dir.filePath(QLatin1String("Properties.xml"))); - if (fInfo.exists()) - sdkPropertyFile.setFileName(fInfo.absoluteFilePath()); - } - if (!sdkPropertyFile.open(QFile::ReadOnly)) - continue; - QXmlStreamReader xml(&sdkPropertyFile); - QString currentElement; - QString curName; - PropertyContainer currentProperty; - QVector<PropertyContainer> propStack; - propStack.push_back(currentProperty); - while (!xml.atEnd()) { - xml.readNext(); - if (xml.isStartElement()) { - currentElement = xml.name().toString(); - if (currentElement == QLatin1String("Property")) { - QXmlStreamAttributes attributes = xml.attributes(); - if (attributes.hasAttribute(QLatin1String("NAME"))) - curName = attributes.value(QLatin1String("NAME")).toString(); - Q_ASSERT(!curName.isEmpty()); - currentProperty.clear(); - currentProperty.name = curName; - propStack.push_back(currentProperty); - } else if (currentElement == QLatin1String("PropertyBag")) { - QXmlStreamAttributes attributes = xml.attributes(); - if (attributes.hasAttribute(QLatin1String("NAME"))) - curName = attributes.value(QLatin1String("NAME")).toString(); - Q_ASSERT(!curName.isEmpty()); - currentProperty.clear(); - currentProperty.name = curName; - propStack.push_back(currentProperty); - } - } else if (xml.isEndElement()) { - currentElement = xml.name().toString(); - PropertyContainer self = propStack.takeLast(); - if (currentElement != QLatin1String("Root")) { - PropertyContainer &last = propStack.last(); - last.properties[self.name] = self; - } else { - currentProperty = self; - } - } else if (xml.isCharacters()) { - PropertyContainer &self = propStack.last(); - self.value = xml.text().toString(); - } - } - - if (xml.error() && xml.error() != QXmlStreamReader::PrematureEndOfDocumentError) { - qWarning() << "XML ERROR:" << xml.lineNumber() << ": " << xml.errorString(); - return; - } - CeSdkInfo currentSdk; - const PropertyContainer &cpuInfo = currentProperty.properties.value(QLatin1String("CPU info")); - if (cpuInfo.properties.isEmpty()) - continue; - const PropertyContainer &cpuInfoVal = cpuInfo.properties.first().properties.value(QLatin1String("CpuName")); - if (cpuInfoVal.name != QLatin1String("CpuName")) - continue; - const QString SDKName = QStringLiteral("SDK name"); - currentSdk.m_name = currentProperty.properties.value(SDKName).value+ - QStringLiteral(" (") + cpuInfoVal.value + ")"; - currentSdk.m_major = currentProperty.properties.value(QLatin1String("OSMajor")).value.toInt(); - currentSdk.m_minor = currentProperty.properties.value(QLatin1String("OSMinor")).value.toInt(); - retrieveEnvironment(currentProperty.properties.value(QLatin1String("MSBuild Files110")).value.split(';'), - filteredToolPaths, ¤tSdk); - retrieveEnvironment(currentProperty.properties.value(QLatin1String("MSBuild Files120")).value.split(';'), - filteredToolPaths, ¤tSdk); - if (!currentSdk.m_include.isEmpty()) - m_list.append(currentSdk); - } - } -} - -void CeSdkHandler::retrieveWEC6n7SDKs() -{ - // look at the file at %VCInstallDir%/vcpackages/WCE.VCPlatform.config - // and scan through all installed sdks... - m_vcInstallDir = QString::fromLatin1(qgetenv("VCInstallDir")); - if (m_vcInstallDir.isEmpty()) - return; - - QDir vStudioDir(m_vcInstallDir); - if (!vStudioDir.cd(QLatin1String("vcpackages"))) - return; - - QFile configFile(vStudioDir.absoluteFilePath(QLatin1String("WCE.VCPlatform.config"))); - if (!configFile.open(QIODevice::ReadOnly)) - return; - - QString currentElement; - CeSdkInfo currentItem; - QXmlStreamReader xml(&configFile); - while (!xml.atEnd()) { - xml.readNext(); - if (xml.isStartElement()) { - currentElement = xml.name().toString(); - if (currentElement == QLatin1String("Platform")) { - currentItem = CeSdkInfo(); - } else if (currentElement == QLatin1String("Directories")) { - QXmlStreamAttributes attr = xml.attributes(); - currentItem.m_include = fixPaths(attr.value(QLatin1String("Include")).toString()); - currentItem.m_lib = fixPaths(attr.value(QLatin1String("Library")).toString()); - currentItem.m_bin = fixPaths(attr.value(QLatin1String("Path")).toString()); - } - } else if (xml.isEndElement()) { - if (xml.name().toString() == QLatin1String("Platform")) - m_list.append(currentItem); - } else if (xml.isCharacters() && !xml.isWhitespace()) { - if (currentElement == QLatin1String("PlatformName")) - currentItem.m_name = xml.text().toString(); - else if (currentElement == QLatin1String("OSMajorVersion")) - currentItem.m_major = xml.text().toString().toInt(); - else if (currentElement == QLatin1String("OSMinorVersion")) - currentItem.m_minor = xml.text().toString().toInt(); - } - } - - if (xml.error() && xml.error() != QXmlStreamReader::PrematureEndOfDocumentError) { - qWarning() << "XML ERROR:" << xml.lineNumber() << ": " << xml.errorString(); - return; - } -} - -bool CeSdkHandler::retrieveAvailableSDKs() -{ - m_list.clear(); - retrieveWEC2013SDKs(); - retrieveWEC6n7SDKs(); - return !m_list.empty(); -} - -QString CeSdkHandler::fixPaths(const QString &path) const -{ - QRegExp searchStr(QLatin1String("(\\$\\(\\w+\\))")); - QString fixedString = path; - for (int index = fixedString.indexOf(searchStr, 0); - index >= 0; - index = fixedString.indexOf(searchStr, index)) { - const QString capture = searchStr.cap(0); - fixedString.replace(index, capture.length(), capture.toUpper()); - index += capture.length(); // don't count the zero terminator - fixedString.insert(index, '\\'); // the configuration file lacks a directory separator for env vars - ++index; - } - return fixedString; -} - -QT_END_NAMESPACE diff --git a/qmake/generators/win32/cesdkhandler.h b/qmake/generators/win32/cesdkhandler.h deleted file mode 100644 index 3bb8d2adcb..0000000000 --- a/qmake/generators/win32/cesdkhandler.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CE_SDK_HANDLER_INCL -#define CE_SDK_HANDLER_INCL - -#include <qstringlist.h> -#include <qdir.h> - -QT_BEGIN_NAMESPACE - -class CeSdkInfo -{ -public: - CeSdkInfo(); - inline QString name() const { return m_name; } - inline QString binPath() const { return m_bin; } - inline QString includePath() const { return m_include; } - inline QString libPath() const { return m_lib; } - inline bool isValid() const; - inline int majorVersion() const { return m_major; } - inline int minorVersion() const { return m_minor; } - inline bool isSupported() const { return m_major >= 5; } -private: - friend class CeSdkHandler; - QString m_name; - QString m_bin; - QString m_include; - QString m_lib; - int m_major; - int m_minor; -}; - -bool CeSdkInfo::isValid() const -{ - return !m_name.isEmpty() && - !m_bin.isEmpty() && - !m_include.isEmpty() && - !m_lib.isEmpty(); -} - -class CeSdkHandler -{ -public: - CeSdkHandler(); - bool retrieveAvailableSDKs(); - inline QList<CeSdkInfo> listAll() const { return m_list; } -private: - void retrieveWEC6n7SDKs(); - void retrieveWEC2013SDKs(); - inline QString fixPaths(const QString &path) const; - QStringList getMsBuildToolPaths() const; - QStringList filterMsBuildToolPaths(const QStringList &paths) const; - bool parseMsBuildFile(QFile *file, CeSdkInfo *info); - bool retrieveEnvironment(const QStringList &relativePaths, - const QStringList &toolPaths, - CeSdkInfo *info); - QList<CeSdkInfo> m_list; - QString m_vcInstallDir; -}; - -QT_END_NAMESPACE - -#endif diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index d8ac80f99d..9e1af05414 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -28,7 +28,6 @@ #include "msvc_nmake.h" #include "option.h" -#include "cesdkhandler.h" #include <qregexp.h> #include <qdir.h> @@ -72,38 +71,7 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) return MakefileGenerator::writeStubMakefile(t); #endif if (!project->isHostBuild()) { - const ProValueMap &variables = project->variables(); - if (project->isActiveConfig("wince")) { - CeSdkHandler sdkhandler; - sdkhandler.retrieveAvailableSDKs(); - const QString sdkName = variables["CE_SDK"].join(' ') - + " (" + variables["CE_ARCH"].join(' ') + ")"; - const QList<CeSdkInfo> sdkList = sdkhandler.listAll(); - CeSdkInfo sdk; - for (const CeSdkInfo &info : sdkList) { - if (info.name().compare(sdkName, Qt::CaseInsensitive ) == 0) { - sdk = info; - break; - } - } - if (sdk.isValid()) { - t << "\nINCLUDE = " << sdk.includePath(); - t << "\nLIB = " << sdk.libPath(); - t << "\nPATH = " << sdk.binPath() << "\n"; - } else { - QStringList sdkStringList; - sdkStringList.reserve(sdkList.size()); - for (const CeSdkInfo &info : sdkList) - sdkStringList << info.name(); - - fprintf(stderr, "Failed to find Windows CE SDK matching %s, found: %s\n" - "SDK needs to be specified in mkspec (using: %s/qmake.conf)\n" - "SDK name needs to match the following format: CE_SDK (CE_ARCH)\n", - qPrintable(sdkName), qPrintable(sdkStringList.join(", ")), - qPrintable(variables["QMAKESPEC"].first().toQString())); - return false; - } - } else if (project->isActiveConfig(QStringLiteral("winrt"))) { + if (project->isActiveConfig(QStringLiteral("winrt"))) { QString arch = project->first("VCPROJ_ARCH").toQString().toLower(); QString compiler; QString compilerArch; @@ -614,12 +582,6 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) writeLinkCommand(t); } } - QString signature = !project->isEmpty("SIGNATURE_FILE") ? var("SIGNATURE_FILE") : var("DEFAULT_SIGNATURE"); - bool useSignature = !signature.isEmpty() && !project->isActiveConfig("staticlib") && - !project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH"); - if(useSignature) { - t << "\n\tsigntool sign /F " << escapeFilePath(signature) << " $(DESTDIR_TARGET)"; - } if(!project->isEmpty("QMAKE_POST_LINK")) { t << "\n\t" << var("QMAKE_POST_LINK"); } diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index c2b285ddc4..79bac8bafe 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -700,9 +700,6 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) QString slnConf = _slnSolutionConf; if (!project->isEmpty("VCPROJ_ARCH")) { slnConf.replace(QLatin1String("|Win32"), "|" + project->first("VCPROJ_ARCH")); - } else if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH")) { - QString slnPlatform = QString("|") + project->values("CE_SDK").join(' ') + " (" + project->first("CE_ARCH") + ")"; - slnConf.replace(QLatin1String("|Win32"), slnPlatform); } else if (is64Bit) { slnConf.replace(QLatin1String("|Win32"), QLatin1String("|x64")); } @@ -717,8 +714,6 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) QString xplatform = platform; if (!project->isEmpty("VCPROJ_ARCH")) { xplatform = project->first("VCPROJ_ARCH").toQString(); - } else if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH")) { - xplatform = project->values("CE_SDK").join(' ') + " (" + project->first("CE_ARCH") + ")"; } if (!project->isHostBuild()) platform = xplatform; @@ -976,10 +971,8 @@ void VcprojGenerator::initProject() vcProject.Keyword = project->first("VCPROJ_KEYWORD").toQString(); if (!project->isEmpty("VCPROJ_ARCH")) { vcProject.PlatformName = project->first("VCPROJ_ARCH").toQString(); - } else if (project->isHostBuild() || project->isEmpty("CE_SDK") || project->isEmpty("CE_ARCH")) { + } else if (project->isHostBuild()) { vcProject.PlatformName = (is64Bit ? "x64" : "Win32"); - } else { - vcProject.PlatformName = project->values("CE_SDK").join(' ') + " (" + project->first("CE_ARCH") + ")"; } vcProject.SdkVersion = project->first("WINSDK_VER").toQString(); // These are not used by Qt, but may be used by customers @@ -1060,10 +1053,8 @@ void VcprojGenerator::initConfiguration() conf.ConfigurationName = conf.Name; if (!project->isEmpty("VCPROJ_ARCH")) { conf.Name += "|" + project->first("VCPROJ_ARCH"); - } else if (project->isHostBuild() || project->isEmpty("CE_SDK") || project->isEmpty("CE_ARCH")) { + } else if (project->isHostBuild()) { conf.Name += (is64Bit ? "|x64" : "|Win32"); - } else { - conf.Name += "|" + project->values("CE_SDK").join(' ') + " (" + project->first("CE_ARCH") + ")"; } conf.ATLMinimizesCRunTimeLibraryUsage = (project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True); conf.BuildBrowserInformation = triState(temp.isEmpty() ? (short)unset : temp.toShort()); @@ -1086,8 +1077,7 @@ void VcprojGenerator::initConfiguration() initPreBuildEventTools(); initPostBuildEventTools(); // Only deploy for CE and WinRT projects - if ((!project->isHostBuild() && !project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH")) - || conf.WinRT) + if (!project->isHostBuild() || conf.WinRT) initDeploymentTool(); initWinDeployQtTool(); initPreLinkEventTools(); @@ -1235,16 +1225,6 @@ void VcprojGenerator::initPostBuildEventTools() conf.postBuild.Description = cmdline.join(QLatin1String("\r\n")); conf.postBuild.ExcludedFromBuild = _False; } - - QString signature = !project->isEmpty("SIGNATURE_FILE") ? var("SIGNATURE_FILE") : var("DEFAULT_SIGNATURE"); - bool useSignature = !signature.isEmpty() && !project->isActiveConfig("staticlib") && - !project->isHostBuild() && !project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH"); - if (useSignature) { - conf.postBuild.CommandLine.prepend( - QLatin1String("signtool sign /F ") + escapeFilePath(signature) + QLatin1String(" \"$(TargetPath)\"")); - conf.postBuild.ExcludedFromBuild = _False; - } - if (!project->values("MSVCPROJ_COPY_DLL").isEmpty()) { conf.postBuild.Description += var("MSVCPROJ_COPY_DLL_DESC"); conf.postBuild.CommandLine += var("MSVCPROJ_COPY_DLL"); @@ -1338,45 +1318,6 @@ void VcprojGenerator::initDeploymentTool() } } - if (!conf.WinRT) { - // C-runtime deployment - QString runtime = project->values("QT_CE_C_RUNTIME").join(QLatin1Char(' ')); - if (!runtime.isEmpty() && (runtime != QLatin1String("no"))) { - QString runtimeVersion = QLatin1String("msvcr"); - ProString mkspec = project->first("QMAKESPEC"); - - if (!mkspec.isEmpty()) { - if (mkspec.endsWith("2008")) - runtimeVersion.append("90"); - else - runtimeVersion.append("80"); - if (project->isActiveConfig("debug")) - runtimeVersion.append("d"); - runtimeVersion.append(".dll"); - - if (runtime == "yes") { - // Auto-find C-runtime - QString vcInstallDir = qgetenv("VCINSTALLDIR"); - if (!vcInstallDir.isEmpty()) { - vcInstallDir += "\\ce\\dll\\"; - vcInstallDir += project->values("CE_ARCH").join(QLatin1Char(' ')); - if (!QFileInfo::exists(vcInstallDir + QDir::separator() + runtimeVersion)) - runtime.clear(); - else - runtime = vcInstallDir; - } - } - } - - if (!runtime.isEmpty() && runtime != QLatin1String("yes")) { - conf.deployment.AdditionalFiles += runtimeVersion - + "|" + QDir::toNativeSeparators(runtime) - + "|" + targetPath - + "|0;"; - } - } - } - for (const ProString &item : project->values("INSTALLS")) { // get item.path QString devicePath = project->first(ProKey(item + ".path")).toQString(); diff --git a/qmake/qmake.pri b/qmake/qmake.pri index 782151d763..7f49bb9adb 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -11,8 +11,7 @@ SOURCES += project.cpp property.cpp main.cpp \ generators/win32/msvc_nmake.cpp generators/projectgenerator.cpp \ generators/win32/msvc_vcproj.cpp \ generators/win32/msvc_vcxproj.cpp \ - generators/win32/msvc_objectmodel.cpp generators/win32/msbuild_objectmodel.cpp \ - generators/win32/cesdkhandler.cpp + generators/win32/msvc_objectmodel.cpp generators/win32/msbuild_objectmodel.cpp HEADERS += project.h property.h \ library/qmake_global.h library/ioutils.h library/proitems.h library/qmakevfs.h library/qmakeglobals.h \ @@ -24,8 +23,7 @@ HEADERS += project.h property.h \ generators/xmloutput.h generators/win32/msvc_nmake.h \ generators/win32/msvc_vcproj.h \ generators/win32/msvc_vcxproj.h \ - generators/win32/msvc_objectmodel.h generators/win32/msbuild_objectmodel.h \ - generators/win32/cesdkhandler.h + generators/win32/msvc_objectmodel.h generators/win32/msbuild_objectmodel.h bootstrap { #Qt code SOURCES+= \ diff --git a/src/3rdparty/double-conversion/include/double-conversion/utils.h b/src/3rdparty/double-conversion/include/double-conversion/utils.h index 53eec64282..01f1dbd3ae 100644 --- a/src/3rdparty/double-conversion/include/double-conversion/utils.h +++ b/src/3rdparty/double-conversion/include/double-conversion/utils.h @@ -74,8 +74,6 @@ #else #undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS #endif // _WIN32 -#elif defined(WINCE) || defined(_WIN32_WCE) -#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 #else #error Target architecture was not detected as supported by Double-Conversion. #endif diff --git a/src/corelib/arch/arch.pri b/src/corelib/arch/arch.pri index ec617386a4..0f7c2b887b 100644 --- a/src/corelib/arch/arch.pri +++ b/src/corelib/arch/arch.pri @@ -1,4 +1,4 @@ -win32|wince:HEADERS += arch/qatomic_msvc.h +win32:HEADERS += arch/qatomic_msvc.h HEADERS += \ arch/qatomic_bootstrap.h \ diff --git a/src/corelib/arch/qatomic_msvc.h b/src/corelib/arch/qatomic_msvc.h index 62d54ded55..5eae2bdc48 100644 --- a/src/corelib/arch/qatomic_msvc.h +++ b/src/corelib/arch/qatomic_msvc.h @@ -45,8 +45,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// -#ifndef Q_OS_WINCE - // use compiler intrinsics for all atomic functions # define QT_INTERLOCKED_PREFIX _ # define QT_INTERLOCKED_PROTOTYPE @@ -58,36 +56,6 @@ # define Q_ATOMIC_INT64_IS_SUPPORTED # endif -#else // Q_OS_WINCE - -# if _WIN32_WCE < 0x600 && defined(_X86_) -// For X86 Windows CE, include winbase.h to catch inline functions which -// override the regular definitions inside of coredll.dll. -// Though one could use the original version of Increment/Decrement, others are -// not exported at all. -# include <winbase.h> - -// It's safer to remove the volatile and let the compiler add it as needed. -# define QT_INTERLOCKED_VOLATILE - -# else // _WIN32_WCE >= 0x600 || !_X86_ - -# define QT_INTERLOCKED_PROTOTYPE __cdecl -# define QT_INTERLOCKED_DECLARE_PROTOTYPES - -# if _WIN32_WCE >= 0x600 -# if defined(_X86_) -# define QT_INTERLOCKED_PREFIX _ -# define QT_INTERLOCKED_INTRINSIC -# endif -# else -# define QT_INTERLOCKED_VOLATILE -# endif - -# endif // _WIN32_WCE >= 0x600 || !_X86_ - -#endif // Q_OS_WINCE - //////////////////////////////////////////////////////////////////////////////////////////////////// // Prototype declaration @@ -128,7 +96,7 @@ extern "C" { long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Exchange )(long QT_INTERLOCKED_VOLATILE *, long); long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( ExchangeAdd )(long QT_INTERLOCKED_VOLATILE *, long); -# if !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) +# if !defined(__i386__) && !defined(_M_IX86) void * QT_INTERLOCKED_FUNCTION( CompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *); void * QT_INTERLOCKED_FUNCTION( ExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *); __int64 QT_INTERLOCKED_FUNCTION( ExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64); @@ -165,7 +133,7 @@ extern "C" { # pragma intrinsic (_InterlockedCompareExchange) # pragma intrinsic (_InterlockedExchangeAdd) -# if !defined(Q_OS_WINCE) && !defined(_M_IX86) +# if !defined(_M_IX86) # pragma intrinsic (_InterlockedCompareExchangePointer) # pragma intrinsic (_InterlockedExchangePointer) # pragma intrinsic (_InterlockedExchangeAdd64) @@ -176,7 +144,7 @@ extern "C" { //////////////////////////////////////////////////////////////////////////////////////////////////// // Interlocked* replacement macros -#if defined(Q_OS_WINCE) || defined(__i386__) || defined(_M_IX86) +#if defined(__i386__) || defined(_M_IX86) # define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \ reinterpret_cast<void *>( \ @@ -195,7 +163,7 @@ extern "C" { reinterpret_cast<long QT_INTERLOCKED_VOLATILE *>(value), \ (valueToAdd)) -#else // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) +#else // !defined(__i386__) && !defined(_M_IX86) # define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \ QT_INTERLOCKED_FUNCTION(CompareExchangePointer)( \ @@ -213,7 +181,7 @@ extern "C" { reinterpret_cast<qint64 QT_INTERLOCKED_VOLATILE *>(value), \ (valueToAdd)) -#endif // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) +#endif // !defined(__i386__) && !defined(_M_IX86) //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index edb03af447..5098ac4242 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -132,7 +132,7 @@ bool qTextCodecNameMatch(const char *n, const char *h) } -#if !defined(Q_OS_WIN32) && !defined(Q_OS_WINCE) && !defined(QT_LOCALE_IS_UTF8) +#if !defined(Q_OS_WIN32) && !defined(QT_LOCALE_IS_UTF8) static QTextCodec *checkForCodec(const QByteArray &name) { QTextCodec *c = QTextCodec::codecForName(name); if (!c) { @@ -169,7 +169,7 @@ static QTextCodec *setupLocaleMapper() #if defined(QT_LOCALE_IS_UTF8) locale = QTextCodec::codecForName("UTF-8"); -#elif defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#elif defined(Q_OS_WIN) locale = QTextCodec::codecForName("System"); #else @@ -289,7 +289,7 @@ static void setup() #if !defined(QT_NO_ICONV) (void) new QIconvCodec; #endif -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) +#if defined(Q_OS_WIN32) (void) new QWindowsLocalCodec; #endif // Q_OS_WIN32 #endif // !QT_NO_CODECS && !QT_BOOTSTRAPPED diff --git a/src/corelib/codecs/qwindowscodec.cpp b/src/corelib/codecs/qwindowscodec.cpp index 74c2f75d2b..e8f7e6f156 100644 --- a/src/corelib/codecs/qwindowscodec.cpp +++ b/src/corelib/codecs/qwindowscodec.cpp @@ -157,7 +157,7 @@ QString QWindowsLocalCodec::convertToUnicodeCharByChar(const char *chars, int le state->remainingChars = 0; } const char *mb = mbcs; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) const char *next = 0; QString s; while ((next = CharNextExA(CP_ACP, mb, 0)) != mb) { diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 362ac37a59..9a5e832dcb 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -47,8 +47,14 @@ include(statemachine/statemachine.pri) include(mimetypes/mimetypes.pri) include(xml/xml.pri) -# otherwise mingw headers do not declare common functions like putenv -mingw: CONFIG -= strict_c++ +win32 { + mingw { + # otherwise mingw headers do not declare common functions like putenv + CONFIG -= strict_c++ + # Override MinGW's definition in _mingw.h + DEFINES += WINVER=0x600 _WIN32_WINNT=0x0600 + } +} mac|darwin { !ios { diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 86d027eb35..9a61efd1b2 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1059,16 +1059,18 @@ # define Q_COMPILER_DEFAULT_DELETE_MEMBERS #endif -#if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304 -# define Q_DECL_CONSTEXPR constexpr -# define Q_DECL_RELAXED_CONSTEXPR constexpr -# define Q_CONSTEXPR constexpr -# define Q_RELAXED_CONSTEXPR constexpr -#elif defined Q_COMPILER_CONSTEXPR -# define Q_DECL_CONSTEXPR constexpr -# define Q_DECL_RELAXED_CONSTEXPR -# define Q_CONSTEXPR constexpr -# define Q_RELAXED_CONSTEXPR const +#if defined Q_COMPILER_CONSTEXPR +# if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304 +# define Q_DECL_CONSTEXPR constexpr +# define Q_DECL_RELAXED_CONSTEXPR constexpr +# define Q_CONSTEXPR constexpr +# define Q_RELAXED_CONSTEXPR constexpr +# else +# define Q_DECL_CONSTEXPR constexpr +# define Q_DECL_RELAXED_CONSTEXPR +# define Q_CONSTEXPR constexpr +# define Q_RELAXED_CONSTEXPR const +# endif #else # define Q_DECL_CONSTEXPR # define Q_DECL_RELAXED_CONSTEXPR diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h index b907caa9b6..f3082a1e39 100644 --- a/src/corelib/global/qflags.h +++ b/src/corelib/global/qflags.h @@ -111,8 +111,8 @@ public: typedef Enum enum_type; // compiler-generated copy/move ctor/assignment operators are fine! #ifdef Q_QDOC - inline QFlags(const QFlags &other); - inline QFlags &operator=(const QFlags &other); + Q_DECL_CONSTEXPR inline QFlags(const QFlags &other); + Q_DECL_CONSTEXPR inline QFlags &operator=(const QFlags &other); #endif Q_DECL_CONSTEXPR inline QFlags(Enum f) Q_DECL_NOTHROW : i(Int(f)) {} Q_DECL_CONSTEXPR inline QFlags(Zero = Q_NULLPTR) Q_DECL_NOTHROW : i(0) {} diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index bf6db53040..a2cbd94c92 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -64,11 +64,9 @@ # include <exception> #endif -#if !defined(Q_OS_WINCE) -# include <errno.h> -# if defined(Q_CC_MSVC) -# include <crtdbg.h> -# endif +#include <errno.h> +#if defined(Q_CC_MSVC) +# include <crtdbg.h> #endif #ifdef Q_OS_WINRT @@ -1262,7 +1260,7 @@ bool qSharedBuild() Q_DECL_NOTHROW \relates <QtGlobal> Defined on all supported versions of Windows. That is, if - \l Q_OS_WIN32, \l Q_OS_WIN64, \l Q_OS_WINCE or \l Q_OS_WINRT is defined. + \l Q_OS_WIN32, \l Q_OS_WIN64 or \l Q_OS_WINRT is defined. */ /*! @@ -1280,13 +1278,6 @@ bool qSharedBuild() Q_DECL_NOTHROW */ /*! - \macro Q_OS_WINCE - \relates <QtGlobal> - - Defined on Windows CE. -*/ - -/*! \macro Q_OS_WINRT \relates <QtGlobal> @@ -1922,7 +1913,7 @@ QSysInfo::MacVersion QSysInfo::macVersion() } const QSysInfo::MacVersion QSysInfo::MacintoshVersion = QSysInfo::macVersion(); -#elif defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#elif defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINRT) QT_BEGIN_INCLUDE_NAMESPACE #include "qt_windows.h" @@ -1975,9 +1966,7 @@ static inline OSVERSIONINFOEX determineWinOsVersion() { OSVERSIONINFOEX result = { sizeof(OSVERSIONINFOEX), 0, 0, 0, 0, {'\0'}, 0, 0, 0, 0, 0}; -#ifndef Q_OS_WINCE #define GetProcAddressA GetProcAddress -#endif // GetModuleHandle is not supported in WinRT and linking to it at load time // will not pass the Windows App Certification Kit... but it exists and is functional, @@ -2048,11 +2037,6 @@ QSysInfo::WinVersion QSysInfo::windowsVersion() const OSVERSIONINFOEX osver = winOsVersion(); if (osver.dwMajorVersion == 0) return QSysInfo::WV_None; -#ifdef Q_OS_WINCE - DWORD qt_cever = 0; - qt_cever = osver.dwMajorVersion * 100; - qt_cever += osver.dwMinorVersion * 10; -#endif switch (osver.dwPlatformId) { case VER_PLATFORM_WIN32s: winver = QSysInfo::WV_32s; @@ -2066,18 +2050,6 @@ QSysInfo::WinVersion QSysInfo::windowsVersion() else winver = QSysInfo::WV_95; break; -#ifdef Q_OS_WINCE - case VER_PLATFORM_WIN32_CE: - if (qt_cever >= 600) - winver = QSysInfo::WV_CE_6; - if (qt_cever >= 500) - winver = QSysInfo::WV_CE_5; - else if (qt_cever >= 400) - winver = QSysInfo::WV_CENET; - else - winver = QSysInfo::WV_CE; - break; -#endif default: // VER_PLATFORM_WIN32_NT if (osver.dwMajorVersion < 5) { winver = QSysInfo::WV_NT; @@ -2168,15 +2140,6 @@ static const char *winVer_helper() return workstation ? "8.1" : "Server 2012 R2"; case QSysInfo::WV_WINDOWS10: return workstation ? "10" : "Server 2016"; - - case QSysInfo::WV_CE: - return "CE"; - case QSysInfo::WV_CENET: - return "CENET"; - case QSysInfo::WV_CE_5: - return "CE5"; - case QSysInfo::WV_CE_6: - return "CE6"; } // unknown, future version return 0; @@ -2434,7 +2397,7 @@ QString QSysInfo::buildCpuArchitecture() */ QString QSysInfo::currentCpuArchitecture() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) // We don't need to catch all the CPU architectures in this function; // only those where the host CPU might be different than the build target // (usually, 64-bit platforms). @@ -2586,9 +2549,7 @@ static QString unknownText() */ QString QSysInfo::kernelType() { -#if defined(Q_OS_WINCE) - return QStringLiteral("wince"); -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) return QStringLiteral("winnt"); #elif defined(Q_OS_UNIX) struct utsname u; @@ -2652,8 +2613,7 @@ QString QSysInfo::kernelVersion() "unknown" otherwise. \b{Windows note}: this function returns "winphone" for builds for Windows - Phone, "winrt" for WinRT builds, "wince" for Windows CE and Embedded - Compact builds, and "windows" for normal desktop builds. + Phone, "winrt" for WinRT builds and "windows" for normal desktop builds. For other Unix-type systems, this function usually returns "unknown". @@ -2666,8 +2626,6 @@ QString QSysInfo::productType() return QStringLiteral("winphone"); #elif defined(Q_OS_WINRT) return QStringLiteral("winrt"); -#elif defined(Q_OS_WINCE) - return QStringLiteral("wince"); #elif defined(Q_OS_WIN) return QStringLiteral("windows"); diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index de37731b1a..295de9485a 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -169,7 +169,7 @@ static bool isFatal(QtMsgType msgType) static bool willLogToConsole() { -#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) // these systems have no stderr, so always log to the system log return false; #elif defined(QT_BOOTSTRAPPED) @@ -1172,7 +1172,7 @@ void QMessagePattern::setPattern(const QString &pattern) else if (inIf) error += QStringLiteral("QT_MESSAGE_PATTERN: missing %{endif}\n"); if (!error.isEmpty()) { -#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) OutputDebugString(reinterpret_cast<const wchar_t*>(error.utf16())); if (0) #elif defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB) diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index 5705bc29c8..b7f7d5187c 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -56,7 +56,7 @@ #include <cmath> #include <limits> -#if defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) +#if defined(Q_CC_MSVC) # include <intrin.h> #elif defined(Q_CC_INTEL) # include <immintrin.h> // for _addcarry_u<nn> diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h index b74fc80468..141d45e0db 100644 --- a/src/corelib/global/qsysinfo.h +++ b/src/corelib/global/qsysinfo.h @@ -69,7 +69,7 @@ public: LittleEndian # ifdef Q_QDOC - , ByteOrder = <platform-dependent> + , ByteOrder = BigEndian or LittleEndian # elif Q_BYTE_ORDER == Q_BIG_ENDIAN , ByteOrder = BigEndian # elif Q_BYTE_ORDER == Q_LITTLE_ENDIAN @@ -109,13 +109,7 @@ public: WV_6_1 = WV_WINDOWS7, WV_6_2 = WV_WINDOWS8, WV_6_3 = WV_WINDOWS8_1, - WV_10_0 = WV_WINDOWS10, - - WV_CE = 0x0100, - WV_CENET = 0x0200, - WV_CE_5 = 0x0300, - WV_CE_6 = 0x0400, - WV_CE_based = 0x0f00 + WV_10_0 = WV_WINDOWS10 }; #if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) static const WinVersion WindowsVersion; diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index 97f750a3a6..ee4b88cdbb 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -56,7 +56,6 @@ OS2 - OS/2 OS2EMX - XFree86 on OS/2 (not PM) WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008) - WINCE - WinCE (Windows CE 5.0) WINRT - WinRT (Windows 8 Runtime) CYGWIN - Cygwin SOLARIS - Sun Solaris @@ -128,9 +127,7 @@ # define Q_OS_WIN32 # define Q_OS_WIN64 #elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) -# if defined(WINCE) || defined(_WIN32_WCE) -# define Q_OS_WINCE -# elif defined(WINAPI_FAMILY) +# if defined(WINAPI_FAMILY) # ifndef WINAPI_FAMILY_PC_APP # define WINAPI_FAMILY_PC_APP WINAPI_FAMILY_APP # endif @@ -205,7 +202,7 @@ # error "Qt has not been ported to this OS - see http://www.qt-project.org/" #endif -#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINRT) # define Q_OS_WIN #endif diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h index 8ac3c2135d..000da29fb8 100644 --- a/src/corelib/global/qt_windows.h +++ b/src/corelib/global/qt_windows.h @@ -48,10 +48,10 @@ #if defined(Q_CC_MINGW) // mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation # ifndef WINVER -# define WINVER 0x501 +# define WINVER 0x600 # endif # ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0501 +# define _WIN32_WINNT 0x600 # endif #endif diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index 06674e9a3f..052dc8408b 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -106,25 +106,21 @@ win32 { SOURCES += io/qfilesystemiterator_win.cpp !winrt { - SOURCES += io/qsettings_win.cpp - SOURCES += io/qstandardpaths_win.cpp + HEADERS += \ + io/qwindowspipereader_p.h \ + io/qwindowspipewriter_p.h \ + io/qwinoverlappedionotifier_p.h - wince* { - SOURCES += io/qprocess_wince.cpp \ - io/qstorageinfo_stub.cpp - } else { - HEADERS += \ - io/qwinoverlappedionotifier_p.h \ - io/qwindowspipereader_p.h \ - io/qwindowspipewriter_p.h - SOURCES += \ - io/qprocess_win.cpp \ - io/qwinoverlappedionotifier.cpp \ - io/qwindowspipereader.cpp \ - io/qwindowspipewriter.cpp \ - io/qstorageinfo_win.cpp - LIBS += -lmpr - } + SOURCES += \ + io/qprocess_win.cpp \ + io/qsettings_win.cpp \ + io/qstandardpaths_win.cpp \ + io/qstorageinfo_win.cpp \ + io/qwindowspipereader.cpp \ + io/qwindowspipewriter.cpp \ + io/qwinoverlappedionotifier.cpp + + LIBS += -lmpr } else { SOURCES += \ io/qstandardpaths_winrt.cpp \ diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h index e4cd3b3509..76d173bb3e 100644 --- a/src/corelib/io/qdatastream.h +++ b/src/corelib/io/qdatastream.h @@ -91,10 +91,11 @@ public: Qt_5_5 = Qt_5_4, Qt_5_6 = 17, Qt_5_7 = Qt_5_6, -#if QT_VERSION >= 0x050800 + Qt_5_8 = Qt_5_7, +#if QT_VERSION >= 0x050900 #error Add the datastream version for this Qt version and update Qt_DefaultCompiledVersion #endif - Qt_DefaultCompiledVersion = Qt_5_7 + Qt_DefaultCompiledVersion = Qt_5_8 }; enum ByteOrder { diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 9b9b00f76d..f8070703ee 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -2191,7 +2191,7 @@ QString QDir::cleanPath(const QString &path) name.replace(dir_separator, QLatin1Char('/')); bool allowUncPaths = false; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) //allow unc paths +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //allow unc paths allowUncPaths = true; #endif diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp index 4ac12fc9ea..7026d3403b 100644 --- a/src/corelib/io/qfileselector.cpp +++ b/src/corelib/io/qfileselector.cpp @@ -369,7 +369,7 @@ QStringList QFileSelectorPrivate::platformSelectors() #if defined(Q_OS_WIN) // can't fall back to QSysInfo because we need both "winphone" and "winrt" for the Windows Phone case ret << QStringLiteral("windows"); - ret << QSysInfo::kernelType(); // "wince" and "winnt" + ret << QSysInfo::kernelType(); // "winnt" # if defined(Q_OS_WINRT) ret << QStringLiteral("winrt"); # if defined(Q_OS_WINPHONE) diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 0829bbc6e8..97af142a08 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -53,13 +53,9 @@ #include "qdatetime.h" #include "qt_windows.h" -#if !defined(Q_OS_WINCE) -# include <sys/types.h> -# include <direct.h> -# include <winioctl.h> -#else -# include <types.h> -#endif +#include <sys/types.h> +#include <direct.h> +#include <winioctl.h> #include <objbase.h> #ifndef Q_OS_WINRT # include <shlobj.h> @@ -116,8 +112,7 @@ typedef INT_PTR intptr_t; # define INVALID_FILE_ATTRIBUTES (DWORD (-1)) #endif -#if !defined(Q_OS_WINCE) -# if !defined(REPARSE_DATA_BUFFER_HEADER_SIZE) +#if !defined(REPARSE_DATA_BUFFER_HEADER_SIZE) typedef struct _REPARSE_DATA_BUFFER { ULONG ReparseTag; USHORT ReparseDataLength; @@ -143,32 +138,31 @@ typedef struct _REPARSE_DATA_BUFFER { } GenericReparseBuffer; }; } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; -# define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer) -# endif // !defined(REPARSE_DATA_BUFFER_HEADER_SIZE) +# define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer) +#endif // !defined(REPARSE_DATA_BUFFER_HEADER_SIZE) -# ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE -# define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384 -# endif -# ifndef IO_REPARSE_TAG_SYMLINK -# define IO_REPARSE_TAG_SYMLINK (0xA000000CL) -# endif -# ifndef FSCTL_GET_REPARSE_POINT -# define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS) -# endif -#endif // !defined(Q_OS_WINCE) +#ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE +# define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384 +#endif +#ifndef IO_REPARSE_TAG_SYMLINK +# define IO_REPARSE_TAG_SYMLINK (0xA000000CL) +#endif +#ifndef FSCTL_GET_REPARSE_POINT +# define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS) +#endif QT_BEGIN_NAMESPACE Q_CORE_EXPORT int qt_ntfs_permission_lookup = 0; -#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) static QString qfsPrivateCurrentDir = QLatin1String(""); -// As none of the functions we try to resolve do exist on Windows CE +// As none of the functions we try to resolve do exist on WinRT // we use QT_NO_LIBRARY to shorten everything up a little bit. -#ifndef QT_NO_LIBRARY -#define QT_NO_LIBRARY 1 -#endif -#endif +# ifndef QT_NO_LIBRARY +# define QT_NO_LIBRARY 1 +# endif +#endif // Q_OS_WINRT #if !defined(QT_NO_LIBRARY) QT_BEGIN_INCLUDE_NAMESPACE @@ -233,7 +227,6 @@ static void resolveLibs() #endif triedResolve = true; -#if !defined(Q_OS_WINCE) HINSTANCE advapiHnd = QSystemLibrary::load(L"advapi32"); if (advapiHnd) { ptrGetNamedSecurityInfoW = (PtrGetNamedSecurityInfoW)GetProcAddress(advapiHnd, "GetNamedSecurityInfoW"); @@ -282,7 +275,6 @@ static void resolveLibs() HINSTANCE kernel32 = LoadLibrary(L"kernel32"); if(kernel32) ptrGetVolumePathNamesForVolumeNameW = (PtrGetVolumePathNamesForVolumeNameW)GetProcAddress(kernel32, "GetVolumePathNamesForVolumeNameW"); -#endif } } #endif // QT_NO_LIBRARY @@ -309,14 +301,14 @@ static bool resolveUNCLibs() } #endif triedResolve = true; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) HINSTANCE hLib = QSystemLibrary::load(L"Netapi32"); if (hLib) { ptrNetShareEnum = (PtrNetShareEnum)GetProcAddress(hLib, "NetShareEnum"); if (ptrNetShareEnum) ptrNetApiBufferFree = (PtrNetApiBufferFree)GetProcAddress(hLib, "NetApiBufferFree"); } -#endif // !Q_OS_WINCE && !Q_OS_WINRT +#endif // !Q_OS_WINRT } return ptrNetShareEnum && ptrNetApiBufferFree; } @@ -324,7 +316,7 @@ static bool resolveUNCLibs() static QString readSymLink(const QFileSystemEntry &link) { QString result; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) HANDLE handle = CreateFile((wchar_t*)link.nativeFilePath().utf16(), FILE_READ_EA, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, @@ -367,17 +359,16 @@ static QString readSymLink(const QFileSystemEntry &link) result.replace(0,matchVolName.matchedLength(), QString::fromWCharArray(buffer)); } } -#endif // !Q_OS_WINCE && !Q_OS_WINRT +#endif // !Q_OS_WINRT } #else Q_UNUSED(link); -#endif // Q_OS_WINCE || Q_OS_WINRT +#endif // Q_OS_WINRT return result; } static QString readLink(const QFileSystemEntry &link) { -#if !defined(Q_OS_WINCE) #if !defined(QT_NO_LIBRARY) QString ret; @@ -418,21 +409,6 @@ static QString readLink(const QFileSystemEntry &link) Q_UNUSED(link); return QString(); #endif // QT_NO_LIBRARY -#elif !defined(QT_NO_WINCE_SHELLSDK) - wchar_t target[MAX_PATH]; - QString result; - if (SHGetShortcutTarget((wchar_t*)QFileInfo(link.filePath()).absoluteFilePath().replace(QLatin1Char('/'),QLatin1Char('\\')).utf16(), target, MAX_PATH)) { - result = QString::fromWCharArray(target); - if (result.startsWith(QLatin1Char('"'))) - result.remove(0,1); - if (result.endsWith(QLatin1Char('"'))) - result.remove(result.size()-1,1); - } - return result; -#else // QT_NO_WINCE_SHELLSDK - Q_UNUSED(link); - return QString(); -#endif // Q_OS_WINCE } static bool uncShareExists(const QString &server) @@ -533,7 +509,7 @@ QString QFileSystemEngine::nativeAbsoluteFilePath(const QString &path) { // can be //server or //server/share QString absPath; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT_WIN81) +#if !defined(Q_OS_WINRT_WIN81) QVarLengthArray<wchar_t, MAX_PATH> buf(qMax(MAX_PATH, path.size() + 1)); wchar_t *fileName = 0; DWORD retLen = GetFullPathName((wchar_t*)path.utf16(), buf.size(), buf.data(), &fileName); @@ -553,17 +529,12 @@ QString QFileSystemEngine::nativeAbsoluteFilePath(const QString &path) if (absPath.size() < rootPath.size() && rootPath.startsWith(absPath)) absPath = rootPath; # endif // Q_OS_WINRT -#elif !defined(Q_OS_WINCE) +#else // !Q_OS_WINRT_WIN81 if (QDir::isRelativePath(path)) absPath = QDir::toNativeSeparators(QDir::cleanPath(QDir::currentPath() + QLatin1Char('/') + path)); else absPath = QDir::toNativeSeparators(QDir::cleanPath(path)); -#else // Q_OS_WINRT - if (path.startsWith(QLatin1Char('/')) || path.startsWith(QLatin1Char('\\'))) - absPath = QDir::toNativeSeparators(path); - else - absPath = QDir::toNativeSeparators(QDir::cleanPath(qfsPrivateCurrentDir + QLatin1Char('/') + path)); -#endif // Q_OS_WINCE +#endif // Q_OS_WINRT_WIN81 // This is really ugly, but GetFullPathName strips off whitespace at the end. // If you for instance write ". " in the lineedit of QFileDialog, // (which is an invalid filename) this function will strip the space off and viola, @@ -580,15 +551,10 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry) QString ret; if (!entry.isRelative()) { -#if !defined(Q_OS_WINCE) - if (entry.isAbsolute() && entry.isClean()) { + if (entry.isAbsolute() && entry.isClean()) ret = entry.filePath(); - } else { + else ret = QDir::fromNativeSeparators(nativeAbsoluteFilePath(entry.filePath())); - } -#else - ret = entry.filePath(); -#endif } else { #ifndef Q_OS_WINRT_WIN81 ret = QDir::cleanPath(QDir::currentPath() + QLatin1Char('/') + entry.filePath()); @@ -617,8 +583,6 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry) return QFileSystemEntry(ret, QFileSystemEntry::FromInternalPath()); } -#ifndef Q_OS_WINCE - // FILE_INFO_BY_HANDLE_CLASS has been extended by FileIdInfo = 18 as of VS2012. typedef enum { Q_FileIdInfo = 18 } Q_FILE_INFO_BY_HANDLE_CLASS; @@ -690,12 +654,10 @@ QByteArray fileIdWin8(HANDLE handle) #endif // Q_OS_WINRT return result; } -#endif // !Q_OS_WINCE //static QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry) { -#ifndef Q_OS_WINCE QByteArray result; const HANDLE handle = #ifndef Q_OS_WINRT @@ -711,9 +673,6 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry) CloseHandle(handle); } return result; -#else // !Q_OS_WINCE - return entry.nativeFilePath().toLower().toLatin1(); -#endif } //static @@ -882,7 +841,7 @@ static bool tryDriveUNCFallback(const QFileSystemEntry &fname, QFileSystemMetaDa { bool entryExists = false; DWORD fileAttrib = 0; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) if (fname.isDriveRoot()) { // a valid drive ?? DWORD drivesBitmask = ::GetLogicalDrives(); @@ -923,7 +882,7 @@ static bool tryDriveUNCFallback(const QFileSystemEntry &fname, QFileSystemMetaDa fileAttrib = FILE_ATTRIBUTE_DIRECTORY; entryExists = true; } -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) } #endif if (entryExists) @@ -947,7 +906,6 @@ static bool tryFindFallback(const QFileSystemEntry &fname, QFileSystemMetaData & return filledData; } -#if !defined(Q_OS_WINCE) //static bool QFileSystemEngine::fillMetaData(int fd, QFileSystemMetaData &data, QFileSystemMetaData::MetaDataFlags what) @@ -958,7 +916,6 @@ bool QFileSystemEngine::fillMetaData(int fd, QFileSystemMetaData &data, } return false; } -#endif //static bool QFileSystemEngine::fillMetaData(HANDLE fHandle, QFileSystemMetaData &data, @@ -1067,25 +1024,6 @@ static inline bool mkDir(const QString &path, DWORD *lastError = 0) { if (lastError) *lastError = 0; -#if defined(Q_OS_WINCE) - // Unfortunately CreateDirectory returns true for paths longer than - // 256, but does not create a directory. It starts to fail, when - // path length > MAX_PATH, which is 260 usually on CE. - // This only happens on a Windows Mobile device. Windows CE seems - // not to be affected by this. - static int platformId = 0; - if (platformId == 0) { - wchar_t platformString[64]; - if (SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(platformString)/sizeof(*platformString),platformString,0)) { - if (0 == wcscmp(platformString, L"PocketPC") || 0 == wcscmp(platformString, L"Smartphone")) - platformId = 1; - else - platformId = 2; - } - } - if (platformId == 1 && QFSFileEnginePrivate::longFileName(path).size() > 256) - return false; -#endif const QString longPath = QFSFileEnginePrivate::longFileName(path); const bool result = ::CreateDirectory((wchar_t*)longPath.utf16(), 0); if (lastError) // Capture lastError before any QString is freed since custom allocators might change it. @@ -1215,9 +1153,7 @@ bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool remo //static QString QFileSystemEngine::rootPath() { -#if defined(Q_OS_WINCE) - QString ret = QLatin1String("/"); -#elif defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) // We specify the package root as root directory QString ret = QLatin1String("/"); // Get package location @@ -1283,13 +1219,8 @@ QString QFileSystemEngine::homePath() + QString::fromLocal8Bit(qgetenv("HOMEPATH")); if (ret.isEmpty() || !QFile::exists(ret)) { ret = QString::fromLocal8Bit(qgetenv("HOME")); - if (ret.isEmpty() || !QFile::exists(ret)) { -#if defined(Q_OS_WINCE) - ret = QLatin1String("\\My Documents"); - if (!QFile::exists(ret)) -#endif - ret = rootPath(); - } + if (ret.isEmpty() || !QFile::exists(ret)) + ret = rootPath(); } } } @@ -1302,10 +1233,6 @@ QString QFileSystemEngine::tempPath() #ifndef Q_OS_WINRT wchar_t tempPath[MAX_PATH]; const DWORD len = GetTempPath(MAX_PATH, tempPath); -#ifdef Q_OS_WINCE - if (len) - ret = QString::fromWCharArray(tempPath, len); -#else // Q_OS_WINCE if (len) { // GetTempPath() can return short names, expand. wchar_t longTempPath[MAX_PATH]; const DWORD longLen = GetLongPathName(tempPath, longTempPath, MAX_PATH); @@ -1313,7 +1240,6 @@ QString QFileSystemEngine::tempPath() QString::fromWCharArray(longTempPath, longLen) : QString::fromWCharArray(tempPath, len); } -#endif // !Q_OS_WINCE if (!ret.isEmpty()) { while (ret.endsWith(QLatin1Char('\\'))) ret.chop(1); @@ -1341,11 +1267,7 @@ QString QFileSystemEngine::tempPath() ret = QDir::fromNativeSeparators(QString::fromWCharArray(path.GetRawBuffer(nullptr))); #endif // Q_OS_WINRT if (ret.isEmpty()) { -#if !defined(Q_OS_WINCE) ret = QLatin1String("C:/tmp"); -#else - ret = QLatin1String("/Temp"); -#endif } else if (ret.length() >= 2 && ret[1] == QLatin1Char(':')) ret[0] = ret.at(0).toUpper(); // Force uppercase drive letters. return ret; @@ -1358,7 +1280,7 @@ bool QFileSystemEngine::setCurrentPath(const QFileSystemEntry &entry) if(!(meta.exists() && meta.isDirectory())) return false; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT_WIN81) +#if !defined(Q_OS_WINRT_WIN81) //TODO: this should really be using nativeFilePath(), but that returns a path in long format \\?\c:\foo //which causes many problems later on when it's returned through currentPath() return ::SetCurrentDirectory(reinterpret_cast<const wchar_t*>(QDir::toNativeSeparators(entry.filePath()).utf16())) != 0; @@ -1371,7 +1293,7 @@ bool QFileSystemEngine::setCurrentPath(const QFileSystemEntry &entry) QFileSystemEntry QFileSystemEngine::currentPath() { QString ret; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT_WIN81) +#if !defined(Q_OS_WINRT_WIN81) DWORD size = 0; wchar_t currentName[PATH_MAX]; size = ::GetCurrentDirectory(PATH_MAX, currentName); @@ -1387,17 +1309,13 @@ QFileSystemEntry QFileSystemEngine::currentPath() } if (ret.length() >= 2 && ret[1] == QLatin1Char(':')) ret[0] = ret.at(0).toUpper(); // Force uppercase drive letters. -#else // !Q_OS_WINCE && !Q_OS_WINRT_WIN81 +#else // !Q_OS_WINRT_WIN81 //TODO - a race condition exists when using currentPath / setCurrentPath from multiple threads if (qfsPrivateCurrentDir.isEmpty()) -#ifndef Q_OS_WINRT_WIN81 - qfsPrivateCurrentDir = QCoreApplication::applicationDirPath(); -#else qfsPrivateCurrentDir = QDir::rootPath(); -#endif ret = qfsPrivateCurrentDir; -#endif // Q_OS_WINCE || Q_OS_WINRT_WIN81 +#endif // Q_OS_WINRT_WIN81 return QFileSystemEntry(ret, QFileSystemEntry::FromNativePath()); } @@ -1479,31 +1397,11 @@ static inline QDateTime fileTimeToQDateTime(const FILETIME *time) { QDateTime ret; -#if defined(Q_OS_WINCE) - SYSTEMTIME systime; - FILETIME ftime; - systime.wYear = 1970; - systime.wMonth = 1; - systime.wDay = 1; - systime.wHour = 0; - systime.wMinute = 0; - systime.wSecond = 0; - systime.wMilliseconds = 0; - systime.wDayOfWeek = 4; - SystemTimeToFileTime(&systime, &ftime); - unsigned __int64 acttime = (unsigned __int64)time->dwHighDateTime << 32 | time->dwLowDateTime; - FileTimeToSystemTime(time, &systime); - unsigned __int64 time1970 = (unsigned __int64)ftime.dwHighDateTime << 32 | ftime.dwLowDateTime; - unsigned __int64 difftime = acttime - time1970; - difftime /= 10000000; - ret.setTime_t((unsigned int)difftime); -#else SYSTEMTIME sTime, lTime; FileTimeToSystemTime(time, &sTime); SystemTimeToTzSpecificLocalTime(0, &sTime, &lTime); ret.setDate(QDate(lTime.wYear, lTime.wMonth, lTime.wDay)); ret.setTime(QTime(lTime.wHour, lTime.wMinute, lTime.wSecond, lTime.wMilliseconds)); -#endif return ret; } diff --git a/src/corelib/io/qfilesystemiterator_win.cpp b/src/corelib/io/qfilesystemiterator_win.cpp index ba195b2330..9e40a41b4c 100644 --- a/src/corelib/io/qfilesystemiterator_win.cpp +++ b/src/corelib/io/qfilesystemiterator_win.cpp @@ -92,12 +92,10 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa haveData = true; int infoLevel = 0 ; // FindExInfoStandard; DWORD dwAdditionalFlags = 0; -#ifndef Q_OS_WINCE if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) { dwAdditionalFlags = 2; // FIND_FIRST_EX_LARGE_FETCH infoLevel = 1 ; // FindExInfoBasic; } -#endif int searchOps = 0; // FindExSearchNameMatch if (onlyDirs) searchOps = 1 ; // FindExSearchLimitToDirectories diff --git a/src/corelib/io/qfilesystemmetadata_p.h b/src/corelib/io/qfilesystemmetadata_p.h index 7135c9b19b..b38188d357 100644 --- a/src/corelib/io/qfilesystemmetadata_p.h +++ b/src/corelib/io/qfilesystemmetadata_p.h @@ -331,13 +331,10 @@ inline void QFileSystemMetaData::fillFromFindData(WIN32_FIND_DATA &findData, boo if (setLinkType) { knownFlagsMask |= LinkType; entryFlags &= ~LinkType; -#if !defined(Q_OS_WINCE) if ((fileAttribute_ & FILE_ATTRIBUTE_REPARSE_POINT) && (findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK)) { entryFlags |= LinkType; } -#endif - } } diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp index e8b49db9f3..be56d8dd1d 100644 --- a/src/corelib/io/qfilesystemwatcher_win.cpp +++ b/src/corelib/io/qfilesystemwatcher_win.cpp @@ -86,13 +86,9 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths, QString path = it.next(); QString normalPath = path; if ((normalPath.endsWith(QLatin1Char('/')) && !normalPath.endsWith(QLatin1String(":/"))) - || (normalPath.endsWith(QLatin1Char('\\')) && !normalPath.endsWith(QLatin1String(":\\"))) -#ifdef Q_OS_WINCE - && normalPath.size() > 1) -#else - ) -#endif - normalPath.chop(1); + || (normalPath.endsWith(QLatin1Char('\\')) && !normalPath.endsWith(QLatin1String(":\\")))) { + normalPath.chop(1); + } QFileInfo fileInfo(normalPath); if (!fileInfo.exists()) continue; diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 2cda4d6bda..7a04939cdb 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -48,9 +48,7 @@ #ifndef QT_NO_FSFILEENGINE -#if !defined(Q_OS_WINCE) #include <errno.h> -#endif #if defined(Q_OS_UNIX) #include "private/qcore_unix_p.h" #endif @@ -125,10 +123,8 @@ void QFSFileEnginePrivate::init() { is_sequential = 0; tried_stat = 0; -#if !defined(Q_OS_WINCE) need_lstat = 1; is_link = 0; -#endif openMode = QIODevice::NotOpen; fd = -1; fh = 0; @@ -139,10 +135,8 @@ void QFSFileEnginePrivate::init() fileAttrib = INVALID_FILE_ATTRIBUTES; fileHandle = INVALID_HANDLE_VALUE; mapHandle = NULL; -#ifndef Q_OS_WINCE cachedFd = -1; #endif -#endif } /*! diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h index dd498a5bc5..593ecc2687 100644 --- a/src/corelib/io/qfsfileengine_p.h +++ b/src/corelib/io/qfsfileengine_p.h @@ -61,10 +61,6 @@ QT_BEGIN_NAMESPACE -#if defined(Q_OS_WINCE_STD) && _WIN32_WCE < 0x600 -#define Q_USE_DEPRECATED_MAP_API 1 -#endif - class QFSFileEnginePrivate; class Q_CORE_EXPORT QFSFileEngine : public QAbstractFileEngine @@ -184,10 +180,7 @@ public: HANDLE mapHandle; QHash<uchar *, DWORD /* offset % AllocationGranularity */> maps; -#ifndef Q_OS_WINCE mutable int cachedFd; -#endif - mutable DWORD fileAttrib; #else QHash<uchar *, QPair<int /*offset % PageSize*/, size_t /*length + offset % PageSize*/> > maps; @@ -206,10 +199,8 @@ public: mutable uint is_sequential : 2; mutable uint tried_stat : 1; -#if !defined(Q_OS_WINCE) mutable uint need_lstat : 1; mutable uint is_link : 1; -#endif #if defined(Q_OS_WIN) bool doStat(QFileSystemMetaData::MetaDataFlags flags) const; diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index d94a8433a9..1e041ab837 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -50,13 +50,9 @@ #include "qdatetime.h" #include "qt_windows.h" -#if !defined(Q_OS_WINCE) -# include <sys/types.h> -# include <direct.h> -# include <winioctl.h> -#else -# include <types.h> -#endif +#include <sys/types.h> +#include <direct.h> +#include <winioctl.h> #include <objbase.h> #ifndef Q_OS_WINRT # include <shlobj.h> @@ -77,14 +73,12 @@ QT_BEGIN_NAMESPACE -#if !defined(Q_OS_WINCE) static inline bool isUncPath(const QString &path) { // Starts with \\, but not \\. return (path.startsWith(QLatin1String("\\\\")) && path.size() > 2 && path.at(2) != QLatin1Char('.')); } -#endif /*! \internal @@ -95,7 +89,7 @@ QString QFSFileEnginePrivate::longFileName(const QString &path) return path; QString absPath = QFileSystemEngine::nativeAbsoluteFilePath(path); -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) QString prefix = QLatin1String("\\\\?\\"); if (isUncPath(absPath)) { prefix.append(QLatin1String("UNC\\")); // "\\\\?\\UNC\\" @@ -171,7 +165,6 @@ bool QFSFileEnginePrivate::nativeClose() // Windows native mode. bool ok = true; -#ifndef Q_OS_WINCE if (cachedFd != -1) { if (::_close(cachedFd) && !::CloseHandle(fileHandle)) { q->setError(QFile::UnspecifiedError, qt_error_string()); @@ -184,7 +177,6 @@ bool QFSFileEnginePrivate::nativeClose() return ok; } -#endif if ((fileHandle == INVALID_HANDLE_VALUE || !::CloseHandle(fileHandle))) { q->setError(QFile::UnspecifiedError, qt_error_string()); @@ -238,24 +230,6 @@ qint64 QFSFileEnginePrivate::nativeSize() const // Always retrive the current information metaData.clearFlags(QFileSystemMetaData::SizeAttribute); -#if defined(Q_OS_WINCE) - // Buffered stdlib mode. - if (fh) { - QT_OFF_T oldPos = QT_FTELL(fh); - QT_FSEEK(fh, 0, SEEK_END); - qint64 fileSize = (qint64)QT_FTELL(fh); - QT_FSEEK(fh, oldPos, SEEK_SET); - if (fileSize == -1) { - fileSize = 0; - thatQ->setError(QFile::UnspecifiedError, qt_error_string(errno)); - } - return fileSize; - } - if (fd != -1) { - thatQ->setError(QFile::UnspecifiedError, QLatin1String("Not implemented!")); - return 0; - } -#endif bool filled = false; if (fileHandle != INVALID_HANDLE_VALUE && openMode != QIODevice::NotOpen ) filled = QFileSystemEngine::fillMetaData(fileHandle, metaData, @@ -287,7 +261,6 @@ qint64 QFSFileEnginePrivate::nativePos() const if (fileHandle == INVALID_HANDLE_VALUE) return 0; -#if !defined(Q_OS_WINCE) LARGE_INTEGER currentFilePos; LARGE_INTEGER offset; offset.QuadPart = 0; @@ -297,18 +270,6 @@ qint64 QFSFileEnginePrivate::nativePos() const } return qint64(currentFilePos.QuadPart); -#else - LARGE_INTEGER filepos; - filepos.HighPart = 0; - DWORD newFilePointer = SetFilePointer(fileHandle, 0, &filepos.HighPart, FILE_CURRENT); - if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) { - thatQ->setError(QFile::UnspecifiedError, qt_error_string()); - return 0; - } - - filepos.LowPart = newFilePointer; - return filepos.QuadPart; -#endif } /* @@ -323,7 +284,6 @@ bool QFSFileEnginePrivate::nativeSeek(qint64 pos) return seekFdFh(pos); } -#if !defined(Q_OS_WINCE) LARGE_INTEGER currentFilePos; LARGE_INTEGER offset; offset.QuadPart = pos; @@ -333,17 +293,6 @@ bool QFSFileEnginePrivate::nativeSeek(qint64 pos) } return true; -#else - DWORD newFilePointer; - LARGE_INTEGER *li = reinterpret_cast<LARGE_INTEGER*>(&pos); - newFilePointer = SetFilePointer(fileHandle, li->LowPart, &li->HighPart, FILE_BEGIN); - if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) { - q->setError(QFile::PositionError, qt_error_string()); - return false; - } - - return true; -#endif } /* @@ -462,7 +411,6 @@ int QFSFileEnginePrivate::nativeHandle() const { if (fh || fd != -1) return fh ? QT_FILENO(fh) : fd; -#ifndef Q_OS_WINCE if (cachedFd != -1) return cachedFd; @@ -473,9 +421,6 @@ int QFSFileEnginePrivate::nativeHandle() const flags |= _O_RDONLY; cachedFd = _open_osfhandle((intptr_t) fileHandle, flags); return cachedFd; -#else - return -1; -#endif } /* @@ -483,7 +428,7 @@ int QFSFileEnginePrivate::nativeHandle() const */ bool QFSFileEnginePrivate::nativeIsSequential() const { -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) HANDLE handle = fileHandle; if (fh || fd != -1) handle = (HANDLE)_get_osfhandle(fh ? QT_FILENO(fh) : fd); @@ -531,35 +476,9 @@ bool QFSFileEngine::rename(const QString &newName) bool QFSFileEngine::renameOverwrite(const QString &newName) { Q_D(QFSFileEngine); -#if defined(Q_OS_WINCE) - // Windows Embedded Compact 7 does not have MoveFileEx, simulate it with the following sequence: - // 1. DeleteAndRenameFile (Should work on RAM FS when both files exist) - // 2. DeleteFile/MoveFile (Should work on all file systems) - // - // DeleteFile/MoveFile fallback implementation violates atomicity, but it is more acceptable than - // alternative CopyFile/DeleteFile sequence for the following reasons: - // - // 1. DeleteFile/MoveFile is way faster than CopyFile/DeleteFile and thus more atomic. - // 2. Given the intended use case of this function in QSaveFile, DeleteFile/MoveFile sequence will - // delete the old content, but leave a file "filename.ext.XXXXXX" in the same directory if MoveFile fails. - // With CopyFile/DeleteFile sequence, it can happen that new data is partially copied to target file - // (because CopyFile is not atomic either), thus leaving *some* content to target file. - // This makes the need for application level recovery harder to detect than in DeleteFile/MoveFile - // sequence where target file simply does not exist. - // - bool ret = ::DeleteAndRenameFile((wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16(), - (wchar_t*)d->fileEntry.nativeFilePath().utf16()) != 0; - if (!ret) { - ret = ::DeleteFile((wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16()) != 0; - if (ret || ::GetLastError() == ERROR_FILE_NOT_FOUND) - ret = ::MoveFile((wchar_t*)d->fileEntry.nativeFilePath().utf16(), - (wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16()) != 0; - } -#else bool ret = ::MoveFileEx((wchar_t*)d->fileEntry.nativeFilePath().utf16(), (wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16(), MOVEFILE_REPLACE_EXISTING) != 0; -#endif if (!ret) setError(QFile::RenameError, QSystemError(::GetLastError(), QSystemError::NativeError).toString()); return ret; @@ -587,7 +506,7 @@ bool QFSFileEngine::setCurrentPath(const QString &path) QString QFSFileEngine::currentPath(const QString &fileName) { -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) QString ret; //if filename is a drive: then get the pwd of that drive if (fileName.length() >= 2 && @@ -606,10 +525,10 @@ QString QFSFileEngine::currentPath(const QString &fileName) if (ret.length() >= 2 && ret[1] == QLatin1Char(':')) ret[0] = ret.at(0).toUpper(); // Force uppercase drive letters. return ret; -#else // !Q_OS_WINCE && !Q_OS_WINRT +#else // !Q_OS_WINRT Q_UNUSED(fileName); return QFileSystemEngine::currentPath().filePath(); -#endif // Q_OS_WINCE || Q_OS_WINRT +#endif // Q_OS_WINRT } QString QFSFileEngine::homePath() @@ -630,10 +549,10 @@ QString QFSFileEngine::tempPath() QFileInfoList QFSFileEngine::drives() { QFileInfoList ret; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) -#if defined(Q_OS_WIN32) +#if !defined(Q_OS_WINRT) +# if defined(Q_OS_WIN32) quint32 driveBits = (quint32) GetLogicalDrives() & 0x3ffffff; -#endif +# endif char driveName[] = "A:/"; while (driveBits) { @@ -643,10 +562,10 @@ QFileInfoList QFSFileEngine::drives() driveBits = driveBits >> 1; } return ret; -#else // !Q_OS_WINCE && !Q_OS_WINRT +#else // !Q_OS_WINRT ret.append(QFileInfo(QLatin1String("/"))); return ret; -#endif // Q_OS_WINCE || Q_OS_WINRT +#endif // Q_OS_WINRT } bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) const @@ -654,13 +573,11 @@ bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) cons if (!tried_stat || !metaData.hasFlags(flags)) { tried_stat = true; -#if !defined(Q_OS_WINCE) int localFd = fd; if (fh && fileEntry.isEmpty()) localFd = QT_FILENO(fh); if (localFd != -1) QFileSystemEngine::fillMetaData(localFd, metaData, flags); -#endif if (metaData.missingFlags(flags) && !fileEntry.isEmpty()) QFileSystemEngine::fillMetaData(fileEntry, metaData, metaData.missingFlags(flags)); } @@ -671,8 +588,8 @@ bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) cons bool QFSFileEngine::link(const QString &newName) { -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) -#if !defined(QT_NO_LIBRARY) +#if !defined(Q_OS_WINRT) +# if !defined(QT_NO_LIBRARY) bool ret = false; QString linkName = newName; @@ -713,24 +630,11 @@ bool QFSFileEngine::link(const QString &newName) CoUninitialize(); return ret; -#else +# else // QT_NO_LIBRARY Q_UNUSED(newName); return false; -#endif // QT_NO_LIBRARY -#elif defined(Q_OS_WINCE) && !defined(QT_NO_WINCE_SHELLSDK) - QString linkName = newName; - linkName.replace(QLatin1Char('/'), QLatin1Char('\\')); - if (!linkName.endsWith(QLatin1String(".lnk"))) - linkName += QLatin1String(".lnk"); - QString orgName = fileName(AbsoluteName).replace(QLatin1Char('/'), QLatin1Char('\\')); - // Need to append on our own - orgName.prepend(QLatin1Char('"')); - orgName.append(QLatin1Char('"')); - bool ret = SUCCEEDED(SHCreateShortcut((wchar_t*)linkName.utf16(), (wchar_t*)orgName.utf16())); - if (!ret) - setError(QFile::RenameError, qt_error_string()); - return ret; -#else // Q_OS_WINCE && !QT_NO_WINCE_SHELLSDK +# endif // QT_NO_LIBRARY +#else // !Q_OS_WINRT Q_UNUSED(newName); Q_UNIMPLEMENTED(); return false; @@ -811,7 +715,6 @@ QString QFSFileEngine::fileName(FileName file) const QString ret; if (!isRelativePath()) { -#if !defined(Q_OS_WINCE) if (d->fileEntry.filePath().startsWith(QLatin1Char('/')) || // It's a absolute path to the current drive, so \a.txt -> Z:\a.txt d->fileEntry.filePath().size() == 2 || // It's a drive letter that needs to get a working dir appended (d->fileEntry.filePath().size() > 2 && d->fileEntry.filePath().at(2) != QLatin1Char('/')) || // It's a drive-relative path, so Z:a.txt -> Z:\currentpath\a.txt @@ -819,9 +722,7 @@ QString QFSFileEngine::fileName(FileName file) const d->fileEntry.filePath().endsWith(QLatin1String("/..")) || d->fileEntry.filePath().endsWith(QLatin1String("/."))) { ret = QDir::fromNativeSeparators(QFileSystemEngine::nativeAbsoluteFilePath(d->fileEntry.filePath())); - } else -#endif - { + } else { ret = d->fileEntry.filePath(); } } else { @@ -903,14 +804,12 @@ bool QFSFileEngine::setSize(qint64 size) if (d->fileHandle != INVALID_HANDLE_VALUE || d->fd != -1 || d->fh) { // resize open file HANDLE fh = d->fileHandle; -#if !defined(Q_OS_WINCE) if (fh == INVALID_HANDLE_VALUE) { if (d->fh) fh = (HANDLE)_get_osfhandle(QT_FILENO(d->fh)); else fh = (HANDLE)_get_osfhandle(d->fd); } -#endif if (fh == INVALID_HANDLE_VALUE) return false; qint64 currentPos = pos(); @@ -982,10 +881,8 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, // get handle to the file HANDLE handle = fileHandle; -#ifndef Q_OS_WINCE if (handle == INVALID_HANDLE_VALUE && fh) handle = (HANDLE)::_get_osfhandle(QT_FILENO(fh)); -#endif #ifdef Q_USE_DEPRECATED_MAP_API nativeClose(); diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index fd204b00de..36616a5236 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -1148,34 +1148,31 @@ QByteArray QIODevice::read(qint64 maxSize) Q_D(QIODevice); QByteArray result; - CHECK_MAXLEN(read, result); - #if defined QIODEVICE_DEBUG printf("%p QIODevice::read(%lld), d->pos = %lld, d->buffer.size() = %lld\n", this, maxSize, d->pos, d->buffer.size()); #endif + // Try to prevent the data from being copied, if we have a chunk + // with the same size in the read buffer. + if (maxSize == d->buffer.nextDataBlockSize() && !d->transactionStarted + && (d->openMode & (QIODevice::ReadOnly | QIODevice::Text)) == QIODevice::ReadOnly) { + result = d->buffer.read(); + if (!d->isSequential()) + d->pos += maxSize; + if (d->buffer.isEmpty()) + readData(nullptr, 0); + return result; + } + + CHECK_MAXLEN(read, result); if (maxSize >= MaxByteArraySize) { checkWarnMessage(this, "read", "maxSize argument exceeds QByteArray size limit"); maxSize = MaxByteArraySize - 1; } - qint64 readBytes = 0; - if (maxSize) { - result.resize(int(maxSize)); - if (!result.size()) { - // If resize fails, read incrementally. - qint64 readResult; - do { - result.resize(int(qMin(maxSize, qint64(result.size() + d->readBufferChunkSize)))); - readResult = read(result.data() + readBytes, result.size() - readBytes); - if (readResult > 0 || readBytes == 0) - readBytes += readResult; - } while (readResult == d->readBufferChunkSize); - } else { - readBytes = read(result.data(), result.size()); - } - } + result.resize(int(maxSize)); + qint64 readBytes = read(result.data(), result.size()); if (readBytes <= 0) result.clear(); diff --git a/src/corelib/io/qlockfile_win.cpp b/src/corelib/io/qlockfile_win.cpp index 9062df37da..261363f320 100644 --- a/src/corelib/io/qlockfile_win.cpp +++ b/src/corelib/io/qlockfile_win.cpp @@ -163,7 +163,7 @@ bool QLockFilePrivate::isApparentlyStale() const QString QLockFilePrivate::processNameByPid(qint64 pid) { -#if !defined(Q_OS_WINRT) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_WINRT) typedef DWORD (WINAPI *GetModuleFileNameExFunc)(HANDLE, HMODULE, LPTSTR, DWORD); HMODULE hPsapi = LoadLibraryA("psapi"); diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 6f11d0892f..8b794df6df 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -48,9 +48,6 @@ #if defined QPROCESS_DEBUG #include <qstring.h> #include <ctype.h> -#if !defined(Q_OS_WINCE) -#include <errno.h> -#endif QT_BEGIN_NAMESPACE /* @@ -2005,13 +2002,6 @@ qint64 QProcess::writeData(const char *data, qint64 len) { Q_D(QProcess); -#if defined(Q_OS_WINCE) - Q_UNUSED(data); - Q_UNUSED(len); - d->setErrorAndEmit(QProcess::WriteError); - return -1; -#endif - if (d->stdinChannel.closed) { #if defined QPROCESS_DEBUG qDebug("QProcess::writeData(%p \"%s\", %lld) == 0 (write channel closing)", @@ -2194,7 +2184,6 @@ void QProcessPrivate::start(QIODevice::OpenMode mode) mode &= ~QIODevice::ReadOnly; // not open for reading if (mode == 0) mode = QIODevice::Unbuffered; -#ifndef Q_OS_WINCE if ((mode & QIODevice::ReadOnly) == 0) { if (stdoutChannel.type == QProcessPrivate::Channel::Normal) q->setStandardOutputFile(q->nullDevice()); @@ -2202,7 +2191,6 @@ void QProcessPrivate::start(QIODevice::OpenMode mode) && processChannelMode != QProcess::MergedChannels) q->setStandardErrorFile(q->nullDevice()); } -#endif q->QIODevice::open(mode); @@ -2562,7 +2550,7 @@ QT_BEGIN_INCLUDE_NAMESPACE #if defined(Q_OS_MACX) # include <crt_externs.h> # define environ (*_NSGetEnviron()) -#elif defined(Q_OS_WINCE) || defined(Q_OS_IOS) +#elif defined(Q_OS_IOS) static char *qt_empty_environ[] = { 0 }; #define environ qt_empty_environ #elif !defined(Q_OS_WIN) diff --git a/src/corelib/io/qprocess_wince.cpp b/src/corelib/io/qprocess_wince.cpp deleted file mode 100644 index 564b3f520d..0000000000 --- a/src/corelib/io/qprocess_wince.cpp +++ /dev/null @@ -1,310 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qprocess.h" -#include "qprocess_p.h" - -#include <qdir.h> -#include <qfileinfo.h> -#include <qregexp.h> -#include <qtimer.h> -#include <qwineventnotifier.h> -#include <qdebug.h> -#include <private/qthread_p.h> - -#ifndef QT_NO_PROCESS - -QT_BEGIN_NAMESPACE - -//#define QPROCESS_DEBUG - -void QProcessPrivate::destroyPipe(Q_PIPE pipe[2]) -{ - Q_UNUSED(pipe); -} - -void QProcessPrivate::closeChannel(Channel *channel) -{ - Q_UNUSED(channel); -} - -static QString qt_create_commandline(const QString &program, const QStringList &arguments) -{ - QString args; - if (!program.isEmpty()) { - QString programName = program; - if (!programName.startsWith(QLatin1Char('\"')) && !programName.endsWith(QLatin1Char('\"')) && programName.contains(QLatin1Char(' '))) - programName = QLatin1Char('\"') + programName + QLatin1Char('\"'); - programName.replace(QLatin1Char('/'), QLatin1Char('\\')); - - // add the prgram as the first arg ... it works better - args = programName + QLatin1Char(' '); - } - - for (int i=0; i<arguments.size(); ++i) { - QString tmp = arguments.at(i); - // Quotes are escaped and their preceding backslashes are doubled. - tmp.replace(QRegExp(QLatin1String("(\\\\*)\"")), QLatin1String("\\1\\1\\\"")); - if (tmp.isEmpty() || tmp.contains(QLatin1Char(' ')) || tmp.contains(QLatin1Char('\t'))) { - // The argument must not end with a \ since this would be interpreted - // as escaping the quote -- rather put the \ behind the quote: e.g. - // rather use "foo"\ than "foo\" - int i = tmp.length(); - while (i > 0 && tmp.at(i - 1) == QLatin1Char('\\')) - --i; - tmp.insert(i, QLatin1Char('"')); - tmp.prepend(QLatin1Char('"')); - } - args += QLatin1Char(' ') + tmp; - } - return args; -} - -QProcessEnvironment QProcessEnvironment::systemEnvironment() -{ - QProcessEnvironment env; - return env; -} - -void QProcessPrivate::startProcess() -{ - Q_Q(QProcess); - - bool success = false; - - if (pid) { - CloseHandle(pid->hThread); - CloseHandle(pid->hProcess); - delete pid; - pid = 0; - } - pid = new PROCESS_INFORMATION; - memset(pid, 0, sizeof(PROCESS_INFORMATION)); - - q->setProcessState(QProcess::Starting); - - QString args = qt_create_commandline(QString(), arguments); - if (!nativeArguments.isEmpty()) { - if (!args.isEmpty()) - args += QLatin1Char(' '); - args += nativeArguments; - } - -#if defined QPROCESS_DEBUG - qDebug("Creating process"); - qDebug(" program : [%s]", program.toLatin1().constData()); - qDebug(" args : %s", args.toLatin1().constData()); - qDebug(" pass environment : %s", environment.isEmpty() ? "no" : "yes"); -#endif - - QString fullPathProgram = program; - if (!QDir::isAbsolutePath(fullPathProgram)) - fullPathProgram = QFileInfo(fullPathProgram).absoluteFilePath(); - fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\')); - success = CreateProcess((wchar_t*)fullPathProgram.utf16(), - (wchar_t*)args.utf16(), - 0, 0, false, 0, 0, 0, 0, pid); - - if (!success) { - cleanup(); - setErrorAndEmit(QProcess::FailedToStart); - q->setProcessState(QProcess::NotRunning); - return; - } - - q->setProcessState(QProcess::Running); - // User can call kill()/terminate() from the stateChanged() slot - // so check before proceeding - if (!pid) - return; - - if (threadData->hasEventDispatcher()) { - processFinishedNotifier = new QWinEventNotifier(pid->hProcess, q); - QObject::connect(processFinishedNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_processDied())); - processFinishedNotifier->setEnabled(true); - } - - // give the process a chance to start ... - Sleep(20); - _q_startupNotification(); -} - -bool QProcessPrivate::processStarted(QString * /*errorMessage*/) -{ - return processState == QProcess::Running; -} - -qint64 QProcessPrivate::bytesAvailableInChannel(const Channel *) const -{ - return 0; -} - -qint64 QProcessPrivate::readFromChannel(const Channel *, char *data, qint64 maxlen) -{ - return -1; -} - -static BOOL QT_WIN_CALLBACK qt_terminateApp(HWND hwnd, LPARAM procId) -{ - DWORD currentProcId = 0; - GetWindowThreadProcessId(hwnd, ¤tProcId); - if (currentProcId == (DWORD)procId) - PostMessage(hwnd, WM_CLOSE, 0, 0); - - return TRUE; -} - -void QProcessPrivate::terminateProcess() -{ - if (pid) { - EnumWindows(qt_terminateApp, (LPARAM)pid->dwProcessId); - PostThreadMessage(pid->dwThreadId, WM_CLOSE, 0, 0); - } -} - -void QProcessPrivate::killProcess() -{ - if (pid) - TerminateProcess(pid->hProcess, 0xf291); -} - -bool QProcessPrivate::waitForStarted(int) -{ - Q_Q(QProcess); - - if (processStarted()) - return true; - - if (processError == QProcess::FailedToStart) - return false; - - setError(QProcess::Timedout); - return false; -} - -bool QProcessPrivate::drainOutputPipes() -{ - return true; -} - -bool QProcessPrivate::waitForReadyRead(int msecs) -{ - return false; -} - -bool QProcessPrivate::waitForBytesWritten(int msecs) -{ - return false; -} - -bool QProcessPrivate::waitForFinished(int msecs) -{ - Q_Q(QProcess); -#if defined QPROCESS_DEBUG - qDebug("QProcessPrivate::waitForFinished(%d)", msecs); -#endif - - if (!pid) - return true; - - if (WaitForSingleObject(pid->hProcess, msecs == -1 ? INFINITE : msecs) == WAIT_OBJECT_0) { - _q_processDied(); - return true; - } - - setError(QProcess::Timedout); - return false; -} - -void QProcessPrivate::findExitCode() -{ - DWORD theExitCode; - if (GetExitCodeProcess(pid->hProcess, &theExitCode)) { - exitCode = theExitCode; - //### for now we assume a crash if exit code is less than -1 or the magic number - crashed = (exitCode == 0xf291 || (int)exitCode < 0); - } -} - -void QProcessPrivate::flushPipeWriter() -{ -} - -qint64 QProcessPrivate::pipeWriterBytesToWrite() const -{ - return 0; -} - -qint64 QProcessPrivate::writeToStdin(const char *data, qint64 maxlen) -{ - Q_UNUSED(data); - Q_UNUSED(maxlen); - return -1; -} - -bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDir, qint64 *pid) -{ - Q_UNUSED(workingDir); - QString args = qt_create_commandline(QString(), arguments); - - bool success = false; - - PROCESS_INFORMATION pinfo; - - QString fullPathProgram = program; - if (!QDir::isAbsolutePath(fullPathProgram)) - fullPathProgram.prepend(QDir::currentPath().append(QLatin1Char('/'))); - fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\')); - success = CreateProcess((wchar_t*)fullPathProgram.utf16(), - (wchar_t*)args.utf16(), - 0, 0, false, CREATE_NEW_CONSOLE, 0, 0, 0, &pinfo); - - if (success) { - CloseHandle(pinfo.hThread); - CloseHandle(pinfo.hProcess); - if (pid) - *pid = pinfo.dwProcessId; - } - - return success; -} - -QT_END_NAMESPACE - -#endif // QT_NO_PROCESS diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 6e788d28f4..8b61bd268d 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -986,21 +986,12 @@ static QString windowsConfigPath(int type) if (result.isEmpty()) { switch (type) { -#ifndef Q_OS_WINCE case CSIDL_COMMON_APPDATA: result = QLatin1String("C:\\temp\\qt-common"); break; case CSIDL_APPDATA: result = QLatin1String("C:\\temp\\qt-user"); break; -#else - case CSIDL_COMMON_APPDATA: - result = QLatin1String("\\Temp\\qt-common"); - break; - case CSIDL_APPDATA: - result = QLatin1String("\\Temp\\qt-user"); - break; -#endif default: ; } diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp index 05ed51e999..7c6b782acd 100644 --- a/src/corelib/io/qsettings_win.cpp +++ b/src/corelib/io/qsettings_win.cpp @@ -609,16 +609,12 @@ HKEY QWinSettingsPrivate::writeHandle() const QWinSettingsPrivate::~QWinSettingsPrivate() { if (deleteWriteHandleOnExit && writeHandle() != 0) { -#if defined(Q_OS_WINCE) - remove(regList.at(0).key()); -#else QString emptyKey; DWORD res = RegDeleteKey(writeHandle(), reinterpret_cast<const wchar_t *>(emptyKey.utf16())); if (res != ERROR_SUCCESS) { qWarning("QSettings: Failed to delete key \"%s\": %s", regList.at(0).key().toLatin1().data(), errorCodeToString(res).toLatin1().data()); } -#endif } for (int i = 0; i < regList.size(); ++i) @@ -660,10 +656,6 @@ void QWinSettingsPrivate::remove(const QString &uKey) } } } else { -#if defined(Q_OS_WINCE) - // For WinCE always Close the handle first. - RegCloseKey(handle); -#endif res = RegDeleteKey(writeHandle(), reinterpret_cast<const wchar_t *>(rKey.utf16())); if (res != ERROR_SUCCESS) { diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp index 9bd5a9e3b6..38c63553ea 100644 --- a/src/corelib/io/qstandardpaths_win.cpp +++ b/src/corelib/io/qstandardpaths_win.cpp @@ -51,13 +51,7 @@ const GUID qCLSID_FOLDERID_Downloads = { 0x374de290, 0x123f, 0x4565, { 0x91, 0x6 #include <qt_windows.h> #include <shlobj.h> -#if !defined(Q_OS_WINCE) -# include <intshcut.h> -#else -# if !defined(STANDARDSHELL_UI_MODEL) -# include <winx.h> -# endif -#endif +#include <intshcut.h> #ifndef CSIDL_MYMUSIC #define CSIDL_MYMUSIC 13 @@ -117,7 +111,6 @@ static inline void appendTestMode(QString &path) // Map QStandardPaths::StandardLocation to CLSID of SHGetSpecialFolderPath() static int writableSpecialFolderClsid(QStandardPaths::StandardLocation type) { -#ifndef Q_OS_WINCE static const int clsids[] = { CSIDL_DESKTOPDIRECTORY, // DesktopLocation CSIDL_PERSONAL, // DocumentsLocation @@ -137,27 +130,6 @@ static int writableSpecialFolderClsid(QStandardPaths::StandardLocation type) CSIDL_APPDATA, // AppDataLocation ("Roaming" path) CSIDL_LOCAL_APPDATA, // AppConfigLocation ("Local" path) }; -#else // !Q_OS_WINCE - static const int clsids[] = { - CSIDL_DESKTOPDIRECTORY, // DesktopLocation - CSIDL_PERSONAL, // DocumentsLocation - CSIDL_FONTS, // FontsLocation - CSIDL_PROGRAMS, // ApplicationsLocation - CSIDL_MYMUSIC, // MusicLocation - CSIDL_MYVIDEO, // MoviesLocation - CSIDL_MYPICTURES, // PicturesLocation - -1, -1, // TempLocation/HomeLocation - CSIDL_APPDATA, // AppLocalDataLocation, AppLocalDataLocation = DataLocation - -1, // CacheLocation - CSIDL_APPDATA, // GenericDataLocation - -1, // RuntimeLocation - CSIDL_APPDATA, // ConfigLocation - -1, -1, // DownloadLocation/GenericCacheLocation - CSIDL_APPDATA, // GenericConfigLocation - CSIDL_APPDATA, // AppDataLocation - CSIDL_APPDATA, // AppConfigLocation - }; -#endif // Q_OS_WINCE Q_STATIC_ASSERT(sizeof(clsids) / sizeof(clsids[0]) == size_t(QStandardPaths::AppConfigLocation + 1)); return size_t(type) < sizeof(clsids) / sizeof(clsids[0]) ? clsids[type] : -1; @@ -183,7 +155,6 @@ static QString sHGetSpecialFolderPath(int clsid, QStandardPaths::StandardLocatio static QString sHGetKnownFolderPath(const GUID &clsid, QStandardPaths::StandardLocation type, bool warn = false) { QString result; -#ifndef Q_OS_WINCE typedef HRESULT (WINAPI *GetKnownFolderPath)(const GUID&, DWORD, HANDLE, LPWSTR*); static const GetKnownFolderPath sHGetKnownFolderPath = // Vista onwards. @@ -199,11 +170,6 @@ static QString sHGetKnownFolderPath(const GUID &clsid, QStandardPaths::StandardL qPrintable(displayName(type))); } } -#else // !Q_OS_WINCE - Q_UNUSED(clsid) - Q_UNUSED(type) - Q_UNUSED(warn) -#endif return result; } @@ -266,7 +232,6 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) dirs.append(localDir); // type-specific handling goes here -#ifndef Q_OS_WINCE if (isConfigLocation(type)) { QString programData = sHGetSpecialFolderPath(CSIDL_COMMON_APPDATA, type); if (!programData.isEmpty()) { @@ -274,12 +239,11 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) appendOrganizationAndApp(programData); dirs.append(programData); } -# ifndef QT_BOOTSTRAPPED +#ifndef QT_BOOTSTRAPPED dirs.append(QCoreApplication::applicationDirPath()); dirs.append(QCoreApplication::applicationDirPath() + QLatin1String("/data")); -# endif // !QT_BOOTSTRAPPED +#endif // !QT_BOOTSTRAPPED } // isConfigLocation() -#endif // !Q_OS_WINCE return dirs; } diff --git a/src/corelib/io/qstorageinfo_p.h b/src/corelib/io/qstorageinfo_p.h index 744653ea42..9dc66f2d69 100644 --- a/src/corelib/io/qstorageinfo_p.h +++ b/src/corelib/io/qstorageinfo_p.h @@ -70,7 +70,7 @@ public: static QStorageInfo root(); protected: -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void retrieveVolumeInfo(); void retrieveDiskFreeSpace(); #elif defined(Q_OS_MAC) diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index 27b7570226..b8db23329a 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -231,9 +231,7 @@ static const int QTEXTSTREAM_BUFFERSIZE = 16384; #include "qnumeric.h" #include "qvarlengtharray.h" -#ifndef Q_OS_WINCE #include <locale.h> -#endif #include "private/qlocale_p.h" #include <stdlib.h> diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 18eaea7e21..1e409c105c 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -413,9 +413,6 @@ #include "qtldurl_p.h" #include "private/qipaddress_p.h" #include "qurlquery.h" -#if defined(Q_OS_WINCE_WM) -#pragma optimize("g", off) -#endif QT_BEGIN_NAMESPACE extern QString qt_normalizePathSegments(const QString &name, bool allowUncPaths); // qdir.cpp diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h index 947b3bbb55..d9d4fd906a 100644 --- a/src/corelib/io/qurl.h +++ b/src/corelib/io/qurl.h @@ -48,9 +48,9 @@ #include <QtCore/qpair.h> #include <QtCore/qglobal.h> -#ifdef Q_OS_MAC +#if defined(Q_OS_MAC) || defined(Q_QDOC) Q_FORWARD_DECLARE_CF_TYPE(CFURL); -# ifdef __OBJC__ +# if defined(__OBJC__) || defined(Q_QDOC) Q_FORWARD_DECLARE_OBJC_CLASS(NSURL); # endif #endif diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index 8c16e10c27..a8d1ec08a6 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -84,14 +84,6 @@ win32 { } } -wince { - SOURCES += \ - kernel/qfunctions_wince.cpp - HEADERS += \ - kernel/qfunctions_fake_env_p.h \ - kernel/qfunctions_wince.h -} - winrt { SOURCES += \ kernel/qfunctions_winrt.cpp diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 879e218e09..ec06d0f1f0 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2259,14 +2259,6 @@ QStringList QCoreApplication::arguments() // classes by index. QString cmdline = QString::fromWCharArray(GetCommandLine()); -#if defined(Q_OS_WINCE) - wchar_t tempFilename[MAX_PATH+1]; - if (GetModuleFileName(0, tempFilename, MAX_PATH)) { - tempFilename[MAX_PATH] = 0; - cmdline.prepend(QLatin1Char('\"') + QString::fromWCharArray(tempFilename) + QLatin1String("\" ")); - } -#endif // Q_OS_WINCE - const QCoreApplicationPrivate *d = self->d_func(); if (d->origArgv) { const QStringList allArguments = qWinCmdArgs(cmdline); @@ -2497,6 +2489,26 @@ QStringList QCoreApplication::libraryPaths() } } +#ifdef Q_OS_DARWIN + // Check the main bundle's PlugIns directory as this is a standard location for Apple OSes. + // Note that the QLibraryInfo::PluginsPath below will coincidentally be the same as this value + // but with a different casing, so it can't be relied upon when the underlying filesystem + // is case sensitive (and this is always the case on newer OSes like iOS). + if (CFBundleRef bundleRef = CFBundleGetMainBundle()) { + if (QCFType<CFURLRef> urlRef = CFBundleCopyBuiltInPlugInsURL(bundleRef)) { + if (QCFType<CFURLRef> absoluteUrlRef = CFURLCopyAbsoluteURL(urlRef)) { + if (QCFString path = CFURLCopyFileSystemPath(absoluteUrlRef, kCFURLPOSIXPathStyle)) { + if (QFile::exists(path)) { + path = QDir(path).canonicalPath(); + if (!app_libpaths->contains(path)) + app_libpaths->append(path); + } + } + } + } + } +#endif // Q_OS_DARWIN + QString installPathPlugins = QLibraryInfo::location(QLibraryInfo::PluginsPath); if (QFile::exists(installPathPlugins)) { // Make sure we convert from backslashes to slashes. diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index 9cd8420a32..61576daba2 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -81,16 +81,12 @@ Q_CORE_EXPORT HINSTANCE qWinAppPrevInst() // get Windows prev app Q_CORE_EXPORT int qWinAppCmdShow() // get main window show command { -#if defined(Q_OS_WINCE) - return appCmdShow; -#else STARTUPINFO startupInfo; GetStartupInfo(&startupInfo); return (startupInfo.dwFlags & STARTF_USESHOWWINDOW) ? startupInfo.wShowWindow : SW_SHOWDEFAULT; -#endif } Q_CORE_EXPORT QString qAppFileName() // get application file name @@ -143,7 +139,7 @@ QString QCoreApplicationPrivate::appName() const qWinMain() - Initializes Windows. Called from WinMain() in qtmain_win.cpp *****************************************************************************/ -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) // ### Qt6: FIXME: Consider removing this function. It is here for Active Qt // servers and for binary for compatibility to applications built with Qt 5.3 @@ -164,30 +160,7 @@ void qWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam, argv.append(_strdup(wArg.toLocal8Bit().constData())); } -#elif defined(Q_OS_WINCE) - -Q_CORE_EXPORT void __cdecl qWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam, - int cmdShow, int &argc, QVector<char *> &argv) -{ - static bool already_called = false; - - if (already_called) { - qWarning("Qt: Internal error: qWinMain should be called only once"); - return; - } - already_called = true; - - // Create command line - argv = qWinCmdLine<char>(cmdParam, int(strlen(cmdParam)), argc); - - appCmdShow = cmdShow; - - // Ignore Windows parameters - Q_UNUSED(instance); - Q_UNUSED(prevInstance); -} - -#endif // Q_OS_WINCE +#endif // !Q_OS_WINRT #ifndef QT_NO_QOBJECT diff --git a/src/corelib/kernel/qcorecmdlineargs_p.h b/src/corelib/kernel/qcorecmdlineargs_p.h index 2d8de08f2d..c5d9d130f0 100644 --- a/src/corelib/kernel/qcorecmdlineargs_p.h +++ b/src/corelib/kernel/qcorecmdlineargs_p.h @@ -81,93 +81,7 @@ static inline QStringList qWinCmdArgs(const QString &cmdLine) return result; } -#elif defined(Q_OS_WINCE) // Q_OS_WIN32 - -// template implementation of the parsing algorithm -// this is used from qcoreapplication_win.cpp and the tools (rcc, uic...) - -template<typename Char> -static QVector<Char*> qWinCmdLine(Char *cmdParam, int length, int &argc) -{ - QVector<Char*> argv(8); - Char *p = cmdParam; - Char *p_end = p + length; - - argc = 0; - - while (*p && p < p_end) { // parse cmd line arguments - while (QChar((short)(*p)).isSpace()) // skip white space - p++; - if (*p && p < p_end) { // arg starts - int quote; - Char *start, *r; - if (*p == Char('\"')) { - quote = *p; - start = ++p; - } else { - quote = 0; - start = p; - } - r = start; - while (*p && p < p_end) { - if (quote) { - if (*p == quote) { - p++; - if (QChar((short)(*p)).isSpace()) - break; - quote = 0; - } - } - if (*p == '\\') { // escape char? - // testing by looking at argc, argv shows that it only escapes quotes - if (p < p_end && (*(p+1) == Char('\"'))) - p++; - } else { - if (!quote && (*p == Char('\"'))) { - quote = *p++; - continue; - } else if (QChar((short)(*p)).isSpace() && !quote) - break; - } - if (*p) - *r++ = *p++; - } - if (*p && p < p_end) - p++; - *r = Char('\0'); - - if (argc >= (int)argv.size()-1) // expand array - argv.resize(argv.size()*2); - argv[argc++] = start; - } - } - argv[argc] = 0; - - return argv; -} - -static inline QStringList qWinCmdArgs(QString cmdLine) // not const-ref: this might be modified -{ - QStringList args; - - int argc = 0; - QVector<wchar_t*> argv = qWinCmdLine<wchar_t>((wchar_t *)cmdLine.utf16(), cmdLine.length(), argc); - for (int a = 0; a < argc; ++a) { - args << QString::fromWCharArray(argv[a]); - } - - return args; -} - -static inline QStringList qCmdLineArgs(int argc, char *argv[]) -{ - Q_UNUSED(argc) - Q_UNUSED(argv) - QString cmdLine = QString::fromWCharArray(GetCommandLine()); - return qWinCmdArgs(cmdLine); -} - -#elif defined(Q_OS_WINRT) // Q_OS_WINCE +#elif defined(Q_OS_WINRT) // Q_OS_WIN32 static inline QStringList qCmdLineArgs(int argc, char *argv[]) { diff --git a/src/corelib/kernel/qeventdispatcher_cf.mm b/src/corelib/kernel/qeventdispatcher_cf.mm index 55f27a5b60..437e4062ad 100644 --- a/src/corelib/kernel/qeventdispatcher_cf.mm +++ b/src/corelib/kernel/qeventdispatcher_cf.mm @@ -210,6 +210,13 @@ QEventDispatcherCoreFoundation::~QEventDispatcherCoreFoundation() m_cfSocketNotifier.removeSocketNotifiers(); } +QEventLoop *QEventDispatcherCoreFoundation::currentEventLoop() const +{ + QEventLoop *eventLoop = QThreadData::current()->eventLoops.top(); + Q_ASSERT(eventLoop); + return eventLoop; +} + /*! Processes all pending events that match \a flags until there are no more events to process. Returns \c true if pending events were handled; @@ -302,10 +309,7 @@ bool QEventDispatcherCoreFoundation::processEvents(QEventLoop::ProcessEventsFlag // to exit, and then unwind back to the previous event loop which will break // immediately, since it has already been exited. - QEventLoop *currentEventLoop = QThreadData::current()->eventLoops.top(); - Q_ASSERT(currentEventLoop); - - if (!currentEventLoop->isRunning()) { + if (!currentEventLoop()->isRunning()) { qEventDispatcherDebug() << "Top level event loop was exited"; break; } else { diff --git a/src/corelib/kernel/qeventdispatcher_cf_p.h b/src/corelib/kernel/qeventdispatcher_cf_p.h index c2592cacc8..e6581e2bac 100644 --- a/src/corelib/kernel/qeventdispatcher_cf_p.h +++ b/src/corelib/kernel/qeventdispatcher_cf_p.h @@ -228,6 +228,8 @@ public: void flush(); protected: + QEventLoop *currentEventLoop() const; + virtual bool processPostedEvents(); struct ProcessEventsState diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 4d7aa83c43..4007824c99 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -63,11 +63,7 @@ extern uint qGlobalPostedEventsCount(); #endif #ifndef QS_RAWINPUT -# ifdef Q_OS_WINCE -# define QS_RAWINPUT 0x0000 -# else # define QS_RAWINPUT 0x0400 -# endif #endif #ifndef WM_TOUCH @@ -89,196 +85,6 @@ enum { SendPostedEventsWindowsTimerId = ~1u }; -#if defined(Q_OS_WINCE) -QT_BEGIN_INCLUDE_NAMESPACE -#include <winsock.h> -QT_END_INCLUDE_NAMESPACE -// Asynchronous Winsocks ------------------------------------------ -#ifndef QT_NO_THREAD -QT_BEGIN_INCLUDE_NAMESPACE -#include <qthread.h> -#include <qmap.h> -#include <qmutex.h> -QT_END_INCLUDE_NAMESPACE - -//#define QCE_ASYNC_DEBUG - -namespace { - class SocketAsyncHandler; - - class SocketAsyncHandler : public QThread - { - public: - SocketAsyncHandler(); - ~SocketAsyncHandler(); - void run(); - void select(SOCKET sock, HWND handle, unsigned int msg, long ev); - void removeSelect(SOCKET sock); - void safeRemove(SOCKET sock); - private: - struct SockInfo { - HWND handle; - unsigned int msg; - long ev; - }; - QMap<SOCKET, SockInfo> sockets; - QMutex mutex; - QWaitCondition cond; - bool supposedToDie; - }; - - SocketAsyncHandler::SocketAsyncHandler() - : supposedToDie(false) - { - } - - SocketAsyncHandler::~SocketAsyncHandler() - { - mutex.lock(); - supposedToDie = true; - mutex.unlock(); - cond.wakeOne(); - wait(); - while (sockets.size() > 0) - removeSelect(sockets.begin().key()); - } - - void SocketAsyncHandler::removeSelect(SOCKET sock) - { - if (!sockets.contains(sock)) - return; - sockets.remove(sock); - return; - } - - void SocketAsyncHandler::safeRemove(SOCKET sock) - { - QMutexLocker locker(&mutex); - removeSelect(sock); - } - - void SocketAsyncHandler::select(SOCKET sock, HWND handle, unsigned int msg, long ev) - { - QMutexLocker locker(&mutex); - - if (sockets.contains(sock)) - sockets.remove(sock); - - SockInfo info; - info.handle = handle; - info.msg = msg; - info.ev = ev; - sockets.insert(sock, info); - cond.wakeOne(); - } - - void SocketAsyncHandler::run() - { - do { - mutex.lock(); - - while (!supposedToDie && sockets.isEmpty()) { - cond.wait(&mutex); - } - - if (supposedToDie) { - mutex.unlock(); - break; - } - - // Copy current items to reduce lock time - // and to be able to use SendMessage - QMap<SOCKET, SockInfo> currentSockets = sockets; - mutex.unlock(); - - fd_set readS, writeS, exS; - FD_ZERO(&readS); - FD_ZERO(&writeS); - FD_ZERO(&exS); - - int maxFd = 0; - - for (QMap<SOCKET, SockInfo>::iterator it = currentSockets.begin(); it != currentSockets.end(); ++it) { - const SockInfo &info = it.value(); - int socket = it.key(); - maxFd = qMax(maxFd, socket); - - if ((info.ev & FD_READ) || (info.ev & FD_CLOSE) || (info.ev & FD_ACCEPT)) - FD_SET(socket, &readS); - if ((info.ev & FD_WRITE)|| (info.ev & FD_CONNECT)) - FD_SET(socket, &writeS); - if (info.ev & FD_OOB) - FD_SET(socket, &exS); - } - - timeval timeout; - timeout.tv_sec = 0; - timeout.tv_usec = 50000; - int result = ::select(maxFd + 1, &readS, &writeS, &exS, &timeout); - if (result > 0) { - HWND handle; - unsigned int tmpMsg; - SOCKET sock; - HRESULT ret; - for (QMap<SOCKET, SockInfo>::const_iterator it = currentSockets.constBegin(); - it != currentSockets.constEnd(); ++it) { - handle = (*it).handle; - tmpMsg = (*it).msg; - sock = it.key(); - if (FD_ISSET(sock, &readS)) - ret = SendMessage(handle, tmpMsg, sock, FD_READ); - - if (FD_ISSET(sock, &writeS)) - ret = SendMessage(handle, tmpMsg, sock, FD_WRITE); - - if (FD_ISSET(sock, &exS)) - ret = SendMessage(handle, tmpMsg, sock, FD_OOB); - } - } - -#ifdef QCE_ASYNC_DEBUG - else if (result == 0) { //timeout - qDebug(" WSAAsync select timeout"); - } else if (result < 0) { // SocketError - // This might happen because of two reasons - // 1. We already closed a socket in between the copy and the select - // and thus select() returns an error - // 2. Something is really wrong, then - // ### Loop on all descriptors, try to select and remove the - // ### broken one. - qWarning("WSAAsync select error %d", WSAGetLastError()); - } -#endif - } while(true); - } -} // namespace - -Q_GLOBAL_STATIC(SocketAsyncHandler, qt_async_handler) - -int WSAAsyncSelect(SOCKET sock, HWND handle, unsigned int msg, long ev) -{ - if (sock == 0 || handle == 0 || handle == INVALID_HANDLE_VALUE) { - WSASetLastError(WSAEINVAL); - return SOCKET_ERROR; - } - - if (msg == 0 && ev == 0) - qt_async_handler()->safeRemove(sock); - else - qt_async_handler()->select(sock, handle, msg, ev); - - qt_async_handler()->start(QThread::LowPriority); - WSASetLastError(0); - return 0; -} -#else // QT_NO_THREAD -int WSAAsyncSelect(SOCKET, HWND, unsigned int, long) -{ - return SOCKET_ERROR; -} -#endif -#endif // Q_OS_WINCE - class QEventDispatcherWin32Private; #if !defined(DWORD_PTR) && !defined(Q_OS_WIN64) @@ -303,13 +109,8 @@ static void resolveTimerAPI() return; #endif triedResolve = true; -#if !defined(Q_OS_WINCE) qtimeSetEvent = (ptimeSetEvent)QSystemLibrary::resolve(QLatin1String("winmm"), "timeSetEvent"); qtimeKillEvent = (ptimeKillEvent)QSystemLibrary::resolve(QLatin1String("winmm"), "timeKillEvent"); -#else - qtimeSetEvent = (ptimeSetEvent)QSystemLibrary::resolve(QLatin1String("Mmtimer"), "timeSetEvent"); - qtimeKillEvent = (ptimeKillEvent)QSystemLibrary::resolve(QLatin1String("Mmtimer"), "timeKillEvent"); -#endif } } @@ -495,11 +296,7 @@ LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp) } } } -#ifdef Q_OS_WINCE - return 0; -#else return q->d_func()->getMessageHook ? CallNextHookEx(0, code, wp, lp) : 0; -#endif } // Provide class name and atom for the message window used by @@ -557,16 +354,11 @@ static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatch QWindowsMessageWindowClassContext *ctx = qWindowsMessageWindowClassContext(); if (!ctx->atom) return 0; -#ifdef Q_OS_WINCE - HWND parent = 0; -#else - HWND parent = HWND_MESSAGE; -#endif HWND wnd = CreateWindow(ctx->className, // classname ctx->className, // window name 0, // style 0, 0, 0, 0, // geometry - parent, // parent + HWND_MESSAGE, // parent 0, // menu handle qWinAppInst(), // application 0); // windows creation data. @@ -693,7 +485,6 @@ void QEventDispatcherWin32::installMessageHook() if (d->getMessageHook) return; -#ifndef Q_OS_WINCE // setup GetMessage hook needed to drive our posted events d->getMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC) qt_GetMessageHook, NULL, GetCurrentThreadId()); if (Q_UNLIKELY(!d->getMessageHook)) { @@ -701,17 +492,14 @@ void QEventDispatcherWin32::installMessageHook() qFatal("Qt: INTERNAL ERROR: failed to install GetMessage hook: %d, %s", errorCode, qPrintable(qt_error_string(errorCode))); } -#endif } void QEventDispatcherWin32::uninstallMessageHook() { Q_D(QEventDispatcherWin32); -#ifndef Q_OS_WINCE if (d->getMessageHook) UnhookWindowsHookEx(d->getMessageHook); -#endif d->getMessageHook = 0; } @@ -1143,11 +931,7 @@ void QEventDispatcherWin32::activateEventNotifiers() Q_D(QEventDispatcherWin32); //### this could break if events are removed/added in the activation for (int i=0; i<d->winEventNotifierList.count(); i++) { -#if !defined(Q_OS_WINCE) if (WaitForSingleObjectEx(d->winEventNotifierList.at(i)->handle(), 0, TRUE) == WAIT_OBJECT_0) -#else - if (WaitForSingleObject(d->winEventNotifierList.at(i)->handle(), 0) == WAIT_OBJECT_0) -#endif d->activateEventNotifier(d->winEventNotifierList.at(i)); } } diff --git a/src/corelib/kernel/qfunctions_p.h b/src/corelib/kernel/qfunctions_p.h index 06f5ea09da..ff035fcb11 100644 --- a/src/corelib/kernel/qfunctions_p.h +++ b/src/corelib/kernel/qfunctions_p.h @@ -53,9 +53,7 @@ #include <QtCore/qglobal.h> -#if defined(Q_OS_WINCE) -# include "QtCore/qfunctions_wince.h" -#elif defined(Q_OS_VXWORKS) +#if defined(Q_OS_VXWORKS) # include "QtCore/qfunctions_vxworks.h" #elif defined(Q_OS_NACL) # include "QtCore/qfunctions_nacl.h" diff --git a/src/corelib/kernel/qfunctions_wince.cpp b/src/corelib/kernel/qfunctions_wince.cpp deleted file mode 100644 index 104c6fb27c..0000000000 --- a/src/corelib/kernel/qfunctions_wince.cpp +++ /dev/null @@ -1,407 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifdef _WIN32_WCE //Q_OS_WINCE - -#include <windows.h> -#include <winbase.h> -#include <kfuncs.h> -#include <stdio.h> -#if _WIN32_WCE < 0x800 -# include <altcecrt.h> -#else -# include <fcntl.h> -#endif - -#include "qplatformdefs.h" -#include "qfunctions_wince.h" -#include "qfunctions_fake_env_p.h" -#include "qstring.h" - -QT_USE_NAMESPACE - -#ifdef __cplusplus -extern "C" { -#endif - -wchar_t* CEPrivConvCharToWide(const char* string) -{ - size_t length = strlen(string); - wchar_t* wString = new wchar_t[length +1]; - for (unsigned int i = 0; i < (length +1); i++) - wString[i] = string[i]; - return wString; -} - -// Time ------------------------------------------------------------- -time_t qt_wince_ftToTime_t( const FILETIME ft ) -{ - ULARGE_INTEGER li; - li.LowPart = ft.dwLowDateTime; - li.HighPart = ft.dwHighDateTime; - - // 100-nanosec to seconds - li.QuadPart /= 10000000; - - // FILETIME is from 1601-01-01 T 00:00:00 - // time_t is from 1970-01-01 T 00:00:00 - // 1970 - 1601 = 369 year (89 leap years) - // - // ((369y*365d) + 89d) *24h *60min *60sec - // = 11644473600 seconds - li.QuadPart -= 11644473600; - return li.LowPart; -} - -FILETIME qt_wince_time_tToFt( time_t tt ) -{ - ULARGE_INTEGER li; - li.QuadPart = tt; - li.QuadPart += 11644473600; - li.QuadPart *= 10000000; - - FILETIME ft; - ft.dwLowDateTime = li.LowPart; - ft.dwHighDateTime = li.HighPart; - return ft; -} - -// File I/O --------------------------------------------------------- -#if _WIN32_WCE < 0x800 -int errno = 0; -#endif - -int qt_wince__getdrive( void ) -{ - return 1; -} - -int qt_wince__waccess( const wchar_t *path, int pmode ) -{ - DWORD res = GetFileAttributes( path ); - if ( 0xFFFFFFFF == res ) - return -1; - - if ( (pmode & W_OK) && (res & FILE_ATTRIBUTE_READONLY) ) - return -1; - - if ( (pmode & X_OK) && !(res & FILE_ATTRIBUTE_DIRECTORY) ) { - QString file = QString::fromWCharArray(path); - if ( !(file.endsWith(QString::fromLatin1(".exe")) || - file.endsWith(QString::fromLatin1(".com"))) ) - return -1; - } - - return 0; -} - -int qt_wince_open( const char *filename, int oflag, int pmode ) -{ - QString fn( QString::fromLatin1(filename) ); - return _wopen( (wchar_t*)fn.utf16(), oflag, pmode ); -} - -int qt_wince__wopen( const wchar_t *filename, int oflag, int /*pmode*/ ) -{ - wchar_t *flag; - - if ( oflag & _O_APPEND ) { - if ( oflag & _O_WRONLY ) { - flag = L"a"; - } else if ( oflag & _O_RDWR ) { - flag = L"a+"; - } - } else if (oflag & _O_BINARY) { - if ( oflag & _O_WRONLY ) { - flag = L"wb"; - } else if ( oflag & _O_RDWR ) { - flag = L"w+b"; // slightly different from "r+" where the file must exist - } else if ( oflag & _O_RDONLY ) { - flag = L"rb"; - } else { - flag = L"b"; - } - } else { - if ( oflag & _O_WRONLY ) { - flag = L"wt"; - } else if ( oflag & _O_RDWR ) { - flag = L"w+t"; // slightly different from "r+" where the file must exist - } else if ( oflag & _O_RDONLY ) { - flag = L"rt"; - } else { - flag = L"t"; - } - } - - int retval = (int)_wfopen( filename, flag ); - return (retval == NULL) ? -1 : retval; -} - -long qt_wince__lseek( int handle, long offset, int origin ) -{ - return fseek( (FILE*)handle, offset, origin ); -} - -int qt_wince__read( int handle, void *buffer, unsigned int count ) -{ - return fread( buffer, 1, count, (FILE*)handle ); -} - -int qt_wince__write( int handle, const void *buffer, unsigned int count ) -{ - return fwrite( buffer, 1, count, (FILE*)handle ); -} - -int qt_wince__close( int handle ) -{ - if (!handle) - return 0; - return fclose( (FILE*)handle ); -} - -FILE *qt_wince__fdopen(int handle, const char* /*mode*/) -{ - return (FILE*)handle; -} - -FILE *qt_wince_fdopen( int handle, const char* /*mode*/ ) -{ - return (FILE*)handle; -} - -void qt_wince_rewind( FILE *stream ) -{ - fseek( stream, 0L, SEEK_SET ); -} - -int qt_wince___fileno(FILE *f) -{ - return (int) _fileno(f); -} - -FILE *qt_wince_tmpfile( void ) -{ - static long i = 0; - char name[16]; - sprintf( name, "tmp%i", i++ ); - return fopen( name, "r+" ); -} - -int qt_wince__mkdir(const char *dirname) -{ - return CreateDirectory(reinterpret_cast<const wchar_t *> (QString(QString::fromLatin1(dirname)).utf16()), 0) ? 0 : -1; -} - -int qt_wince__rmdir(const char *dirname) -{ - return RemoveDirectory(reinterpret_cast<const wchar_t *> (QString::fromLatin1(dirname).utf16())) ? 0 : -1; -} - -int qt_wince__access( const char *path, int pmode ) -{ - return _waccess(reinterpret_cast<const wchar_t *> (QString::fromLatin1(path).utf16()),pmode); -} - -int qt_wince__rename( const char *oldname, const char *newname ) -{ - return !MoveFile(reinterpret_cast<const wchar_t *> (QString::fromLatin1(oldname).utf16()), reinterpret_cast<const wchar_t *> (QString::fromLatin1(newname).utf16())); -} - -int qt_wince__remove( const char *name ) -{ - return !DeleteFile(reinterpret_cast<const wchar_t *> (QString::fromLatin1(name).utf16())); -} - -int qt_wince_stat( const char *path, struct stat *buffer ) -{ - WIN32_FIND_DATA finfo; - HANDLE ff = FindFirstFile( reinterpret_cast<const wchar_t *> (QString::fromLatin1(path).utf16()), &finfo ); - - if ( ff == INVALID_HANDLE_VALUE ) - return -1; - - buffer->st_ctime = qt_wince_ftToTime_t( finfo.ftCreationTime ); - buffer->st_atime = qt_wince_ftToTime_t( finfo.ftLastAccessTime ); - buffer->st_mtime = qt_wince_ftToTime_t( finfo.ftLastWriteTime ); - buffer->st_nlink = 0; - buffer->st_size = finfo.nFileSizeLow; // ### missing high! - buffer->st_mode = (finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR : _S_IFREG; - buffer->st_mode |= (finfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? _O_RDONLY : _O_RDWR; - return (FindClose(ff) == 0); -} - -int qt_wince__fstat( int handle, struct stat *buffer) -{ - BY_HANDLE_FILE_INFORMATION fInfo; - BOOL res = GetFileInformationByHandle((HANDLE)handle, &fInfo); - - buffer->st_ctime = qt_wince_ftToTime_t( fInfo.ftCreationTime ); - buffer->st_atime = qt_wince_ftToTime_t( fInfo.ftLastAccessTime ); - buffer->st_mtime = qt_wince_ftToTime_t( fInfo.ftLastWriteTime ); - buffer->st_nlink = 0; - buffer->st_size = fInfo.nFileSizeLow; // ### missing high! - buffer->st_mode = (fInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR : _S_IFREG; - buffer->st_mode |= (fInfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? _O_RDONLY : _O_RDWR; - return (res == 0); -} - -int qt_wince_SetErrorMode(int newValue) -{ - static int oldValue; - int result = oldValue; - oldValue = newValue; - return result; -} - -bool qt_wince__chmod(const char *file, int mode) -{ - return _wchmod( reinterpret_cast<const wchar_t *> (QString::fromLatin1(file).utf16()), mode); -} - -bool qt_wince__wchmod(const wchar_t *file, int mode) -{ - BOOL success = FALSE; - // ### Does not work properly, what about just adding one property? - if(mode&_S_IWRITE) { - success = SetFileAttributes(file, FILE_ATTRIBUTE_NORMAL); - } else if((mode&_S_IREAD) && !(mode&_S_IWRITE)) { - success = SetFileAttributes(file, FILE_ATTRIBUTE_READONLY); - } - return success ? 0 : -1; -} - -HANDLE qt_wince_CreateFileA(LPCSTR filename, DWORD access, DWORD share, LPSECURITY_ATTRIBUTES attr, DWORD dispo, DWORD flags, HANDLE tempFile) -{ - return CreateFileW( reinterpret_cast<const wchar_t *>(QString::fromLatin1(filename).utf16()), access, share, attr, dispo, flags, tempFile); -} - -// Graphics --------------------------------------------------------- -BOOL qt_wince_SetWindowOrgEx( HDC /*hdc*/, int /*X*/, int /*Y*/, LPPOINT /*lpPoint*/) { - return TRUE; -} - -// Threading -------------------------------------------------------- -HANDLE qt_wince__beginthread(void( *start_address )( void * ), unsigned stack_size, void *arglist) -{ - unsigned initflag = 0; - if (stack_size > 0) - initflag |= STACK_SIZE_PARAM_IS_A_RESERVATION; - return CreateThread(NULL, stack_size, (LPTHREAD_START_ROUTINE)start_address, arglist, initflag, NULL); -} - -unsigned long qt_wince__beginthreadex( void *security, - unsigned stack_size, - unsigned (__stdcall *start_address)(void *), - void *arglist, - unsigned initflag, - unsigned *thrdaddr) -{ - if (stack_size > 0) - initflag |= STACK_SIZE_PARAM_IS_A_RESERVATION; - return (unsigned long) - CreateThread( (LPSECURITY_ATTRIBUTES)security, - (DWORD)stack_size, - (LPTHREAD_START_ROUTINE)start_address, - (LPVOID)arglist, - (DWORD)initflag | CREATE_SUSPENDED, - (LPDWORD)thrdaddr); -} - -void qt_wince__endthreadex(unsigned nExitCode) { - ExitThread((DWORD)nExitCode); -} - -void *qt_wince_bsearch(const void *key, - const void *base, - size_t num, - size_t size, - int (__cdecl *compare)(const void *, const void *)) -{ - size_t low = 0; - size_t high = num - 1; - while (low <= high) { - size_t mid = (low + high) >> 1; - int c = compare(key, (char*)base + mid * size); - if (c < 0) { - if (!mid) - break; - high = mid - 1; - } else if (c > 0) - low = mid + 1; - else - return (char*) base + mid * size; - } - return 0; -} - -void *lfind(const void* key, const void* base, size_t* elements, size_t size, - int (__cdecl *compare)(const void*, const void*)) -{ - const char* current = (char*) base; - const char* const end = (char*) (current + (*elements) * size); - while (current != end) { - if (compare(current, key) == 0) - return (void*)current; - current += size; - } - return 0; -} - -DWORD qt_wince_GetThreadLocale(void) -{ - return GetUserDefaultLCID(); -} - -void *qt_wince_calloc( size_t num, size_t size ) -{ - void *ptr = malloc( num * size ); - if( ptr ) - memset( ptr, 0, num * size ); - return ptr; -} - -// _getpid is currently only used for creating a temporary filename -int qt_wince__getpid() -{ - return qAbs((int)GetCurrentProcessId()); -} - -#ifdef __cplusplus -} // extern "C" -#endif -#endif // Q_OS_WINCE diff --git a/src/corelib/kernel/qfunctions_wince.h b/src/corelib/kernel/qfunctions_wince.h deleted file mode 100644 index 030950e1bd..0000000000 --- a/src/corelib/kernel/qfunctions_wince.h +++ /dev/null @@ -1,473 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFUNCTIONS_WINCE_H -#define QFUNCTIONS_WINCE_H - -#include <QtCore/qglobal.h> - -#ifdef Q_OS_WINCE -# ifndef NOMINMAX -# define NOMINMAX -# endif -#include <stdio.h> -#include <stdlib.h> -#include <windows.h> -#include <winuser.h> -#include <winbase.h> -#include <objbase.h> -#include <kfuncs.h> -#include <ctype.h> -#include <time.h> -#include <crtdefs.h> -#if _WIN32_WCE < 0x800 -# include <altcecrt.h> -#else -# include <fcntl.h> -# include <stat.h> -#endif -#include <winsock.h> -#include <ceconfig.h> - -QT_BEGIN_NAMESPACE - -#ifdef QT_BUILD_CORE_LIB -#endif - -QT_END_NAMESPACE - -// The standard SDK misses this define... -#define _control87 _controlfp - -#if !defined __cplusplus -#define bool int -#define true 1 -#define false 0 -#endif - -// Environment ------------------------------------------------------ -errno_t qt_fake_getenv_s(size_t*, char*, size_t, const char*); -errno_t qt_fake__putenv_s(const char*, const char*); - -#ifdef __cplusplus // have this as tiff plugin is written in C -extern "C" { -#endif - -#if !defined(NO_ERRNO_H) -#define NO_ERRNO_H -#endif - -// Environment ------------------------------------------------------ -int qt_wince__getpid(void); - - -// Time ------------------------------------------------------------- -#ifndef _TM_DEFINED -#define _TM_DEFINED -struct tm { - int tm_sec; /* seconds after the minute - [0,59] */ - int tm_min; /* minutes after the hour - [0,59] */ - int tm_hour; /* hours since midnight - [0,23] */ - int tm_mday; /* day of the month - [1,31] */ - int tm_mon; /* months since January - [0,11] */ - int tm_year; /* years since 1900 */ - int tm_wday; /* days since Sunday - [0,6] */ - int tm_yday; /* days since January 1 - [0,365] */ - int tm_isdst; /* daylight-saving time flag */ -}; -#endif // _TM_DEFINED - -FILETIME qt_wince_time_tToFt( time_t tt ); -time_t qt_wince_ftToTime_t( const FILETIME ft ); - -#if _WIN32_WCE < 0x800 - -// File I/O --------------------------------------------------------- -#define _O_RDONLY 0x0001 -#define _O_RDWR 0x0002 -#define _O_WRONLY 0x0004 -#define _O_CREAT 0x0008 -#define _O_TRUNC 0x0010 -#define _O_APPEND 0x0020 -#define _O_EXCL 0x0040 - -#define O_RDONLY _O_RDONLY -#define O_RDWR _O_RDWR -#define O_WRONLY _O_WRONLY -#define O_CREAT _O_CREAT -#define O_TRUNC _O_TRUNC -#define O_APPEND _O_APPEND -#define O_EXCL _O_EXCL - -#define _S_IFMT 0x0600 -#define _S_IFDIR 0x0200 -#define _S_IFCHR 0x0100 -#define _S_IFREG 0x0400 -#define _S_IREAD 0x0010 -#define _S_IWRITE 0x0008 - -#define S_IFMT _S_IFMT -#define S_IFDIR _S_IFDIR -#define S_IFCHR _S_IFCHR -#define S_IFREG _S_IFREG -#define S_IREAD _S_IREAD -#define S_IWRITE _S_IWRITE - -#ifndef _IOFBF -#define _IOFBF 0x0000 -#endif - -#ifndef _IOLBF -#define _IOLBF 0x0040 -#endif - -#ifndef _IONBF -#define _IONBF 0x0004 -#endif - -// Regular Berkeley error constants -#ifndef _STAT_DEFINED -#define _STAT_DEFINED -struct stat -{ - int st_mode; - int st_size; - int st_nlink; - time_t st_mtime; - time_t st_atime; - time_t st_ctime; -}; -#endif - -typedef int mode_t; -extern int errno; -#endif // _WIN32_WCE < 0x800 - -int qt_wince__getdrive( void ); -int qt_wince__waccess( const wchar_t *path, int pmode ); -int qt_wince__wopen( const wchar_t *filename, int oflag, int pmode ); -long qt_wince__lseek( int handle, long offset, int origin ); -int qt_wince__read( int handle, void *buffer, unsigned int count ); -int qt_wince__write( int handle, const void *buffer, unsigned int count ); -int qt_wince__close( int handle ); -FILE *qt_wince__fdopen(int handle, const char *mode); -FILE *qt_wince_fdopen(int handle, const char *mode); -void qt_wince_rewind( FILE *stream ); -int qt_wince___fileno(FILE *); -FILE *qt_wince_tmpfile( void ); - -//For zlib we need these helper functions, but they break the build when -//set globally, so just set them for zlib use -#ifdef ZLIB_H -#define open qt_wince_open -#define close qt_wince__close -#define lseek qt_wince__lseek -#define read qt_wince__read -#define write qt_wince__write -#endif - -int qt_wince__mkdir(const char *dirname); -int qt_wince__rmdir(const char *dirname); -int qt_wince__access( const char *path, int pmode ); -int qt_wince__rename( const char *oldname, const char *newname ); -int qt_wince__remove( const char *name ); -#ifdef __cplusplus -int qt_wince_open( const char *filename, int oflag, int pmode = 0 ); -#else -int qt_wince_open( const char *filename, int oflag, int pmode ); -#endif -int qt_wince_stat( const char *path, struct stat *buffer ); -int qt_wince__fstat( int handle, struct stat *buffer); - -#define SEM_FAILCRITICALERRORS 0x0001 -#define SEM_NOOPENFILEERRORBOX 0x0002 -int qt_wince_SetErrorMode(int); -#ifndef CoInitialize -#define CoInitialize(x) CoInitializeEx(x, COINIT_MULTITHREADED) -#endif - -bool qt_wince__chmod(const char *file, int mode); -bool qt_wince__wchmod(const wchar_t *file, int mode); - -QT_WARNING_DISABLE_MSVC(4273) -HANDLE qt_wince_CreateFileA(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE); - -// Printer ---------------------------------------------------------- -#define ETO_GLYPH_INDEX 0x0010 - -// Graphics --------------------------------------------------------- -#ifndef SM_CXCURSOR -# define SM_CXCURSOR 13 -#endif -#ifndef SM_CYCURSOR -# define SM_CYCURSOR 14 -#endif -BOOL qt_wince_SetWindowOrgEx( HDC hdc, int X, int Y, LPPOINT lpPoint ); - -// Other stuff ------------------------------------------------------ -#define MWMO_ALERTABLE 0x0002 -// ### not the real values -#define CREATE_NO_WINDOW 2 -#define CF_HDROP 15 - -void *qt_wince_calloc(size_t num, size_t size); -#if !defined(TLS_OUT_OF_INDEXES) -# define TLS_OUT_OF_INDEXES 0xffffffff -#endif -DWORD qt_wince_GetThreadLocale(void); - -HANDLE qt_wince__beginthread(void( *start_address )( void * ), unsigned stack_size, void *arglist); - -unsigned long qt_wince__beginthreadex( void *security, - unsigned stack_size, - unsigned (__stdcall *start_address)(void *), - void *arglist, - unsigned initflag, - unsigned *thrdaddr ); -void qt_wince__endthreadex(unsigned nExitCode); - - -// bsearch is needed for building the tiff plugin -// otherwise it could go into qguifunctions_wce -void *qt_wince_bsearch(const void *key, - const void *base, - size_t num, - size_t size, - int (__cdecl *compare)(const void *, const void *)); - -// Missing typedefs -#ifndef _TIME_T_DEFINED -typedef unsigned long time_t; -#define _TIME_T_DEFINED -#endif -typedef HANDLE HDROP; - -#ifndef WS_THICKFRAME -#define WS_THICKFRAME WS_DLGFRAME -#endif - -typedef UINT UWORD; - -// Missing definitions: not necessary equal to their Win32 values -// (the goal is to just have a clean compilation of MFC) -#define WS_MAXIMIZE 0 -#define WS_MINIMIZE 0 -#ifndef WS_EX_TOOLWINDOW -#define WS_EX_TOOLWINDOW 0 -#endif -#define WS_EX_NOPARENTNOTIFY 0 -#define WM_ENTERIDLE 0x0121 -#define WM_PRINT WM_PAINT -#define WM_NCCREATE (0x0081) -#define WM_PARENTNOTIFY 0 -#define WM_NCDESTROY (WM_APP-1) -#ifndef SW_RESTORE -#define SW_RESTORE (SW_SHOWNORMAL) -#endif -#define SW_NORMAL (SW_SHOWNORMAL) -#define WAIT_OBJECT_0 0x00000000L -#define DEFAULT_GUI_FONT SYSTEM_FONT -#ifndef SWP_NOREDRAW -#define SWP_NOREDRAW 0 -#endif -#define WSAGETSELECTEVENT(lParam) LOWORD(lParam) -#define HWND_TOPMOST ((HWND)-1) -#define HWND_NOTOPMOST ((HWND)-2) -#define PS_DOT 2 -#define PD_ALLPAGES 0 -#define PD_USEDEVMODECOPIES 0 -#define PD_NOSELECTION 0 -#define PD_HIDEPRINTTOFILE 0 -#define PD_NOPAGENUMS 0 -#define CF_METAFILEPICT 3 -#define MM_ANISOTROPIC 8 -#define KF_ALTDOWN 0x2000 -#define SPI_GETWORKAREA 48 - -#ifndef WM_SETCURSOR - #define WM_SETCURSOR 0x0020 - #define IDC_ARROW MAKEINTRESOURCE(32512) - #define IDC_IBEAM MAKEINTRESOURCE(32513) - #define IDC_WAIT MAKEINTRESOURCE(32514) - #define IDC_CROSS MAKEINTRESOURCE(32515) - #define IDC_UPARROW MAKEINTRESOURCE(32516) - #define IDC_SIZE MAKEINTRESOURCE(32646) - #define IDC_ICON MAKEINTRESOURCE(32512) - #define IDC_SIZENWSE MAKEINTRESOURCE(32642) - #define IDC_SIZENESW MAKEINTRESOURCE(32643) - #define IDC_SIZEWE MAKEINTRESOURCE(32644) - #define IDC_SIZENS MAKEINTRESOURCE(32645) - #define IDC_SIZEALL MAKEINTRESOURCE(32646) - #define IDC_NO MAKEINTRESOURCE(32648) - #define IDC_APPSTARTING MAKEINTRESOURCE(32650) - #define IDC_HELP MAKEINTRESOURCE(32651) - #define IDC_HAND MAKEINTRESOURCE(32649) -#endif - -#define GMEM_MOVEABLE LMEM_MOVEABLE -#define GPTR LPTR - -// WinCE: CESYSGEN prunes the following FRP defines, -// and INTERNET_TRANSFER_TYPE_ASCII breaks in wininet.h -#undef FTP_TRANSFER_TYPE_ASCII -#define FTP_TRANSFER_TYPE_ASCII 0x00000001 -#undef FTP_TRANSFER_TYPE_BINARY -#define FTP_TRANSFER_TYPE_BINARY 0x00000002 - -typedef DWORD OLE_COLOR; - -// Define the Windows Styles which are not defined by MS -#ifndef WS_POPUPWINDOW -#define WS_POPUPWINDOW WS_POPUP|WS_BORDER|WS_SYSMENU|WS_CAPTION -#endif - -#ifndef WS_OVERLAPPEDWINDOW -#define WS_OVERLAPPEDWINDOW WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX -#endif - -#ifndef WS_TILED -#define WS_TILED WS_OVERLAPPED -#endif - -#ifndef WS_TILEDWINDOW -#define WS_TILEDWINDOW WS_OVERLAPPEDWINDOW -#endif - -#ifndef WS_EX_CAPTIONOKBTN -#define WS_EX_CAPTIONOKBTN 0x80000000L -#endif - -#ifndef WS_EX_NODRAG -#define WS_EX_NODRAG 0x40000000L -#endif - -#ifdef __cplusplus -} // Extern C. -#endif - -#ifdef __cplusplus - - -// As Windows CE lacks some standard functions used in Qt, these got -// reimplemented. Other projects do this as well. Inline functions are used -// that there is a central place to disable functions for newer versions if -// they get available. There are no defines used anymore, because this -// will break member functions of classes which are called like these -// functions. Also inline functions are only supported by C++, so just define -// them for C++, as only 3rd party dependencies are C, this is no issue. -// The other declarations available in this file are being used per -// define inside qplatformdefs.h of the corresponding WinCE mkspec. - -#define generate_inline_return_func0(funcname, returntype) \ - inline returntype funcname() \ - { \ - return qt_wince_##funcname(); \ - } -#define generate_inline_return_func1(funcname, returntype, param1) \ - inline returntype funcname(param1 p1) \ - { \ - return qt_wince_##funcname(p1); \ - } -#define generate_inline_return_func2(funcname, returntype, prependnamespace, param1, param2) \ - inline returntype funcname(param1 p1, param2 p2) \ - { \ - return prependnamespace##funcname(p1, p2); \ - } -#define generate_inline_return_func3(funcname, returntype, param1, param2, param3) \ - inline returntype funcname(param1 p1, param2 p2, param3 p3) \ - { \ - return qt_wince_##funcname(p1, p2, p3); \ - } -#define generate_inline_return_func4(funcname, returntype, prependnamespace, param1, param2, param3, param4) \ - inline returntype funcname(param1 p1, param2 p2, param3 p3, param4 p4) \ - { \ - return prependnamespace##funcname(p1, p2, p3, p4); \ - } -#define generate_inline_return_func5(funcname, returntype, param1, param2, param3, param4, param5) \ - inline returntype funcname(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \ - { \ - return qt_wince_##funcname(p1, p2, p3, p4, p5); \ - } -#define generate_inline_return_func6(funcname, returntype, param1, param2, param3, param4, param5, param6) \ - inline returntype funcname(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \ - { \ - return qt_wince_##funcname(p1, p2, p3, p4, p5, p6); \ - } -#define generate_inline_return_func7(funcname, returntype, param1, param2, param3, param4, param5, param6, param7) \ - inline returntype funcname(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7) \ - { \ - return qt_wince_##funcname(p1, p2, p3, p4, p5, p6, p7); \ - } - -typedef unsigned (__stdcall *StartAdressExFunc)(void *); -typedef void(*StartAdressFunc)(void *); -typedef int ( __cdecl *CompareFunc ) (const void *, const void *) ; - -generate_inline_return_func4(getenv_s, errno_t, qt_fake_, size_t *, char *, size_t, const char *) -generate_inline_return_func2(_putenv_s, errno_t, qt_fake_, const char *, const char *) -generate_inline_return_func0(_getpid, int) -generate_inline_return_func1(time_tToFt, FILETIME, time_t) -generate_inline_return_func1(ftToTime_t, time_t, FILETIME) -generate_inline_return_func0(_getdrive, int) -generate_inline_return_func2(_waccess, int, qt_wince_, const wchar_t *, int) -generate_inline_return_func3(_wopen, int, const wchar_t *, int, int) -generate_inline_return_func2(_fdopen, FILE *, qt_wince_, int, const char *) -generate_inline_return_func2(fdopen, FILE *, qt_wince_, int, const char *) -generate_inline_return_func1(rewind, void, FILE *) -generate_inline_return_func0(tmpfile, FILE *) -generate_inline_return_func2(_rename, int, qt_wince_, const char *, const char *) -generate_inline_return_func1(_remove, int, const char *) -generate_inline_return_func1(SetErrorMode, int, int) -#if _WIN32_WCE < 0x800 -generate_inline_return_func2(_chmod, bool, qt_wince_, const char *, int) -generate_inline_return_func2(_wchmod, bool, qt_wince_, const wchar_t *, int) -#endif -generate_inline_return_func7(CreateFileA, HANDLE, LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE) -generate_inline_return_func4(SetWindowOrgEx, BOOL, qt_wince_, HDC, int, int, LPPOINT) -generate_inline_return_func2(calloc, void *, qt_wince_, size_t, size_t) -generate_inline_return_func0(GetThreadLocale, DWORD) -generate_inline_return_func3(_beginthread, HANDLE, StartAdressFunc, unsigned, void *) -generate_inline_return_func6(_beginthreadex, unsigned long, void *, unsigned, StartAdressExFunc, void *, unsigned, unsigned *) -generate_inline_return_func1(_endthreadex, void, unsigned) -generate_inline_return_func5(bsearch, void *, const void *, const void *, size_t, size_t, CompareFunc) - -#endif //__cplusplus - -#endif // Q_OS_WINCE -#endif // QFUNCTIONS_WINCE_H diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h index f7c60cc309..4d114a5616 100644 --- a/src/corelib/kernel/qmetaobject.h +++ b/src/corelib/kernel/qmetaobject.h @@ -168,19 +168,15 @@ public: inline bool isValid() const { return mobj != Q_NULLPTR; } -#ifdef Q_QDOC - static QMetaMethod fromSignal(PointerToMemberFunction signal); -#else - template <typename Func> - static inline QMetaMethod fromSignal(Func signal) + template <typename PointerToMemberFunction> + static inline QMetaMethod fromSignal(PointerToMemberFunction signal) { - typedef QtPrivate::FunctionPointer<Func> SignalType; + typedef QtPrivate::FunctionPointer<PointerToMemberFunction> SignalType; Q_STATIC_ASSERT_X(QtPrivate::HasQ_OBJECT_Macro<typename SignalType::Object>::Value, "No Q_OBJECT in the class with the signal"); return fromSignalImpl(&SignalType::Object::staticMetaObject, reinterpret_cast<void **>(&signal)); } -#endif private: #if QT_DEPRECATED_SINCE(5,0) diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h index 69f884f4ed..54cc9d33c3 100644 --- a/src/corelib/kernel/qmetaobject_p.h +++ b/src/corelib/kernel/qmetaobject_p.h @@ -167,6 +167,7 @@ class QMutex; struct QMetaObjectPrivate { + // revision 7 is Qt 5.0 everything lower is not supported enum { OutputRevision = 7 }; // Used by moc, qmetaobjectbuilder and qdbus int revision; @@ -175,12 +176,9 @@ struct QMetaObjectPrivate int methodCount, methodData; int propertyCount, propertyData; int enumeratorCount, enumeratorData; - int constructorCount, constructorData; //since revision 2 - int flags; //since revision 3 - int signalCount; //since revision 4 - // revision 5 introduces changes in normalized signatures, no new members - // revision 6 added qt_static_metacall as a member of each Q_OBJECT and inside QMetaObject itself - // revision 7 is Qt 5 + int constructorCount, constructorData; + int flags; + int signalCount; static inline const QMetaObjectPrivate *get(const QMetaObject *metaobject) { return reinterpret_cast<const QMetaObjectPrivate*>(metaobject->d.data); } diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index ebe118dce4..48011f795d 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -600,8 +600,11 @@ public: } #ifdef Q_QDOC + template<typename MemberFunction, int> static bool registerConverter(MemberFunction function); + template<typename MemberFunctionOk, char> static bool registerConverter(MemberFunctionOk function); + template<typename UnaryFunction> static bool registerConverter(UnaryFunction function); #else // member function as in "QString QFont::toString() const" @@ -1897,7 +1900,9 @@ QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_FORWARD_DECLARE_STATIC_TYPES_ITER) typedef QList<QVariant> QVariantList; typedef QMap<QString, QVariant> QVariantMap; typedef QHash<QString, QVariant> QVariantHash; +#ifndef Q_QDOC typedef QList<QByteArray> QByteArrayList; +#endif #define Q_DECLARE_METATYPE_TEMPLATE_1ARG(SINGLE_ARG_TEMPLATE) \ QT_BEGIN_NAMESPACE \ diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index e3e536d7e1..a6baff8a49 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3662,15 +3662,31 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i return; } - const QObjectPrivate::ConnectionList *list; - if (signal_index < connectionLists->count()) - list = &connectionLists->at(signal_index); - else - list = &connectionLists->allsignals; + // contains the non-empty connection lists + const QObjectPrivate::ConnectionList *lists[2]; + int numLists = 0; + if (signal_index < connectionLists->count()) { + const auto *list = &connectionLists->at(signal_index); + if (list->first) // only add if non-empty + lists[numLists++] = list; + } + if (connectionLists->allsignals.first) // only add if non-empty + lists[numLists++] = &connectionLists->allsignals; + + for (int i = 0; i < numLists; ++i) { + const auto *list = lists[i]; + if (i == 0) { + // on the first iteration, the mutex must be locked already + Q_ASSERT(!locker.mutex()->tryLock()); + } else { + // otherwise the mutex is unlocked and must be relocked + locker.relock(); + if (connectionLists->orphaned) + break; + } - do { QObjectPrivate::Connection *c = list->first; - if (!c) continue; + Q_ASSERT(c); // We need to check against last here to ensure that signals added // during the signal emission are not emitted in this emission. QObjectPrivate::Connection *last = list->last; @@ -3723,8 +3739,6 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i // destructor of the slot object might also lock a mutex from the signalSlotLock() mutex pool, // and that would deadlock if the pool happens to return the same mutex. obj.reset(); - - locker.relock(); } else if (c->callFunction && c->method_offset <= receiver->metaObject()->methodOffset()) { //we compare the vtable to make sure we are not in the destructor of the object. const int methodIndex = c->method(); @@ -3738,7 +3752,6 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i if (qt_signal_spy_callback_set.slot_end_callback != 0) qt_signal_spy_callback_set.slot_end_callback(receiver, methodIndex); - locker.relock(); } else { const int method = c->method_relative + c->method_offset; locker.unlock(); @@ -3753,19 +3766,17 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i if (qt_signal_spy_callback_set.slot_end_callback != 0) qt_signal_spy_callback_set.slot_end_callback(receiver, method); - - locker.relock(); } - if (connectionLists->orphaned) + if (c == last) // early break without relock for the last signal break; - } while (c != last && (c = c->nextConnectionList) != 0); - if (connectionLists->orphaned) - break; - } while (list != &connectionLists->allsignals && - //start over for all signals; - ((list = &connectionLists->allsignals), true)); + locker.relock(); + + if (connectionLists->orphaned) + break; + } while ((c = c->nextConnectionList) != 0); + } } diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 1f3d3dcfc7..87d006bdc6 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -210,8 +210,11 @@ public: const char *member, Qt::ConnectionType type = Qt::AutoConnection) const; #ifdef Q_QDOC + template<typename PointerToMemberFunction> static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type = Qt::AutoConnection); + template<typename PointerToMemberFunction, typename Functor> static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor); + template<typename PointerToMemberFunction, typename Functor> static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type = Qt::AutoConnection); #else //Connect a signal to a pointer to qobject member function @@ -360,6 +363,7 @@ public: static bool disconnect(const QMetaObject::Connection &); #ifdef Q_QDOC + template<typename PointerToMemberFunction> static bool disconnect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method); #else template <typename Func1, typename Func2> diff --git a/src/corelib/kernel/qsharedmemory_win.cpp b/src/corelib/kernel/qsharedmemory_win.cpp index e998b938c7..07d4930332 100644 --- a/src/corelib/kernel/qsharedmemory_win.cpp +++ b/src/corelib/kernel/qsharedmemory_win.cpp @@ -64,8 +64,8 @@ void QSharedMemoryPrivate::setErrorString(QLatin1String function) errorString = QSharedMemory::tr("%1: already exists").arg(function); break; case ERROR_FILE_NOT_FOUND: -#if defined(Q_OS_WINCE) || (defined(Q_OS_WINRT) && _MSC_VER < 1900) - // This happens on CE only if no file is present as CreateFileMappingW +#if defined(Q_OS_WINRT) && _MSC_VER < 1900 + // This happens on WinRT only if no file is present as CreateFileMappingW // bails out with this error code case ERROR_INVALID_PARAMETER: #endif @@ -112,10 +112,6 @@ HANDLE QSharedMemoryPrivate::handle() #else hand = CreateFileMappingFromApp(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, (PCWSTR)nativeKey.utf16()); #endif -#elif defined(Q_OS_WINCE) - // This works for opening a mapping too, but always opens it with read/write access in - // attach as it seems. - hand = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, 0, (wchar_t*)nativeKey.utf16()); #else hand = OpenFileMapping(FILE_MAP_ALL_ACCESS, false, (wchar_t*)nativeKey.utf16()); #endif diff --git a/src/corelib/kernel/qsystemerror.cpp b/src/corelib/kernel/qsystemerror.cpp index 12fd5404da..f38daec4f8 100644 --- a/src/corelib/kernel/qsystemerror.cpp +++ b/src/corelib/kernel/qsystemerror.cpp @@ -39,15 +39,9 @@ #include <qglobal.h> #include "qsystemerror_p.h" -#if !defined(Q_OS_WINCE) -# include <errno.h> -# if defined(Q_CC_MSVC) -# include <crtdbg.h> -# endif -#else -# if (_WIN32_WCE >= 0x700) -# include <errno.h> -# endif +#include <errno.h> +#if defined(Q_CC_MSVC) +# include <crtdbg.h> #endif #ifdef Q_OS_WIN # include <qt_windows.h> @@ -131,16 +125,12 @@ static QString standardLibraryErrorString(int errorCode) s = QT_TRANSLATE_NOOP("QIODevice", "No space left on device"); break; default: { - #ifdef Q_OS_WINCE - ret = windowsErrorString(errorCode); - #else - #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX) + #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX) QByteArray buf(1024, '\0'); ret = fromstrerror_helper(strerror_r(errorCode, buf.data(), buf.size()), buf); - #else + #else ret = QString::fromLocal8Bit(strerror(errorCode)); - #endif - #endif + #endif break; } } if (s) { diff --git a/src/corelib/kernel/qsystemsemaphore_p.h b/src/corelib/kernel/qsystemsemaphore_p.h index 26647db2e1..3b55d80276 100644 --- a/src/corelib/kernel/qsystemsemaphore_p.h +++ b/src/corelib/kernel/qsystemsemaphore_p.h @@ -56,9 +56,7 @@ #ifndef QT_NO_SYSTEMSEMAPHORE #include "qsharedmemory_p.h" -#ifndef Q_OS_WINCE -# include <sys/types.h> -#endif +#include <sys/types.h> #ifdef QT_POSIX_IPC # include <semaphore.h> #endif diff --git a/src/corelib/kernel/qsystemsemaphore_win.cpp b/src/corelib/kernel/qsystemsemaphore_win.cpp index 236e346afe..3395f5641e 100644 --- a/src/corelib/kernel/qsystemsemaphore_win.cpp +++ b/src/corelib/kernel/qsystemsemaphore_win.cpp @@ -121,11 +121,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count) return false; } } else { -#if !defined(Q_OS_WINCE) if (WAIT_OBJECT_0 != WaitForSingleObjectEx(semaphore, INFINITE, FALSE)) { -#else - if (WAIT_OBJECT_0 != WaitForSingleObject(semaphore, INFINITE)) { -#endif setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore")); #if defined QSYSTEMSEMAPHORE_DEBUG qDebug("QSystemSemaphore::modifySemaphore WaitForSingleObject failed"); diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h index dd52d52a1c..d97fe933b9 100644 --- a/src/corelib/kernel/qtimer.h +++ b/src/corelib/kernel/qtimer.h @@ -80,11 +80,17 @@ public: static void singleShot(int msec, Qt::TimerType timerType, const QObject *receiver, const char *member); #ifdef Q_QDOC + template<typename PointerToMemberFunction> static void singleShot(int msec, const QObject *receiver, PointerToMemberFunction method); + template<typename PointerToMemberFunction> static void singleShot(int msec, Qt::TimerType timerType, const QObject *receiver, PointerToMemberFunction method); + template<typename Functor> static void singleShot(int msec, Functor functor); + template<typename Functor> static void singleShot(int msec, Qt::TimerType timerType, Functor functor); + template<typename Functor, int> static void singleShot(int msec, const QObject *context, Functor functor); + template<typename Functor, int> static void singleShot(int msec, Qt::TimerType timerType, const QObject *context, Functor functor); #else // singleShot to a QObject slot diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index dce750b5ad..53b38c3be2 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -120,7 +120,11 @@ void QFactoryLoader::update() if (!QDir(path).exists(QLatin1String("."))) continue; - QStringList plugins = QDir(path).entryList(QDir::Files); + QStringList plugins = QDir(path).entryList( +#ifdef Q_OS_WIN + QStringList(QStringLiteral("*.dll")), +#endif + QDir::Files); QLibraryPrivate *library = 0; #ifdef Q_OS_MAC diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp index deec54db0a..982035b49b 100644 --- a/src/corelib/plugin/qlibrary_win.cpp +++ b/src/corelib/plugin/qlibrary_win.cpp @@ -71,15 +71,6 @@ bool QLibraryPrivate::load_sys() #endif // We make the following attempts at locating the library: // - // WinCE - // if (absolute) - // fileName - // fileName + ".dll" - // else - // fileName + ".dll" - // fileName - // QFileInfo(fileName).absoluteFilePath() - // // Windows // if (absolute) // fileName @@ -97,14 +88,10 @@ bool QLibraryPrivate::load_sys() // If the fileName is an absolute path we try that first, otherwise we // use the system-specific suffix first QFileSystemEntry fsEntry(fileName); - if (fsEntry.isAbsolute()) { + if (fsEntry.isAbsolute()) attempts.prepend(fileName); - } else { + else attempts.append(fileName); -#if defined(Q_OS_WINCE) - attempts.append(QFileInfo(fileName).absoluteFilePath()); -#endif - } #ifdef Q_OS_WINRT if (fileName.startsWith(QLatin1Char('/'))) attempts.prepend(QDir::rootPath() + fileName); @@ -165,11 +152,7 @@ bool QLibraryPrivate::unload_sys() QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol) { -#ifdef Q_OS_WINCE - FARPROC address = GetProcAddress(pHnd, (const wchar_t*)QString::fromLatin1(symbol).utf16()); -#else FARPROC address = GetProcAddress(pHnd, symbol); -#endif if (!address) { errorString = QLibrary::tr("Cannot resolve symbol \"%1\" in %2: %3").arg( QString::fromLatin1(symbol)).arg( diff --git a/src/corelib/plugin/qsystemlibrary.cpp b/src/corelib/plugin/qsystemlibrary.cpp index 178a33f987..7c80fbbd42 100644 --- a/src/corelib/plugin/qsystemlibrary.cpp +++ b/src/corelib/plugin/qsystemlibrary.cpp @@ -68,23 +68,11 @@ DLL Safe search mode is documented in the "Dynamic-Link Library Search Order" document on MSDN. - - Since library loading code is sometimes shared between Windows and WinCE, - this class can also be used on WinCE. However, its implementation just - calls the LoadLibrary() function. This is ok since it is documented as not - loading from the current directory on WinCE. This behaviour is documented - in the documentation for LoadLibrary for Windows CE at MSDN. - (http://msdn.microsoft.com/en-us/library/ms886736.aspx) */ QT_BEGIN_NAMESPACE -#if defined(Q_OS_WINCE) -HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory /* = true */) -{ - return ::LoadLibrary(libraryName); -} -#elif defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory /* = true */) { Q_UNUSED(onlySystemDirectory); @@ -141,6 +129,6 @@ HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirect } -#endif //Q_OS_WINCE +#endif // Q_OS_WINRT QT_END_NAMESPACE diff --git a/src/corelib/plugin/qsystemlibrary_p.h b/src/corelib/plugin/qsystemlibrary_p.h index 469376d81b..7b6d180df9 100644 --- a/src/corelib/plugin/qsystemlibrary_p.h +++ b/src/corelib/plugin/qsystemlibrary_p.h @@ -93,11 +93,7 @@ public: load(); if (!m_handle) return 0; -#ifdef Q_OS_WINCE - return QFunctionPointer(GetProcAddress(m_handle, (const wchar_t*)QString::fromLatin1(symbol).utf16())); -#else return QFunctionPointer(GetProcAddress(m_handle, symbol)); -#endif } static QFunctionPointer resolve(const QString &libraryName, const char *symbol) diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h index a1d16b449e..409eec1989 100644 --- a/src/corelib/plugin/quuid.h +++ b/src/corelib/plugin/quuid.h @@ -55,9 +55,9 @@ typedef struct _GUID #endif #endif -#ifdef Q_OS_DARWIN +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) Q_FORWARD_DECLARE_CF_TYPE(CFUUID); -# ifdef __OBJC__ +# if defined(__OBJC__) || defined(Q_QDOC) Q_FORWARD_DECLARE_OBJC_CLASS(NSUUID); # endif #endif diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h index e8d413cd8a..d7cf8584da 100644 --- a/src/corelib/statemachine/qsignaltransition.h +++ b/src/corelib/statemachine/qsignaltransition.h @@ -60,6 +60,7 @@ public: QSignalTransition(const QObject *sender, const char *signal, QState *sourceState = Q_NULLPTR); #ifdef Q_QDOC + template<typename PointerToMemberFunction> QSignalTransition(const QObject *object, PointerToMemberFunction signal, QState *sourceState = Q_NULLPTR); #elif defined(Q_COMPILER_DELEGATING_CONSTRUCTORS) diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h index ee1ff3fea3..7a9dc9c132 100644 --- a/src/corelib/statemachine/qstate.h +++ b/src/corelib/statemachine/qstate.h @@ -82,6 +82,7 @@ public: void addTransition(QAbstractTransition *transition); QSignalTransition *addTransition(const QObject *sender, const char *signal, QAbstractState *target); #ifdef Q_QDOC + template<typename PointerToMemberFunction> QSignalTransition *addTransition(const QObject *sender, PointerToMemberFunction signal, QAbstractState *target); #else diff --git a/src/corelib/thread/qmutex_win.cpp b/src/corelib/thread/qmutex_win.cpp index acb0f9dc61..3c314a4c0c 100644 --- a/src/corelib/thread/qmutex_win.cpp +++ b/src/corelib/thread/qmutex_win.cpp @@ -61,11 +61,7 @@ QMutexPrivate::~QMutexPrivate() bool QMutexPrivate::wait(int timeout) { -#ifndef Q_OS_WINCE return (WaitForSingleObjectEx(event, timeout < 0 ? INFINITE : timeout, FALSE) == WAIT_OBJECT_0); -#else - return (WaitForSingleObject(event, timeout < 0 ? INFINITE : timeout) == WAIT_OBJECT_0); -#endif } void QMutexPrivate::wakeUp() Q_DECL_NOTHROW diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index ef1799a021..74e191f889 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -55,15 +55,10 @@ #include <qt_windows.h> #ifndef Q_OS_WINRT -#ifndef Q_OS_WINCE -#ifndef _MT -#define _MT -#endif // _MT -#include <process.h> -#else // !Q_OS_WINCE -#include "qfunctions_wince.h" -#endif // Q_OS_WINCE -#else // !Q_OS_WINRT +# ifndef _MT +# define _MT +# endif // _MT +# include <process.h> #endif // Q_OS_WINRT #ifndef QT_NO_THREAD @@ -150,7 +145,6 @@ QThreadData *QThreadData::current(bool createIfNecessary) // WinRT API? } else { HANDLE realHandle = INVALID_HANDLE_VALUE; -#if !defined(Q_OS_WINCE) || (defined(_WIN32_WCE) && (_WIN32_WCE>=0x600)) DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), @@ -158,9 +152,6 @@ QThreadData *QThreadData::current(bool createIfNecessary) 0, FALSE, DUPLICATE_SAME_ACCESS); -#else - realHandle = reinterpret_cast<HANDLE>(GetCurrentThreadId()); -#endif qt_watch_adopted_thread(realHandle, threadData->thread); } } @@ -190,9 +181,7 @@ void qt_watch_adopted_thread(const HANDLE adoptedThreadHandle, QThread *qthread) QMutexLocker lock(&qt_adopted_thread_watcher_mutex); if (GetCurrentThreadId() == qt_adopted_thread_watcher_id) { -#if !defined(Q_OS_WINCE) || (defined(_WIN32_WCE) && (_WIN32_WCE>=0x600)) CloseHandle(adoptedThreadHandle); -#endif return; } @@ -291,9 +280,7 @@ DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID) data->deref(); QMutexLocker lock(&qt_adopted_thread_watcher_mutex); -#if !defined(Q_OS_WINCE) || (defined(_WIN32_WCE) && (_WIN32_WCE>=0x600)) CloseHandle(qt_adopted_thread_handles.at(handleIndex)); -#endif qt_adopted_thread_handles.remove(handleIndex); qt_adopted_qthreads.remove(qthreadIndex); } @@ -306,7 +293,7 @@ DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID) return 0; } -#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINRT) #ifndef Q_OS_WIN64 # define ULONG_PTR DWORD @@ -336,7 +323,7 @@ void qt_set_thread_name(HANDLE threadId, LPCSTR threadName) { } } -#endif // !QT_NO_DEBUG && Q_CC_MSVC && !Q_OS_WINCE && !Q_OS_WINRT +#endif // !QT_NO_DEBUG && Q_CC_MSVC && !Q_OS_WINRT /************************************************************************** ** QThreadPrivate @@ -378,7 +365,7 @@ unsigned int __stdcall QT_ENSURE_STACK_ALIGNED_FOR_SSE QThreadPrivate::start(voi else createEventDispatcher(data); -#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINRT) // sets the name of the current thread. QByteArray objectName = thr->objectName().toLocal8Bit(); qt_set_thread_name((HANDLE)-1, @@ -453,7 +440,7 @@ int QThread::idealThreadCount() Q_DECL_NOTHROW void QThread::yieldCurrentThread() { -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) SwitchToThread(); #else ::Sleep(0); diff --git a/src/corelib/thread/qwaitcondition_win.cpp b/src/corelib/thread/qwaitcondition_win.cpp index f3a645c504..34db71808d 100644 --- a/src/corelib/thread/qwaitcondition_win.cpp +++ b/src/corelib/thread/qwaitcondition_win.cpp @@ -115,12 +115,7 @@ bool QWaitConditionPrivate::wait(QWaitConditionEvent *wce, unsigned long time) { // wait for the event bool ret = false; -#ifndef Q_OS_WINCE switch (WaitForSingleObjectEx(wce->event, time, FALSE)) { -#else - switch (WaitForSingleObject(wce->event, time)) { -#endif - default: break; case WAIT_OBJECT_0: diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h index 14465240b4..854276d150 100644 --- a/src/corelib/tools/qalgorithms.h +++ b/src/corelib/tools/qalgorithms.h @@ -142,15 +142,9 @@ QT_DEPRECATED_X("Use std::count") inline void qCount(const Container &container, } #ifdef Q_QDOC -template <typename T> -LessThan qLess() -{ -} - -template <typename T> -LessThan qGreater() -{ -} +typedef void* LessThan; +template <typename T> LessThan qLess(); +template <typename T> LessThan qGreater(); #else template <typename T> class QT_DEPRECATED_X("Use std::less") qLess diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index a53d4eabd3..bf4175d67e 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -56,9 +56,9 @@ #error qbytearray.h must be included before any header file that defines truncate #endif -#ifdef Q_OS_MAC +#if defined(Q_OS_MAC) || defined(Q_QDOC) Q_FORWARD_DECLARE_CF_TYPE(CFData); -# ifdef __OBJC__ +# if defined(__OBJC__) || defined(Q_QDOC) Q_FORWARD_DECLARE_OBJC_CLASS(NSData); # endif #endif diff --git a/src/corelib/tools/qbytearraylist.h b/src/corelib/tools/qbytearraylist.h index bc8b08b380..501bb2e0d5 100644 --- a/src/corelib/tools/qbytearraylist.h +++ b/src/corelib/tools/qbytearraylist.h @@ -50,11 +50,13 @@ QT_BEGIN_NAMESPACE typedef QListIterator<QByteArray> QByteArrayListIterator; typedef QMutableListIterator<QByteArray> QMutableByteArrayListIterator; +#ifndef Q_QDOC typedef QList<QByteArray> QByteArrayList; namespace QtPrivate { QByteArray Q_CORE_EXPORT QByteArrayList_join(const QByteArrayList *that, const char *separator, int separatorLength); } +#endif #ifdef Q_QDOC class QByteArrayList : public QList<QByteArray> diff --git a/src/corelib/tools/qcommandlineoption.cpp b/src/corelib/tools/qcommandlineoption.cpp index 64cabcc304..1f7f9cc33b 100644 --- a/src/corelib/tools/qcommandlineoption.cpp +++ b/src/corelib/tools/qcommandlineoption.cpp @@ -49,14 +49,12 @@ class QCommandLineOptionPrivate : public QSharedData public: Q_NEVER_INLINE explicit QCommandLineOptionPrivate(const QString &name) - : names(removeInvalidNames(QStringList(name))), - hidden(false) + : names(removeInvalidNames(QStringList(name))) { } Q_NEVER_INLINE explicit QCommandLineOptionPrivate(const QStringList &names) - : names(removeInvalidNames(names)), - hidden(false) + : names(removeInvalidNames(names)) { } static QStringList removeInvalidNames(QStringList nameList); @@ -74,8 +72,7 @@ public: //! The list of default values used for this option. QStringList defaultValues; - //! Show or hide in --help - bool hidden; + QCommandLineOption::Flags flags; }; /*! @@ -394,6 +391,7 @@ QStringList QCommandLineOption::defaultValues() const return d->defaultValues; } +#if QT_DEPRECATED_SINCE(5, 8) /*! Sets whether to hide this option in the user-visible help output. @@ -401,11 +399,12 @@ QStringList QCommandLineOption::defaultValues() const a particular option makes it internal, i.e. not listed in the help output. \since 5.6 + \obsolete Use setFlags(QCommandLineOption::HiddenFromHelp), QCommandLineOption::HiddenFromHelp \sa isHidden */ void QCommandLineOption::setHidden(bool hide) { - d->hidden = hide; + d->flags.setFlag(HiddenFromHelp, hide); } /*! @@ -413,11 +412,52 @@ void QCommandLineOption::setHidden(bool hide) false if the option is listed. \since 5.6 - \sa setHidden() + \obsolete Use flags() & QCommandLineOption::HiddenFromHelp + \sa setHidden(), QCommandLineOption::HiddenFromHelp */ bool QCommandLineOption::isHidden() const { - return d->hidden; + return d->flags & HiddenFromHelp; } +#endif + +/*! + Returns a set of flags that affect this command-line option. + + \since 5.8 + \sa setFlags(), QCommandLineOption::Flags + */ +QCommandLineOption::Flags QCommandLineOption::flags() const +{ + return d->flags; +} + +/*! + Set the set of flags that affect this command-line option. + + \since 5.8 + \sa flags(), QCommandLineOption::Flags + */ +void QCommandLineOption::setFlags(Flags flags) +{ + d->flags = flags; +} + +/*! + \enum QCommandLineOption::Flag + + \value HiddenFromHelp Hide this option in the user-visible help output. All + options are visible by default. Setting this flag for a particular + option makes it internal, i.e. not listed in the help output. + + \value ShortOptionStyle The option will always be understood as a short + option, regardless of what was set by + QCommandLineParser::setSingleDashWordOptionMode. + This allows flags such as \c{-DDEFINE=VALUE} or \c{-I/include/path} to be + interpreted as short flags even when the parser is in + QCommandLineParser::ParseAsLongOptions mode. + + \sa QCommandLineOption::setFlags(), QCommandLineOption::flags() +*/ QT_END_NAMESPACE diff --git a/src/corelib/tools/qcommandlineoption.h b/src/corelib/tools/qcommandlineoption.h index a7747f9fb2..6ebaab3d48 100644 --- a/src/corelib/tools/qcommandlineoption.h +++ b/src/corelib/tools/qcommandlineoption.h @@ -50,6 +50,12 @@ class QCommandLineOptionPrivate; class Q_CORE_EXPORT QCommandLineOption { public: + enum Flag { + HiddenFromHelp = 0x1, + ShortOptionStyle = 0x2 + }; + Q_DECLARE_FLAGS(Flags, Flag) + explicit QCommandLineOption(const QString &name); explicit QCommandLineOption(const QStringList &names); /*implicit*/ QCommandLineOption(const QString &name, const QString &description, @@ -82,14 +88,24 @@ public: void setDefaultValues(const QStringList &defaultValues); QStringList defaultValues() const; + Flags flags() const; + void setFlags(Flags aflags); + +#if QT_DEPRECATED_SINCE(5, 8) + QT_DEPRECATED_X("Use setFlags() with HiddenFromHelp)") void setHidden(bool hidden); + QT_DEPRECATED_X("Use flags() and HiddenFromHelp") bool isHidden() const; +#endif + private: QSharedDataPointer<QCommandLineOptionPrivate> d; }; Q_DECLARE_SHARED(QCommandLineOption) +Q_DECLARE_OPERATORS_FOR_FLAGS(QCommandLineOption::Flags) + QT_END_NAMESPACE diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp index 6587d900d2..c0bd132fc3 100644 --- a/src/corelib/tools/qcommandlineparser.cpp +++ b/src/corelib/tools/qcommandlineparser.cpp @@ -44,7 +44,7 @@ #include <qhash.h> #include <qvector.h> #include <qdebug.h> -#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINRT) # include <qt_windows.h> #endif #include <stdio.h> @@ -295,7 +295,9 @@ QCommandLineParser::~QCommandLineParser() i.e. as the long option named \c{abc}. This is how Qt's own tools (uic, rcc...) have always been parsing arguments. This mode should be used for preserving compatibility in applications that were parsing - arguments in such a way. + arguments in such a way. There is an exception if the \c{a} option has the + QCommandLineOption::ShortOptionStyle flag set, in which case it is still + interpreted as \c{-a bc}. \sa setSingleDashWordOptionMode() */ @@ -530,7 +532,7 @@ QString QCommandLineParser::errorText() const enum MessageType { UsageMessage, ErrorMessage }; -#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINRT) // Return whether to use a message box. Use handles if a console can be obtained // or we are run with redirected handles (for example, by QProcess). static inline bool displayMessageBox() @@ -552,7 +554,7 @@ static void showParserMessage(const QString &message, MessageType type) else qCritical(qPrintable(message)); return; -#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINCE) +#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) if (displayMessageBox()) { const UINT flags = MB_OK | MB_TOPMOST | MB_SETFOREGROUND | (type == UsageMessage ? MB_ICONINFORMATION : MB_ICONERROR); @@ -565,7 +567,7 @@ static void showParserMessage(const QString &message, MessageType type) reinterpret_cast<const wchar_t *>(title.utf16()), flags); return; } -#endif // Q_OS_WIN && !QT_BOOTSTRAPPED && !Q_OS_WINCE +#endif // Q_OS_WIN && !QT_BOOTSTRAPPED fputs(qPrintable(message), type == UsageMessage ? stdout : stderr); } @@ -762,6 +764,18 @@ bool QCommandLineParserPrivate::parse(const QStringList &args) } case QCommandLineParser::ParseAsLongOptions: { + if (argument.size() > 2) { + const QString possibleShortOptionStyleName = argument.mid(1, 1); + const auto shortOptionIt = nameHash.constFind(possibleShortOptionStyleName); + if (shortOptionIt != nameHash.constEnd()) { + const auto &arg = commandLineOptionList.at(*shortOptionIt); + if (arg.flags() & QCommandLineOption::ShortOptionStyle) { + registerFoundOption(possibleShortOptionStyleName); + optionValuesHash[*shortOptionIt].append(argument.mid(2)); + break; + } + } + } const QString optionName = argument.mid(1).section(assignChar, 0, 0); if (registerFoundOption(optionName)) { if (!parseOptionValue(optionName, argument, &argumentIterator, args.end())) @@ -1097,7 +1111,7 @@ QString QCommandLineParserPrivate::helpText() const optionNameList.reserve(commandLineOptionList.size()); int longestOptionNameString = 0; for (const QCommandLineOption &option : commandLineOptionList) { - if (option.isHidden()) + if (option.flags() & QCommandLineOption::HiddenFromHelp) continue; const QStringList optionNames = option.names(); QString optionNamesString; @@ -1116,7 +1130,7 @@ QString QCommandLineParserPrivate::helpText() const ++longestOptionNameString; auto optionNameIterator = optionNameList.cbegin(); for (const QCommandLineOption &option : commandLineOptionList) { - if (option.isHidden()) + if (option.flags() & QCommandLineOption::HiddenFromHelp) continue; text += wrapText(*optionNameIterator, longestOptionNameString, option.description()); ++optionNameIterator; diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 221cdfcdb5..6f3e0c01de 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -57,9 +57,6 @@ #include <time.h> #ifdef Q_OS_WIN # include <qt_windows.h> -# ifdef Q_OS_WINCE -# include "qfunctions_wince.h" -# endif # ifdef Q_OS_WINRT # include "qfunctions_winrt.h" # endif @@ -1682,9 +1679,6 @@ QString QTime::toString(const QString& format) const bool QTime::setHMS(int h, int m, int s, int ms) { -#if defined(Q_OS_WINCE) - startTick = NullTime; -#endif if (!isValid(h,m,s,ms)) { mds = NullTime; // make this invalid return false; @@ -1764,10 +1758,6 @@ QTime QTime::addMSecs(int ms) const t.mds = (ds() + ms) % MSECS_PER_DAY; } } -#if defined(Q_OS_WINCE) - if (startTick > NullTime) - t.startTick = (startTick + ms) % MSECS_PER_DAY; -#endif return t; } @@ -1789,13 +1779,7 @@ int QTime::msecsTo(const QTime &t) const { if (!isValid() || !t.isValid()) return 0; -#if defined(Q_OS_WINCE) - // GetLocalTime() for Windows CE has no milliseconds resolution - if (t.startTick > NullTime && startTick > NullTime) - return t.startTick - startTick; - else -#endif - return t.ds() - ds(); + return t.ds() - ds(); } @@ -2137,10 +2121,7 @@ int QTime::elapsed() const // Calls the platform variant of tzset static void qt_tzset() { -#if defined(Q_OS_WINCE) - // WinCE doesn't use tzset - return; -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) _tzset(); #else tzset(); @@ -2154,12 +2135,7 @@ static void qt_tzset() // Relies on tzset, mktime, or localtime having been called to populate timezone static int qt_timezone() { -#if defined(Q_OS_WINCE) - TIME_ZONE_INFORMATION tzi; - GetTimeZoneInformation(&tzi); - // Expressed in minutes, convert to seconds - return (tzi.Bias + tzi.StandardBias) * 60; -#elif defined(_MSC_VER) && _MSC_VER >= 1400 +#if defined(_MSC_VER) long offset; _get_timezone(&offset); return offset; @@ -2188,16 +2164,6 @@ static int qt_timezone() // Returns the tzname, assume tzset has been called already static QString qt_tzname(QDateTimePrivate::DaylightStatus daylightStatus) { -#if defined(Q_OS_WINCE) - TIME_ZONE_INFORMATION tzi; - DWORD res = GetTimeZoneInformation(&tzi); - if (res == TIME_ZONE_ID_UNKNOWN) - return QString(); - else if (daylightStatus == QDateTimePrivate::DaylightTime) - return QString::fromWCharArray(tzi.DaylightName); - else - return QString::fromWCharArray(tzi.StandardName); -#else int isDst = (daylightStatus == QDateTimePrivate::DaylightTime) ? 1 : 0; #if defined(_MSC_VER) && _MSC_VER >= 1400 size_t s = 0; @@ -2208,7 +2174,6 @@ static QString qt_tzname(QDateTimePrivate::DaylightStatus daylightStatus) #else return QString::fromLocal8Bit(tzname[isDst]); #endif // Q_OS_WIN -#endif // Q_OS_WINCE } // Calls the platform variant of mktime for the given date, time and daylightStatus, @@ -2223,48 +2188,6 @@ static qint64 qt_mktime(QDate *date, QTime *time, QDateTimePrivate::DaylightStat int yy, mm, dd; date->getDate(&yy, &mm, &dd); -#if defined(Q_OS_WINCE) - // WinCE doesn't provide standard C library time functions - SYSTEMTIME st; - memset(&st, 0, sizeof(SYSTEMTIME)); - st.wSecond = time->second(); - st.wMinute = time->minute(); - st.wHour = time->hour(); - st.wDay = dd; - st.wMonth = mm; - st.wYear = yy; - FILETIME lft; - bool valid = SystemTimeToFileTime(&st, &lft); - FILETIME ft; - if (valid) - valid = LocalFileTimeToFileTime(&lft, &ft); - const time_t secsSinceEpoch = ftToTime_t(ft); - const time_t localSecs = ftToTime_t(lft); - TIME_ZONE_INFORMATION tzi; - GetTimeZoneInformation(&tzi); - bool isDaylight = false; - // Check for overflow - qint64 localDiff = qAbs(localSecs - secsSinceEpoch); - int daylightOffset = qAbs(tzi.Bias + tzi.DaylightBias) * 60; - if (localDiff > daylightOffset) - valid = false; - else - isDaylight = (localDiff == daylightOffset); - if (daylightStatus) { - if (isDaylight) - *daylightStatus = QDateTimePrivate::DaylightTime; - else - *daylightStatus = QDateTimePrivate::StandardTime; - } - if (abbreviation) { - if (isDaylight) - *abbreviation = QString::fromWCharArray(tzi.DaylightName); - else - *abbreviation = QString::fromWCharArray(tzi.StandardName); - } - if (ok) - *ok = valid; -#else // All other platforms provide standard C library time functions tm local; memset(&local, 0, sizeof(local)); // tm_[wy]day plus any non-standard fields @@ -2326,7 +2249,6 @@ static qint64 qt_mktime(QDate *date, QTime *time, QDateTimePrivate::DaylightStat if (ok) *ok = false; } -#endif // Q_OS_WINCE return ((qint64)secsSinceEpoch * 1000) + msec; } @@ -2342,23 +2264,7 @@ static bool qt_localtime(qint64 msecsSinceEpoch, QDate *localDate, QTime *localT tm local; bool valid = false; -#if defined(Q_OS_WINCE) - FILETIME utcTime = time_tToFt(secsSinceEpoch); - FILETIME resultTime; - valid = FileTimeToLocalFileTime(&utcTime , &resultTime); - SYSTEMTIME sysTime; - if (valid) - valid = FileTimeToSystemTime(&resultTime , &sysTime); - - if (valid) { - local.tm_sec = sysTime.wSecond; - local.tm_min = sysTime.wMinute; - local.tm_hour = sysTime.wHour; - local.tm_mday = sysTime.wDay; - local.tm_mon = sysTime.wMonth - 1; - local.tm_year = sysTime.wYear - 1900; - } -#elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) +#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) // localtime() is required to work as if tzset() was called before it. // localtime_r() does not have this requirement, so make an explicit call. qt_tzset(); @@ -4106,9 +4012,6 @@ QTime QTime::currentTime() memset(&st, 0, sizeof(SYSTEMTIME)); GetLocalTime(&st); ct.setHMS(st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); -#if defined(Q_OS_WINCE) - ct.startTick = GetTickCount() % MSECS_PER_DAY; -#endif return ct; } diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index ee3be5553b..a9271ef177 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -46,9 +46,9 @@ #include <limits> -#ifdef Q_OS_MAC +#if defined(Q_OS_MAC) || defined(Q_QDOC) Q_FORWARD_DECLARE_CF_TYPE(CFDate); -# ifdef __OBJC__ +# if defined(__OBJC__) || defined(Q_QDOC) Q_FORWARD_DECLARE_OBJC_CLASS(NSDate); # endif #endif @@ -148,15 +148,9 @@ Q_DECLARE_TYPEINFO(QDate, Q_MOVABLE_TYPE); class Q_CORE_EXPORT QTime { explicit Q_DECL_CONSTEXPR QTime(int ms) : mds(ms) -#if defined(Q_OS_WINCE) - , startTick(NullTime) -#endif {} public: Q_DECL_CONSTEXPR QTime(): mds(NullTime) -#if defined(Q_OS_WINCE) - , startTick(NullTime) -#endif {} QTime(int h, int m, int s = 0, int ms = 0); @@ -202,9 +196,6 @@ private: enum TimeFlag { NullTime = -1 }; Q_DECL_CONSTEXPR inline int ds() const { return mds == -1 ? 0 : mds; } int mds; -#if defined(Q_OS_WINCE) - int startTick; -#endif friend class QDateTime; friend class QDateTimePrivate; diff --git a/src/corelib/tools/qelapsedtimer_win.cpp b/src/corelib/tools/qelapsedtimer_win.cpp index 734aaf80f2..532d61d504 100644 --- a/src/corelib/tools/qelapsedtimer_win.cpp +++ b/src/corelib/tools/qelapsedtimer_win.cpp @@ -58,13 +58,13 @@ static void resolveLibs() if (done) return; -#if !defined(Q_OS_WINRT) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_WINRT) // try to get GetTickCount64 from the system HMODULE kernel32 = GetModuleHandleW(L"kernel32"); if (!kernel32) return; ptrGetTickCount64 = (PtrGetTickCount64)GetProcAddress(kernel32, "GetTickCount64"); -#endif // !Q_OS_WINRT && !Q_OS_WINCE +#endif // !Q_OS_WINRT // Retrieve the number of high-resolution performance counter ticks per second LARGE_INTEGER frequency; diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 5509c3adce..8149238a50 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -118,7 +118,10 @@ struct Q_CORE_EXPORT QListData { }; template <typename T> -class QList : public QListSpecialMethods<T> +class QList +#ifndef Q_QDOC + : public QListSpecialMethods<T> +#endif { public: struct MemoryLayout diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp index 88bfada515..b4598af45a 100644 --- a/src/corelib/tools/qlocale_win.cpp +++ b/src/corelib/tools/qlocale_win.cpp @@ -1161,19 +1161,16 @@ static QByteArray getWinLocaleName(LPWSTR id) } } -#if defined(Q_OS_WINCE) - result = winLangCodeToIsoName(id != LOCALE_USER_DEFAULT ? id : GetUserDefaultLCID()); -#else // !Q_OS_WINCE -# ifndef Q_OS_WINRT +#ifndef Q_OS_WINRT if (id == LOCALE_USER_DEFAULT) id = GetUserDefaultLCID(); -# else // !Q_OS_WINRT +#else // !Q_OS_WINRT WCHAR lcName[LOCALE_NAME_MAX_LENGTH]; if (QString::fromWCharArray(id) == QString::fromWCharArray(LOCALE_NAME_USER_DEFAULT)) { GetUserDefaultLocaleName(lcName, LOCALE_NAME_MAX_LENGTH); id = lcName; } -# endif // Q_OS_WINRT +#endif // Q_OS_WINRT QString resultuage = winIso639LangName(id); QString country = winIso3116CtryName(id); result = resultuage.toLatin1(); @@ -1181,7 +1178,6 @@ static QByteArray getWinLocaleName(LPWSTR id) result += '_'; result += country.toLatin1(); } -#endif // !Q_OS_WINCE return result; } diff --git a/src/corelib/tools/qsharedpointer.h b/src/corelib/tools/qsharedpointer.h index 901862e7a2..6742a66939 100644 --- a/src/corelib/tools/qsharedpointer.h +++ b/src/corelib/tools/qsharedpointer.h @@ -68,6 +68,7 @@ public: // constructors QSharedPointer(); explicit QSharedPointer(T *ptr); + template<typename Deleter> QSharedPointer(T *ptr, Deleter d); QSharedPointer(const QSharedPointer<T> &other); QSharedPointer(const QWeakPointer<T> &other); diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index 9037442d9d..698189f9c6 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -48,16 +48,8 @@ #endif #if defined(Q_OS_WIN) -# if defined(Q_OS_WINCE) -# include <qt_windows.h> -# if _WIN32_WCE < 0x800 -# include <cmnintrin.h> -# endif -# endif # if !defined(Q_CC_GNU) -# ifndef Q_OS_WINCE -# include <intrin.h> -# endif +# include <intrin.h> # endif #elif defined(Q_OS_LINUX) && (defined(Q_PROCESSOR_ARM) || defined(Q_PROCESSOR_MIPS_32)) #include "private/qcore_unix_p.h" @@ -93,25 +85,6 @@ static inline uint detectProcessorFeatures() { return 0; } -#elif defined (Q_OS_WINCE) -static inline quint64 detectProcessorFeatures() -{ - quint64 features = 0; - -#if defined (ARM) -# ifdef PF_ARM_NEON - if (IsProcessorFeaturePresent(PF_ARM_NEON)) - features |= Q_UINT64_C(1) << CpuFeatureNEON; -# endif -#elif defined(_X86_) - if (IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE)) - features |= Q_UINT64_C(1) << CpuFeatureSSE2; - if (IsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE)) - features |= Q_UINT64_C(1) << CpuFeatureSSE3; -#endif - return features; -} - #elif defined(Q_PROCESSOR_ARM) static inline quint64 detectProcessorFeatures() { diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index a4fe8e67f8..48ef686bbd 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -139,7 +139,7 @@ * } */ -#if defined(__MINGW64_VERSION_MAJOR) || (defined(Q_CC_MSVC) && !defined(Q_OS_WINCE)) +#if defined(__MINGW64_VERSION_MAJOR) || defined(Q_CC_MSVC) #include <intrin.h> #endif @@ -483,7 +483,7 @@ static Q_ALWAYS_INLINE unsigned _bit_scan_forward(unsigned val) } #elif defined(Q_PROCESSOR_X86) // Bit scan functions for x86 -# if defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) +# if defined(Q_CC_MSVC) // MSVC calls it _BitScanReverse and returns the carry flag, which we don't need static __forceinline unsigned long _bit_scan_reverse(uint val) { diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index c7cd1a7751..b4140a58c3 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -81,9 +81,6 @@ #ifdef Q_OS_WIN # include <qt_windows.h> -# ifdef Q_OS_WINCE -# include <winnls.h> -# endif #endif #ifdef truncate @@ -5518,7 +5515,7 @@ int QString::localeAwareCompare(const QString &other) const return localeAwareCompare_helper(constData(), length(), other.constData(), other.length()); } -#if defined(QT_USE_ICU) && !defined(Q_OS_WIN32) && !defined(Q_OS_WINCE) && !defined (Q_OS_MAC) +#if defined(QT_USE_ICU) && !defined(Q_OS_WIN32) && !defined(Q_OS_DARWIN) Q_GLOBAL_STATIC(QThreadStorage<QCollator>, defaultCollator) #endif @@ -5533,12 +5530,12 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1, if (length1 == 0 || length2 == 0) return ucstrcmp(data1, length1, data2, length2); -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) -#ifndef Q_OS_WINRT +#if defined(Q_OS_WIN) +# ifndef Q_OS_WINRT int res = CompareString(GetUserDefaultLCID(), 0, (wchar_t*)data1, length1, (wchar_t*)data2, length2); -#else +# else int res = CompareStringEx(LOCALE_NAME_USER_DEFAULT, 0, (LPCWSTR)data1, length1, (LPCWSTR)data2, length2, NULL, NULL, 0); -#endif +# endif switch (res) { case CSTR_LESS_THAN: @@ -8324,6 +8321,78 @@ QString &QString::setRawData(const QChar *unicode, int size) Returns the size of the Latin-1 string stored in this object. */ +/*! \fn QLatin1Char QLatin1String::at(int pos) const + \since 5.8 + + Returns the character at position \a pos in this object. + + \note This function performs no error checking. + The behavior is undefined when \a pos < 0 or \a pos ≥ size(). + + \sa operator[]() +*/ + +/*! \fn QLatin1Char QLatin1String::operator[](int pos) const + \since 5.8 + + Returns the character at position \a pos in this object. + + \note This function performs no error checking. + The behavior is undefined when \a pos < 0 or \a pos ≥ size(). + + \sa at() +*/ + +/*! \fn QLatin1String QLatin1String::mid(int start) const + \since 5.8 + + Returns the substring starting at position \a start in this object, + and extending to the end of the string. + + \note This function performs no error checking. + The behavior is undefined when \a start < 0 or \a start > size(). + + \sa left(), right() +*/ + +/*! \fn QLatin1String QLatin1String::mid(int start, int length) const + \since 5.8 + \overload + + Returns the substring of length \a length starting at position + \a start in this object. + + \note This function performs no error checking. + The behavior is undefined when \a start < 0, \length < 0, + or \a start + \a length > size(). + + \sa left(), right() +*/ + +/*! \fn QLatin1String QLatin1String::left(int length) const + \since 5.8 + + Returns the substring of length \a length starting at position + 0 in this object. + + \note This function performs no error checking. + The behavior is undefined when \length < 0 or \a length > size(). + + \sa mid(), right() +*/ + +/*! \fn QLatin1String QLatin1String::right(int length) const + \since 5.8 + + Returns the substring of length \a length starting at position + size() - \a length in this object. + + \note This function performs no error checking. + The behavior is undefined when \length < 0 or \a length > size(). + + \sa mid(), left() +*/ + /*! \fn bool QLatin1String::operator==(const QString &other) const Returns \c true if this string is equal to string \a other; diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index ddaab1f544..e223c44b75 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -68,9 +68,9 @@ namespace std #error qstring.h must be included before any header file that defines truncate #endif -#ifdef Q_OS_MAC +#if defined(Q_OS_MAC) || defined(Q_QDOC) Q_FORWARD_DECLARE_CF_TYPE(CFString); -# ifdef __OBJC__ +# if defined(__OBJC__) || defined(Q_QDOC) Q_FORWARD_DECLARE_OBJC_CLASS(NSString); # endif #endif @@ -99,6 +99,18 @@ public: Q_DECL_CONSTEXPR int size() const Q_DECL_NOTHROW { return m_size; } Q_DECL_CONSTEXPR const char *data() const Q_DECL_NOTHROW { return m_data; } + Q_DECL_CONSTEXPR QLatin1Char at(int i) const { return QLatin1Char(m_data[i]); } + Q_DECL_CONSTEXPR QLatin1Char operator[](int i) const { return at(i); } + + Q_DECL_CONSTEXPR QLatin1String mid(int pos) const + { return QLatin1String(m_data + pos, m_size - pos); } + Q_DECL_CONSTEXPR QLatin1String mid(int pos, int n) const + { return QLatin1String(m_data + pos, n); } + Q_DECL_CONSTEXPR QLatin1String left(int n) const + { return QLatin1String(m_data, n); } + Q_DECL_CONSTEXPR QLatin1String right(int n) const + { return QLatin1String(m_data + m_size - n, n); } + inline bool operator==(const QString &s) const Q_DECL_NOTHROW; inline bool operator!=(const QString &s) const Q_DECL_NOTHROW; inline bool operator>(const QString &s) const Q_DECL_NOTHROW; @@ -593,7 +605,7 @@ public: Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW { return -s2.compare(s1, cs); } - int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW; + inline int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW; static int compare(const QString &s1, const QStringRef &s2, Qt::CaseSensitivity = Qt::CaseSensitive) Q_DECL_NOTHROW; @@ -1512,24 +1524,10 @@ inline QStringRef::QStringRef(const QString *aString, int aPosition, int aSize) inline QStringRef::QStringRef(const QString *aString) :m_string(aString), m_position(0), m_size(aString?aString->size() : 0){} +// QStringRef <> QStringRef Q_CORE_EXPORT bool operator==(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW; inline bool operator!=(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW { return !(s1 == s2); } -Q_CORE_EXPORT bool operator==(const QString &s1, const QStringRef &s2) Q_DECL_NOTHROW; -inline bool operator!=(const QString &s1, const QStringRef &s2) Q_DECL_NOTHROW -{ return !(s1 == s2); } -inline bool operator==(const QStringRef &s1, const QString &s2) Q_DECL_NOTHROW -{ return s2 == s1; } -inline bool operator!=(const QStringRef &s1, const QString &s2) Q_DECL_NOTHROW -{ return s2 != s1; } -Q_CORE_EXPORT bool operator==(QLatin1String s1, const QStringRef &s2) Q_DECL_NOTHROW; -inline bool operator!=(QLatin1String s1, const QStringRef &s2) Q_DECL_NOTHROW -{ return !(s1 == s2); } -inline bool operator==(const QStringRef &s1, QLatin1String s2) Q_DECL_NOTHROW -{ return s2 == s1; } -inline bool operator!=(const QStringRef &s1, QLatin1String s2) Q_DECL_NOTHROW -{ return s2 != s1; } - Q_CORE_EXPORT bool operator<(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW; inline bool operator>(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW { return s2 < s1; } @@ -1538,6 +1536,53 @@ inline bool operator<=(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHRO inline bool operator>=(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW { return !(s1 < s2); } +// QString <> QStringRef +Q_CORE_EXPORT bool operator==(const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW; +inline bool operator!=(const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) != 0; } +inline bool operator< (const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) < 0; } +inline bool operator> (const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) > 0; } +inline bool operator<=(const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) <= 0; } +inline bool operator>=(const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) >= 0; } + +inline bool operator==(const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs == lhs; } +inline bool operator!=(const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs != lhs; } +inline bool operator< (const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs > lhs; } +inline bool operator> (const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs < lhs; } +inline bool operator<=(const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs >= lhs; } +inline bool operator>=(const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs <= lhs; } + +inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW +{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } +inline int QString::compare(const QString &s1, const QStringRef &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } +inline int QStringRef::compare(const QString &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW +{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } +inline int QStringRef::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW +{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } +inline int QStringRef::compare(QLatin1String s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW +{ return QString::compare_helper(constData(), length(), s, cs); } +inline int QStringRef::compare(const QStringRef &s1, const QString &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } +inline int QStringRef::compare(const QStringRef &s1, const QStringRef &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } +inline int QStringRef::compare(const QStringRef &s1, QLatin1String s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +{ return QString::compare_helper(s1.constData(), s1.length(), s2, cs); } + +// QLatin1String <> QStringRef +Q_CORE_EXPORT bool operator==(QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW; +inline bool operator!=(QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) != 0; } +inline bool operator< (QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) > 0; } +inline bool operator> (QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) < 0; } +inline bool operator<=(QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) >= 0; } +inline bool operator>=(QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) <= 0; } + +inline bool operator==(const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs == lhs; } +inline bool operator!=(const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs != lhs; } +inline bool operator< (const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs > lhs; } +inline bool operator> (const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs < lhs; } +inline bool operator<=(const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs >= lhs; } +inline bool operator>=(const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs <= lhs; } + #if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) inline QT_ASCII_CAST_WARN bool QStringRef::operator==(const char *s) const { return QString::compare_helper(constData(), size(), s, -1) == 0; } @@ -1566,23 +1611,6 @@ inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QStringRef &s2) { return QString::compare_helper(s2.constData(), s2.size(), s1, -1) >= 0; } #endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) -inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW -{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } -inline int QString::compare(const QString &s1, const QStringRef &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW -{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } -inline int QStringRef::compare(const QString &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW -{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } -inline int QStringRef::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW -{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } -inline int QStringRef::compare(QLatin1String s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW -{ return QString::compare_helper(constData(), length(), s, cs); } -inline int QStringRef::compare(const QStringRef &s1, const QString &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW -{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } -inline int QStringRef::compare(const QStringRef &s1, const QStringRef &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW -{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } -inline int QStringRef::compare(const QStringRef &s1, QLatin1String s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW -{ return QString::compare_helper(s1.constData(), s1.length(), s2, cs); } - inline int QString::localeAwareCompare(const QStringRef &s) const { return localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); } inline int QString::localeAwareCompare(const QString& s1, const QStringRef& s2) diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h index e01f9e16e8..87f15528bf 100644 --- a/src/corelib/tools/qstringlist.h +++ b/src/corelib/tools/qstringlist.h @@ -149,6 +149,7 @@ public: Q_DECLARE_TYPEINFO(QStringList, Q_MOVABLE_TYPE); +#ifndef Q_QDOC inline QStringList *QListSpecialMethods<QString>::self() { return static_cast<QStringList *>(this); } inline const QStringList *QListSpecialMethods<QString>::self() const @@ -284,6 +285,7 @@ inline int QStringList::lastIndexOf(const QRegularExpression &rx, int from) cons } #endif // QT_NO_REGULAREXPRESSION #endif // QT_BOOTSTRAPPED +#endif // Q_QDOC QT_END_NAMESPACE diff --git a/src/corelib/tools/qtimezoneprivate_win.cpp b/src/corelib/tools/qtimezoneprivate_win.cpp index 8e32db48de..4febeda537 100644 --- a/src/corelib/tools/qtimezoneprivate_win.cpp +++ b/src/corelib/tools/qtimezoneprivate_win.cpp @@ -383,17 +383,11 @@ static void calculateTransitionsForYear(const QWinTimeZonePrivate::QWinTransitio static QLocale::Country userCountry() { -#if defined(Q_OS_WINCE) - // Guess that the syslem locale country is the right one to use - // TODO Find if WinCE has equivalent api - return QLocale::system().country(); -#else const GEOID id = GetUserGeoID(GEOCLASS_NATION); wchar_t code[3]; const int size = GetGeoInfo(id, GEO_ISO2, code, 3, 0); return (size == 3) ? QLocalePrivate::codeToCountry(reinterpret_cast<const QChar*>(code), size) : QLocale::AnyCountry; -#endif // Q_OS_WINCE } // Create the system default time zone diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 93dc71c3d8..95a7ece67c 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -152,10 +152,10 @@ else:win32 { } else:integrity:SOURCES += tools/qelapsedtimer_unix.cpp tools/qlocale_unix.cpp else:SOURCES += tools/qelapsedtimer_generic.cpp -contains(QT_CONFIG, zlib) { - include($$PWD/../../3rdparty/zlib.pri) -} else { +contains(QT_CONFIG, system-zlib) { include($$PWD/../../3rdparty/zlib_dependency.pri) +} else { + include($$PWD/../../3rdparty/zlib.pri) } contains(QT_CONFIG,icu) { diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 0906b65d96..2a17edd038 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -298,10 +298,8 @@ QRectF QBlittablePlatformPixmap::clipAndTransformRect(const QRectF &rect) const if (clipData->hasRectClip) { transformationRect &= clipData->clipRect; } else if (clipData->hasRegionClip) { - const QVector<QRect> rects = clipData->clipRegion.rects(); - for (int i = 0; i < rects.size(); i++) { - transformationRect &= rects.at(i); - } + for (const QRect &rect : clipData->clipRegion) + transformationRect &= rect; } } } diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp index 7f20586156..92f6964783 100644 --- a/src/gui/image/qpixmap_win.cpp +++ b/src/gui/image/qpixmap_win.cpp @@ -48,84 +48,6 @@ QT_BEGIN_NAMESPACE -#ifdef Q_OS_WINCE -#define GetDIBits(a,b,c,d,e,f,g) qt_wince_GetDIBits(a,b,c,d,e,f,g) -int qt_wince_GetDIBits(HDC /*hdc*/ , HBITMAP hSourceBitmap, uint, uint, LPVOID lpvBits, LPBITMAPINFO, uint) -{ - if (!lpvBits) { - qWarning("::GetDIBits(), lpvBits NULL"); - return 0; - } - BITMAP bm; - GetObject(hSourceBitmap, sizeof(BITMAP), &bm); - bm.bmHeight = qAbs(bm.bmHeight); - - HBITMAP hTargetBitmap; - void *pixels; - - BITMAPINFO dibInfo; - memset(&dibInfo, 0, sizeof(dibInfo)); - dibInfo.bmiHeader.biBitCount = 32; - dibInfo.bmiHeader.biClrImportant = 0; - dibInfo.bmiHeader.biClrUsed = 0; - dibInfo.bmiHeader.biCompression = BI_RGB;; - dibInfo.bmiHeader.biHeight = -bm.bmHeight; - dibInfo.bmiHeader.biWidth = bm.bmWidth; - dibInfo.bmiHeader.biPlanes = 1; - dibInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - dibInfo.bmiHeader.biSizeImage = bm.bmWidth * bm.bmHeight * 4; - - HDC displayDC = GetDC(NULL); - if (!displayDC) { - qWarning("::GetDIBits(), failed to GetDC"); - return 0; - } - - int ret = bm.bmHeight; - - hTargetBitmap = CreateDIBSection(displayDC, (const BITMAPINFO*) &dibInfo, DIB_RGB_COLORS, - (void**)&pixels, NULL, 0); - if (!hTargetBitmap) { - qWarning("::GetDIBits(), failed to CreateDIBSection"); - return 0; - } - - HDC hdcSrc = CreateCompatibleDC(displayDC); - HDC hdcDst = CreateCompatibleDC(displayDC); - - if (!(hdcDst && hdcSrc)) { - qWarning("::GetDIBits(), failed to CreateCompatibleDC"); - ret = 0; - } - - HBITMAP hOldBitmap1 = (HBITMAP) SelectObject(hdcSrc, hSourceBitmap); - HBITMAP hOldBitmap2 = (HBITMAP) SelectObject(hdcDst, hTargetBitmap); - - if (!(hOldBitmap1 && hOldBitmap2)) { - qWarning("::GetDIBits(), failed to SelectObject for bitmaps"); - ret = 0; - } - - if (!BitBlt(hdcDst, 0, 0, bm.bmWidth, bm.bmHeight, hdcSrc, 0, 0, SRCCOPY)) { - qWarning("::GetDIBits(), BitBlt failed"); - ret = 0; - } - - SelectObject(hdcSrc, hOldBitmap1); - SelectObject(hdcDst, hOldBitmap2); - - DeleteDC(hdcSrc); - DeleteDC(hdcDst); - - ReleaseDC(NULL, displayDC); - - memcpy(lpvBits, pixels, dibInfo.bmiHeader.biSizeImage); - - DeleteObject(hTargetBitmap); - return ret; -} -#endif - static inline void initBitMapInfoHeader(int width, int height, bool topToBottom, BITMAPINFOHEADER *bih) { memset(bih, 0, sizeof(BITMAPINFOHEADER)); @@ -325,8 +247,6 @@ Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &p) return hIcon; } -#ifndef Q_OS_WINCE - Q_GUI_EXPORT QImage qt_imageFromWinHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h) { QImage image(w, h, QImage::Format_ARGB32_Premultiplied); @@ -415,95 +335,5 @@ Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon) DeleteDC(hdc); return QPixmap::fromImage(image); } -#else //ifndef Q_OS_WINCE -Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon) -{ - HDC screenDevice = GetDC(0); - HDC hdc = CreateCompatibleDC(screenDevice); - ReleaseDC(0, screenDevice); - - ICONINFO iconinfo; - bool result = GetIconInfo(icon, &iconinfo); - if (!result) - qWarning("QPixmap::fromWinHICON(), failed to GetIconInfo()"); - - int w = 0; - int h = 0; - if (!iconinfo.xHotspot || !iconinfo.yHotspot) { - // We could not retrieve the icon size via GetIconInfo, - // so we try again using the icon bitmap. - BITMAP bm; - int result = GetObject(iconinfo.hbmColor, sizeof(BITMAP), &bm); - if (!result) result = GetObject(iconinfo.hbmMask, sizeof(BITMAP), &bm); - if (!result) { - qWarning("QPixmap::fromWinHICON(), failed to retrieve icon size"); - return QPixmap(); - } - w = bm.bmWidth; - h = bm.bmHeight; - } else { - // x and y Hotspot describes the icon center - w = iconinfo.xHotspot * 2; - h = iconinfo.yHotspot * 2; - } - const DWORD dwImageSize = w * h * 4; - - BITMAPINFO bmi; - memset(&bmi, 0, sizeof(bmi)); - bmi.bmiHeader.biSize = sizeof(BITMAPINFO); - bmi.bmiHeader.biWidth = w; - bmi.bmiHeader.biHeight = -h; - bmi.bmiHeader.biPlanes = 1; - bmi.bmiHeader.biBitCount = 32; - bmi.bmiHeader.biCompression = BI_RGB; - bmi.bmiHeader.biSizeImage = dwImageSize; - - uchar* bits; - - HBITMAP winBitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**) &bits, 0, 0); - if (winBitmap ) - memset(bits, 0xff, dwImageSize); - if (!winBitmap) { - qWarning("QPixmap::fromWinHICON(), failed to CreateDIBSection()"); - return QPixmap(); - } - - HGDIOBJ oldhdc = (HBITMAP)SelectObject(hdc, winBitmap); - if (!DrawIconEx( hdc, 0, 0, icon, w, h, 0, 0, DI_NORMAL)) - qWarning("QPixmap::fromWinHICON(), failed to DrawIcon()"); - - uint mask = 0xff000000; - // Create image and copy data into image. - QImage image(w, h, QImage::Format_ARGB32); - - if (!image.isNull()) { // failed to alloc? - 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 *) (bits + y * bytes_per_line); - for (int x=0; x < w; ++x) { - dest[x] = src[x]; - } - } - } - if (!DrawIconEx( hdc, 0, 0, icon, w, h, 0, 0, DI_MASK)) - qWarning("QPixmap::fromWinHICON(), failed to DrawIcon()"); - if (!image.isNull()) { // failed to alloc? - 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 *) (bits + y * bytes_per_line); - for (int x=0; x < w; ++x) { - if (!src[x]) - dest[x] = dest[x] | mask; - } - } - } - SelectObject(hdc, oldhdc); //restore state - DeleteObject(winBitmap); - DeleteDC(hdc); - return QPixmap::fromImage(image); -} -#endif //ifndef Q_OS_WINCE QT_END_NAMESPACE diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index c84f429e46..7fbb498bbb 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -75,20 +75,8 @@ # endif #endif -#ifdef Q_OS_WINCE -#define CALLBACK_CALL_TYPE __cdecl -#else -#define CALLBACK_CALL_TYPE -#endif - QT_BEGIN_NAMESPACE -#if defined(Q_OS_WINCE) && defined(STANDARDSHELL_UI_MODEL) -# define Q_INTERNAL_WIN_NO_THROW __declspec(nothrow) -#else -# define Q_INTERNAL_WIN_NO_THROW -#endif - // avoid going through QImage::scanLine() which calls detach #define FAST_SCAN_LINE(data, bpl, y) (data + (y) * bpl) @@ -190,7 +178,7 @@ private: extern "C" { static -void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_size_t length) +void iod_read_fn(png_structp png_ptr, png_bytep data, png_size_t length) { QPngHandlerPrivate *d = (QPngHandlerPrivate *)png_get_io_ptr(png_ptr); QIODevice *in = d->q->device(); @@ -215,7 +203,7 @@ void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_siz static -void CALLBACK_CALL_TYPE qpiw_write_fn(png_structp png_ptr, png_bytep data, png_size_t length) +void qpiw_write_fn(png_structp png_ptr, png_bytep data, png_size_t length) { QPNGImageWriter* qpiw = (QPNGImageWriter*)png_get_io_ptr(png_ptr); QIODevice* out = qpiw->device(); @@ -229,7 +217,7 @@ void CALLBACK_CALL_TYPE qpiw_write_fn(png_structp png_ptr, png_bytep data, png_s static -void CALLBACK_CALL_TYPE qpiw_flush_fn(png_structp /* png_ptr */) +void qpiw_flush_fn(png_structp /* png_ptr */) { } @@ -487,7 +475,7 @@ static void read_image_scaled(QImage *outImage, png_structp png_ptr, png_infop i } extern "C" { -static void CALLBACK_CALL_TYPE qt_png_warning(png_structp /*png_ptr*/, png_const_charp message) +static void qt_png_warning(png_structp /*png_ptr*/, png_const_charp message) { qWarning("libpng warning: %s", message); } @@ -495,7 +483,7 @@ static void CALLBACK_CALL_TYPE qt_png_warning(png_structp /*png_ptr*/, png_const } -void Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngTexts(png_info *info) +void QPngHandlerPrivate::readPngTexts(png_info *info) { png_textp text_ptr; int num_text=0; @@ -522,7 +510,7 @@ void Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngTexts(png_info *info) } -bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngHeader() +bool QPngHandlerPrivate::readPngHeader() { state = Error; png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0); @@ -566,7 +554,7 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngHeader() return true; } -bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage) +bool QPngHandlerPrivate::readPngImage(QImage *outImage) { if (state == Error) return false; @@ -810,7 +798,7 @@ bool QPNGImageWriter::writeImage(const QImage& image, int off_x, int off_y) return writeImage(image, -1, QString(), off_x, off_y); } -bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image, volatile int quality_in, const QString &description, +bool QPNGImageWriter::writeImage(const QImage& image, volatile int quality_in, const QString &description, int off_x_in, int off_y_in) { QPoint offset = image.offset(); diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp index 5ae8e893cb..5c8ff84929 100644 --- a/src/gui/image/qxpmhandler.cpp +++ b/src/gui/image/qxpmhandler.cpp @@ -845,7 +845,7 @@ static bool read_xpm_header( if (!read_xpm_string(buf, device, source, index, state)) return false; -#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE) +#ifdef Q_CC_MSVC if (sscanf_s(buf, "%d %d %d %d", w, h, ncols, cpp) < 4) #else if (sscanf(buf, "%d %d %d %d", w, h, ncols, cpp) < 4) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 78a4dc4f35..2b3b153537 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -2065,6 +2065,16 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos) */ /*! + \fn QInputMethodEvent::Attribute::Attribute(AttributeType type, int start, int length) + \overload + \since 5.7 + + Constructs an input method attribute with no value. \a type + specifies the type of attribute, and \a start and \a length + the position of the attribute. +*/ + +/*! Constructs an event of type QEvent::InputMethod. The attributes(), preeditString(), commitString(), replacementStart(), and replacementLength() are initialized to default values. diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 0a207667ad..1c42c61e85 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -535,8 +535,9 @@ public: class Attribute { public: Attribute(AttributeType t, int s, int l, QVariant val) : type(t), start(s), length(l), value(qMove(val)) {} - AttributeType type; + Attribute(AttributeType t, int s, int l) : type(t), start(s), length(l), value() {} + AttributeType type; int start; int length; QVariant value; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index ec1e771b90..3855c9dab9 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -104,13 +104,13 @@ #if defined(Q_OS_MAC) # include "private/qcore_mac_p.h" -#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#elif defined(Q_OS_WIN) # include <QtCore/qt_windows.h> # include <QtCore/QLibraryInfo> # if defined(Q_OS_WINPHONE) # include <Objbase.h> # endif -#endif // Q_OS_WIN && !Q_OS_WINCE +#endif // Q_OS_WIN #include <ctype.h> @@ -1102,12 +1102,12 @@ static void init_platform(const QString &pluginArgument, const QString &platform keys.join(QStringLiteral(", "))); } fatalMessage += QStringLiteral("Reinstalling the application may fix this problem."); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // Windows: Display message box unless it is a console application // or debug build showing an assert box. if (!QLibraryInfo::isDebugBuild() && !GetConsoleWindow()) MessageBox(0, (LPCTSTR)fatalMessage.utf16(), (LPCTSTR)(QCoreApplication::applicationName().utf16()), MB_OK | MB_ICONERROR); -#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT +#endif // Q_OS_WIN && !Q_OS_WINRT qFatal("%s", qPrintable(fatalMessage)); return; } @@ -1310,7 +1310,7 @@ void QGuiApplicationPrivate::init() #ifndef QT_NO_SESSIONMANAGER QString session_id; QString session_key; -# if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +# if defined(Q_OS_WIN) wchar_t guidstr[40]; GUID guid; CoCreateGuid(&guid); diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h index eb3a9d5545..e790e3094f 100644 --- a/src/gui/kernel/qhighdpiscaling_p.h +++ b/src/gui/kernel/qhighdpiscaling_p.h @@ -382,8 +382,7 @@ inline QRegion fromNativeLocalRegion(const QRegion &pixelRegion, const QWindow * qreal scaleFactor = QHighDpiScaling::factor(window); QRegion pointRegion; - const auto rects = pixelRegion.rects(); - for (const QRect &rect : rects) { + for (const QRect &rect : pixelRegion) { pointRegion += QRect(fromNative(rect.topLeft(), scaleFactor), fromNative(rect.size(), scaleFactor)); } @@ -399,7 +398,7 @@ inline QRegion fromNativeLocalExposedRegion(const QRegion &pixelRegion, const QW const qreal scaleFactor = QHighDpiScaling::factor(window); QRegion pointRegion; - foreach (const QRect &rect, pixelRegion.rects()) { + for (const QRect &rect : pixelRegion) { const QPointF topLeftP = QPointF(rect.topLeft()) / scaleFactor; const QPointF bottomRightP = QPointF(rect.bottomRight()) / scaleFactor; pointRegion += QRect(QPoint(qFloor(topLeftP.x()), qFloor(topLeftP.y())), @@ -415,8 +414,7 @@ inline QRegion toNativeLocalRegion(const QRegion &pointRegion, const QWindow *wi qreal scaleFactor = QHighDpiScaling::factor(window); QRegion pixelRegon; - const auto rects = pointRegion.rects(); - for (const QRect &rect : rects) { + for (const QRect &rect : pointRegion) { pixelRegon += QRect(toNative(rect.topLeft(), scaleFactor), toNative(rect.size(), scaleFactor)); } diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp index fe4d167078..c36186b815 100644 --- a/src/gui/kernel/qplatformdialoghelper.cpp +++ b/src/gui/kernel/qplatformdialoghelper.cpp @@ -156,23 +156,33 @@ public: QString windowTitle; }; -QFontDialogOptions::QFontDialogOptions() : d(new QFontDialogOptionsPrivate) +QFontDialogOptions::QFontDialogOptions(QFontDialogOptionsPrivate *dd) + : d(dd) { } -QFontDialogOptions::QFontDialogOptions(const QFontDialogOptions &rhs) : d(rhs.d) +QFontDialogOptions::~QFontDialogOptions() { } -QFontDialogOptions &QFontDialogOptions::operator=(const QFontDialogOptions &rhs) +namespace { + struct FontDialogCombined : QFontDialogOptionsPrivate, QFontDialogOptions + { + FontDialogCombined() : QFontDialogOptionsPrivate(), QFontDialogOptions(this) {} + FontDialogCombined(const FontDialogCombined &other) + : QFontDialogOptionsPrivate(other), QFontDialogOptions(this) {} + }; +} + +// static +QSharedPointer<QFontDialogOptions> QFontDialogOptions::create() { - if (this != &rhs) - d = rhs.d; - return *this; + return QSharedPointer<FontDialogCombined>::create(); } -QFontDialogOptions::~QFontDialogOptions() +QSharedPointer<QFontDialogOptions> QFontDialogOptions::clone() const { + return QSharedPointer<FontDialogCombined>::create(*static_cast<const FontDialogCombined*>(this)); } QString QFontDialogOptions::windowTitle() const @@ -289,23 +299,33 @@ public: QString windowTitle; }; -QColorDialogOptions::QColorDialogOptions() : d(new QColorDialogOptionsPrivate) +QColorDialogOptions::QColorDialogOptions(QColorDialogOptionsPrivate *dd) + : d(dd) { } -QColorDialogOptions::QColorDialogOptions(const QColorDialogOptions &rhs) : d(rhs.d) +QColorDialogOptions::~QColorDialogOptions() { } -QColorDialogOptions &QColorDialogOptions::operator=(const QColorDialogOptions &rhs) +namespace { + struct ColorDialogCombined : QColorDialogOptionsPrivate, QColorDialogOptions + { + ColorDialogCombined() : QColorDialogOptionsPrivate(), QColorDialogOptions(this) {} + ColorDialogCombined(const ColorDialogCombined &other) + : QColorDialogOptionsPrivate(other), QColorDialogOptions(this) {} + }; +} + +// static +QSharedPointer<QColorDialogOptions> QColorDialogOptions::create() { - if (this != &rhs) - d = rhs.d; - return *this; + return QSharedPointer<ColorDialogCombined>::create(); } -QColorDialogOptions::~QColorDialogOptions() +QSharedPointer<QColorDialogOptions> QColorDialogOptions::clone() const { + return QSharedPointer<ColorDialogCombined>::create(*static_cast<const ColorDialogCombined*>(this)); } QString QColorDialogOptions::windowTitle() const @@ -436,23 +456,32 @@ public: QStringList supportedSchemes; }; -QFileDialogOptions::QFileDialogOptions() : d(new QFileDialogOptionsPrivate) +QFileDialogOptions::QFileDialogOptions(QFileDialogOptionsPrivate *dd) + : d(dd) { } -QFileDialogOptions::QFileDialogOptions(const QFileDialogOptions &rhs) : d(rhs.d) +QFileDialogOptions::~QFileDialogOptions() { } -QFileDialogOptions &QFileDialogOptions::operator=(const QFileDialogOptions &rhs) +namespace { + struct FileDialogCombined : QFileDialogOptionsPrivate, QFileDialogOptions + { + FileDialogCombined() : QFileDialogOptionsPrivate(), QFileDialogOptions(this) {} + FileDialogCombined(const FileDialogCombined &other) : QFileDialogOptionsPrivate(other), QFileDialogOptions(this) {} + }; +} + +// static +QSharedPointer<QFileDialogOptions> QFileDialogOptions::create() { - if (this != &rhs) - d = rhs.d; - return *this; + return QSharedPointer<FileDialogCombined>::create(); } -QFileDialogOptions::~QFileDialogOptions() +QSharedPointer<QFileDialogOptions> QFileDialogOptions::clone() const { + return QSharedPointer<FileDialogCombined>::create(*static_cast<const FileDialogCombined*>(this)); } QString QFileDialogOptions::windowTitle() const @@ -728,23 +757,33 @@ public: QPlatformDialogHelper::StandardButtons buttons; }; -QMessageDialogOptions::QMessageDialogOptions() : d(new QMessageDialogOptionsPrivate) +QMessageDialogOptions::QMessageDialogOptions(QMessageDialogOptionsPrivate *dd) + : d(dd) { } -QMessageDialogOptions::QMessageDialogOptions(const QMessageDialogOptions &rhs) : d(rhs.d) +QMessageDialogOptions::~QMessageDialogOptions() { } -QMessageDialogOptions &QMessageDialogOptions::operator=(const QMessageDialogOptions &rhs) +namespace { + struct MessageDialogCombined : QMessageDialogOptionsPrivate, QMessageDialogOptions + { + MessageDialogCombined() : QMessageDialogOptionsPrivate(), QMessageDialogOptions(this) {} + MessageDialogCombined(const MessageDialogCombined &other) + : QMessageDialogOptionsPrivate(other), QMessageDialogOptions(this) {} + }; +} + +// static +QSharedPointer<QMessageDialogOptions> QMessageDialogOptions::create() { - if (this != &rhs) - d = rhs.d; - return *this; + return QSharedPointer<MessageDialogCombined>::create(); } -QMessageDialogOptions::~QMessageDialogOptions() +QSharedPointer<QMessageDialogOptions> QMessageDialogOptions::clone() const { + return QSharedPointer<MessageDialogCombined>::create(*static_cast<const MessageDialogCombined*>(this)); } QString QMessageDialogOptions::windowTitle() const diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h index 825dcf293d..78667643fe 100644 --- a/src/gui/kernel/qplatformdialoghelper.h +++ b/src/gui/kernel/qplatformdialoghelper.h @@ -72,6 +72,8 @@ class QFontDialogOptionsPrivate; class QFileDialogOptionsPrivate; class QMessageDialogOptionsPrivate; +#define QPLATFORMDIALOGHELPERS_HAS_CREATE + class Q_GUI_EXPORT QPlatformDialogHelper : public QObject { Q_OBJECT @@ -176,6 +178,10 @@ QT_BEGIN_NAMESPACE class Q_GUI_EXPORT QColorDialogOptions { Q_GADGET + Q_DISABLE_COPY(QColorDialogOptions) +protected: + explicit QColorDialogOptions(QColorDialogOptionsPrivate *dd); + ~QColorDialogOptions(); public: enum ColorDialogOption { ShowAlphaChannel = 0x00000001, @@ -186,12 +192,8 @@ public: Q_DECLARE_FLAGS(ColorDialogOptions, ColorDialogOption) Q_FLAG(ColorDialogOptions) - QColorDialogOptions(); - QColorDialogOptions(const QColorDialogOptions &rhs); - QColorDialogOptions &operator=(const QColorDialogOptions &rhs); - ~QColorDialogOptions(); - - void swap(QColorDialogOptions &other) { qSwap(d, other.d); } + static QSharedPointer<QColorDialogOptions> create(); + QSharedPointer<QColorDialogOptions> clone() const; QString windowTitle() const; void setWindowTitle(const QString &); @@ -211,11 +213,9 @@ public: static void setStandardColor(int index, QRgb color); private: - QSharedDataPointer<QColorDialogOptionsPrivate> d; + QColorDialogOptionsPrivate *d; }; -Q_DECLARE_SHARED(QColorDialogOptions) - class Q_GUI_EXPORT QPlatformColorDialogHelper : public QPlatformDialogHelper { Q_OBJECT @@ -237,6 +237,11 @@ private: class Q_GUI_EXPORT QFontDialogOptions { Q_GADGET + Q_DISABLE_COPY(QFontDialogOptions) +protected: + explicit QFontDialogOptions(QFontDialogOptionsPrivate *dd); + ~QFontDialogOptions(); + public: enum FontDialogOption { NoButtons = 0x00000001, @@ -250,12 +255,8 @@ public: Q_DECLARE_FLAGS(FontDialogOptions, FontDialogOption) Q_FLAG(FontDialogOptions) - QFontDialogOptions(); - QFontDialogOptions(const QFontDialogOptions &rhs); - QFontDialogOptions &operator=(const QFontDialogOptions &rhs); - ~QFontDialogOptions(); - - void swap(QFontDialogOptions &other) { qSwap(d, other.d); } + static QSharedPointer<QFontDialogOptions> create(); + QSharedPointer<QFontDialogOptions> clone() const; QString windowTitle() const; void setWindowTitle(const QString &); @@ -266,11 +267,9 @@ public: FontDialogOptions options() const; private: - QSharedDataPointer<QFontDialogOptionsPrivate> d; + QFontDialogOptionsPrivate *d; }; -Q_DECLARE_SHARED(QFontDialogOptions) - class Q_GUI_EXPORT QPlatformFontDialogHelper : public QPlatformDialogHelper { Q_OBJECT @@ -292,6 +291,11 @@ private: class Q_GUI_EXPORT QFileDialogOptions { Q_GADGET + Q_DISABLE_COPY(QFileDialogOptions) +protected: + QFileDialogOptions(QFileDialogOptionsPrivate *dd); + ~QFileDialogOptions(); + public: enum ViewMode { Detail, List }; Q_ENUM(ViewMode) @@ -319,12 +323,8 @@ public: Q_DECLARE_FLAGS(FileDialogOptions, FileDialogOption) Q_FLAG(FileDialogOptions) - QFileDialogOptions(); - QFileDialogOptions(const QFileDialogOptions &rhs); - QFileDialogOptions &operator=(const QFileDialogOptions &rhs); - ~QFileDialogOptions(); - - void swap(QFileDialogOptions &other) { qSwap(d, other.d); } + static QSharedPointer<QFileDialogOptions> create(); + QSharedPointer<QFileDialogOptions> clone() const; QString windowTitle() const; void setWindowTitle(const QString &); @@ -383,11 +383,9 @@ public: static QString defaultNameFilterString(); private: - QSharedDataPointer<QFileDialogOptionsPrivate> d; + QFileDialogOptionsPrivate *d; }; -Q_DECLARE_SHARED(QFileDialogOptions) - class Q_GUI_EXPORT QPlatformFileDialogHelper : public QPlatformDialogHelper { Q_OBJECT @@ -423,17 +421,18 @@ private: class Q_GUI_EXPORT QMessageDialogOptions { Q_GADGET + Q_DISABLE_COPY(QMessageDialogOptions) +protected: + QMessageDialogOptions(QMessageDialogOptionsPrivate *dd); + ~QMessageDialogOptions(); + public: // Keep in sync with QMessageBox::Icon enum Icon { NoIcon, Information, Warning, Critical, Question }; Q_ENUM(Icon) - QMessageDialogOptions(); - QMessageDialogOptions(const QMessageDialogOptions &rhs); - QMessageDialogOptions &operator=(const QMessageDialogOptions &rhs); - ~QMessageDialogOptions(); - - void swap(QMessageDialogOptions &other) { qSwap(d, other.d); } + static QSharedPointer<QMessageDialogOptions> create(); + QSharedPointer<QMessageDialogOptions> clone() const; QString windowTitle() const; void setWindowTitle(const QString &); @@ -454,11 +453,9 @@ public: QPlatformDialogHelper::StandardButtons standardButtons() const; private: - QSharedDataPointer<QMessageDialogOptionsPrivate> d; + QMessageDialogOptionsPrivate *d; }; -Q_DECLARE_SHARED(QMessageDialogOptions) - class Q_GUI_EXPORT QPlatformMessageDialogHelper : public QPlatformDialogHelper { Q_OBJECT diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp index d93871c99b..5c05a05d80 100644 --- a/src/gui/opengl/qopenglpaintengine.cpp +++ b/src/gui/opengl/qopenglpaintengine.cpp @@ -1012,11 +1012,11 @@ void QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data, funcs.glStencilMask(0xff); // Enable stencil writes if (dirtyStencilRegion.intersects(currentScissorBounds)) { - QVector<QRect> clearRegion = dirtyStencilRegion.intersected(currentScissorBounds).rects(); + const QRegion clearRegion = dirtyStencilRegion.intersected(currentScissorBounds); funcs.glClearStencil(0); // Clear to zero - for (int i = 0; i < clearRegion.size(); ++i) { + for (const QRect &rect : clearRegion) { #ifndef QT_GL_NO_SCISSOR_TEST - setScissor(clearRegion.at(i)); + setScissor(rect); #endif funcs.glClear(GL_STENCIL_BUFFER_BIT); } diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index a325ee923e..ae6d373f0e 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -4032,7 +4032,7 @@ template<typename T> struct QBlendBase { typedef T BlendType; - QBlendBase(QSpanData *d, Operator o) + QBlendBase(QSpanData *d, const Operator &o) : data(d) , op(o) , dest(0) @@ -4051,7 +4051,7 @@ struct QBlendBase class BlendSrcGeneric : public QBlendBase<uint> { public: - BlendSrcGeneric(QSpanData *d, Operator o) + BlendSrcGeneric(QSpanData *d, const Operator &o) : QBlendBase<uint>(d, o) { } @@ -4077,7 +4077,7 @@ public: class BlendSrcGenericRGB64 : public QBlendBase<QRgba64> { public: - BlendSrcGenericRGB64(QSpanData *d, Operator o) + BlendSrcGenericRGB64(QSpanData *d, const Operator &o) : QBlendBase<QRgba64>(d, o) { } @@ -5758,7 +5758,7 @@ static inline void rgbBlendPixel(quint32 *dst, int coverage, int sr, int sg, int *dst = qRgb(nr, ng, nb); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) Q_GUI_EXPORT bool qt_needs_a8_gamma_correction = false; static inline void grayBlendPixel(quint32 *dst, int coverage, int sr, int sg, int sb, const uint *gamma, const uchar *invgamma) @@ -5795,7 +5795,7 @@ static void qt_alphamapblit_uint32(QRasterBuffer *rasterBuffer, const quint32 c = color; const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint32); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) const QDrawHelperGammaTables *tables = QGuiApplicationPrivate::instance()->gammaTables(); if (!tables) return; @@ -5822,7 +5822,7 @@ static void qt_alphamapblit_uint32(QRasterBuffer *rasterBuffer, } else if (coverage == 255) { dest[i] = c; } else { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && doGrayBlendPixel && qAlpha(dest[i]) == 255) { grayBlendPixel(dest+i, coverage, sr, sg, sb, gamma, invgamma); @@ -5863,7 +5863,7 @@ static void qt_alphamapblit_uint32(QRasterBuffer *rasterBuffer, } else if (coverage == 255) { dest[xp] = c; } else { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && doGrayBlendPixel && qAlpha(dest[xp]) == 255) { grayBlendPixel(dest+xp, coverage, sr, sg, sb, gamma, invgamma); diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 81191d07b8..a50d1dfd73 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -312,7 +312,7 @@ void QBlitterPaintEnginePrivate::updateBrushState(QPainterState *s) { Qt::BrushStyle style = qbrush_style(s->brush); - caps.updateState(STATE_BRUSH_PATTERN, style > Qt::SolidPattern); + caps.updateState(STATE_BRUSH_PATTERN, style != Qt::SolidPattern); caps.updateState(STATE_BRUSH_ALPHA, qbrush_color(s->brush).alpha() < 255); } @@ -374,9 +374,8 @@ void QBlitterPaintEnginePrivate::fillRect(const QRectF &rect, const QColor &colo else pmData->blittable()->fillRect(targetRect & clipData->clipRect, color); } else if (clipData->hasRegionClip) { - QVector<QRect> rects = clipData->clipRegion.rects(); - for (int i = 0; i < rects.size(); ++i) { - QRect intersectRect = rects.at(i).intersected(targetRect.toRect()); + for (const QRect &rect : clipData->clipRegion) { + QRect intersectRect = rect.intersected(targetRect.toRect()); if (!intersectRect.isEmpty()) { unlock(); if (alpha) @@ -609,10 +608,8 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) } } else if (clipData->hasRegionClip) { QRect unclippedTargetRect(x, y, blitWidth, blitHeight); - const QVector<QRect> intersectedRects = clipData->clipRegion.intersected(unclippedTargetRect).rects(); - const int intersectedSize = intersectedRects.size(); - for (int i = 0; i < intersectedSize; ++i) { - const QRect &targetRect = intersectedRects.at(i); + const QRegion targetRegion = clipData->clipRegion.intersected(unclippedTargetRect); + for (const QRect &targetRect : targetRegion) { if (!targetRect.isValid() || targetRect.isEmpty()) continue; int tmpSrcX = srcX + (targetRect.x() - x); @@ -686,9 +683,8 @@ void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const Q if (clipData->hasRectClip) { d->clipAndDrawPixmap(clipData->clipRect, targetRect, pm, sr, canDrawOpacity); } else if (clipData->hasRegionClip) { - QVector<QRect>rects = clipData->clipRegion.rects(); - for (int i = 0; i<rects.size(); ++i) - d->clipAndDrawPixmap(rects.at(i), targetRect, pm, sr, canDrawOpacity); + for (const QRect &rect : clipData->clipRegion) + d->clipAndDrawPixmap(rect, targetRect, pm, sr, canDrawOpacity); } } else { QRectF deviceRect(0, 0, paintDevice()->width(), paintDevice()->height()); diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 4ab029cf7a..00dc4ccb81 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3893,7 +3893,7 @@ void QClipData::setClipRect(const QRect &rect) void QClipData::setClipRegion(const QRegion ®ion) { if (region.rectCount() == 1) { - setClipRect(region.rects().at(0)); + setClipRect(*region.begin()); return; } diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index bcef14ca61..e70079915a 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2835,7 +2835,7 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op) QRect rect = r.boundingRect(); if (qt_show_painter_debug_output) printf("QPainter::setClipRegion(), size=%d, [%d,%d,%d,%d]\n", - r.rects().size(), rect.x(), rect.y(), rect.width(), rect.height()); + r.rectCount(), rect.x(), rect.y(), rect.width(), rect.height()); #endif if (!d->engine) { qWarning("QPainter::setClipRegion: Painter not active"); @@ -6473,6 +6473,8 @@ void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QText extended->drawTextItem(QPointF(x, y), ti2); else engine->drawTextItem(QPointF(x, y), ti2); + drawTextItemDecoration(q, p, ti2.fontEngine, textEngine, ti2.underlineStyle, + ti2.flags, ti2.width.toReal(), ti2.charFormat); if (!rtl) x += ti2.width.toReal(); @@ -6504,6 +6506,8 @@ void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QText extended->drawTextItem(QPointF(x, y), ti2); else engine->drawTextItem(QPointF(x,y), ti2); + drawTextItemDecoration(q, p, ti2.fontEngine, textEngine, ti2.underlineStyle, + ti2.flags, ti2.width.toReal(), ti2.charFormat); // reset the high byte for all glyphs const int hi = which << 24; @@ -6515,9 +6519,9 @@ void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QText extended->drawTextItem(p, ti); else engine->drawTextItem(p, ti); + drawTextItemDecoration(q, p, ti.fontEngine, textEngine, ti.underlineStyle, + ti.flags, ti.width.toReal(), ti.charFormat); } - drawTextItemDecoration(q, p, ti.fontEngine, textEngine, ti.underlineStyle, - ti.flags, ti.width.toReal(), ti.charFormat); if (state->renderHints != oldRenderHints) { state->renderHints = oldRenderHints; diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index ba14a45d4a..7072a2d79c 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -1294,10 +1294,9 @@ void QPainterPath::addRegion(const QRegion ®ion) ensureData(); detach(); - QVector<QRect> rects = region.rects(); - d_func()->elements.reserve(rects.size() * 5); - for (int i=0; i<rects.size(); ++i) - addRect(rects.at(i)); + d_func()->elements.reserve(region.rectCount() * 5); + for (const QRect &rect : region) + addRect(rect); } diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index f83f1c997e..86f176bc99 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1078,9 +1078,8 @@ void QPdfEngine::updateState(const QPaintEngineState &state) } else if (flags & DirtyClipRegion) { d->clipEnabled = true; QPainterPath path; - QVector<QRect> rects = state.clipRegion().rects(); - for (int i = 0; i < rects.size(); ++i) - path.addRect(rects.at(i)); + for (const QRect &rect : state.clipRegion()) + path.addRect(rect); updateClipPath(path, state.clipOperation()); flags |= DirtyClipPath; } else if (flags & DirtyClipEnabled) { diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index 6cec4a0a8d..61975ee045 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -250,9 +250,8 @@ static QRegion deviceRegion(const QRegion ®ion, QWindow *window, const QPoint return region; QVector<QRect> rects; - const QVector<QRect> regionRects = region.rects(); - rects.reserve(regionRects.count()); - for (const QRect &rect : regionRects) + rects.reserve(region.rectCount()); + for (const QRect &rect : region) rects.append(deviceRect(rect.translated(offset), window)); QRegion deviceRegion; diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 35c4abb3ac..b70257a00f 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -81,8 +81,8 @@ QT_BEGIN_NAMESPACE contains() a QPoint or QRect. The bounding rectangle can be found with boundingRect(). - The function rects() gives a decomposition of the region into - rectangles. + Iteration over the region (with begin(), end()) gives a decomposition of + the region into rectangles. The same sequence of rectangles is returned by rects(). Example of using complex regions: \snippet code/src_gui_painting_qregion.cpp 0 @@ -395,23 +395,24 @@ void QRegion::exec(const QByteArray &buffer, int ver, QDataStream::ByteOrder byt QDataStream &operator<<(QDataStream &s, const QRegion &r) { - QVector<QRect> a = r.rects(); - if (a.isEmpty()) { + auto b = r.begin(), e = r.end(); + if (b == e) { s << (quint32)0; } else { + const auto size = e - b; if (s.version() == 1) { - int i; - for (i = a.size() - 1; i > 0; --i) { + for (auto i = size - 1; i > 0; --i) { s << (quint32)(12 + i * 24); s << (int)QRGN_OR; } - for (i = 0; i < a.size(); ++i) { - s << (quint32)(4+8) << (int)QRGN_SETRECT << a[i]; - } + for (auto it = b; it != e; ++it) + s << (quint32)(4+8) << (int)QRGN_SETRECT << *it; } else { - s << (quint32)(4 + 4 + 16 * a.size()); // 16: storage size of QRect + s << quint32(4 + 4 + 16 * size); // 16: storage size of QRect s << (qint32)QRGN_RECTS; - s << a; + s << quint32(size); + for (auto it = b; it != e; ++it) + s << *it; } } return s; @@ -722,12 +723,9 @@ bool QRegion::intersects(const QRegion ®ion) const if (rectCount() == 1 && region.rectCount() == 1) return true; - const QVector<QRect> myRects = rects(); - const QVector<QRect> otherRects = region.rects(); - - for (QVector<QRect>::const_iterator i1 = myRects.constBegin(); i1 < myRects.constEnd(); ++i1) - for (QVector<QRect>::const_iterator i2 = otherRects.constBegin(); i2 < otherRects.constEnd(); ++i2) - if (rect_intersects(*i1, *i2)) + for (const QRect &myRect : *this) + for (const QRect &otherRect : region) + if (rect_intersects(myRect, otherRect)) return true; return false; } @@ -928,6 +926,100 @@ QRegion QRegion::intersect(const QRect &r) const */ /*! + \typedef QRegion::const_iterator + \since 5.8 + + An iterator over the QRects that make up the region. + + QRegion does not offer mutable iterators. + + \sa begin(), end() +*/ + +/*! + \typedef QRegion::const_reverse_iterator + \since 5.8 + + A reverse iterator over the QRects that make up the region. + + QRegion does not offer mutable iterators. + + \sa rbegin(), rend() +*/ + +/*! + \fn QRegion::begin() const + \since 5.8 + + Returns a const_iterator pointing to the beginning of the range of + rectangles that make up this range, in the order in which rects() + returns them. + + \sa rbegin(), cbegin(), end() +*/ + +/*! + \fn QRegion::cbegin() const + \since 5.8 + + Same as begin(). +*/ + +/*! + \fn QRegion::end() const + \since 5.8 + + Returns a const_iterator pointing to one past the end of the range of + rectangles that make up this range, in the order in which rects() + returns them. + + \sa rend(), cend(), begin() +*/ + +/*! + \fn QRegion::cend() const + \since 5.8 + + Same as end(). +*/ + +/*! + \fn QRegion::rbegin() const + \since 5.8 + + Returns a const_reverse_iterator pointing to the beginning of the range of + rectangles that make up this range, in the reverse order in which rects() + returns them. + + \sa begin(), crbegin(), rend() +*/ + +/*! + \fn QRegion::crbegin() const + \since 5.8 + + Same as rbegin(). +*/ + +/*! + \fn QRegion::rend() const + \since 5.8 + + Returns a const_reverse_iterator pointing to one past the end of the range of + rectangles that make up this range, in the reverse order in which rects() + returns them. + + \sa end(), crend(), rbegin() +*/ + +/*! + \fn QRegion::crend() const + \since 5.8 + + Same as rend(). +*/ + +/*! \fn void QRegion::setRects(const QRect *rects, int number) Sets the region using the array of rectangles specified by \a rects and @@ -1057,13 +1149,11 @@ Q_GUI_EXPORT QPainterPath qt_regionToPath(const QRegion ®ion) return result; } - const QVector<QRect> rects = region.rects(); + auto rect = region.begin(); + const auto end = region.end(); QVarLengthArray<Segment> segments; - segments.resize(4 * rects.size()); - - const QRect *rect = rects.constData(); - const QRect *end = rect + rects.size(); + segments.resize(4 * (end - rect)); int lastRowSegmentCount = 0; Segment *lastRowSegments = 0; @@ -1171,6 +1261,12 @@ struct QRegionPrivate { } } + const QRect *begin() const Q_DECL_NOTHROW + { return numRects == 1 ? &extents : rects.data(); } // avoid vectorize() + + const QRect *end() const Q_DECL_NOTHROW + { return begin() + numRects; } + inline void append(const QRect *r); void append(const QRegionPrivate *r); void prepend(const QRect *r); @@ -4248,6 +4344,16 @@ QVector<QRect> QRegion::rects() const } } +QRegion::const_iterator QRegion::begin() const Q_DECL_NOTHROW +{ + return d->qt_rgn ? d->qt_rgn->begin() : nullptr; +} + +QRegion::const_iterator QRegion::end() const Q_DECL_NOTHROW +{ + return d->qt_rgn ? d->qt_rgn->end() : nullptr; +} + void QRegion::setRects(const QRect *rects, int num) { *this = QRegion(); @@ -4310,10 +4416,10 @@ bool QRegion::intersects(const QRect &rect) const if (d->qt_rgn->numRects == 1) return true; - const QVector<QRect> myRects = rects(); - for (QVector<QRect>::const_iterator it = myRects.constBegin(); it < myRects.constEnd(); ++it) - if (rect_intersects(r, *it)) + for (const QRect &rect : *this) { + if (rect_intersects(r, rect)) return true; + } return false; } diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h index d66f80fcde..f00b1fd284 100644 --- a/src/gui/painting/qregion.h +++ b/src/gui/painting/qregion.h @@ -81,6 +81,18 @@ public: bool isEmpty() const; bool isNull() const; + typedef const QRect *const_iterator; + typedef std::reverse_iterator<const_iterator> const_reverse_iterator; + + const_iterator begin() const Q_DECL_NOTHROW; + const_iterator cbegin() const Q_DECL_NOTHROW { return begin(); } + const_iterator end() const Q_DECL_NOTHROW; + const_iterator cend() const Q_DECL_NOTHROW { return end(); } + const_reverse_iterator rbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); } + const_reverse_iterator crbegin() const Q_DECL_NOTHROW { return rbegin(); } + const_reverse_iterator rend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); } + const_reverse_iterator crend() const Q_DECL_NOTHROW { return rend(); } + bool contains(const QPoint &p) const; bool contains(const QRect &r) const; diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index d2c3eceeef..bfc8551a9b 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -247,6 +247,7 @@ void QTextureGlyphCache::fillInPendingGlyphs() resizeCache(qNextPowerOfTwo(requiredWidth - 1), qNextPowerOfTwo(requiredHeight - 1)); } + beginFillTexture(); { QHash<GlyphAndSubPixelPosition, Coord>::iterator iter = m_pendingGlyphs.begin(); while (iter != m_pendingGlyphs.end()) { @@ -256,6 +257,7 @@ void QTextureGlyphCache::fillInPendingGlyphs() ++iter; } } + endFillTexture(); m_pendingGlyphs.clear(); } diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h index 14271ccc65..a8efb4abb1 100644 --- a/src/gui/painting/qtextureglyphcache_p.h +++ b/src/gui/painting/qtextureglyphcache_p.h @@ -117,7 +117,9 @@ public: virtual void resizeTextureData(int width, int height) = 0; virtual int glyphPadding() const { return 0; } + virtual void beginFillTexture() { } virtual void fillTexture(const Coord &coord, glyph_t glyph, QFixed subPixelPosition) = 0; + virtual void endFillTexture() { } inline void createCache(int width, int height) { m_w = width; diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp index ff2497817e..2278378613 100644 --- a/src/gui/text/qabstracttextdocumentlayout.cpp +++ b/src/gui/text/qabstracttextdocumentlayout.cpp @@ -602,9 +602,32 @@ QTextDocument *QAbstractTextDocumentLayout::document() const */ QString QAbstractTextDocumentLayout::anchorAt(const QPointF& pos) const { + QTextCharFormat fmt = formatAt(pos).toCharFormat(); + return fmt.anchorHref(); +} + +/*! + \since 5.8 + + Returns the source of the image at the given position \a pos, or an empty + string if no image exists at that point. +*/ +QString QAbstractTextDocumentLayout::imageAt(const QPointF &pos) const +{ + QTextImageFormat fmt = formatAt(pos).toImageFormat(); + return fmt.name(); +} + +/*! + \since 5.8 + + Returns the text format at the given position \a pos. +*/ +QTextFormat QAbstractTextDocumentLayout::formatAt(const QPointF &pos) const +{ int cursorPos = hitTest(pos, Qt::ExactHit); if (cursorPos == -1) - return QString(); + return QTextFormat(); // compensate for preedit in the hit text block QTextBlock block = document()->firstBlock(); @@ -623,8 +646,7 @@ QString QAbstractTextDocumentLayout::anchorAt(const QPointF& pos) const QTextDocumentPrivate *pieceTable = qobject_cast<const QTextDocument *>(parent())->docHandle(); QTextDocumentPrivate::FragmentIterator it = pieceTable->find(cursorPos); - QTextCharFormat fmt = pieceTable->formatCollection()->charFormat(it->format); - return fmt.anchorHref(); + return pieceTable->formatCollection()->format(it->format); } /*! diff --git a/src/gui/text/qabstracttextdocumentlayout.h b/src/gui/text/qabstracttextdocumentlayout.h index 01704fe37b..e2fad12ad3 100644 --- a/src/gui/text/qabstracttextdocumentlayout.h +++ b/src/gui/text/qabstracttextdocumentlayout.h @@ -82,7 +82,10 @@ public: virtual void draw(QPainter *painter, const PaintContext &context) = 0; virtual int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const = 0; + QString anchorAt(const QPointF& pos) const; + QString imageAt(const QPointF &pos) const; + QTextFormat formatAt(const QPointF &pos) const; virtual int pageCount() const = 0; virtual QSizeF documentSize() const = 0; diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index b9e05e726e..4782ef5e20 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -899,7 +899,7 @@ static QBrush brushFromData(const BrushData& c, const QPalette &pal) } } -static BorderStyle parseStyleValue(QCss::Value v) +static BorderStyle parseStyleValue(const QCss::Value &v) { if (v.type == Value::KnownIdentifier) { switch (v.variant.toInt()) { diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp index d90134482d..d4bd975eca 100644 --- a/src/gui/text/qdistancefield.cpp +++ b/src/gui/text/qdistancefield.cpp @@ -45,6 +45,8 @@ QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcDistanceField, "qt.distanceField"); + namespace { enum FillHDir @@ -734,8 +736,45 @@ static bool imageHasNarrowOutlines(const QImage &im) return minHThick == 1 || minVThick == 1; } +static int QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE = 54; +static int QT_DISTANCEFIELD_DEFAULT_TILESIZE = 64; +static int QT_DISTANCEFIELD_DEFAULT_SCALE = 16; +static int QT_DISTANCEFIELD_DEFAULT_RADIUS = 80; +static int QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT = 2000; + +static void initialDistanceFieldFactor() +{ + static bool initialized = false; + if (initialized) + return; + initialized = true; + + if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE")) { + QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE"); + qCDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE:" << QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE; + } + + if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_TILESIZE")) { + QT_DISTANCEFIELD_DEFAULT_TILESIZE = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_TILESIZE"); + qCDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_TILESIZE:" << QT_DISTANCEFIELD_DEFAULT_TILESIZE; + } + if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_SCALE")) { + QT_DISTANCEFIELD_DEFAULT_SCALE = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_SCALE"); + qCDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_SCALE:" << QT_DISTANCEFIELD_DEFAULT_SCALE; + } + if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_RADIUS")) { + QT_DISTANCEFIELD_DEFAULT_RADIUS = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_RADIUS"); + qDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_RADIUS:" << QT_DISTANCEFIELD_DEFAULT_RADIUS; + } + if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT")) { + QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT"); + qCDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT:" << QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT; + } +} + bool qt_fontHasNarrowOutlines(QFontEngine *fontEngine) { + initialDistanceFieldFactor(); QFontEngine *fe = fontEngine->cloneWithSize(QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE); if (!fe) return false; @@ -755,6 +794,7 @@ bool qt_fontHasNarrowOutlines(QFontEngine *fontEngine) bool qt_fontHasNarrowOutlines(const QRawFont &f) { QRawFont font = f; + initialDistanceFieldFactor(); font.setPixelSize(QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE); if (!font.isValid()) return false; @@ -767,6 +807,51 @@ bool qt_fontHasNarrowOutlines(const QRawFont &f) QRawFont::PixelAntialiasing)); } +int QT_DISTANCEFIELD_BASEFONTSIZE(bool narrowOutlineFont) +{ + initialDistanceFieldFactor(); + + if (Q_UNLIKELY(narrowOutlineFont)) + return QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE * 2; + else + return QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE; +} + +int QT_DISTANCEFIELD_TILESIZE(bool narrowOutlineFont) +{ + initialDistanceFieldFactor(); + + if (Q_UNLIKELY(narrowOutlineFont)) + return QT_DISTANCEFIELD_DEFAULT_TILESIZE * 2; + else + return QT_DISTANCEFIELD_DEFAULT_TILESIZE; +} + +int QT_DISTANCEFIELD_SCALE(bool narrowOutlineFont) +{ + initialDistanceFieldFactor(); + + if (Q_UNLIKELY(narrowOutlineFont)) + return QT_DISTANCEFIELD_DEFAULT_SCALE / 2; + else + return QT_DISTANCEFIELD_DEFAULT_SCALE; +} + +int QT_DISTANCEFIELD_RADIUS(bool narrowOutlineFont) +{ + initialDistanceFieldFactor(); + + if (Q_UNLIKELY(narrowOutlineFont)) + return QT_DISTANCEFIELD_DEFAULT_RADIUS / 2; + else + return QT_DISTANCEFIELD_DEFAULT_RADIUS; +} + +int QT_DISTANCEFIELD_HIGHGLYPHCOUNT() +{ + initialDistanceFieldFactor(); + return QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT; +} QDistanceFieldData::QDistanceFieldData(const QDistanceFieldData &other) : QSharedData(other) diff --git a/src/gui/text/qdistancefield_p.h b/src/gui/text/qdistancefield_p.h index 7cd385587b..3076a90b9d 100644 --- a/src/gui/text/qdistancefield_p.h +++ b/src/gui/text/qdistancefield_p.h @@ -54,31 +54,20 @@ #include <qrawfont.h> #include <private/qfontengine_p.h> #include <QtCore/qshareddata.h> +#include <QtCore/qglobal.h> +#include <QLoggingCategory> QT_BEGIN_NAMESPACE -#define QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE 54 -#define QT_DISTANCEFIELD_DEFAULT_TILESIZE 64 -#define QT_DISTANCEFIELD_DEFAULT_SCALE 16 -#define QT_DISTANCEFIELD_DEFAULT_RADIUS 80 -#define QT_DISTANCEFIELD_HIGHGLYPHCOUNT 2000 - -#define QT_DISTANCEFIELD_BASEFONTSIZE(NarrowOutlineFont) \ - (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE * 2 : \ - QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE) -#define QT_DISTANCEFIELD_TILESIZE(NarrowOutlineFont) \ - (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_TILESIZE * 2 : \ - QT_DISTANCEFIELD_DEFAULT_TILESIZE) -#define QT_DISTANCEFIELD_SCALE(NarrowOutlineFont) \ - (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_SCALE / 2 : \ - QT_DISTANCEFIELD_DEFAULT_SCALE) -#define QT_DISTANCEFIELD_RADIUS(NarrowOutlineFont) \ - (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_RADIUS / 2 : \ - QT_DISTANCEFIELD_DEFAULT_RADIUS) - bool Q_GUI_EXPORT qt_fontHasNarrowOutlines(const QRawFont &f); bool Q_GUI_EXPORT qt_fontHasNarrowOutlines(QFontEngine *fontEngine); +int Q_GUI_EXPORT QT_DISTANCEFIELD_BASEFONTSIZE(bool narrowOutlineFont); +int Q_GUI_EXPORT QT_DISTANCEFIELD_TILESIZE(bool narrowOutlineFont); +int Q_GUI_EXPORT QT_DISTANCEFIELD_SCALE(bool narrowOutlineFont); +int Q_GUI_EXPORT QT_DISTANCEFIELD_RADIUS(bool narrowOutlineFont); +int Q_GUI_EXPORT QT_DISTANCEFIELD_HIGHGLYPHCOUNT(); + class Q_GUI_EXPORT QDistanceFieldData : public QSharedData { public: diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index f50f771c07..3a08176044 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -3141,7 +3141,7 @@ void QTextHtmlExporter::emitTable(const QTextTable *table) html += QLatin1String("</table>"); } -void QTextHtmlExporter::emitFrame(QTextFrame::Iterator frameIt) +void QTextHtmlExporter::emitFrame(const QTextFrame::Iterator &frameIt) { if (!frameIt.atEnd()) { QTextFrame::Iterator next = frameIt; diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 93071aaf59..df0d52d8e9 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -1077,8 +1077,9 @@ void QTextDocumentPrivate::appendUndoItem(const QTextUndoCommand &c) QTextUndoCommand &last = undoStack[undoState - 1]; if ( (last.block_part && c.block_part && !last.block_end) // part of the same block => can merge - || (!c.block_part && !last.block_part)) { // two single undo items => can merge - + || (!c.block_part && !last.block_part) // two single undo items => can merge + || (c.command == QTextUndoCommand::Inserted && last.command == c.command && (last.block_part && !c.block_part))) { + // two sequential inserts that are not part of the same block => can merge if (last.tryMerge(c)) return; } diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h index 34849df0bb..caa63e15d2 100644 --- a/src/gui/text/qtextdocument_p.h +++ b/src/gui/text/qtextdocument_p.h @@ -378,7 +378,7 @@ private: enum StyleMode { EmitStyleTag, OmitStyleTag }; enum FrameType { TextFrame, TableFrame, RootFrame }; - void emitFrame(QTextFrame::Iterator frameIt); + void emitFrame(const QTextFrame::Iterator &frameIt); void emitTextFrame(const QTextFrame *frame); void emitBlock(const QTextBlock &block); void emitTable(const QTextTable *table); diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index c26fd08c41..a8b57d6dfd 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -295,7 +295,7 @@ static inline bool isEmptyBlockBeforeTable(const QTextBlock &block, const QTextB ; } -static inline bool isEmptyBlockBeforeTable(QTextFrame::Iterator it) +static inline bool isEmptyBlockBeforeTable(const QTextFrame::Iterator &it) { QTextFrame::Iterator next = it; ++next; if (it.currentFrame()) @@ -419,7 +419,7 @@ static bool operator<(int pos, const QCheckPoint &checkPoint) #endif -static void fillBackground(QPainter *p, const QRectF &rect, QBrush brush, const QPointF &origin, QRectF gradientRect = QRectF()) +static void fillBackground(QPainter *p, const QRectF &rect, QBrush brush, const QPointF &origin, const QRectF &gradientRect = QRectF()) { p->save(); if (brush.style() >= Qt::LinearGradientPattern && brush.style() <= Qt::ConicalGradientPattern) { @@ -1504,7 +1504,7 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p painter->restore(); } -static QFixed flowPosition(const QTextFrame::iterator it) +static QFixed flowPosition(const QTextFrame::iterator &it) { if (it.atEnd()) return 0; diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index fa73507c16..8e03797080 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -843,7 +843,7 @@ enum JustificationClass { Adds an inter character justification opportunity after the number or letter character and a space justification opportunity after the space character. */ -static inline void qt_getDefaultJustificationOpportunities(const ushort *string, int length, QGlyphLayout g, ushort *log_clusters, int spaceAs) +static inline void qt_getDefaultJustificationOpportunities(const ushort *string, int length, const QGlyphLayout &g, ushort *log_clusters, int spaceAs) { int str_pos = 0; while (str_pos < length) { @@ -877,7 +877,7 @@ static inline void qt_getDefaultJustificationOpportunities(const ushort *string, } } -static inline void qt_getJustificationOpportunities(const ushort *string, int length, const QScriptItem &si, QGlyphLayout g, ushort *log_clusters) +static inline void qt_getJustificationOpportunities(const ushort *string, int length, const QScriptItem &si, const QGlyphLayout &g, ushort *log_clusters) { Q_ASSERT(length > 0 && g.numGlyphs > 0); @@ -3508,7 +3508,7 @@ QTextItemInt QTextItemInt::midItem(QFontEngine *fontEngine, int firstGlyphIndex, } -QTransform qt_true_matrix(qreal w, qreal h, QTransform x) +QTransform qt_true_matrix(qreal w, qreal h, const QTransform &x) { QRectF rect = x.mapRect(QRectF(0, 0, w, h)); return x * QTransform::fromTranslate(-rect.x(), -rect.y()); diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 128966a35a..83f2a9bc25 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -975,7 +975,7 @@ void QTextLayout::setFlags(int flags) } static void addSelectedRegionsToPath(QTextEngine *eng, int lineNumber, const QPointF &pos, QTextLayout::FormatRange *selection, - QPainterPath *region, QRectF boundingRect) + QPainterPath *region, const QRectF &boundingRect) { const QScriptLine &line = eng->lines[lineNumber]; @@ -1326,7 +1326,11 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition && (p->transform().type() > QTransform::TxTranslate); if (toggleAntialiasing) p->setRenderHint(QPainter::Antialiasing); + QPainter::CompositionMode origCompositionMode = p->compositionMode(); + if (p->paintEngine()->hasFeature(QPaintEngine::RasterOpModes)) + p->setCompositionMode(QPainter::RasterOp_NotDestination); p->fillRect(QRectF(x, y, qreal(width), (base + descent).toReal()), p->pen().brush()); + p->setCompositionMode(origCompositionMode); if (toggleAntialiasing) p->setRenderHint(QPainter::Antialiasing, false); if (d->layoutData->hasBidi) { diff --git a/src/network/access/access.pri b/src/network/access/access.pri index 42c7c80f3b..17897ca869 100644 --- a/src/network/access/access.pri +++ b/src/network/access/access.pri @@ -37,7 +37,8 @@ HEADERS += \ access/qnetworkdiskcache.h \ access/qhttpthreaddelegate_p.h \ access/qhttpmultipart.h \ - access/qhttpmultipart_p.h + access/qhttpmultipart_p.h \ + access/qnetworkfile_p.h SOURCES += \ access/qftp.cpp \ @@ -68,7 +69,8 @@ SOURCES += \ access/qabstractnetworkcache.cpp \ access/qnetworkdiskcache.cpp \ access/qhttpthreaddelegate.cpp \ - access/qhttpmultipart.cpp + access/qhttpmultipart.cpp \ + access/qnetworkfile.cpp mac: LIBS_PRIVATE += -framework Security diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index d2b1a8a912..ed586c1de5 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1523,27 +1523,35 @@ void QNetworkAccessManagerPrivate::clearCache(QNetworkAccessManager *manager) manager->d_func()->objectCache.clear(); manager->d_func()->authenticationManager->clearCache(); - if (manager->d_func()->httpThread) { - manager->d_func()->httpThread->quit(); - manager->d_func()->httpThread->wait(5000); - if (manager->d_func()->httpThread->isFinished()) - delete manager->d_func()->httpThread; - else - QObject::connect(manager->d_func()->httpThread, SIGNAL(finished()), manager->d_func()->httpThread, SLOT(deleteLater())); - manager->d_func()->httpThread = 0; - } + manager->d_func()->destroyThread(); } QNetworkAccessManagerPrivate::~QNetworkAccessManagerPrivate() { - if (httpThread) { - httpThread->quit(); - httpThread->wait(5000); - if (httpThread->isFinished()) - delete httpThread; + destroyThread(); +} + +QThread * QNetworkAccessManagerPrivate::createThread() +{ + if (!thread) { + thread = new QThread; + thread->setObjectName(QStringLiteral("QNetworkAccessManager thread")); + thread->start(); + } + Q_ASSERT(thread); + return thread; +} + +void QNetworkAccessManagerPrivate::destroyThread() +{ + if (thread) { + thread->quit(); + thread->wait(5000); + if (thread->isFinished()) + delete thread; else - QObject::connect(httpThread, SIGNAL(finished()), httpThread, SLOT(deleteLater())); - httpThread = 0; + QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); + thread = 0; } } diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index 4efa30df49..9d02fd7c34 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -172,6 +172,7 @@ private: friend class QNetworkReplyImplPrivate; friend class QNetworkReplyHttpImpl; friend class QNetworkReplyHttpImplPrivate; + friend class QNetworkReplyFileImpl; Q_DECLARE_PRIVATE(QNetworkAccessManager) Q_PRIVATE_SLOT(d_func(), void _q_replyFinished()) diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 413de2a4fe..48270f0c17 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -74,7 +74,7 @@ class QNetworkAccessManagerPrivate: public QObjectPrivate public: QNetworkAccessManagerPrivate() : networkCache(0), cookieJar(0), - httpThread(0), + thread(0), #ifndef QT_NO_NETWORKPROXY proxyFactory(0), #endif @@ -107,6 +107,9 @@ public: } ~QNetworkAccessManagerPrivate(); + QThread * createThread(); + void destroyThread(); + void _q_replyFinished(); void _q_replyEncrypted(); void _q_replySslErrors(const QList<QSslError> &errors); @@ -158,7 +161,7 @@ public: QNetworkCookieJar *cookieJar; - QThread *httpThread; + QThread *thread; #ifndef QT_NO_NETWORKPROXY diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index 99e67cb463..68c962636e 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -421,7 +421,7 @@ QIODevice *QNetworkDiskCache::data(const QUrl &url) // ### verify that QFile uses the fd size and not the file name qint64 size = file->size() - file->pos(); const uchar *p = 0; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_INTEGRITY) +#if !defined(Q_OS_INTEGRITY) p = file->map(file->pos(), size); #endif if (p) { diff --git a/config.tests/unix/openvg/openvg.cpp b/src/network/access/qnetworkfile.cpp index a322db4824..374dd26e2e 100644 --- a/config.tests/unix/openvg/openvg.cpp +++ b/src/network/access/qnetworkfile.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -37,19 +37,56 @@ ** ****************************************************************************/ -// There is some variation in OpenVG engines as to what case -// the VG includes use. The Khronos reference implementation -// for OpenVG 1.1 uses upper case, so we treat that as canonical. -#if defined(QT_LOWER_CASE_VG_INCLUDES) -#include <vg/openvg.h> -#else -#include <VG/openvg.h> -#endif +#include "qnetworkfile_p.h" -int main(int, char **) +#include <QtCore/QDebug> +#include <QNetworkReply> +#include <QtCore/QDateTime> +#include <QtCore/QFileInfo> +#include <QtCore/QMetaObject> +#include <QtCore/QCoreApplication> + +QT_BEGIN_NAMESPACE + +QNetworkFile::QNetworkFile() + : QFile() +{ +} + +QNetworkFile::QNetworkFile(const QString &name) + : QFile(name) +{ +} + +void QNetworkFile::open() +{ + bool opened = false; + QFileInfo fi(fileName()); + if (fi.isDir()) { + QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", + "Cannot open %1: Path is a directory").arg(fileName()); + error(QNetworkReply::ContentOperationNotPermittedError, msg); + } else { + headerRead(QNetworkRequest::LastModifiedHeader, QVariant::fromValue(fi.lastModified())); + headerRead(QNetworkRequest::ContentLengthHeader, QVariant::fromValue(fi.size())); + opened = QFile::open(QIODevice::ReadOnly | QIODevice::Unbuffered); + if (!opened) { + QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", + "Error opening %1: %2").arg(fileName(), errorString()); + if (exists()) + error(QNetworkReply::ContentAccessDenied, msg); + else + error(QNetworkReply::ContentNotFoundError, msg); + } + } + finished(opened); +} + +void QNetworkFile::close() { - VGint i; - i = 2; - vgFlush(); - return 0; + // This override is needed because 'using' keyword cannot be used for slots. And the base + // function is not an invokable/slot function. + QFile::close(); } + +QT_END_NAMESPACE diff --git a/config.tests/unix/shivavg/shivavg.cpp b/src/network/access/qnetworkfile_p.h index 33fb7d226d..7794c0f18a 100644 --- a/config.tests/unix/shivavg/shivavg.cpp +++ b/src/network/access/qnetworkfile_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the config.tests of the Qt Toolkit. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -37,13 +37,43 @@ ** ****************************************************************************/ -#include <vg/openvg.h> +#ifndef QNETWORKFILE_H +#define QNETWORKFILE_H -int main(int, char **) +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the Network Access API. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include <QFile> +#include <qnetworkreply.h> + +QT_BEGIN_NAMESPACE + +class QNetworkFile : public QFile { - VGint i; - i = 2; - vgFlush(); - vgDestroyContextSH(); - return 0; -} + Q_OBJECT +public: + QNetworkFile(); + QNetworkFile(const QString &name); + using QFile::open; + +public Q_SLOTS: + void open(); + void close() Q_DECL_OVERRIDE; + +Q_SIGNALS: + void finished(bool ok); + void headerRead(QNetworkRequest::KnownHeaders header, const QVariant &value); + void error(QNetworkReply::NetworkError error, const QString &message); +}; + +QT_END_NAMESPACE + +#endif // QNETWORKFILE_H diff --git a/src/network/access/qnetworkreplyfileimpl.cpp b/src/network/access/qnetworkreplyfileimpl.cpp index 36bc4b41df..ef319ebf0d 100644 --- a/src/network/access/qnetworkreplyfileimpl.cpp +++ b/src/network/access/qnetworkreplyfileimpl.cpp @@ -40,31 +40,45 @@ #include "qnetworkreplyfileimpl_p.h" #include "QtCore/qdatetime.h" +#include "qnetworkaccessmanager_p.h" #include <QtCore/QCoreApplication> #include <QtCore/QFileInfo> +#include <QtCore/QThread> +#include "qnetworkfile_p.h" +#include "qnetworkrequest.h" QT_BEGIN_NAMESPACE QNetworkReplyFileImplPrivate::QNetworkReplyFileImplPrivate() - : QNetworkReplyPrivate(), realFileSize(0) + : QNetworkReplyPrivate(), managerPrivate(0), realFile(0) { + qRegisterMetaType<QNetworkRequest::KnownHeaders>(); + qRegisterMetaType<QNetworkReply::NetworkError>(); } QNetworkReplyFileImpl::~QNetworkReplyFileImpl() { + QNetworkReplyFileImplPrivate *d = (QNetworkReplyFileImplPrivate*) d_func(); + if (d->realFile) { + if (d->realFile->thread() == QThread::currentThread()) + delete d->realFile; + else + QMetaObject::invokeMethod(d->realFile, "deleteLater", Qt::QueuedConnection); + } } -QNetworkReplyFileImpl::QNetworkReplyFileImpl(QObject *parent, const QNetworkRequest &req, const QNetworkAccessManager::Operation op) - : QNetworkReply(*new QNetworkReplyFileImplPrivate(), parent) +QNetworkReplyFileImpl::QNetworkReplyFileImpl(QNetworkAccessManager *manager, const QNetworkRequest &req, const QNetworkAccessManager::Operation op) + : QNetworkReply(*new QNetworkReplyFileImplPrivate(), manager) { setRequest(req); setUrl(req.url()); setOperation(op); - setFinished(true); QNetworkReply::open(QIODevice::ReadOnly); QNetworkReplyFileImplPrivate *d = (QNetworkReplyFileImplPrivate*) d_func(); + d->managerPrivate = manager->d_func(); + QUrl url = req.url(); if (url.host() == QLatin1String("localhost")) url.setHost(QString()); @@ -77,7 +91,7 @@ QNetworkReplyFileImpl::QNetworkReplyFileImpl(QObject *parent, const QNetworkRequ setError(QNetworkReply::ProtocolInvalidOperationError, msg); QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ProtocolInvalidOperationError)); - QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); + fileOpenFinished(false); return; } #endif @@ -85,7 +99,6 @@ QNetworkReplyFileImpl::QNetworkReplyFileImpl(QObject *parent, const QNetworkRequ url.setPath(QLatin1String("/")); setUrl(url); - QString fileName = url.toLocalFile(); if (fileName.isEmpty()) { const QString scheme = url.scheme(); @@ -101,68 +114,85 @@ QNetworkReplyFileImpl::QNetworkReplyFileImpl(QObject *parent, const QNetworkRequ } } - QFileInfo fi(fileName); - if (fi.isDir()) { - QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Cannot open %1: Path is a directory").arg(url.toString()); - setError(QNetworkReply::ContentOperationNotPermittedError, msg); - QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, - Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentOperationNotPermittedError)); - QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); - return; - } - - d->realFile.setFileName(fileName); - bool opened = d->realFile.open(QIODevice::ReadOnly | QIODevice::Unbuffered); - - // could we open the file? - if (!opened) { - QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Error opening %1: %2") - .arg(d->realFile.fileName(), d->realFile.errorString()); - - if (d->realFile.exists()) { - setError(QNetworkReply::ContentAccessDenied, msg); - QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, - Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentAccessDenied)); - } else { - setError(QNetworkReply::ContentNotFoundError, msg); + if (req.attribute(QNetworkRequest::BackgroundRequestAttribute).toBool()) { // Asynchronous open + auto realFile = new QNetworkFile(fileName); + connect(realFile, &QNetworkFile::headerRead, this, &QNetworkReplyFileImpl::setHeader, + Qt::QueuedConnection); + connect(realFile, &QNetworkFile::error, this, &QNetworkReplyFileImpl::setError, + Qt::QueuedConnection); + connect(realFile, SIGNAL(finished(bool)), SLOT(fileOpenFinished(bool)), + Qt::QueuedConnection); + + realFile->moveToThread(d->managerPrivate->createThread()); + QMetaObject::invokeMethod(realFile, "open", Qt::QueuedConnection); + + d->realFile = realFile; + } else { // Synch open + setFinished(true); + + QFileInfo fi(fileName); + if (fi.isDir()) { + QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Cannot open %1: Path is a directory").arg(url.toString()); + setError(QNetworkReply::ContentOperationNotPermittedError, msg); QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, - Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentNotFoundError)); + Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentOperationNotPermittedError)); + QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); + return; + } + d->realFile = new QFile(fileName, this); + bool opened = d->realFile->open(QIODevice::ReadOnly | QIODevice::Unbuffered); + + // could we open the file? + if (!opened) { + QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Error opening %1: %2") + .arg(d->realFile->fileName(), d->realFile->errorString()); + + if (fi.exists()) { + setError(QNetworkReply::ContentAccessDenied, msg); + QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, + Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentAccessDenied)); + } else { + setError(QNetworkReply::ContentNotFoundError, msg); + QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, + Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentNotFoundError)); + } + QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); + return; } + setHeader(QNetworkRequest::LastModifiedHeader, fi.lastModified()); + setHeader(QNetworkRequest::ContentLengthHeader, fi.size()); + + QMetaObject::invokeMethod(this, "metaDataChanged", Qt::QueuedConnection); + QMetaObject::invokeMethod(this, "downloadProgress", Qt::QueuedConnection, + Q_ARG(qint64, fi.size()), Q_ARG(qint64, fi.size())); + QMetaObject::invokeMethod(this, "readyRead", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); - return; } - - setHeader(QNetworkRequest::LastModifiedHeader, fi.lastModified()); - d->realFileSize = fi.size(); - setHeader(QNetworkRequest::ContentLengthHeader, d->realFileSize); - - QMetaObject::invokeMethod(this, "metaDataChanged", Qt::QueuedConnection); - QMetaObject::invokeMethod(this, "downloadProgress", Qt::QueuedConnection, - Q_ARG(qint64, d->realFileSize), Q_ARG(qint64, d->realFileSize)); - QMetaObject::invokeMethod(this, "readyRead", Qt::QueuedConnection); - QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); } void QNetworkReplyFileImpl::close() { Q_D(QNetworkReplyFileImpl); QNetworkReply::close(); - d->realFile.close(); + if (d->realFile) { + if (d->realFile->thread() == thread()) + d->realFile->close(); + else + QMetaObject::invokeMethod(d->realFile, "close", Qt::QueuedConnection); + } } void QNetworkReplyFileImpl::abort() { - Q_D(QNetworkReplyFileImpl); - QNetworkReply::close(); - d->realFile.close(); + close(); } qint64 QNetworkReplyFileImpl::bytesAvailable() const { Q_D(const QNetworkReplyFileImpl); - if (!d->realFile.isOpen()) + if (!d->isFinished || !d->realFile || !d->realFile->isOpen()) return QNetworkReply::bytesAvailable(); - return QNetworkReply::bytesAvailable() + d->realFile.bytesAvailable(); + return QNetworkReply::bytesAvailable() + d->realFile->bytesAvailable(); } bool QNetworkReplyFileImpl::isSequential () const @@ -172,8 +202,9 @@ bool QNetworkReplyFileImpl::isSequential () const qint64 QNetworkReplyFileImpl::size() const { - Q_D(const QNetworkReplyFileImpl); - return d->realFileSize; + bool ok; + int size = header(QNetworkRequest::ContentLengthHeader).toInt(&ok); + return ok ? size : 0; } /*! @@ -182,11 +213,11 @@ qint64 QNetworkReplyFileImpl::size() const qint64 QNetworkReplyFileImpl::readData(char *data, qint64 maxlen) { Q_D(QNetworkReplyFileImpl); - if (!d->realFile.isOpen()) + if (!d->isFinished || !d->realFile || !d->realFile->isOpen()) return -1; - qint64 ret = d->realFile.read(data, maxlen); - if (bytesAvailable() == 0 && d->realFile.isOpen()) - d->realFile.close(); + qint64 ret = d->realFile->read(data, maxlen); + if (bytesAvailable() == 0) + d->realFile->close(); if (ret == 0 && bytesAvailable() == 0) return -1; else { @@ -196,6 +227,17 @@ qint64 QNetworkReplyFileImpl::readData(char *data, qint64 maxlen) } } +void QNetworkReplyFileImpl::fileOpenFinished(bool isOpen) +{ + setFinished(true); + if (isOpen) { + const auto fileSize = size(); + Q_EMIT metaDataChanged(); + Q_EMIT downloadProgress(fileSize, fileSize); + Q_EMIT readyRead(); + } + Q_EMIT finished(); +} QT_END_NAMESPACE diff --git a/src/network/access/qnetworkreplyfileimpl_p.h b/src/network/access/qnetworkreplyfileimpl_p.h index bac00881a8..1f1be40bc8 100644 --- a/src/network/access/qnetworkreplyfileimpl_p.h +++ b/src/network/access/qnetworkreplyfileimpl_p.h @@ -59,13 +59,12 @@ QT_BEGIN_NAMESPACE - class QNetworkReplyFileImplPrivate; class QNetworkReplyFileImpl: public QNetworkReply { Q_OBJECT public: - QNetworkReplyFileImpl(QObject *parent, const QNetworkRequest &req, const QNetworkAccessManager::Operation op); + QNetworkReplyFileImpl(QNetworkAccessManager *manager, const QNetworkRequest &req, const QNetworkAccessManager::Operation op); ~QNetworkReplyFileImpl(); virtual void abort() Q_DECL_OVERRIDE; @@ -77,6 +76,9 @@ public: virtual qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE; +private Q_SLOTS: + void fileOpenFinished(bool isOpen); + Q_DECLARE_PRIVATE(QNetworkReplyFileImpl) }; @@ -85,12 +87,14 @@ class QNetworkReplyFileImplPrivate: public QNetworkReplyPrivate public: QNetworkReplyFileImplPrivate(); - QFile realFile; - qint64 realFileSize; + QNetworkAccessManagerPrivate *managerPrivate; + QPointer<QFile> realFile; Q_DECLARE_PUBLIC(QNetworkReplyFileImpl) }; QT_END_NAMESPACE +Q_DECLARE_METATYPE(QNetworkRequest::KnownHeaders) + #endif // QNETWORKREPLYFILEIMPL_H diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index e1323527f6..6b77ab303f 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -617,17 +617,10 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq thread->setObjectName(QStringLiteral("Qt HTTP synchronous thread")); QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); thread->start(); - } else if (!managerPrivate->httpThread) { + } else { // We use the manager-global thread. // At some point we could switch to having multiple threads if it makes sense. - managerPrivate->httpThread = new QThread(); - managerPrivate->httpThread->setObjectName(QStringLiteral("Qt HTTP thread")); - managerPrivate->httpThread->start(); - - thread = managerPrivate->httpThread; - } else { - // Asynchronous request, thread already exists - thread = managerPrivate->httpThread; + thread = managerPrivate->createThread(); } QUrl url = newHttpRequest.url(); @@ -1137,8 +1130,8 @@ void QNetworkReplyHttpImplPrivate::onRedirected(const QUrl &redirectUrl, int htt cookedHeaders.clear(); - if (managerPrivate->httpThread) - managerPrivate->httpThread->disconnect(); + if (managerPrivate->thread) + managerPrivate->thread->disconnect(); // Recurse QMetaObject::invokeMethod(q, "start", Qt::QueuedConnection, diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 78753a7393..10c0dccb9e 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -1453,15 +1453,9 @@ static bool q_NTLM_SSPI_library_load() if (pSecurityFunctionTable == NULL) { securityDLLHandle = LoadLibrary(L"secur32.dll"); if (securityDLLHandle != NULL) { -#if defined(Q_OS_WINCE) - INIT_SECURITY_INTERFACE pInitSecurityInterface = - (INIT_SECURITY_INTERFACE)GetProcAddress(securityDLLHandle, - L"InitSecurityInterfaceW"); -#else INIT_SECURITY_INTERFACE pInitSecurityInterface = (INIT_SECURITY_INTERFACE)GetProcAddress(securityDLLHandle, "InitSecurityInterfaceW"); -#endif if (pInitSecurityInterface != NULL) pSecurityFunctionTable = pInitSecurityInterface(); } diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index 0dbe1112cd..dfade24edd 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE // sockaddr_in6 size changed between old and new SDK // Only the new version is the correct one, so always // use this structure. -#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) # if !defined(u_char) # define u_char unsigned char # endif diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp index cc6102a713..1d34ae8277 100644 --- a/src/network/kernel/qhostinfo_win.cpp +++ b/src/network/kernel/qhostinfo_win.cpp @@ -82,11 +82,7 @@ static void resolveLibrary() { // Attempt to resolve getaddrinfo(); without it we'll have to fall // back to gethostbyname(), which has no IPv6 support. -#if defined(Q_OS_WINCE) - local_getaddrinfo = (getaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "getaddrinfo"); - local_freeaddrinfo = (freeaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "freeaddrinfo"); - local_getnameinfo = (getnameinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "getnameinfo"); -#elif defined (Q_OS_WINRT) +#if defined (Q_OS_WINRT) local_getaddrinfo = (getaddrinfoProto) &getaddrinfo; local_freeaddrinfo = (freeaddrinfoProto) &freeaddrinfo; local_getnameinfo = (getnameinfoProto) getnameinfo; @@ -115,11 +111,6 @@ static void translateWSAError(int error, QHostInfo *results) QHostInfo QHostInfoAgent::fromName(const QString &hostName) { -#if defined(Q_OS_WINCE) - static QBasicMutex qPrivCEMutex; - QMutexLocker locker(&qPrivCEMutex); -#endif - QSysInfo::machineHostName(); // this initializes ws2_32.dll // Load res_init on demand. diff --git a/src/network/kernel/qnetworkinterface_win.cpp b/src/network/kernel/qnetworkinterface_win.cpp index 0a82eac417..3002b2497b 100644 --- a/src/network/kernel/qnetworkinterface_win.cpp +++ b/src/network/kernel/qnetworkinterface_win.cpp @@ -81,19 +81,11 @@ static void resolveLibs() HINSTANCE iphlpapiHnd = GetModuleHandle(L"iphlpapi"); Q_ASSERT(iphlpapiHnd); -#if defined(Q_OS_WINCE) - // since Windows Embedded Compact 7 - ptrConvertInterfaceIndexToLuid = (PtrConvertInterfaceIndexToLuid)GetProcAddress(iphlpapiHnd, L"ConvertInterfaceIndexToLuid"); - ptrConvertInterfaceLuidToName = (PtrConvertInterfaceLuidToName)GetProcAddress(iphlpapiHnd, L"ConvertInterfaceLuidToNameW"); - ptrConvertInterfaceLuidToIndex = (PtrConvertInterfaceLuidToIndex)GetProcAddress(iphlpapiHnd, L"ConvertInterfaceLuidToIndex"); - ptrConvertInterfaceNameToLuid = (PtrConvertInterfaceNameToLuid)GetProcAddress(iphlpapiHnd, L"ConvertInterfaceNameToLuidW"); -#else // since Windows Vista ptrConvertInterfaceIndexToLuid = (PtrConvertInterfaceIndexToLuid)GetProcAddress(iphlpapiHnd, "ConvertInterfaceIndexToLuid"); ptrConvertInterfaceLuidToName = (PtrConvertInterfaceLuidToName)GetProcAddress(iphlpapiHnd, "ConvertInterfaceLuidToNameW"); ptrConvertInterfaceLuidToIndex = (PtrConvertInterfaceLuidToIndex)GetProcAddress(iphlpapiHnd, "ConvertInterfaceLuidToIndex"); ptrConvertInterfaceNameToLuid = (PtrConvertInterfaceNameToLuid)GetProcAddress(iphlpapiHnd, "ConvertInterfaceNameToLuidW"); -#endif done = true; } } diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp index 832a3badb9..682b7b157a 100644 --- a/src/network/kernel/qnetworkproxy_win.cpp +++ b/src/network/kernel/qnetworkproxy_win.cpp @@ -122,7 +122,6 @@ static PtrWinHttpGetIEProxyConfigForCurrentUser ptrWinHttpGetIEProxyConfigForCur static PtrWinHttpCloseHandle ptrWinHttpCloseHandle = 0; -#ifndef Q_OS_WINCE static bool currentProcessIsService() { typedef BOOL (WINAPI *PtrGetUserName)(LPTSTR lpBuffer, LPDWORD lpnSize); @@ -152,7 +151,6 @@ static bool currentProcessIsService() } return false; } -#endif // ! Q_OS_WINCE static QStringList splitSpaceSemicolon(const QString &source) { @@ -358,7 +356,7 @@ static QList<QNetworkProxy> parseServerList(const QNetworkProxyQuery &query, con return removeDuplicateProxies(result); } -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) namespace { class QRegistryWatcher { public: @@ -409,7 +407,7 @@ private: QVector<HKEY> m_registryHandles; }; } // namespace -#endif // !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#endif // !defined(Q_OS_WINRT) class QWindowsSystemProxy { @@ -428,7 +426,7 @@ public: QStringList proxyServerList; QStringList proxyBypass; QList<QNetworkProxy> defaultResult; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) QRegistryWatcher proxySettingsWatcher; #endif bool initialized; @@ -464,7 +462,7 @@ void QWindowsSystemProxy::reset() void QWindowsSystemProxy::init() { bool proxySettingsChanged = false; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) proxySettingsChanged = proxySettingsWatcher.hasChanged(); #endif @@ -474,12 +472,7 @@ void QWindowsSystemProxy::init() reset(); -#ifdef Q_OS_WINCE - // Windows CE does not have any of the following API - return; -#else - -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) proxySettingsWatcher.clear(); // needs reset to trigger a new detection proxySettingsWatcher.addLocation(HKEY_CURRENT_USER, QStringLiteral("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings")); proxySettingsWatcher.addLocation(HKEY_LOCAL_MACHINE, QStringLiteral("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings")); @@ -567,7 +560,6 @@ void QWindowsSystemProxy::init() } functional = isAutoConfig || !proxyServerList.isEmpty(); -#endif } QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &query) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 802b623375..731afd4e36 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -691,6 +691,7 @@ bool QAbstractSocketPrivate::canReadNotification() if (isBuffered) { // Return if there is no space in the buffer if (readBufferMaxSize && buffer.size() >= readBufferMaxSize) { + socketEngine->setReadNotificationEnabled(false); #if defined (QABSTRACTSOCKET_DEBUG) qDebug("QAbstractSocketPrivate::canReadNotification() buffer is full"); #endif @@ -708,11 +709,6 @@ bool QAbstractSocketPrivate::canReadNotification() return false; } newBytes = buffer.size() - newBytes; - - // If read buffer is full, disable the read socket notifier. - if (readBufferMaxSize && buffer.size() == readBufferMaxSize) { - socketEngine->setReadNotificationEnabled(false); - } } // Only emit readyRead() if there is data available. @@ -728,10 +724,6 @@ bool QAbstractSocketPrivate::canReadNotification() return true; } - // turn the socket engine off if we've reached the buffer size limit - if (socketEngine && isBuffered) - socketEngine->setReadNotificationEnabled(readBufferMaxSize == 0 || readBufferMaxSize > q->bytesAvailable()); - return true; } @@ -788,12 +780,8 @@ bool QAbstractSocketPrivate::canWriteNotification() #if defined (QABSTRACTSOCKET_DEBUG) qDebug("QAbstractSocketPrivate::canWriteNotification() flushing"); #endif - bool dataWasWritten = writeToSocket(); - - if (socketEngine && writeBuffer.isEmpty() && socketEngine->bytesToWrite() == 0) - socketEngine->setWriteNotificationEnabled(false); - return dataWasWritten; + return writeToSocket(); } /*! \internal @@ -833,8 +821,12 @@ bool QAbstractSocketPrivate::writeToSocket() #endif // this covers the case when the buffer was empty, but we had to wait for the socket engine to finish - if (state == QAbstractSocket::ClosingState) + if (state == QAbstractSocket::ClosingState) { q->disconnectFromHost(); + } else { + if (socketEngine) + socketEngine->setWriteNotificationEnabled(false); + } return false; } @@ -872,8 +864,7 @@ bool QAbstractSocketPrivate::writeToSocket() emit q->channelBytesWritten(0, written); } - if (writeBuffer.isEmpty() && socketEngine && socketEngine->isWriteNotificationEnabled() - && !socketEngine->bytesToWrite()) + if (writeBuffer.isEmpty() && socketEngine && !socketEngine->bytesToWrite()) socketEngine->setWriteNotificationEnabled(false); if (state == QAbstractSocket::ClosingState) q->disconnectFromHost(); @@ -1144,12 +1135,10 @@ void QAbstractSocketPrivate::_q_connectToNextAddress() */ void QAbstractSocketPrivate::_q_testConnection() { - if (socketEngine) { - if (threadData->hasEventDispatcher()) { - if (connectTimer) - connectTimer->stop(); - } + if (connectTimer) + connectTimer->stop(); + if (socketEngine) { if (socketEngine->state() == QAbstractSocket::ConnectedState) { // Fetch the parameters if our connection is completed; // otherwise, fall out and try the next address. @@ -1166,11 +1155,6 @@ void QAbstractSocketPrivate::_q_testConnection() addresses.clear(); } - if (threadData->hasEventDispatcher()) { - if (connectTimer) - connectTimer->stop(); - } - #if defined(QABSTRACTSOCKET_DEBUG) qDebug("QAbstractSocketPrivate::_q_testConnection() connection failed," " checking for alternative addresses"); @@ -2379,11 +2363,6 @@ void QAbstractSocket::abort() return; } #endif - if (d->connectTimer) { - d->connectTimer->stop(); - delete d->connectTimer; - d->connectTimer = 0; - } d->abortCalled = true; close(); @@ -2430,15 +2409,7 @@ bool QAbstractSocket::atEnd() const // Note! docs copied to QSslSocket::flush() bool QAbstractSocket::flush() { - Q_D(QAbstractSocket); -#ifndef QT_NO_SSL - // Manual polymorphism; flush() isn't virtual, but QSslSocket overloads - // it. - if (QSslSocket *socket = qobject_cast<QSslSocket *>(this)) - return socket->flush(); -#endif - Q_CHECK_SOCKETENGINE(false); - return d->flush(); + return d_func()->flush(); } /*! \reimp @@ -2461,7 +2432,7 @@ qint64 QAbstractSocket::readData(char *data, qint64 maxSize) d->setError(d->socketEngine->error(), d->socketEngine->errorString()); d->resetSocketLayer(); d->state = QAbstractSocket::UnconnectedState; - } else if (!d->socketEngine->isReadNotificationEnabled()) { + } else { // Only do this when there was no error d->socketEngine->setReadNotificationEnabled(true); } @@ -2828,12 +2799,12 @@ void QAbstractSocket::setReadBufferSize(qint64 size) if (d->readBufferMaxSize == size) return; d->readBufferMaxSize = size; - if (!d->emittedReadyRead && d->socketEngine) { - // ensure that the read notification is enabled if we've now got - // room in the read buffer - // but only if we're not inside canReadNotification -- that will take care on its own - if ((size == 0 || d->buffer.size() < size) && d->state == QAbstractSocket::ConnectedState) // Do not change the notifier unless we are connected. - d->socketEngine->setReadNotificationEnabled(true); + + // Do not change the notifier unless we are connected. + if (d->socketEngine && d->state == QAbstractSocket::ConnectedState) { + // Ensure that the read notification is enabled if we've now got + // room in the read buffer. + d->socketEngine->setReadNotificationEnabled(size == 0 || d->buffer.size() < size); } } diff --git a/src/network/socket/qabstractsocket_p.h b/src/network/socket/qabstractsocket_p.h index b718c21ff5..ab642e039b 100644 --- a/src/network/socket/qabstractsocket_p.h +++ b/src/network/socket/qabstractsocket_p.h @@ -128,13 +128,12 @@ public: inline void resolveProxy(quint16 port) { resolveProxy(QString(), port); } void resetSocketLayer(); - bool flush(); + virtual bool flush(); bool initSocketLayer(QAbstractSocket::NetworkLayerProtocol protocol); virtual void configureCreatedSocket(); void startConnectingByName(const QString &host); void fetchConnectionParameters(); - void setupSocketNotifiers(); bool readFromSocket(); bool writeToSocket(); void emitReadyRead(); diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h index 19e9e1d9b7..5a05d7c98c 100644 --- a/src/network/socket/qnativesocketengine_p.h +++ b/src/network/socket/qnativesocketengine_p.h @@ -66,21 +66,20 @@ QT_BEGIN_NAMESPACE #ifdef Q_OS_WIN -#define QT_SOCKLEN_T int -#define QT_SOCKOPTLEN_T int +# define QT_SOCKLEN_T int +# define QT_SOCKOPTLEN_T int // The following definitions are copied from the MinGW header mswsock.h which // was placed in the public domain. The WSASendMsg and WSARecvMsg functions // were introduced with Windows Vista, so some Win32 headers are lacking them. // There are no known versions of Windows CE or Embedded that contain them. -#ifndef Q_OS_WINCE # ifndef WSAID_WSARECVMSG typedef INT (WINAPI *LPFN_WSARECVMSG)(SOCKET s, LPWSAMSG lpMsg, LPDWORD lpdwNumberOfBytesRecvd, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); # define WSAID_WSARECVMSG {0xf689d7c8,0x6f1f,0x436b,{0x8a,0x53,0xe5,0x4f,0xe3,0x51,0xc3,0x22}} -# endif +# endif // !WSAID_WSARECVMSG # ifndef WSAID_WSASENDMSG typedef struct { LPWSAMSG lpMsg; @@ -96,9 +95,8 @@ typedef INT (WSAAPI *LPFN_WSASENDMSG)(SOCKET s, LPWSAMSG lpMsg, DWORD dwFlags, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); # define WSAID_WSASENDMSG {0xa441e712,0x754f,0x43ca,{0x84,0xa7,0x0d,0xee,0x44,0xcf,0x60,0x6d}} -# endif -#endif -#endif +# endif // !WSAID_WSASENDMSG +#endif // Q_OS_WIN union qt_sockaddr { sockaddr a; @@ -210,7 +208,7 @@ public: QSocketNotifier *readNotifier, *writeNotifier, *exceptNotifier; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) LPFN_WSASENDMSG sendmsg; LPFN_WSARECVMSG recvmsg; # endif diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index 648f2bf376..07f4899bae 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -387,7 +387,6 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc return false; } -#if !defined(Q_OS_WINCE) if (socketType == QAbstractSocket::UdpSocket) { // enable new behavior using // SIO_UDP_CONNRESET @@ -414,7 +413,6 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc &sendmsgguid, sizeof(sendmsgguid), &sendmsg, sizeof(sendmsg), &bytesReturned, NULL, NULL) == SOCKET_ERROR) sendmsg = 0; -#endif socketDescriptor = socket; if (socket != INVALID_SOCKET) { @@ -1078,7 +1076,6 @@ qint64 QNativeSocketEnginePrivate::nativeBytesAvailable() const bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const { -#if !defined(Q_OS_WINCE) // Create a sockaddr struct and reset its port number. qt_sockaddr storage; QT_SOCKLEN_T storageSize = sizeof(storage); @@ -1105,18 +1102,6 @@ bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const result = true; } -#else // Q_OS_WINCE - bool result = false; - fd_set readS; - FD_ZERO(&readS); - FD_SET((SOCKET)socketDescriptor, &readS); - timeval timeout; - timeout.tv_sec = 0; - timeout.tv_usec = 5000; - int available = ::select(1, &readS, 0, 0, &timeout); - result = available > 0; -#endif - #if defined (QNATIVESOCKETENGINE_DEBUG) qDebug("QNativeSocketEnginePrivate::nativeHasPendingDatagrams() == %s", result ? "true" : "false"); @@ -1128,7 +1113,6 @@ bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const { qint64 ret = -1; -#if !defined(Q_OS_WINCE) int recvResult = 0; DWORD flags; DWORD bufferCount = 5; @@ -1173,18 +1157,6 @@ qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const if (buf) delete[] buf; -#else // Q_OS_WINCE - DWORD size = -1; - DWORD bytesReturned; - int ioResult = WSAIoctl(socketDescriptor, FIONREAD, 0,0, &size, sizeof(size), &bytesReturned, 0, 0); - if (ioResult == SOCKET_ERROR) { - int err = WSAGetLastError(); - WS_ERROR_DEBUG(err); - } else { - ret = qint64(size); - } -#endif - #if defined (QNATIVESOCKETENGINE_DEBUG) qDebug("QNativeSocketEnginePrivate::nativePendingDatagramSize() == %li", ret); #endif @@ -1192,12 +1164,6 @@ qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const return ret; } -#ifdef Q_OS_WINCE -// Windows CE has no support for sendmsg or recvmsg. We set it to null here to simplify the code below. -static int (*const recvmsg)(...) = 0; -static int (*const sendmsg)(...) = 0; -#endif - qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxLength, QIpPacketHeader *header, QAbstractSocketEngine::PacketHeaderOptions options) { @@ -1316,12 +1282,7 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l memset(&msg, 0, sizeof(msg)); memset(&aa, 0, sizeof(aa)); -#if !defined(Q_OS_WINCE) buf.buf = len ? (char*)data : 0; -#else - char tmp; - buf.buf = len ? (char*)data : &tmp; -#endif msg.lpBuffers = &buf; msg.dwBufferCount = 1; msg.name = &aa.a; @@ -1482,9 +1443,6 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxLength) buf.len = maxLength; DWORD flags = 0; DWORD bytesRead = 0; -#if defined(Q_OS_WINCE) - WSASetLastError(0); -#endif if (::WSARecv(socketDescriptor, &buf, 1, &bytesRead, &flags, 0,0) == SOCKET_ERROR) { int err = WSAGetLastError(); WS_ERROR_DEBUG(err); @@ -1598,11 +1556,7 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; -#if !defined(Q_OS_WINCE) ret = select(socketDescriptor + 1, &fdread, &fdwrite, &fdexception, timeout < 0 ? 0 : &tv); -#else - ret = select(1, &fdread, &fdwrite, &fdexception, timeout < 0 ? 0 : &tv); -#endif //... but if it is actually set, pretend it did not happen if (ret > 0 && FD_ISSET((SOCKET)socketDescriptor, &fdexception)) diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index 0c15810a48..369396271e 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -64,11 +64,7 @@ static const int MaxWriteBufferSize = 128*1024; //#define QSOCKS5SOCKETLAYER_DEBUG #define MAX_DATA_DUMP 256 -#if !defined(Q_OS_WINCE) #define SOCKS5_BLOCKING_BIND_TIMEOUT 5000 -#else -#define SOCKS5_BLOCKING_BIND_TIMEOUT 10000 -#endif #define Q_INIT_CHECK(returnValue) do { \ if (!d->data) { \ diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp index 7dd884c16a..809b603403 100644 --- a/src/network/socket/qtcpserver.cpp +++ b/src/network/socket/qtcpserver.cpp @@ -543,8 +543,11 @@ QTcpSocket *QTcpServer::nextPendingConnection() if (d->pendingConnections.isEmpty()) return 0; - if (!d->socketEngine->isReadNotificationEnabled()) + if (!d->socketEngine) { + qWarning("QTcpServer::nextPendingConnection() called while not listening"); + } else if (!d->socketEngine->isReadNotificationEnabled()) { d->socketEngine->setReadNotificationEnabled(true); + } return d->pendingConnections.takeFirst(); } diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri index f50a7b1229..2d80f38bec 100644 --- a/src/network/socket/socket.pri +++ b/src/network/socket/socket.pri @@ -43,7 +43,7 @@ win32:!winrt:SOURCES += socket/qnativesocketengine_win.cpp \ socket/qlocalsocket_win.cpp \ socket/qlocalserver_win.cpp -win32:!wince:!winrt:LIBS_PRIVATE += -ladvapi32 +win32:!winrt:LIBS_PRIVATE += -ladvapi32 winrt { SOURCES += socket/qnativesocketengine_winrt.cpp \ @@ -54,15 +54,6 @@ winrt { DEFINES += QT_LOCALSOCKET_TCP } -wince { - SOURCES -= socket/qlocalsocket_win.cpp \ - socket/qlocalserver_win.cpp - SOURCES += socket/qlocalsocket_tcp.cpp \ - socket/qlocalserver_tcp.cpp - - DEFINES += QT_LOCALSOCKET_TCP -} - integrity: { SOURCES -= socket/qlocalsocket_unix.cpp \ socket/qlocalserver_unix.cpp diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp index f9bb28e033..1fff2c31dd 100644 --- a/src/network/ssl/qsslconfiguration.cpp +++ b/src/network/ssl/qsslconfiguration.cpp @@ -119,7 +119,8 @@ const char QSslConfiguration::NextProtocolHttp1_1[] = "http/1.1"; /*! \enum QSslConfiguration::NextProtocolNegotiationStatus - Describes the status of the Next Protocol Negotiation (NPN). + Describes the status of the Next Protocol Negotiation (NPN) or + Application-Layer Protocol Negotiation (ALPN). \value NextProtocolNegotiationNone No application protocol has been negotiated (yet). @@ -812,8 +813,9 @@ QVector<QSslEllipticCurve> QSslConfiguration::supportedEllipticCurves() \since 5.3 This function returns the protocol negotiated with the server - if the Next Protocol Negotiation (NPN) TLS extension was enabled. - In order for the NPN extension to be enabled, setAllowedNextProtocols() + if the Next Protocol Negotiation (NPN) or Application-Layer Protocol + Negotiation (ALPN) TLS extension was enabled. + In order for the NPN/ALPN extension to be enabled, setAllowedNextProtocols() needs to be called explicitly before connecting to the server. If no protocol could be negotiated or the extension was not enabled, @@ -830,9 +832,10 @@ QByteArray QSslConfiguration::nextNegotiatedProtocol() const \since 5.3 This function sets the allowed \a protocols to be negotiated with the - server through the Next Protocol Negotiation (NPN) TLS extension; each + server through the Next Protocol Negotiation (NPN) or Application-Layer + Protocol Negotiation (ALPN) TLS extension; each element in \a protocols must define one allowed protocol. - The function must be called explicitly before connecting to send the NPN + The function must be called explicitly before connecting to send the NPN/ALPN extension in the SSL handshake. Whether or not the negotiation succeeded can be queried through nextProtocolNegotiationStatus(). @@ -852,8 +855,8 @@ void QSslConfiguration::setAllowedNextProtocols(QList<QByteArray> protocols) \since 5.3 This function returns the allowed protocols to be negotiated with the - server through the Next Protocol Negotiation (NPN) TLS extension, as set - by setAllowedNextProtocols(). + server through the Next Protocol Negotiation (NPN) or Application-Layer + Protocol Negotiation (ALPN) TLS extension, as set by setAllowedNextProtocols(). \sa nextNegotiatedProtocol(), nextProtocolNegotiationStatus(), setAllowedNextProtocols(), QSslConfiguration::NextProtocolSpdy3_0, QSslConfiguration::NextProtocolHttp1_1 */ @@ -865,7 +868,8 @@ QList<QByteArray> QSslConfiguration::allowedNextProtocols() const /*! \since 5.3 - This function returns the status of the Next Protocol Negotiation (NPN). + This function returns the status of the Next Protocol Negotiation (NPN) + or Application-Layer Protocol Negotiation (ALPN). If the feature has not been enabled through setAllowedNextProtocols(), this function returns NextProtocolNegotiationNone. The status will be set before emitting the encrypted() signal. diff --git a/src/network/ssl/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp index b3786f989e..543e87c0ca 100644 --- a/src/network/ssl/qsslcontext_openssl.cpp +++ b/src/network/ssl/qsslcontext_openssl.cpp @@ -457,7 +457,25 @@ SSL* QSslContext::createSsl() m_npnContext.data = reinterpret_cast<unsigned char *>(m_supportedNPNVersions.data()); m_npnContext.len = m_supportedNPNVersions.count(); m_npnContext.status = QSslConfiguration::NextProtocolNegotiationNone; - q_SSL_CTX_set_next_proto_select_cb(ctx, next_proto_cb, &m_npnContext); +#if OPENSSL_VERSION_NUMBER >= 0x10002000L + if (q_SSLeay() >= 0x10002000L) { + // Callback's type has a parameter 'const unsigned char ** out' + // since it was introduced in 1.0.2. Internally, OpenSSL's own code + // (tests/examples) cast it to unsigned char * (since it's 'out'). + // We just re-use our NPN callback and cast here: + typedef int (*alpn_callback_t) (SSL *, const unsigned char **, unsigned char *, + const unsigned char *, unsigned int, void *); + // With ALPN callback is for a server side only, for a client m_npnContext.status + // will stay in NextProtocolNegotiationNone. + q_SSL_CTX_set_alpn_select_cb(ctx, alpn_callback_t(next_proto_cb), &m_npnContext); + // Client: + q_SSL_set_alpn_protos(ssl, m_npnContext.data, m_npnContext.len); + } else { +#else + { +#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L ... + q_SSL_CTX_set_next_proto_select_cb(ctx, next_proto_cb, &m_npnContext); + } } #endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ... diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 3e7a30aa9f..bbc62c47ff 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -836,15 +836,7 @@ bool QSslSocket::atEnd() const // Note! docs copied from QAbstractSocket::flush() bool QSslSocket::flush() { - Q_D(QSslSocket); -#ifdef QSSLSOCKET_DEBUG - qCDebug(lcSsl) << "QSslSocket::flush()"; -#endif - if (d->mode != UnencryptedMode) - // encrypt any unencrypted bytes in our buffer - d->transmit(); - - return d->plainSocket ? d->plainSocket->flush() : false; + return d_func()->flush(); } /*! @@ -2614,6 +2606,22 @@ QByteArray QSslSocketPrivate::peek(qint64 maxSize) /*! \internal */ +bool QSslSocketPrivate::flush() +{ +#ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << "QSslSocketPrivate::flush()"; +#endif + if (mode != QSslSocket::UnencryptedMode) { + // encrypt any unencrypted bytes in our buffer + transmit(); + } + + return plainSocket && plainSocket->flush(); +} + +/*! + \internal +*/ bool QSslSocketPrivate::rootCertOnDemandLoadingSupported() { return s_loadRootCertsOnDemand; diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h index c069ff2f9d..1f2ed7687b 100644 --- a/src/network/ssl/qsslsocket.h +++ b/src/network/ssl/qsslsocket.h @@ -116,7 +116,7 @@ public: bool canReadLine() const Q_DECL_OVERRIDE; void close() Q_DECL_OVERRIDE; bool atEnd() const Q_DECL_OVERRIDE; - bool flush(); + bool flush(); // ### Qt6: remove me (implementation moved to private flush()) void abort(); // From QAbstractSocket: diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 4f62f53a93..48f8e258df 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -522,15 +522,9 @@ void QSslSocketPrivate::ensureCiphersAndCertsLoaded() #if defined(Q_OS_WIN) HINSTANCE hLib = LoadLibraryW(L"Crypt32"); if (hLib) { -#if defined(Q_OS_WINCE) - ptrCertOpenSystemStoreW = (PtrCertOpenSystemStoreW)GetProcAddress(hLib, L"CertOpenStore"); - ptrCertFindCertificateInStore = (PtrCertFindCertificateInStore)GetProcAddress(hLib, L"CertFindCertificateInStore"); - ptrCertCloseStore = (PtrCertCloseStore)GetProcAddress(hLib, L"CertCloseStore"); -#else ptrCertOpenSystemStoreW = (PtrCertOpenSystemStoreW)GetProcAddress(hLib, "CertOpenSystemStoreW"); ptrCertFindCertificateInStore = (PtrCertFindCertificateInStore)GetProcAddress(hLib, "CertFindCertificateInStore"); ptrCertCloseStore = (PtrCertCloseStore)GetProcAddress(hLib, "CertCloseStore"); -#endif if (!ptrCertOpenSystemStoreW || !ptrCertFindCertificateInStore || !ptrCertCloseStore) qCWarning(lcSsl, "could not resolve symbols in crypt32 library"); // should never happen } else { @@ -691,15 +685,7 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates() #if defined(Q_OS_WIN) if (ptrCertOpenSystemStoreW && ptrCertFindCertificateInStore && ptrCertCloseStore) { HCERTSTORE hSystemStore; -#if defined(Q_OS_WINCE) - hSystemStore = ptrCertOpenSystemStoreW(CERT_STORE_PROV_SYSTEM_W, - 0, - 0, - CERT_STORE_NO_CRYPT_RELEASE_FLAG|CERT_SYSTEM_STORE_CURRENT_USER, - L"ROOT"); -#else hSystemStore = ptrCertOpenSystemStoreW(0, L"ROOT"); -#endif if(hSystemStore) { PCCERT_CONTEXT pc = NULL; while(1) { @@ -1571,7 +1557,20 @@ void QSslSocketBackendPrivate::continueHandshake() } else { const unsigned char *proto = 0; unsigned int proto_len = 0; - q_SSL_get0_next_proto_negotiated(ssl, &proto, &proto_len); +#if OPENSSL_VERSION_NUMBER >= 0x10002000L + if (q_SSLeay() >= 0x10002000L) { + q_SSL_get0_alpn_selected(ssl, &proto, &proto_len); + if (proto_len && mode == QSslSocket::SslClientMode) { + // Client does not have a callback that sets it ... + configuration.nextProtocolNegotiationStatus = QSslConfiguration::NextProtocolNegotiationNegotiated; + } + } else { +#else + { +#endif + q_SSL_get0_next_proto_negotiated(ssl, &proto, &proto_len); + } + if (proto_len) configuration.nextNegotiatedProtocol = QByteArray(reinterpret_cast<const char *>(proto), proto_len); else diff --git a/src/network/ssl/qsslsocket_openssl_android.cpp b/src/network/ssl/qsslsocket_openssl_android.cpp index d73ed8995e..b5d2458d56 100644 --- a/src/network/ssl/qsslsocket_openssl_android.cpp +++ b/src/network/ssl/qsslsocket_openssl_android.cpp @@ -70,6 +70,7 @@ QList<QByteArray> QSslSocketPrivate::fetchSslCertificateData() QJNIEnvironmentPrivate env; jobjectArray jcertificates = static_cast<jobjectArray>(certificates.object()); const jint nCertificates = env->GetArrayLength(jcertificates); + certificateData.reserve(static_cast<int>(nCertificates)); for (int i = 0; i < nCertificates; ++i) { jbyteArray jCert = static_cast<jbyteArray>(env->GetObjectArrayElement(jcertificates, i)); diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index d0982377fb..05b7e2da7f 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -418,6 +418,18 @@ DEFINEFUNC3(void, SSL_CTX_set_next_proto_select_cb, SSL_CTX *s, s, void *arg, arg, return, DUMMYARG) DEFINEFUNC3(void, SSL_get0_next_proto_negotiated, const SSL *s, s, const unsigned char **data, data, unsigned *len, len, return, DUMMYARG) +#if OPENSSL_VERSION_NUMBER >= 0x10002000L +DEFINEFUNC3(int, SSL_set_alpn_protos, SSL *s, s, const unsigned char *protos, protos, + unsigned protos_len, protos_len, return -1, return) +DEFINEFUNC3(void, SSL_CTX_set_alpn_select_cb, SSL_CTX *s, s, + int (*cb) (SSL *ssl, const unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen, void *arg), cb, + void *arg, arg, return, DUMMYARG) +DEFINEFUNC3(void, SSL_get0_alpn_selected, const SSL *s, s, const unsigned char **data, data, + unsigned *len, len, return, DUMMYARG) +#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L ... #endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ... DEFINEFUNC(DH *, DH_new, DUMMYARG, DUMMYARG, return 0, return) DEFINEFUNC(void, DH_free, DH *dh, dh, return, DUMMYARG) diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h index 36e041b6cb..5a6c934d1a 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h @@ -558,6 +558,19 @@ void q_SSL_CTX_set_next_proto_select_cb(SSL_CTX *s, void *arg); void q_SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data, unsigned *len); +#if OPENSSL_VERSION_NUMBER >= 0x10002000L +int q_SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos, + unsigned protos_len); +void q_SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, + int (*cb) (SSL *ssl, + const unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen, + void *arg), void *arg); +void q_SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, + unsigned *len); +#endif #endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ... // Helper function diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index 5d4d52cd6d..e791b9d166 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -89,11 +89,7 @@ QT_BEGIN_NAMESPACE #endif #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) -#if defined(Q_OS_WINCE) - typedef HCERTSTORE (WINAPI *PtrCertOpenSystemStoreW)(LPCSTR, DWORD, HCRYPTPROV_LEGACY, DWORD, const void*); -#else typedef HCERTSTORE (WINAPI *PtrCertOpenSystemStoreW)(HCRYPTPROV_LEGACY, LPCWSTR); -#endif typedef PCCERT_CONTEXT (WINAPI *PtrCertFindCertificateInStore)(HCERTSTORE, DWORD, DWORD, DWORD, const void*, PCCERT_CONTEXT); typedef BOOL (WINAPI *PtrCertCloseStore)(HCERTSTORE, DWORD); #endif // Q_OS_WIN && !Q_OS_WINRT @@ -193,6 +189,7 @@ public: virtual qint64 peek(char *data, qint64 maxSize) Q_DECL_OVERRIDE; virtual QByteArray peek(qint64 maxSize) Q_DECL_OVERRIDE; + bool flush() Q_DECL_OVERRIDE; // Platform specific functions virtual void startClientEncryption() = 0; diff --git a/src/network/ssl/qsslsocket_winrt.cpp b/src/network/ssl/qsslsocket_winrt.cpp index 045c89eb0e..5704d6b151 100644 --- a/src/network/ssl/qsslsocket_winrt.cpp +++ b/src/network/ssl/qsslsocket_winrt.cpp @@ -215,7 +215,9 @@ QList<QSslCipher> QSslSocketBackendPrivate::defaultCiphers() const QString protocolStrings[] = { QStringLiteral("SSLv3"), QStringLiteral("TLSv1"), QStringLiteral("TLSv1.1"), QStringLiteral("TLSv1.2") }; const QSsl::SslProtocol protocols[] = { QSsl::SslV3, QSsl::TlsV1_0, QSsl::TlsV1_1, QSsl::TlsV1_2 }; - for (int i = 0; i < ARRAYSIZE(protocols); ++i) { + const int size = static_cast<int>(ARRAYSIZE(protocols)); + ciphers.reserve(size); + for (int i = 0; i < size; ++i) { QSslCipher cipher; cipher.d->isNull = false; cipher.d->name = QStringLiteral("WINRT"); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 868e9ed265..6365a7421b 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1006,11 +1006,11 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data, glStencilMask(0xff); // Enable stencil writes if (dirtyStencilRegion.intersects(currentScissorBounds)) { - QVector<QRect> clearRegion = dirtyStencilRegion.intersected(currentScissorBounds).rects(); + const QRegion clearRegion = dirtyStencilRegion.intersected(currentScissorBounds); glClearStencil(0); // Clear to zero - for (int i = 0; i < clearRegion.size(); ++i) { + for (const QRect &rect : clearRegion) { #ifndef QT_GL_NO_SCISSOR_TEST - setScissor(clearRegion.at(i)); + setScissor(rect); #endif glClear(GL_STENCIL_BUFFER_BIT); } diff --git a/src/platformsupport/fbconvenience/qfbscreen.cpp b/src/platformsupport/fbconvenience/qfbscreen.cpp index d631849775..ee8183c896 100644 --- a/src/platformsupport/fbconvenience/qfbscreen.cpp +++ b/src/platformsupport/fbconvenience/qfbscreen.cpp @@ -206,15 +206,13 @@ void QFbScreen::generateRects() remainingScreen -= localGeometry; QRegion windowRegion(localGeometry); windowRegion -= remainingScreen; - foreach (const QRect &rect, windowRegion.rects()) { + for (const QRect &rect : windowRegion) mCachedRects += QPair<QRect, int>(rect, i); - } } #endif } - const QVector<QRect> remainingScreenRects = remainingScreen.rects(); - mCachedRects.reserve(mCachedRects.count() + remainingScreenRects.count()); - foreach (const QRect &rect, remainingScreenRects) + mCachedRects.reserve(mCachedRects.count() + remainingScreen.rectCount()); + for (const QRect &rect : remainingScreen) mCachedRects += QPair<QRect, int>(rect, -1); mIsUpToDate = true; } @@ -253,7 +251,7 @@ QRegion QFbScreen::doRedraw() rectRegion -= intersect; // we only expect one rectangle, but defensive coding... - foreach (const QRect &rect, intersect.rects()) { + for (const QRect &rect : intersect) { bool firstLayer = true; if (layer == -1) { mCompositePainter->fillRect(rect, Qt::black); diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index c7209fe696..bbc5cf0c8f 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -215,6 +215,9 @@ void QCoreTextFontEngine::init() } else avgCharWidth = QFontEngine::averageCharWidth(); + underlineThickness = QFixed::fromReal(CTFontGetUnderlineThickness(ctfont)); + underlinePos = -QFixed::fromReal(CTFontGetUnderlinePosition(ctfont)); + cache_cost = (CTFontGetAscent(ctfont) + CTFontGetDescent(ctfont)) * avgCharWidth.toInt() * 2000; // HACK hb_coretext requires both CTFont and CGFont but user_data is only void* @@ -762,6 +765,16 @@ bool QCoreTextFontEngine::supportsTransformation(const QTransform &transform) co return false; } +QFixed QCoreTextFontEngine::lineThickness() const +{ + return underlineThickness; +} + +QFixed QCoreTextFontEngine::underlinePosition() const +{ + return underlinePos; +} + QFontEngine::Properties QCoreTextFontEngine::properties() const { Properties result; diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h index 67a5a3185b..8a487f0ff0 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h @@ -92,6 +92,9 @@ public: int synthesized() const Q_DECL_OVERRIDE { return synthesisFlags; } bool supportsSubPixelPositions() const Q_DECL_OVERRIDE { return true; } + QFixed lineThickness() const Q_DECL_OVERRIDE; + QFixed underlinePosition() const Q_DECL_OVERRIDE; + void draw(CGContextRef ctx, qreal x, qreal y, const QTextItemInt &ti, int paintDeviceHeight); FaceId faceId() const Q_DECL_OVERRIDE; @@ -141,6 +144,8 @@ private: int synthesisFlags; CGAffineTransform transform; QFixed avgCharWidth; + QFixed underlineThickness; + QFixed underlinePos; QFontEngine::FaceId face_id; mutable bool kerningPairsLoaded; }; diff --git a/src/platformsupport/graphics/qrasterbackingstore.cpp b/src/platformsupport/graphics/qrasterbackingstore.cpp index 3b1a87b8cd..58e811dff1 100644 --- a/src/platformsupport/graphics/qrasterbackingstore.cpp +++ b/src/platformsupport/graphics/qrasterbackingstore.cpp @@ -89,7 +89,7 @@ bool QRasterBackingStore::scroll(const QRegion ®ion, int dx, int dy) const qreal devicePixelRatio = m_image.devicePixelRatio(); const QPoint delta(dx * devicePixelRatio, dy * devicePixelRatio); - foreach (const QRect &rect, region.rects()) + for (const QRect &rect : region) qt_scrollRectInImage(m_image, QRect(rect.topLeft() * devicePixelRatio, rect.size() * devicePixelRatio), delta); return true; @@ -103,7 +103,7 @@ void QRasterBackingStore::beginPaint(const QRegion ®ion) QPainter painter(&m_image); painter.setCompositionMode(QPainter::CompositionMode_Source); const QColor blank = Qt::transparent; - foreach (const QRect &rect, region.rects()) + for (const QRect &rect : region) painter.fillRect(rect, blank); } diff --git a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp index 7c29be7804..dbaaf524e8 100644 --- a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp +++ b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp @@ -140,7 +140,7 @@ void QOpenGLCompositorBackingStore::updateTexture() QOpenGLContext *ctx = QOpenGLContext::currentContext(); if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) { - foreach (const QRect &rect, m_dirty.rects()) { + for (const QRect &rect : m_dirty) { QRect r = imageRect & rect; glPixelStorei(GL_UNPACK_ROW_LENGTH, m_image.width()); glTexSubImage2D(GL_TEXTURE_2D, 0, r.x(), r.y(), r.width(), r.height(), GL_RGBA, GL_UNSIGNED_BYTE, @@ -148,7 +148,7 @@ void QOpenGLCompositorBackingStore::updateTexture() glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); } } else { - foreach (const QRect &rect, m_dirty.rects()) { + for (const QRect &rect : m_dirty) { // intersect with image rect to be sure QRect r = imageRect & rect; @@ -161,7 +161,7 @@ void QOpenGLCompositorBackingStore::updateTexture() fixed |= r; } - foreach (const QRect &rect, fixed.rects()) { + for (const QRect &rect : fixed) { // if the sub-rect is full-width we can pass the image data directly to // OpenGL instead of copying, since there's no gap between scanlines if (rect.width() == imageRect.width()) { @@ -258,7 +258,7 @@ void QOpenGLCompositorBackingStore::beginPaint(const QRegion ®ion) if (m_image.hasAlphaChannel()) { QPainter p(&m_image); p.setCompositionMode(QPainter::CompositionMode_Source); - foreach (const QRect &r, region.rects()) + for (const QRect &r : region) p.fillRect(r, Qt::transparent); } } diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index cc590cc545..8028e65147 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -7,7 +7,7 @@ TEMPLATE = subdirs #win32:SUBDIRS += nla win32:SUBDIRS += generic -win32:!wince:!winrt: SUBDIRS += nativewifi +win32:!winrt: SUBDIRS += nativewifi mac:contains(QT_CONFIG, corewlan):SUBDIRS += corewlan mac:SUBDIRS += generic android:SUBDIRS += android diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index aa0fc6b945..02ea7abf88 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -50,17 +50,10 @@ #include <QtCore/qdebug.h> #include <QtCore/private/qcoreapplication_p.h> -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) +#if defined(Q_OS_WIN32) #include "../platformdefs_win.h" #endif -#ifdef Q_OS_WINCE -typedef ULONG NDIS_OID, *PNDIS_OID; -# ifndef QT_NO_WINCE_NUIOUSER -# include <nuiouser.h> -# endif -#endif // Q_OS_WINCE - #ifdef Q_OS_WINRT #include <qfunctions_winrt.h> @@ -92,36 +85,22 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_NETWORKINTERFACE static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interface) { -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) +#if defined(Q_OS_WIN32) DWORD bytesWritten; NDIS_MEDIUM medium; NDIS_PHYSICAL_MEDIUM physicalMedium; -#if defined(Q_OS_WINCE) && !defined(QT_NO_WINCE_NUIOUSER) - NDISUIO_QUERY_OID nicGetOid; - HANDLE handle = CreateFile((PTCHAR)NDISUIO_DEVICE_NAME, 0, - FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); -#else unsigned long oid; HANDLE handle = CreateFile((TCHAR *)QString::fromLatin1("\\\\.\\%1").arg(interface).utf16(), 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); -#endif if (handle == INVALID_HANDLE_VALUE) return QNetworkConfiguration::BearerUnknown; bytesWritten = 0; -#if defined(Q_OS_WINCE) && !defined(QT_NO_WINCE_NUIOUSER) - ZeroMemory(&nicGetOid, sizeof(NDISUIO_QUERY_OID)); - nicGetOid.Oid = OID_GEN_MEDIA_SUPPORTED; - nicGetOid.ptcDeviceName = (PTCHAR)interface.utf16(); - bool result = DeviceIoControl(handle, IOCTL_NDISUIO_QUERY_OID_VALUE, &nicGetOid, sizeof(nicGetOid), - &nicGetOid, sizeof(nicGetOid), &bytesWritten, 0); -#else oid = OID_GEN_MEDIA_SUPPORTED; bool result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid), &medium, sizeof(medium), &bytesWritten, 0); -#endif if (!result) { CloseHandle(handle); return QNetworkConfiguration::BearerUnknown; @@ -129,22 +108,9 @@ static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interf bytesWritten = 0; -#if defined(Q_OS_WINCE) && !defined(QT_NO_WINCE_NUIOUSER) - medium = NDIS_MEDIUM( *(LPDWORD)nicGetOid.Data ); - - ZeroMemory(&nicGetOid, sizeof(NDISUIO_QUERY_OID)); - nicGetOid.Oid = OID_GEN_PHYSICAL_MEDIUM; - nicGetOid.ptcDeviceName = (PTCHAR)interface.utf16(); - - result = DeviceIoControl(handle, IOCTL_NDISUIO_QUERY_OID_VALUE, &nicGetOid, sizeof(nicGetOid), - &nicGetOid, sizeof(nicGetOid), &bytesWritten, 0); - - physicalMedium = NDIS_PHYSICAL_MEDIUM( *(LPDWORD)nicGetOid.Data ); -#else oid = OID_GEN_PHYSICAL_MEDIUM; result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid), &physicalMedium, sizeof(physicalMedium), &bytesWritten, 0); -#endif if (!result) { CloseHandle(handle); diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro index 32ff5446e5..113d0667d2 100644 --- a/src/plugins/bearer/nla/nla.pro +++ b/src/plugins/bearer/nla/nla.pro @@ -2,11 +2,7 @@ TARGET = qnlabearer QT = core core-private network network-private -!wince* { - LIBS += -lws2_32 -} else { - LIBS += -lws2 -} +LIBS += -lws2_32 HEADERS += qnlaengine.h \ ../platformdefs_win.h \ diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp index 200d5789a8..994fe8386b 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp @@ -278,7 +278,7 @@ void QIBusPlatformInputContext::updatePreeditText(const QDBusVariant &text, uint QList<QInputMethodEvent::Attribute> attributes = t.attributes.imAttributes(); if (!t.text.isEmpty()) - attributes += QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursorPos, visible ? 1 : 0, QVariant()); + attributes += QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursorPos, visible ? 1 : 0); QInputMethodEvent event(t.text, attributes); QCoreApplication::sendEvent(input, &event); diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index dc420775cf..125a03469f 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -645,7 +645,7 @@ jboolean QAndroidInputContext::commitText(const QString &text, jint newCursorPos : localPos - text.length() + newCursorPosition; //move the cursor attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, - newLocalPos, 0, QVariant())); + newLocalPos, 0)); } } m_blockUpdateSelection = updateSelectionWasBlocked; @@ -691,7 +691,7 @@ jboolean QAndroidInputContext::finishComposingText() // Moving Qt's cursor to where the preedit cursor used to be QList<QInputMethodEvent::Attribute> attributes; - attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, localCursorPos, 0, QVariant())); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, localCursorPos, 0)); QInputMethodEvent event(QString(), attributes); event.setCommitString(m_composingText); @@ -848,8 +848,7 @@ jboolean QAndroidInputContext::setComposingText(const QString &text, jint newCur QList<QInputMethodEvent::Attribute> attributes; attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, newCursorPosition, - 1, - QVariant())); + 1)); // Show compose text underlined QTextCharFormat underlined; underlined.setFontUnderline(true); @@ -921,7 +920,7 @@ jboolean QAndroidInputContext::setComposingRegion(jint start, jint end) QVariant(underlined))); // Keep the cursor position unchanged (don't move to end of preedit) - attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, currentCursor - start, 1, QVariant())); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, currentCursor - start, 1)); QInputMethodEvent event(m_composingText, attributes); event.setCommitString(QString(), relativeStart, length); @@ -955,7 +954,7 @@ jboolean QAndroidInputContext::setSelection(jint start, jint end) // preedit cursor int localOldPos = query->value(Qt::ImCursorPosition).toInt(); int pos = localCursorPos - localOldPos; - attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, pos, 1, QVariant())); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, pos, 1)); //but we have to tell Qt about the compose text all over again @@ -970,8 +969,7 @@ jboolean QAndroidInputContext::setSelection(jint start, jint end) // actually changing the selection attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, localCursorPos, - end - start, - QVariant())); + end - start)); } QInputMethodEvent event(m_composingText, attributes); sendInputMethodEventThreadSafe(&event); diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp index 80d7e31aa3..c0a2b2c578 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp @@ -80,6 +80,8 @@ Qt::ScreenOrientation QAndroidPlatformIntegration::m_nativeOrientation = Qt::Pri Qt::ApplicationState QAndroidPlatformIntegration::m_defaultApplicationState = Qt::ApplicationActive; +bool QAndroidPlatformIntegration::m_showPasswordEnabled = false; + void *QAndroidPlatformNativeInterface::nativeResourceForIntegration(const QByteArray &resource) { if (resource=="JavaVM") @@ -191,6 +193,12 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList ¶ } QWindowSystemInterface::registerTouchDevice(m_touchDevice); } + + auto contentResolver = javaActivity.callObjectMethod("getContentResolver", "()Landroid/content/ContentResolver;"); + Q_ASSERT(contentResolver.isValid()); + m_showPasswordEnabled = QJNIObjectPrivate::callStaticMethod<jint>("android/provider/Settings$System", "getInt", + "(Landroid/content/ContentResolver;Ljava/lang/String;)I", contentResolver.object(), + QJNIObjectPrivate::getStaticObjectField("android/provider/Settings$System", "TEXT_SHOW_PASSWORD", "Ljava/lang/String;").object()) > 0; } QGuiApplicationPrivate::instance()->setApplicationState(m_defaultApplicationState); @@ -313,6 +321,9 @@ QPlatformServices *QAndroidPlatformIntegration::services() const QVariant QAndroidPlatformIntegration::styleHint(StyleHint hint) const { switch (hint) { + case PasswordMaskDelay: + // this number is from a hard-coded value in Android code (cf. PasswordTransformationMethod) + return m_showPasswordEnabled ? 1500 : 0; case ShowIsMaximized: return true; default: diff --git a/src/plugins/platforms/android/qandroidplatformintegration.h b/src/plugins/platforms/android/qandroidplatformintegration.h index 1f06c23d0b..bda0bee9ad 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.h +++ b/src/plugins/platforms/android/qandroidplatformintegration.h @@ -143,6 +143,8 @@ private: static Qt::ApplicationState m_defaultApplicationState; + static bool m_showPasswordEnabled; + QPlatformFontDatabase *m_androidFDB; QAndroidPlatformNativeInterface *m_androidPlatformNativeInterface; QAndroidPlatformServices *m_androidPlatformServices; diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp index aa4fa94f0a..35a93bb847 100644 --- a/src/plugins/platforms/android/qandroidplatformscreen.cpp +++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp @@ -379,9 +379,8 @@ void QAndroidPlatformScreen::doRedraw() } } - foreach (const QRect &rect, visibleRegion.rects()) { + for (const QRect &rect : visibleRegion) compositePainter.fillRect(rect, QColor(Qt::transparent)); - } ret = ANativeWindow_unlockAndPost(m_nativeSurface); if (ret >= 0) diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.mm b/src/plugins/platforms/cocoa/qcocoaapplication.mm index c496134606..170f17504f 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplication.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplication.mm @@ -71,11 +71,11 @@ ** ****************************************************************************/ -#include <qcocoaapplication.h> +#include "qcocoaapplication.h" -#include <qcocoaintrospection.h> -#include <qcocoaapplicationdelegate.h> -#include <qcocoahelpers.h> +#include "qcocoaintrospection.h" +#include "qcocoaapplicationdelegate.h" +#include "qcocoahelpers.h" #include <qguiapplication.h> #include <qdebug.h> diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index b060d6a082..20233518b3 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -96,9 +96,8 @@ bool QCocoaBackingStore::scroll(const QRegion &area, int dx, int dy) extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); const qreal devicePixelRatio = m_qImage.devicePixelRatio(); QPoint qpoint(dx * devicePixelRatio, dy * devicePixelRatio); - const QVector<QRect> qrects = area.rects(); - for (int i = 0; i < qrects.count(); ++i) { - const QRect &qrect = QRect(qrects.at(i).topLeft() * devicePixelRatio, qrects.at(i).size() * devicePixelRatio); + for (const QRect &rect : area) { + const QRect qrect(rect.topLeft() * devicePixelRatio, rect.size() * devicePixelRatio); qt_scrollRectInImage(m_qImage, qrect, qpoint); } return true; @@ -109,10 +108,9 @@ void QCocoaBackingStore::beginPaint(const QRegion ®ion) if (m_qImage.hasAlphaChannel()) { QPainter p(&m_qImage); p.setCompositionMode(QPainter::CompositionMode_Source); - const QVector<QRect> rects = region.rects(); const QColor blank = Qt::transparent; - for (QVector<QRect>::const_iterator it = rects.begin(), end = rects.end(); it != end; ++it) - p.fillRect(*it, blank); + for (const QRect &rect : region) + p.fillRect(rect, blank); } } diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 4eb35f5495..0375dd85f2 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -61,6 +61,8 @@ #include <qvarlengtharray.h> #include <stdlib.h> #include <qabstracteventdispatcher.h> +#include <qsysinfo.h> +#include <qglobal.h> #include <QDir> #include <qpa/qplatformnativeinterface.h> @@ -160,6 +162,11 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate); // here to make sure it gets the correct value. [mSavePanel setDelegate:self]; +#if QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_11) + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_11) + mOpenPanel.accessoryViewDisclosed = YES; +#endif + if (mOptions->isLabelExplicitlySet(QFileDialogOptions::Accept)) [mSavePanel setPrompt:[self strip:options->labelText(QFileDialogOptions::Accept)]]; if (mOptions->isLabelExplicitlySet(QFileDialogOptions::FileName)) diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 7480d99d19..c91c67fe79 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -202,15 +202,9 @@ NSImage *qt_mac_create_nsimage(const QIcon &icon) HIMutableShapeRef qt_mac_QRegionToHIMutableShape(const QRegion ®ion) { HIMutableShapeRef shape = HIShapeCreateMutable(); - QVector<QRect> rects = region.rects(); - if (!rects.isEmpty()) { - int n = rects.count(); - const QRect *qt_r = rects.constData(); - while (n--) { - CGRect cgRect = CGRectMake(qt_r->x(), qt_r->y(), qt_r->width(), qt_r->height()); - HIShapeUnionWithRect(shape, &cgRect); - ++qt_r; - } + for (const QRect &rect : region) { + CGRect cgRect = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()); + HIShapeUnionWithRect(shape, &cgRect); } return shape; } diff --git a/src/plugins/platforms/cocoa/qcocoakeymapper.h b/src/plugins/platforms/cocoa/qcocoakeymapper.h index 93ebc5b9dc..4ba615efeb 100644 --- a/src/plugins/platforms/cocoa/qcocoakeymapper.h +++ b/src/plugins/platforms/cocoa/qcocoakeymapper.h @@ -40,7 +40,7 @@ #ifndef QCOCOAKEYMAPPER_H #define QCOCOAKEYMAPPER_H -#include <qcocoahelpers.h> +#include "qcocoahelpers.h" #include <AppKit/AppKit.h> #include <Carbon/Carbon.h> diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 4d2af84e8e..4d5f5d74f2 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -72,6 +72,7 @@ typedef NSWindow<QNSWindowProtocol> QCocoaNSWindow; QCocoaWindow *_platformWindow; BOOL _grabbingMouse; BOOL _releaseOnMouseUp; + QPointer<QObject> _watcher; } @property (nonatomic, readonly) QCocoaNSWindow *window; @@ -321,6 +322,11 @@ public: // for QNSView }; QHash<quintptr, BorderRange> m_contentBorderAreas; // identifer -> uppper/lower QHash<quintptr, bool> m_enabledContentBorderAreas; // identifer -> enabled state (true/false) + + // This object is tracked by a 'watcher' + // object in a window helper, preventing use of dangling + // pointers. + QObject sentinel; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 29cc4130ed..01e72303be 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -99,6 +99,7 @@ static bool isMouseEvent(NSEvent *ev) // make sure that m_nsWindow stays valid until the // QCocoaWindow is deleted by Qt. [_window setReleasedWhenClosed:NO]; + _watcher = &_platformWindow->sentinel; } return self; @@ -107,7 +108,7 @@ static bool isMouseEvent(NSEvent *ev) - (void)handleWindowEvent:(NSEvent *)theEvent { QCocoaWindow *pw = self.platformWindow; - if (pw && pw->m_forwardWindow) { + if (_watcher && pw && pw->m_forwardWindow) { if (theEvent.type == NSLeftMouseUp || theEvent.type == NSLeftMouseDragged) { QNSView *forwardView = pw->m_qtView; if (theEvent.type == NSLeftMouseUp) { @@ -146,7 +147,7 @@ static bool isMouseEvent(NSEvent *ev) if (!self.window.delegate) return; // Already detached, pending NSAppKitDefined event - if (pw && pw->frameStrutEventsEnabled() && isMouseEvent(theEvent)) { + if (_watcher && pw && pw->frameStrutEventsEnabled() && isMouseEvent(theEvent)) { NSPoint loc = [theEvent locationInWindow]; NSRect windowFrame = [self.window convertRectFromScreen:[self.window frame]]; NSRect contentFrame = [[self.window contentView] frame]; @@ -162,6 +163,7 @@ static bool isMouseEvent(NSEvent *ev) - (void)detachFromPlatformWindow { _platformWindow = 0; + _watcher.clear(); [self.window.delegate release]; self.window.delegate = nil; } diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index cbb4888718..fb20b4d23b 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -425,7 +425,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; // set the active window to zero here, the new key window's // NSWindowDidBecomeKeyNotification hander will change the active window NSWindow *keyWindow = [NSApp keyWindow]; - if (!keyWindow) { + if (!keyWindow || keyWindow == windowNotification.object) { // no new key window, go ahead and set the active window to zero if (!m_platformWindow->windowIsPopupType() && !m_isMenuView) QWindowSystemInterface::handleWindowActivated(0); @@ -518,7 +518,7 @@ QT_WARNING_POP m_backingStore = backingStore; m_backingStoreOffset = offset * m_backingStore->getBackingStoreDevicePixelRatio(); - foreach (QRect rect, region.rects()) + for (const QRect &rect : region) [self setNeedsDisplayInRect:NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())]; } diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm index 395c25c915..759c4d26a5 100644 --- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm +++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm @@ -88,10 +88,7 @@ static void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransfor if (rgn.isEmpty()) { CGContextAddRect(hd, CGRectMake(0, 0, 0, 0)); } else { - QVector<QRect> rects = rgn.rects(); - const int count = rects.size(); - for (int i = 0; i < count; i++) { - const QRect &r = rects[i]; + for (const QRect &r : rgn) { CGRect mac_r = CGRectMake(r.x(), r.y(), r.width(), r.height()); CGContextAddRect(hd, mac_r); } diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.cpp index 97eadb207b..565d46a424 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.cpp @@ -95,7 +95,7 @@ void QWindowsDirect2DBackingStore::beginPaint(const QRegion ®ion) painter.setCompositionMode(QPainter::CompositionMode_Source); - foreach (const QRect &r, region.rects()) + for (const QRect &r, region) painter.fillRect(r, clear); } @@ -127,9 +127,8 @@ void QWindowsDirect2DBackingStore::resize(const QSize &size, const QRegion ®i QPixmap *newPixmap = nativeWindow(window())->pixmap(); if (!old.isNull()) { - foreach (const QRect &rect, region.rects()) { + for (const QRect &rect : region) platformPixmap(newPixmap)->copy(old.handle(), rect); - } } } diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp index 4e677166b2..c750b02078 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp @@ -122,7 +122,7 @@ void QWindowsDirect2DWindow::flush(QWindowsDirect2DBitmap *bitmap, const QRegion QRegion clipped = region; clipped &= QRect(QPoint(), size); - foreach (const QRect &rect, clipped.rects()) { + for (const QRect &rect : clipped) { QRectF rectF(rect); dc->DrawBitmap(bitmap->bitmap(), to_d2d_rect_f(rectF), diff --git a/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp b/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp index 0bcf93aa3d..9786f66b7c 100644 --- a/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp +++ b/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp @@ -70,9 +70,7 @@ void QDirectFbBackingStore::flush(QWindow *, const QRegion ®ion, const QPoint { m_pmdata->blittable()->unlock(); - QVector<QRect> rects = region.rects(); - for (int i = 0 ; i < rects.size(); i++) { - const QRect rect = rects.at(i); + for (const QRect &rect : region) { DFBRegion dfbReg(rect.x() + offset.x(),rect.y() + offset.y(),rect.right() + offset.x(),rect.bottom() + offset.y()); m_dfbSurface->Flip(m_dfbSurface.data(), &dfbReg, DFBSurfaceFlipFlags(DSFLIP_BLIT|DSFLIP_ONSYNC)); } @@ -108,11 +106,8 @@ bool QDirectFbBackingStore::scroll(const QRegion &area, int dx, int dy) if (area.rectCount() == 1) { scrollSurface(m_dfbSurface.data(), area.boundingRect(), dx, dy); } else { - const QVector<QRect> rects = area.rects(); - const int n = rects.size(); - for (int i=0; i<n; ++i) { - scrollSurface(m_dfbSurface.data(), rects.at(i), dx, dy); - } + for (const QRect &rect : area) + scrollSurface(m_dfbSurface.data(), rect, dx, dy); } return true; } diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm index 8d82364cc0..f49f81912e 100644 --- a/src/plugins/platforms/ios/qioseventdispatcher.mm +++ b/src/plugins/platforms/ios/qioseventdispatcher.mm @@ -493,7 +493,7 @@ void QIOSEventDispatcher::handleRunLoopExit(CFRunLoopActivity activity) Q_UNUSED(activity); Q_ASSERT(activity == kCFRunLoopExit); - if (m_processEventLevel == 1 && !QThreadData::current()->eventLoops.top()->isRunning()) { + if (m_processEventLevel == 1 && !currentEventLoop()->isRunning()) { qEventDispatcherDebug() << "Root runloop level exited"; interruptEventLoopExec(); } diff --git a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp index d123bdf82d..025dc22111 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp @@ -414,9 +414,8 @@ QRegion QLinuxFbScreen::doRedraw() if (!mBlitter) mBlitter = new QPainter(&mFbScreenImage); - QVector<QRect> rects = touched.rects(); - for (int i = 0; i < rects.size(); i++) - mBlitter->drawImage(rects[i], *mScreenImage, rects[i]); + for (const QRect &rect : touched) + mBlitter->drawImage(rect, *mScreenImage, rect); return touched; } diff --git a/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp b/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp index 465ad355b9..f80d85842a 100644 --- a/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp +++ b/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp @@ -100,7 +100,7 @@ void QMirClientBackingStore::updateTexture() QRegion fixed; QRect imageRect = mImage.rect(); - Q_FOREACH (const QRect &rect, mDirty.rects()) { + for (const QRect &rect : mDirty) { // intersect with image rect to be sure QRect r = imageRect & rect; @@ -113,7 +113,7 @@ void QMirClientBackingStore::updateTexture() fixed |= r; } - Q_FOREACH (const QRect &rect, fixed.rects()) { + for (const QRect &rect : fixed) { // if the sub-rect is full-width we can pass the image data directly to // OpenGL instead of copying, since there is no gap between scanlines if (rect.width() == imageRect.width()) { diff --git a/src/plugins/platforms/offscreen/qoffscreencommon.cpp b/src/plugins/platforms/offscreen/qoffscreencommon.cpp index ed1a81c2b3..a63aacdbfe 100644 --- a/src/plugins/platforms/offscreen/qoffscreencommon.cpp +++ b/src/plugins/platforms/offscreen/qoffscreencommon.cpp @@ -179,9 +179,8 @@ bool QOffscreenBackingStore::scroll(const QRegion &area, int dx, int dy) if (m_image.isNull()) return false; - const QVector<QRect> rects = area.rects(); - for (int i = 0; i < rects.size(); ++i) - qt_scrollRectInImage(m_image, rects.at(i), QPoint(dx, dy)); + for (const QRect &rect : area) + qt_scrollRectInImage(m_image, rect, QPoint(dx, dy)); return true; } diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp index c9a89def41..a758bdf7f4 100644 --- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp @@ -139,7 +139,7 @@ void QQnxRasterBackingStore::beginPaint(const QRegion ®ion) platformWindow()->adjustBufferSize(); if (window()->requestedFormat().alphaBufferSize() > 0) { - foreach (const QRect &r, region.rects()) { + for (const QRect &r : region) { // Clear transparent regions const int bg[] = { SCREEN_BLIT_COLOR, 0x00000000, diff --git a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp index 0fe80d856d..b075690e3d 100644 --- a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp @@ -208,10 +208,9 @@ void QQnxRasterWindow::blitPreviousToCurrent(const QRegion ®ion, int dx, int QQnxBuffer &previousBuffer = m_buffers[m_previousBufferIndex]; // Break down region into non-overlapping rectangles - const QVector<QRect> rects = region.rects(); - for (int i = rects.size() - 1; i >= 0; i--) { + for (auto rit = region.rbegin(), rend = region.rend(); rit != rend; ++rit) { // Clip rectangle to bounds of target - const QRect rect = rects[i].intersected(currentBuffer.rect()); + const QRect rect = rit->intersected(currentBuffer.rect()); if (rect.isEmpty()) continue; diff --git a/src/plugins/platforms/windows/accessible/accessible.pri b/src/plugins/platforms/windows/accessible/accessible.pri index 0774d907f2..0e3aacc558 100644 --- a/src/plugins/platforms/windows/accessible/accessible.pri +++ b/src/plugins/platforms/windows/accessible/accessible.pri @@ -6,15 +6,13 @@ HEADERS += \ $$PWD/qwindowsaccessibility.h \ $$PWD/comutils.h -!wince: { - SOURCES += $$PWD/qwindowsmsaaaccessible.cpp - HEADERS += $$PWD/qwindowsmsaaaccessible.h +SOURCES += $$PWD/qwindowsmsaaaccessible.cpp +HEADERS += $$PWD/qwindowsmsaaaccessible.h - !mingw: { - SOURCES += $$PWD/iaccessible2.cpp - HEADERS += $$PWD/iaccessible2.h - include(../../../../3rdparty/iaccessible2/iaccessible2.pri) - } +!mingw: { + SOURCES += $$PWD/iaccessible2.cpp + HEADERS += $$PWD/iaccessible2.h + include(../../../../3rdparty/iaccessible2/iaccessible2.pri) } mingw: LIBS *= -luuid diff --git a/src/plugins/platforms/windows/accessible/comutils.cpp b/src/plugins/platforms/windows/accessible/comutils.cpp index 7655bdf622..1c072c5e2c 100644 --- a/src/plugins/platforms/windows/accessible/comutils.cpp +++ b/src/plugins/platforms/windows/accessible/comutils.cpp @@ -170,7 +170,6 @@ bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeN case QVariant::LongLong: if (out && arg.vt == (VT_CY|VT_BYREF)) { arg.pcyVal->int64 = qvar.toLongLong(); -#if !defined(Q_OS_WINCE) && defined(_MSC_VER) && _MSC_VER >= 1400 } else if (out && arg.vt == (VT_I8|VT_BYREF)) { *arg.pllVal = qvar.toLongLong(); } else { @@ -181,22 +180,11 @@ bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeN arg.vt |= VT_BYREF; } } -#else - } else { - arg.vt = VT_CY; - arg.cyVal.int64 = qvar.toLongLong(); - if (out) { - arg.pcyVal = new CY(arg.cyVal); - arg.vt |= VT_BYREF; - } - } -#endif break; case QVariant::ULongLong: if (out && arg.vt == (VT_CY|VT_BYREF)) { arg.pcyVal->int64 = qvar.toULongLong(); -#if !defined(Q_OS_WINCE) && defined(_MSC_VER) && _MSC_VER >= 1400 } else if (out && arg.vt == (VT_UI8|VT_BYREF)) { *arg.pullVal = qvar.toULongLong(); } else { @@ -207,18 +195,6 @@ bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeN arg.vt |= VT_BYREF; } } -#else - } else { - arg.vt = VT_CY; - arg.cyVal.int64 = qvar.toULongLong(); - if (out) { - arg.pcyVal = new CY(arg.cyVal); - arg.vt |= VT_BYREF; - } - } - -#endif - break; case QVariant::Bool: diff --git a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp index 4a3f0ccb2b..08edf816b0 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp @@ -56,12 +56,10 @@ #include <QtGui/qguiapplication.h> #include "qwindowsaccessibility.h" -#if !defined(Q_OS_WINCE) -# ifdef Q_CC_MINGW -# include "qwindowsmsaaaccessible.h" -# else -# include "iaccessible2.h" -# endif +#ifdef Q_CC_MINGW +# include "qwindowsmsaaaccessible.h" +#else +# include "iaccessible2.h" #endif #include "comutils.h" @@ -74,11 +72,7 @@ #include <winuser.h> #if !defined(WINABLEAPI) -# if defined(Q_OS_WINCE) -# include <bldver.h> -# else -# include <winable.h> -# endif +# include <winable.h> #endif #include <servprov.h> @@ -153,10 +147,6 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) } } -#if defined(Q_OS_WINCE) // ### TODO: check for NotifyWinEvent in CE 6.0 - // There is no user32.lib nor NotifyWinEvent for CE - return; -#else // An event has to be associated with a window, // so find the first parent that is a widget and that has a WId QAccessibleInterface *iface = event->accessibleInterface(); @@ -179,7 +169,6 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) event->type() != QAccessible::ObjectDestroyed) { ::NotifyWinEvent(event->type(), hWnd, OBJID_CLIENT, QAccessible::uniqueId(iface)); } -#endif // Q_OS_WINCE } QWindow *QWindowsAccessibility::windowHelper(const QAccessibleInterface *iface) @@ -202,11 +191,6 @@ QWindow *QWindowsAccessibility::windowHelper(const QAccessibleInterface *iface) */ IAccessible *QWindowsAccessibility::wrap(QAccessibleInterface *acc) { -#if defined(Q_OS_WINCE) - Q_UNUSED(acc); - - return 0; -#else if (!acc) return 0; @@ -222,12 +206,10 @@ IAccessible *QWindowsAccessibility::wrap(QAccessibleInterface *acc) IAccessible *iacc = 0; wacc->QueryInterface(IID_IAccessible, reinterpret_cast<void **>(&iacc)); return iacc; -#endif // defined(Q_OS_WINCE) } bool QWindowsAccessibility::handleAccessibleObjectFromWindowRequest(HWND hwnd, WPARAM wParam, LPARAM lParam, LRESULT *lResult) { -#if !defined(Q_OS_WINCE) if (static_cast<long>(lParam) == static_cast<long>(UiaRootObjectId)) { /* For UI Automation */ } else if (DWORD(lParam) == DWORD(OBJID_CLIENT)) { @@ -263,12 +245,6 @@ bool QWindowsAccessibility::handleAccessibleObjectFromWindowRequest(HWND hwnd, W } } } -#else - Q_UNUSED(hwnd); - Q_UNUSED(wParam); - Q_UNUSED(lParam); - Q_UNUSED(lResult); -#endif // !defined(Q_OS_WINCE) return false; } diff --git a/src/plugins/platforms/windows/qplatformfunctions_wince.h b/src/plugins/platforms/windows/qplatformfunctions_wince.h deleted file mode 100644 index 309191537a..0000000000 --- a/src/plugins/platforms/windows/qplatformfunctions_wince.h +++ /dev/null @@ -1,371 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORMFUNCTIONS_WCE_H -#define QPLATFORMFUNCTIONS_WCE_H -// -// W A R N I N G -// ------------- -// -// This file is part of the QPA API and is not meant to be used -// in applications. Usage of this API may make your code -// source and binary incompatible with future versions of Qt. -// - -#ifdef Q_OS_WINCE -#include <QtCore/qfunctions_wince.h> -#define UNDER_NT -#include <wingdi.h> -#include <objidl.h> - -#ifndef WM_MOUSELEAVE -# define WM_MOUSELEAVE 0x02A3 -#endif - -#ifndef WM_TOUCH -# define WM_TOUCH 0x0240 -#endif - -#ifndef WM_GETOBJECT -#define WM_GETOBJECT 0x003D -#endif - -#define GetWindowLongPtr GetWindowLong -#define SetWindowLongPtr SetWindowLong -#define GWLP_USERDATA GWL_USERDATA - -#ifndef CWP_SKIPINVISIBLE -#define CWP_SKIPINVISIBLE 0x0001 -#define CWP_SKIPTRANSPARENT 0x0004 -#endif - -#ifndef CS_OWNDC -#define CS_OWNDC 0x0020 -#endif - -#ifndef HWND_MESSAGE -#define HWND_MESSAGE 0 -#endif - -// Real Value would be 0x40000000, but if we pass this to Windows Embedded Compact -// he blits it wrongly, so lets not do any harm and define it to 0 -#ifndef CAPTUREBLT -#define CAPTUREBLT (DWORD)0x0 -#endif - -#define SW_SHOWMINIMIZED SW_MINIMIZE -#define SW_SHOWMINNOACTIVE SW_MINIMIZE - -#ifndef CF_DIBV5 -#define CF_DIBV5 17 -#endif - -#ifndef WM_MOUSEACTIVATE -#define WM_MOUSEACTIVATE 0x0021 -#endif - -#ifndef WM_CHILDACTIVATE -#define WM_CHILDACTIVATE 0x0022 -#endif - -#ifndef WM_PARENTNOTIFY -#define WM_PARENTNOTIFY 0x0210 -#endif - -#ifndef WM_ENTERIDLE -#define WM_ENTERIDLE 0x0121 -#endif - -#ifndef WM_GETMINMAXINFO -#define WM_GETMINMAXINFO 0x0024 -#endif - -#ifndef WM_WINDOWPOSCHANGING -#define WM_WINDOWPOSCHANGING 0x0046 -#endif - -#ifndef WM_NCMOUSEMOVE -#define WM_NCMOUSEMOVE 0x00A0 -#endif - -#ifndef WM_NCMBUTTONDBLCLK -#define WM_NCMBUTTONDBLCLK 0x00A -#endif - -#ifndef WM_NCCREATE -#define WM_NCCREATE 0x0081 -#endif - -#ifndef WM_NCCALCSIZE -#define WM_NCCALCSIZE 0x0083 -#endif - -#ifndef WM_NCACTIVATE -#define WM_NCACTIVATE 0x0086 -#endif - -#ifndef WM_NCMOUSELEAVE -#define WM_NCMOUSELEAVE 0x02A2 -#endif - -#ifndef WM_NCLBUTTONDOWN -#define WM_NCLBUTTONDOWN 0x00A1 -#endif - -#ifndef WM_NCLBUTTONUP -#define WM_NCLBUTTONUP 0x00A2 -#endif - -#ifndef WM_NCPAINT -#define WM_NCPAINT 0x0085 -#endif - -#ifndef WM_NCHITTEST -#define WM_NCHITTEST 0x0084 -#endif - -#ifndef WM_THEMECHANGED -#define WM_THEMECHANGED 0x031A -#endif - -#ifndef WM_DISPLAYCHANGE -#define WM_DISPLAYCHANGE 0x007E -#endif - -#ifndef VREFRESH -#define VREFRESH 116 -#endif - -#ifndef SM_SWAPBUTTON -#define SM_SWAPBUTTON 23 -#endif - -// application defines -#define SPI_SETNONCLIENTMETRICS 72 -#define SPI_SETICONTITLELOGFONT 0x0022 -#define WM_ACTIVATEAPP 0x001c -#define SW_PARENTCLOSING 1 -#define SW_OTHERMAXIMIZED 2 -#define SW_PARENTOPENING 3 -#define SW_OTHERRESTORED 4 -#define GET_XBUTTON_WPARAM(wParam) (HIWORD(wParam)) - -// drag n drop -#ifndef CFSTR_PERFORMEDDROPEFFECT -#define CFSTR_PERFORMEDDROPEFFECT TEXT("Performed DropEffect") -#endif - -// QWidget -#define SW_SHOWMINIMIZED SW_MINIMIZE - -// QRegion -#define ALTERNATE 0 -#define WINDING 1 - -// QFontEngine -typedef struct _FIXED { - WORD fract; - short value; -} FIXED; - -typedef struct tagPOINTFX { - FIXED x; - FIXED y; -} POINTFX; - -typedef struct _MAT2 { - FIXED eM11; - FIXED eM12; - FIXED eM21; - FIXED eM22; -} MAT2; - -typedef struct _GLYPHMETRICS { - UINT gmBlackBoxX; - UINT gmBlackBoxY; - POINT gmptGlyphOrigin; - short gmCellIncX; - short gmCellIncY; -} GLYPHMETRICS; - -typedef struct tagTTPOLYGONHEADER -{ - DWORD cb; - DWORD dwType; - POINTFX pfxStart; -} TTPOLYGONHEADER; - -typedef struct tagTTPOLYCURVE -{ - WORD wType; - WORD cpfx; - POINTFX apfx[1]; -} TTPOLYCURVE; - -#define GGO_NATIVE 2 -#define GGO_GLYPH_INDEX 0x0080 -#define TT_PRIM_LINE 1 -#define TT_PRIM_QSPLINE 2 -#define TT_PRIM_CSPLINE 3 -#define ANSI_VAR_FONT 12 - -#ifndef OleInitialize -#define OleInitialize(a) 0 -#endif - -#ifndef SPI_GETSNAPTODEFBUTTON -#define SPI_GETSNAPTODEFBUTTON 95 -#endif - -#ifndef WS_EX_LAYERED -#define WS_EX_LAYERED 0x00080000 -#endif - -// Clipboard -------------------------------------------------------- -#ifndef WM_CHANGECBCHAIN -#define WM_CHANGECBCHAIN 0x030D -#endif - -#ifndef WM_DRAWCLIPBOARD -#define WM_DRAWCLIPBOARD 0x0308 -#endif - -#include <QFileInfo> - -inline bool IsIconic( HWND /*hWnd*/ ) -{ - return false; -} - -inline int AddFontResourceExW( LPCWSTR name, DWORD /*fl*/, PVOID /*res*/) -{ - QString fName = QString::fromWCharArray(name); - QFileInfo fileinfo(fName); - fName = fileinfo.absoluteFilePath(); - return AddFontResource((LPCWSTR)fName.utf16()); -} - -inline bool RemoveFontResourceExW( LPCWSTR /*name*/, DWORD /*fl*/, PVOID /*pdv*/) -{ - return 0; -} - -inline void OleUninitialize() -{ -} - -inline DWORD GetGlyphOutline( HDC /*hdc*/, UINT /*uChar*/, INT /*fuFormat*/, GLYPHMETRICS * /*lpgm*/, - DWORD /*cjBuffer*/, LPVOID /*pvBuffer*/, CONST MAT2 * /*lpmat2*/ ) -{ - qFatal("GetGlyphOutline() not supported under Windows CE. Please try using freetype font-rendering, by " - "passing the command line argument -platform windows:fontengine=freetype to the application."); - return GDI_ERROR; -} - -inline HWND GetAncestor(HWND hWnd, UINT /*gaFlags*/) -{ - return GetParent(hWnd); -} - -#ifndef GA_PARENT -# define GA_PARENT 1 -#endif - -#ifndef SPI_SETFONTSMOOTHINGTYPE -# define SPI_SETFONTSMOOTHINGTYPE 0x200B -#endif -#ifndef SPI_GETFONTSMOOTHINGTYPE -# define SPI_GETFONTSMOOTHINGTYPE 0x200A -#endif -#ifndef FE_FONTSMOOTHINGCLEARTYPE -# define FE_FONTSMOOTHINGCLEARTYPE 0x0002 -#endif - -#ifndef DEVICE_FONTTYPE -#define DEVICE_FONTTYPE 0x0002 -#endif - -#ifndef RASTER_FONTTYPE -#define RASTER_FONTTYPE 0x0001 -#endif - -#ifndef WM_DISPLAYCHANGE -#define WM_DISPLAYCHANGE 0x007E -#endif - -BOOL qt_wince_ChangeClipboardChain( - HWND hWndRemove, // handle to window to remove - HWND hWndNewNext // handle to next window -); -#define ChangeClipboardChain(a,b) qt_wince_ChangeClipboardChain(a,b); - -HWND qt_wince_SetClipboardViewer( - HWND hWndNewViewer // handle to clipboard viewer window -); -#define SetClipboardViewer(a) qt_wince_SetClipboardViewer(a) - -/* Shell stock icon IDs - SHGetStockIconInfo() is not available on CE, but we're using these - constants in code that is built on CE as well */ - enum - { - SIID_INVALID = -1, - SIID_DOCNOASSOC = 0, - SIID_FOLDER = 3, - SIID_FOLDEROPEN = 4, - SIID_DRIVE35 = 6, - SIID_DRIVEFIXED = 8, - SIID_DRIVENET = 9, - SIID_DRIVECD = 11, - SIID_HELP = 23, - SIID_RECYCLER = 31, - SIID_DRIVEDVD = 59, - SIID_SHIELD = 77, - SIID_WARNING = 78, - SIID_INFO = 79, - SIID_ERROR = 80 -}; - -#ifndef SHGSI_LINKOVERLAY -// Value is wrong, but doesn't matter, not used at runtime -#define SHGSI_LINKOVERLAY 0 -#endif - -#endif // Q_OS_WINCE -#endif // QPLATFORMFUNCTIONS_WCE_H diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h index 90008663e7..cb85856787 100644 --- a/src/plugins/platforms/windows/qtwindowsglobal.h +++ b/src/plugins/platforms/windows/qtwindowsglobal.h @@ -43,9 +43,6 @@ #include "qtwindows_additional.h" #include <QtCore/qnamespace.h> -#ifdef Q_OS_WINCE -# include "qplatformfunctions_wince.h" -#endif QT_BEGIN_NAMESPACE @@ -158,10 +155,8 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI case WM_MOUSEWHEEL: case WM_MOUSEHWHEEL: return QtWindows::MouseWheelEvent; -#ifndef Q_OS_WINCE case WM_WINDOWPOSCHANGING: return QtWindows::GeometryChangingEvent; -#endif case WM_MOVE: return QtWindows::MoveEvent; case WM_SHOWWINDOW: @@ -172,10 +167,8 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI return QtWindows::ResizeEvent; case WM_NCCALCSIZE: return QtWindows::CalculateSize; -#ifndef Q_OS_WINCE case WM_NCHITTEST: return QtWindows::NonClientHitTest; -#endif // !Q_OS_WINCE case WM_GETMINMAXINFO: return QtWindows::QuerySizeHints; case WM_KEYDOWN: // keyboard event @@ -243,12 +236,10 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI return QtWindows::ContextMenu; #endif case WM_SYSCOMMAND: -#ifndef Q_OS_WINCE if ((wParamIn & 0xfff0) == SC_CONTEXTHELP) return QtWindows::WhatsThisEvent; -#endif break; -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) case WM_QUERYENDSESSION: return QtWindows::QueryEndSessionApplicationEvent; case WM_ENDSESSION: diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp index 7123ed826d..2d5e4071bc 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -87,7 +87,6 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, QWindowsWindow *rw = QWindowsWindow::windowsWindowOf(window); Q_ASSERT(rw); -#ifndef Q_OS_WINCE const bool hasAlpha = rw->format().hasAlpha(); const Qt::WindowFlags flags = window->flags(); if ((flags & Qt::FramelessWindowHint) && QWindowsWindow::setWindowLayered(rw->handle(), flags, hasAlpha, rw->opacity()) && hasAlpha) { @@ -101,21 +100,16 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, POINT ptDst = {r.x(), r.y()}; POINT ptSrc = {0, 0}; BLENDFUNCTION blend = {AC_SRC_OVER, 0, BYTE(qRound(255.0 * rw->opacity())), AC_SRC_ALPHA}; - if (QWindowsContext::user32dll.updateLayeredWindowIndirect) { - RECT dirty = {dirtyRect.x(), dirtyRect.y(), - dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()}; - UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA, &dirty}; - const BOOL result = QWindowsContext::user32dll.updateLayeredWindowIndirect(rw->handle(), &info); - if (!result) - qErrnoWarning("UpdateLayeredWindowIndirect failed for ptDst=(%d, %d)," - " size=(%dx%d), dirty=(%dx%d %d, %d)", r.x(), r.y(), - r.width(), r.height(), dirtyRect.width(), dirtyRect.height(), - dirtyRect.x(), dirtyRect.y()); - } else { - QWindowsContext::user32dll.updateLayeredWindow(rw->handle(), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA); - } + RECT dirty = {dirtyRect.x(), dirtyRect.y(), + dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()}; + UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA, &dirty}; + const BOOL result = UpdateLayeredWindowIndirect(rw->handle(), &info); + if (!result) + qErrnoWarning("UpdateLayeredWindowIndirect failed for ptDst=(%d, %d)," + " size=(%dx%d), dirty=(%dx%d %d, %d)", r.x(), r.y(), + r.width(), r.height(), dirtyRect.width(), dirtyRect.height(), + dirtyRect.x(), dirtyRect.y()); } else { -#endif const HDC dc = rw->getDC(); if (!dc) { qErrnoWarning("%s: GetDC failed", __FUNCTION__); @@ -129,9 +123,7 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, qErrnoWarning(int(lastError), "%s: BitBlt failed", __FUNCTION__); } rw->releaseDC(); -#ifndef Q_OS_WINCE } -#endif // Write image for debug purposes. if (QWindowsContext::verbose > 2 && lcQpaBackingStore().isDebugEnabled()) { @@ -175,7 +167,7 @@ void QWindowsBackingStore::resize(const QSize &size, const QRegion ®ion) staticRegion &= QRect(0, 0, newimg.width(), newimg.height()); QPainter painter(&newimg); painter.setCompositionMode(QPainter::CompositionMode_Source); - foreach (const QRect &rect, staticRegion.rects()) + for (const QRect &rect : staticRegion) painter.drawImage(rect, oldimg, rect); } @@ -190,10 +182,9 @@ bool QWindowsBackingStore::scroll(const QRegion &area, int dx, int dy) if (m_image.isNull() || m_image->image().isNull()) return false; - const QVector<QRect> rects = area.rects(); const QPoint offset(dx, dy); - for (int i = 0; i < rects.size(); ++i) - qt_scrollRectInImage(m_image->image(), rects.at(i), offset); + for (const QRect &rect : area) + qt_scrollRectInImage(m_image->image(), rect, offset); return true; } @@ -207,7 +198,7 @@ void QWindowsBackingStore::beginPaint(const QRegion ®ion) QPainter p(&m_image->image()); p.setCompositionMode(QPainter::CompositionMode_Source); const QColor blank = Qt::transparent; - foreach (const QRect &r, region.rects()) + for (const QRect &r : region) p.fillRect(r, blank); } } diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp index d527e07308..21bc9d7377 100644 --- a/src/plugins/platforms/windows/qwindowsclipboard.cpp +++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp @@ -237,8 +237,7 @@ void QWindowsClipboard::propagateClipboardMessage(UINT message, WPARAM wParam, L 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)) { + if (IsHungAppWindow(m_nextClipboardViewer)) { qWarning("Cowardly refusing to send clipboard message to hung application..."); return; } diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index efeb1f5f05..ef0962c2ff 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -51,7 +51,7 @@ #ifndef QT_NO_ACCESSIBILITY # include "accessible/qwindowsaccessibility.h" #endif -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) # include <private/qsessionmanager_p.h> # include "qwindowssessionmanager.h" #endif @@ -76,9 +76,7 @@ #include <stdlib.h> #include <stdio.h> #include <windowsx.h> -#ifndef Q_OS_WINCE -# include <comdef.h> -#endif +#include <comdef.h> QT_BEGIN_NAMESPACE @@ -99,45 +97,29 @@ int QWindowsContext::verbose = 0; # define LANG_SYRIAC 0x5a #endif -static inline bool useRTL_Extensions(QSysInfo::WinVersion ver) +static inline bool useRTL_Extensions() { - // This is SDK dependent on CE so out of scope for now - if (QSysInfo::windowsVersion() & QSysInfo::WV_CE_based) - return false; - 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 int nLayouts = GetKeyboardLayoutList(0, 0)) { - QScopedArrayPointer<HKL> lpList(new HKL[nLayouts]); - GetKeyboardLayoutList(nLayouts, lpList.data()); - for (int 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; - } + // Since the IsValidLanguageGroup/IsValidLocale functions always return true on + // Vista, check the Keyboard Layouts for enabling RTL. + if (const int nLayouts = GetKeyboardLayoutList(0, 0)) { + QScopedArrayPointer<HKL> lpList(new HKL[nLayouts]); + GetKeyboardLayoutList(nLayouts, lpList.data()); + for (int 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 -#ifndef Q_OS_WINCE - // 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); -#else + } return false; -#endif } -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) static inline QWindowsSessionManager *platformSessionManager() { QGuiApplicationPrivate *guiPrivate = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(qApp)); QSessionManagerPrivate *managerPrivate = static_cast<QSessionManagerPrivate*>(QObjectPrivate::get(guiPrivate->session_manager)); @@ -160,13 +142,8 @@ static inline QWindowsSessionManager *platformSessionManager() { \internal \ingroup qt-lighthouse-win */ - -#ifndef Q_OS_WINCE - QWindowsUser32DLL::QWindowsUser32DLL() : - setLayeredWindowAttributes(0), updateLayeredWindow(0), - updateLayeredWindowIndirect(0), - isHungAppWindow(0), isTouchWindow(0), + isTouchWindow(0), registerTouchWindow(0), unregisterTouchWindow(0), getTouchInputInfo(0), closeTouchInputHandle(0), setProcessDPIAware(0), addClipboardFormatListener(0), removeClipboardFormatListener(0), @@ -177,20 +154,11 @@ QWindowsUser32DLL::QWindowsUser32DLL() : 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")); - if (Q_UNLIKELY(!setLayeredWindowAttributes || !updateLayeredWindow)) - qFatal("This version of Windows is not supported (User32.dll is missing the symbols 'SetLayeredWindowAttributes', 'UpdateLayeredWindow')."); - - updateLayeredWindowIndirect = (UpdateLayeredWindowIndirect)(library.resolve("UpdateLayeredWindowIndirect")); - isHungAppWindow = (IsHungAppWindow)library.resolve("IsHungAppWindow"); setProcessDPIAware = (SetProcessDPIAware)library.resolve("SetProcessDPIAware"); - if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) { - addClipboardFormatListener = (AddClipboardFormatListener)library.resolve("AddClipboardFormatListener"); - removeClipboardFormatListener = (RemoveClipboardFormatListener)library.resolve("RemoveClipboardFormatListener"); - } + addClipboardFormatListener = (AddClipboardFormatListener)library.resolve("AddClipboardFormatListener"); + removeClipboardFormatListener = (RemoveClipboardFormatListener)library.resolve("RemoveClipboardFormatListener"); + getDisplayAutoRotationPreferences = (GetDisplayAutoRotationPreferences)library.resolve("GetDisplayAutoRotationPreferences"); setDisplayAutoRotationPreferences = (SetDisplayAutoRotationPreferences)library.resolve("SetDisplayAutoRotationPreferences"); } @@ -208,38 +176,6 @@ bool QWindowsUser32DLL::initTouch() return isTouchWindow && registerTouchWindow && unregisterTouchWindow && getTouchInputInfo && closeTouchInputHandle; } -/*! - \class QWindowsShell32DLL - \brief Struct that contains dynamically resolved symbols of Shell32.dll. - - The stub libraries shipped with the MinGW compiler miss some of the - functions. They need to be retrieved dynamically. - - \sa QWindowsUser32DLL - - \internal - \ingroup qt-lighthouse-win -*/ - -QWindowsShell32DLL::QWindowsShell32DLL() - : sHCreateItemFromParsingName(0) - , sHGetKnownFolderIDList(0) - , sHGetStockIconInfo(0) - , sHGetImageList(0) - , sHCreateItemFromIDList(0) -{ -} - -void QWindowsShell32DLL::init() -{ - QSystemLibrary library(QStringLiteral("shell32")); - sHCreateItemFromParsingName = (SHCreateItemFromParsingName)(library.resolve("SHCreateItemFromParsingName")); - sHGetKnownFolderIDList = (SHGetKnownFolderIDList)(library.resolve("SHGetKnownFolderIDList")); - sHGetStockIconInfo = (SHGetStockIconInfo)library.resolve("SHGetStockIconInfo"); - sHGetImageList = (SHGetImageList)library.resolve("SHGetImageList"); - sHCreateItemFromIDList = (SHCreateItemFromIDList)library.resolve("SHCreateItemFromIDList"); -} - QWindowsShcoreDLL::QWindowsShcoreDLL() : getProcessDpiAwareness(0) , setProcessDpiAwareness(0) @@ -258,11 +194,8 @@ void QWindowsShcoreDLL::init() } QWindowsUser32DLL QWindowsContext::user32dll; -QWindowsShell32DLL QWindowsContext::shell32dll; QWindowsShcoreDLL QWindowsContext::shcoredll; -#endif // !Q_OS_WINCE - QWindowsContext *QWindowsContext::m_instance = 0; /*! @@ -291,7 +224,7 @@ struct QWindowsContextPrivate { QWindowsMimeConverter m_mimeConverter; QWindowsScreenManager m_screenManager; QSharedPointer<QWindowCreationContext> m_creationContext; -#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_TABLETEVENT) QScopedPointer<QWindowsTabletSupport> m_tabletSupport; #endif const HRESULT m_oleInitializeResult; @@ -306,18 +239,14 @@ QWindowsContextPrivate::QWindowsContextPrivate() , m_eventType(QByteArrayLiteral("windows_generic_MSG")) , m_lastActiveWindow(0), m_asyncExpose(0) { - const QSysInfo::WinVersion ver = QSysInfo::windowsVersion(); -#ifndef Q_OS_WINCE QWindowsContext::user32dll.init(); - QWindowsContext::shell32dll.init(); QWindowsContext::shcoredll.init(); if (m_mouseHandler.touchDevice() && QWindowsContext::user32dll.initTouch()) m_systemInfo |= QWindowsContext::SI_SupportsTouch; -#endif // !Q_OS_WINCE m_displayContext = GetDC(0); m_defaultDPI = GetDeviceCaps(m_displayContext, LOGPIXELSY); - if (useRTL_Extensions(ver)) { + if (useRTL_Extensions()) { m_systemInfo |= QWindowsContext::SI_RTL_Extensions; m_keyMapper.setUseRTLExtensions(true); } @@ -338,7 +267,7 @@ QWindowsContext::QWindowsContext() : const QByteArray bv = qgetenv("QT_QPA_VERBOSE"); if (!bv.isEmpty()) QLoggingCategory::setFilterRules(QString::fromLocal8Bit(bv)); -#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_TABLETEVENT) d->m_tabletSupport.reset(QWindowsTabletSupport::create()); qCDebug(lcQpaTablet) << "Tablet support: " << (d->m_tabletSupport.isNull() ? QStringLiteral("None") : d->m_tabletSupport->description()); #endif @@ -346,7 +275,7 @@ QWindowsContext::QWindowsContext() : QWindowsContext::~QWindowsContext() { -#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_TABLETEVENT) d->m_tabletSupport.reset(); // Destroy internal window before unregistering classes. #endif unregisterWindowClasses(); @@ -371,12 +300,10 @@ bool QWindowsContext::initTouch(unsigned integrationOptions) if (!touchDevice) return false; -#ifndef Q_OS_WINCE if (!QWindowsContext::user32dll.initTouch()) { delete touchDevice; return false; } -#endif // !Q_OS_WINCE if (!(integrationOptions & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch)) touchDevice->setCapabilities(touchDevice->capabilities() | QTouchDevice::MouseEmulation); @@ -389,7 +316,7 @@ bool QWindowsContext::initTouch(unsigned integrationOptions) void QWindowsContext::setTabletAbsoluteRange(int a) { -#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_TABLETEVENT) if (!d->m_tabletSupport.isNull()) d->m_tabletSupport->setAbsoluteRange(a); #else @@ -399,19 +326,16 @@ void QWindowsContext::setTabletAbsoluteRange(int a) int QWindowsContext::processDpiAwareness() { -#ifndef Q_OS_WINCE int result; if (QWindowsContext::shcoredll.getProcessDpiAwareness && SUCCEEDED(QWindowsContext::shcoredll.getProcessDpiAwareness(NULL, &result))) { return result; } -#endif // !Q_OS_WINCE return -1; } void QWindowsContext::setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiAwareness) { -#ifndef Q_OS_WINCE qCDebug(lcQpaWindows) << __FUNCTION__ << dpiAwareness; if (QWindowsContext::shcoredll.isValid()) { const HRESULT hr = QWindowsContext::shcoredll.setProcessDpiAwareness(dpiAwareness); @@ -426,9 +350,6 @@ void QWindowsContext::setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiA qErrnoWarning("SetProcessDPIAware() failed"); } } -#else // !Q_OS_WINCE - Q_UNUSED(dpiAwareness) -#endif } QWindowsContext *QWindowsContext::instance() @@ -559,19 +480,14 @@ QString QWindowsContext::registerWindowClass(QString cname, if (d->m_registeredWindowClassNames.contains(cname)) // already registered in our list return cname; -#ifndef Q_OS_WINCE WNDCLASSEX wc; wc.cbSize = sizeof(WNDCLASSEX); -#else - WNDCLASS wc; -#endif wc.style = style; wc.lpfnWndProc = proc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = appInstance; wc.hCursor = 0; -#ifndef Q_OS_WINCE wc.hbrBackground = brush; if (icon) { wc.hIcon = static_cast<HICON>(LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE)); @@ -587,22 +503,10 @@ QString QWindowsContext::registerWindowClass(QString cname, wc.hIcon = 0; wc.hIconSm = 0; } -#else - if (icon) { - wc.hIcon = (HICON)LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE); - } else { - wc.hIcon = 0; - } -#endif wc.lpszMenuName = 0; wc.lpszClassName = reinterpret_cast<LPCWSTR>(cname.utf16()); -#ifndef Q_OS_WINCE ATOM atom = RegisterClassEx(&wc); -#else - ATOM atom = RegisterClass(&wc); -#endif - if (!atom) qErrnoWarning("QApplication::regClass: Registering window class '%s' failed.", qPrintable(cname)); @@ -720,28 +624,14 @@ static inline bool findPlatformWindowHelper(const POINT &screenPoint, unsigned c POINT point = screenPoint; ScreenToClient(*hwnd, &point); // Returns parent if inside & none matched. -#ifndef Q_OS_WINCE const HWND child = ChildWindowFromPointEx(*hwnd, point, cwexFlags); -#else -// Under Windows CE we don't use ChildWindowFromPointEx as it's not available -// and ChildWindowFromPoint does not work properly. - Q_UNUSED(cwexFlags) - const HWND child = WindowFromPoint(point); -#endif if (!child || child == *hwnd) return false; if (QWindowsWindow *window = context->findPlatformWindow(child)) { *result = window; *hwnd = child; -#ifndef Q_OS_WINCE return true; -#else -// WindowFromPoint does not return same handle in two sequential calls, which leads -// to an endless loop, but calling WindowFromPoint once is good enough. - return false; -#endif } -#ifndef Q_OS_WINCE // Does not have WS_EX_TRANSPARENT . // QTBUG-40555: despite CWP_SKIPINVISIBLE, it is possible to hit on invisible // full screen windows of other applications that have WS_EX_TRANSPARENT set // (for example created by screen sharing applications). In that case, try to @@ -757,7 +647,6 @@ static inline bool findPlatformWindowHelper(const POINT &screenPoint, unsigned c return true; } } -#endif // !Q_OS_WINCE *hwnd = child; return true; } @@ -784,7 +673,7 @@ QWindowsScreenManager &QWindowsContext::screenManager() QWindowsTabletSupport *QWindowsContext::tabletSupport() const { -#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_TABLETEVENT) return d->m_tabletSupport.data(); #else return 0; @@ -810,7 +699,6 @@ HWND QWindowsContext::createDummyWindow(const QString &classNameIn, HWND_MESSAGE, NULL, static_cast<HINSTANCE>(GetModuleHandle(0)), NULL); } -#ifndef Q_OS_WINCE // Re-engineered from the inline function _com_error::ErrorMessage(). // We cannot use it directly since it uses swprintf_s(), which is not // present in the MSVCRT.DLL found on Windows XP (QTBUG-35617). @@ -829,7 +717,6 @@ static inline QString errorMessageFromComError(const _com_error &comError) return QStringLiteral("IDispatch error #") + QString::number(wCode); return QStringLiteral("Unknown error 0x0") + QString::number(comError.Error(), 16); } -#endif // !Q_OS_WINCE /*! \brief Common COM error strings. @@ -894,12 +781,10 @@ QByteArray QWindowsContext::comErrorString(HRESULT hr) default: break; } -#ifndef Q_OS_WINCE _com_error error(hr); result += QByteArrayLiteral(" ("); result += errorMessageFromComError(error); result += ')'; -#endif // !Q_OS_WINCE return result; } @@ -935,9 +820,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, ClientToScreen(msg.hwnd, &msg.pt); } } else { -#ifndef Q_OS_WINCE GetCursorPos(&msg.pt); -#endif } // Run the native event filters. @@ -980,7 +863,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, switch (et) { case QtWindows::GestureEvent: -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result); #else return d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result); @@ -1019,11 +902,9 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, // Pass on to current creation context if (!platformWindow && !d->m_creationContext.isNull()) { switch (et) { -#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO case QtWindows::QuerySizeHints: d->m_creationContext->applyToMinMaxInfo(reinterpret_cast<MINMAXINFO *>(lParam)); return true; -#endif case QtWindows::ResizeEvent: d->m_creationContext->obtainedGeometry.setSize(QSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); return true; @@ -1061,7 +942,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::InputMethodKeyEvent: case QtWindows::InputMethodKeyDownEvent: case QtWindows::AppCommandEvent: -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInteractionBlocked() ? true : d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result); #else return d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result); @@ -1072,7 +953,6 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::ResizeEvent: platformWindow->handleResized(static_cast<int>(wParam)); return true; -#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO case QtWindows::QuerySizeHints: platformWindow->getSizeHints(reinterpret_cast<MINMAXINFO *>(lParam)); return true;// maybe available on some SDKs revisit WM_NCCALCSIZE @@ -1082,30 +962,18 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return platformWindow->handleNonClientHitTest(QPoint(msg.pt.x, msg.pt.y), result); case QtWindows::GeometryChangingEvent: return platformWindow->QWindowsWindow::handleGeometryChanging(&msg); -#endif // !Q_OS_WINCE case QtWindows::ExposeEvent: return platformWindow->handleWmPaint(hwnd, message, wParam, lParam); case QtWindows::NonClientMouseEvent: if (platformWindow->frameStrutEventsEnabled()) -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); #else return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); #endif break; -/* the mouse tracking on windows already handles the reset of the cursor - * and does not like somebody else handling it. - * on WINCE its necessary to handle this event to get the correct cursor - */ -#ifdef Q_OS_WINCE - case QtWindows::CursorEvent: - { - QWindowsWindow::baseWindowOf(platformWindow->window())->applyCursor(); - return true; - } -#endif case QtWindows::ScrollEvent: -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateScrollEvent(platformWindow->window(), hwnd, msg, result); #else return d->m_mouseHandler.translateScrollEvent(platformWindow->window(), hwnd, msg, result); @@ -1113,13 +981,13 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::MouseWheelEvent: case QtWindows::MouseEvent: case QtWindows::LeaveEvent: -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); #else return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); #endif case QtWindows::TouchEvent: -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result); #else return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result); @@ -1152,7 +1020,6 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::CompositionSettingsChanged: platformWindow->handleCompositionSettingsChanged(); return true; -#ifndef Q_OS_WINCE case QtWindows::ActivateWindowEvent: if (platformWindow->window()->flags() & Qt::WindowDoesNotAcceptFocus) { *result = LRESULT(MA_NOACTIVATE); @@ -1175,7 +1042,6 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return true; } break; -#endif #ifndef QT_NO_CONTEXTMENU case QtWindows::ContextMenu: return handleContextMenuEvent(platformWindow->window(), msg); @@ -1186,7 +1052,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return true; #endif } break; -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) case QtWindows::QueryEndSessionApplicationEvent: { QWindowsSessionManager *sessionManager = platformSessionManager(); if (sessionManager->isActive()) { // bogus message from windows @@ -1226,7 +1092,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, } return true; } -#endif // !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#endif // !defined(QT_NO_SESSIONMANAGER) default: break; } diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index 3559335747..32d7800ef5 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -79,38 +79,23 @@ class QPoint; class QKeyEvent; class QTouchDevice; -#ifndef Q_OS_WINCE struct QWindowsUser32DLL { QWindowsUser32DLL(); inline void init(); inline bool initTouch(); - typedef BOOL (WINAPI *IsTouchWindow)(HWND, PULONG); + typedef BOOL (WINAPI *IsTouchWindow)(HWND, PULONG); // Windows 7 typedef BOOL (WINAPI *RegisterTouchWindow)(HWND, ULONG); typedef BOOL (WINAPI *UnregisterTouchWindow)(HWND); 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); typedef BOOL (WINAPI *SetProcessDPIAware)(); typedef BOOL (WINAPI *AddClipboardFormatListener)(HWND); typedef BOOL (WINAPI *RemoveClipboardFormatListener)(HWND); typedef BOOL (WINAPI *GetDisplayAutoRotationPreferences)(DWORD *); typedef BOOL (WINAPI *SetDisplayAutoRotationPreferences)(DWORD); - // Functions missing in Q_CC_GNU stub libraries. - SetLayeredWindowAttributes setLayeredWindowAttributes; - UpdateLayeredWindow updateLayeredWindow; - - // Functions missing in older versions of Windows - UpdateLayeredWindowIndirect updateLayeredWindowIndirect; - IsHungAppWindow isHungAppWindow; - // Touch functions from Windows 7 onwards (also for use with Q_CC_MSVC). IsTouchWindow isTouchWindow; RegisterTouchWindow registerTouchWindow; @@ -121,7 +106,8 @@ struct QWindowsUser32DLL // Windows Vista onwards SetProcessDPIAware setProcessDPIAware; - // Clipboard listeners, Windows Vista onwards + // Clipboard listeners are present on Windows Vista onwards + // but missing in MinGW 4.9 stub libs. Can be removed in MinGW 5. AddClipboardFormatListener addClipboardFormatListener; RemoveClipboardFormatListener removeClipboardFormatListener; @@ -130,24 +116,6 @@ struct QWindowsUser32DLL SetDisplayAutoRotationPreferences setDisplayAutoRotationPreferences; }; -struct QWindowsShell32DLL -{ - QWindowsShell32DLL(); - inline void init(); - - typedef HRESULT (WINAPI *SHCreateItemFromParsingName)(PCWSTR, IBindCtx *, const GUID&, void **); - typedef HRESULT (WINAPI *SHGetKnownFolderIDList)(const GUID &, DWORD, HANDLE, PIDLIST_ABSOLUTE *); - typedef HRESULT (WINAPI *SHGetStockIconInfo)(int , int , _SHSTOCKICONINFO *); - typedef HRESULT (WINAPI *SHGetImageList)(int, REFIID , void **); - typedef HRESULT (WINAPI *SHCreateItemFromIDList)(PCIDLIST_ABSOLUTE, REFIID, void **); - - SHCreateItemFromParsingName sHCreateItemFromParsingName; - SHGetKnownFolderIDList sHGetKnownFolderIDList; - SHGetStockIconInfo sHGetStockIconInfo; - SHGetImageList sHGetImageList; - SHCreateItemFromIDList sHCreateItemFromIDList; -}; - // Shell scaling library (Windows 8.1 onwards) struct QWindowsShcoreDLL { QWindowsShcoreDLL(); @@ -163,8 +131,6 @@ struct QWindowsShcoreDLL { GetDpiForMonitor getDpiForMonitor; }; -#endif // Q_OS_WINCE - class QWindowsContext { Q_DISABLE_COPY(QWindowsContext) @@ -236,11 +202,9 @@ public: QWindowsMimeConverter &mimeConverter() const; QWindowsScreenManager &screenManager(); QWindowsTabletSupport *tabletSupport() const; -#ifndef Q_OS_WINCE + static QWindowsUser32DLL user32dll; - static QWindowsShell32DLL shell32dll; static QWindowsShcoreDLL shcoredll; -#endif static QByteArray comErrorString(HRESULT hr); bool asyncExpose() const; diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp index 0eb7043bbc..d952fde978 100644 --- a/src/plugins/platforms/windows/qwindowscursor.cpp +++ b/src/plugins/platforms/windows/qwindowscursor.cpp @@ -56,7 +56,7 @@ static bool initResources() { -#if !defined (Q_OS_WINCE) && !defined (QT_NO_IMAGEFORMAT_PNG) +#if !defined (QT_NO_IMAGEFORMAT_PNG) Q_INIT_RESOURCE(cursors); #endif return true; @@ -143,7 +143,6 @@ static HCURSOR createBitmapCursor(const QImage &bbits, const QImage &mbits, if (hotSpot.y() < 0) hotSpot.setY(height / 2); const int n = qMax(1, width / 8); -#if !defined(Q_OS_WINCE) QScopedArrayPointer<uchar> xBits(new uchar[height * n]); QScopedArrayPointer<uchar> xMask(new uchar[height * n]); int x = 0; @@ -164,54 +163,6 @@ static HCURSOR createBitmapCursor(const QImage &bbits, const QImage &mbits, } return CreateCursor(GetModuleHandle(0), hotSpot.x(), hotSpot.y(), width, height, xBits.data(), xMask.data()); -#elif defined(GWES_ICONCURS) // Q_OS_WINCE - // Windows CE only supports fixed cursor size. - int sysW = GetSystemMetrics(SM_CXCURSOR); - int sysH = GetSystemMetrics(SM_CYCURSOR); - int sysN = qMax(1, sysW / 8); - uchar* xBits = new uchar[sysH * sysN]; - uchar* xMask = new uchar[sysH * sysN]; - int x = 0; - for (int i = 0; i < sysH; ++i) { - if (i >= height) { - memset(&xBits[x] , 255, sysN); - memset(&xMask[x] , 0, sysN); - x += sysN; - } else { - int fillWidth = n > sysN ? sysN : n; - const uchar *bits = bbits.constScanLine(i); - const uchar *mask = mbits.constScanLine(i); - for (int j = 0; j < fillWidth; ++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; - } - for (int j = fillWidth; j < sysN; ++j ) { - xBits[x] = 255; - xMask[x] = 0; - ++x; - } - } - } - - HCURSOR hcurs = CreateCursor(qWinAppInst(), hotSpot.x(), hotSpot.y(), sysW, sysH, - xBits, xMask); - delete [] xBits; - delete [] xMask; - return hcurs; -#else - Q_UNUSED(n); - Q_UNUSED(invm); - Q_UNUSED(invb); - Q_UNUSED(mbits); - return 0; -#endif } // Create a cursor from image and mask of the format QImage::Format_Mono. @@ -252,7 +203,7 @@ static QSize systemCursorSize(const QPlatformScreen *screen = Q_NULLPTR) return primaryScreenCursorSize; } -#if defined (Q_OS_WINCE) || defined (QT_NO_IMAGEFORMAT_PNG) +#if defined (QT_NO_IMAGEFORMAT_PNG) static inline QSize standardCursorSize() { return QSize(32, 32); } @@ -468,7 +419,7 @@ QWindowsCursor::PixmapCursor QWindowsCursor::customCursor(Qt::CursorShape cursor return QWindowsCursor::PixmapCursor(); } -#else // Q_OS_WINCE || QT_NO_IMAGEFORMAT_PNG +#else // QT_NO_IMAGEFORMAT_PNG struct QWindowsCustomPngCursor { Qt::CursorShape shape; int size; @@ -526,7 +477,7 @@ QWindowsCursor::PixmapCursor QWindowsCursor::customCursor(Qt::CursorShape cursor QString::fromLatin1(bestFit->fileName)); return PixmapCursor(rawImage, QPoint(bestFit->hotSpotX, bestFit->hotSpotY)); } -#endif // Q_OS_WINCE || QT_NO_IMAGEFORMAT_PNG +#endif // !QT_NO_IMAGEFORMAT_PNG struct QWindowsStandardCursorMapping { Qt::CursorShape shape; @@ -575,13 +526,8 @@ HCURSOR QWindowsCursor::createCursorFromShape(Qt::CursorShape cursorShape, const // Load available standard cursors from resources const QWindowsStandardCursorMapping *sEnd = standardCursors + sizeof(standardCursors) / sizeof(standardCursors[0]); for (const QWindowsStandardCursorMapping *s = standardCursors; s < sEnd; ++s) { - if (s->shape == cursorShape) { -#ifndef Q_OS_WINCE + if (s->shape == cursorShape) return static_cast<HCURSOR>(LoadImage(0, s->resource, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED)); -#else - return LoadCursor(0, s->resource); -#endif - } } qWarning("%s: Invalid cursor shape %d", __FUNCTION__, cursorShape); @@ -677,7 +623,6 @@ QPoint QWindowsCursor::mousePosition() QWindowsCursor::CursorState QWindowsCursor::cursorState() { -#ifndef Q_OS_WINCE enum { cursorShowing = 0x1, cursorSuppressed = 0x2 }; // Windows 8: CURSOR_SUPPRESSED CURSORINFO cursorInfo; cursorInfo.cbSize = sizeof(CURSORINFO); @@ -687,7 +632,6 @@ QWindowsCursor::CursorState QWindowsCursor::cursorState() if (cursorInfo.flags & cursorSuppressed) return CursorSuppressed; } -#endif // !Q_OS_WINCE return CursorHidden; } @@ -758,7 +702,6 @@ QPixmap QWindowsCursor::dragDefaultCursor(Qt::DropAction action) const "...............XXXX....."}; if (m_ignoreDragCursor.isNull()) { -#if !defined (Q_OS_WINCE) HCURSOR cursor = LoadCursor(NULL, IDC_NO); ICONINFO iconInfo = {0, 0, 0, 0, 0}; GetIconInfo(cursor, &iconInfo); @@ -782,9 +725,6 @@ QPixmap QWindowsCursor::dragDefaultCursor(Qt::DropAction action) const DeleteObject(iconInfo.hbmMask); DeleteObject(iconInfo.hbmColor); DestroyCursor(cursor); -#else // !Q_OS_WINCE - m_ignoreDragCursor = QPixmap(ignoreDragCursorXpmC); -#endif // !Q_OS_WINCE } return m_ignoreDragCursor; } diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index d5e5f87e5c..a237013c87 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -637,7 +637,6 @@ void QWindowsDialogHelperBase<BaseClass>::stopTimer() } } -#ifndef Q_OS_WINCE // Find a file dialog window created by IFileDialog by process id, window // title and class, which starts with a hash '#'. @@ -673,7 +672,6 @@ static inline HWND findDialogWindow(const QString &title) EnumWindows(findDialogEnumWindowsProc, reinterpret_cast<LPARAM>(&context)); return context.hwnd; } -#endif // !Q_OS_WINCE template <class BaseClass> void QWindowsDialogHelperBase<BaseClass>::hide() @@ -989,24 +987,19 @@ void QWindowsNativeFileDialogBase::setWindowTitle(const QString &title) IShellItem *QWindowsNativeFileDialogBase::shellItem(const QUrl &url) { -#ifndef Q_OS_WINCE if (url.isLocalFile()) { - if (!QWindowsContext::shell32dll.sHCreateItemFromParsingName) - return Q_NULLPTR; IShellItem *result = Q_NULLPTR; const QString native = QDir::toNativeSeparators(url.toLocalFile()); const HRESULT hr = - QWindowsContext::shell32dll.sHCreateItemFromParsingName(reinterpret_cast<const wchar_t *>(native.utf16()), - NULL, IID_IShellItem, - reinterpret_cast<void **>(&result)); + SHCreateItemFromParsingName(reinterpret_cast<const wchar_t *>(native.utf16()), + NULL, IID_IShellItem, + reinterpret_cast<void **>(&result)); if (FAILED(hr)) { qErrnoWarning("%s: SHCreateItemFromParsingName(%s)) failed", __FUNCTION__, qPrintable(url.toString())); return Q_NULLPTR; } return result; } else if (url.scheme() == QLatin1String("clsid")) { - if (!QWindowsContext::shell32dll.sHGetKnownFolderIDList || !QWindowsContext::shell32dll.sHCreateItemFromIDList) - return Q_NULLPTR; // Support for virtual folders via GUID // (see https://msdn.microsoft.com/en-us/library/windows/desktop/dd378457(v=vs.85).aspx) // specified as "clsid:<GUID>" (without '{', '}'). @@ -1017,12 +1010,12 @@ IShellItem *QWindowsNativeFileDialogBase::shellItem(const QUrl &url) return Q_NULLPTR; } PIDLIST_ABSOLUTE idList; - HRESULT hr = QWindowsContext::shell32dll.sHGetKnownFolderIDList(uuid, 0, 0, &idList); + HRESULT hr = SHGetKnownFolderIDList(uuid, 0, 0, &idList); if (FAILED(hr)) { qErrnoWarning("%s: SHGetKnownFolderIDList(%s)) failed", __FUNCTION__, qPrintable(url.toString())); return Q_NULLPTR; } - hr = QWindowsContext::shell32dll.sHCreateItemFromIDList(idList, IID_IShellItem, reinterpret_cast<void **>(&result)); + hr = SHCreateItemFromIDList(idList, IID_IShellItem, reinterpret_cast<void **>(&result)); CoTaskMemFree(idList); if (FAILED(hr)) { qErrnoWarning("%s: SHCreateItemFromIDList(%s)) failed", __FUNCTION__, qPrintable(url.toString())); @@ -1032,9 +1025,6 @@ IShellItem *QWindowsNativeFileDialogBase::shellItem(const QUrl &url) } else { qWarning() << __FUNCTION__ << ": Unhandled scheme: " << url.scheme(); } -#else // !Q_OS_WINCE - Q_UNUSED(url) -#endif return 0; } @@ -1050,11 +1040,9 @@ void QWindowsNativeFileDialogBase::setDirectory(const QUrl &directory) QString QWindowsNativeFileDialogBase::directory() const { -#ifndef Q_OS_WINCE IShellItem *item = 0; if (m_fileDialog && SUCCEEDED(m_fileDialog->GetFolder(&item)) && item) return QWindowsNativeFileDialogBase::itemPath(item); -#endif return QString(); } @@ -1106,7 +1094,7 @@ void QWindowsNativeFileDialogBase::setMode(QFileDialogOptions::FileMode mode, qErrnoWarning("%s: SetOptions() failed", __FUNCTION__); } -#if !defined(Q_OS_WINCE) && defined(__IShellLibrary_INTERFACE_DEFINED__) // Windows SDK 7 +#if defined(__IShellLibrary_INTERFACE_DEFINED__) // Windows SDK 7 // Helper for "Libraries": collections of folders appearing from Windows 7 // on, visible in the file dialogs. @@ -1159,7 +1147,7 @@ QString QWindowsNativeFileDialogBase::libraryItemDefaultSaveFolder(IShellItem *i return result; } -#else // !Q_OS_WINCE && __IShellLibrary_INTERFACE_DEFINED__ +#else // __IShellLibrary_INTERFACE_DEFINED__ QList<QUrl> QWindowsNativeFileDialogBase::libraryItemFolders(IShellItem *) { @@ -1171,7 +1159,7 @@ QString QWindowsNativeFileDialogBase::libraryItemDefaultSaveFolder(IShellItem *) return QString(); } -#endif // Q_OS_WINCE || !__IShellLibrary_INTERFACE_DEFINED__ +#endif // !__IShellLibrary_INTERFACE_DEFINED__ QString QWindowsNativeFileDialogBase::itemPath(IShellItem *item) { @@ -1417,14 +1405,12 @@ bool QWindowsNativeFileDialogBase::onFileOk() void QWindowsNativeFileDialogBase::close() { m_fileDialog->Close(S_OK); -#ifndef Q_OS_WINCE // IFileDialog::Close() does not work unless invoked from a callback. // Try to find the window and send it a WM_CLOSE in addition. const HWND hwnd = findDialogWindow(m_title); qCDebug(lcQpaDialogs) << __FUNCTION__ << "closing" << hwnd; if (hwnd && IsWindowVisible(hwnd)) PostMessageW(hwnd, WM_CLOSE, 0, 0); -#endif // !Q_OS_WINCE } HRESULT QWindowsNativeFileDialogEventHandler::OnFolderChanging(IFileDialog *, IShellItem *item) @@ -1725,8 +1711,6 @@ QString QWindowsFileDialogHelper::selectedNameFilter() const return m_data.selectedNameFilter(); } -#ifndef Q_OS_WINCE - /*! \class QWindowsXpNativeFileDialog \brief Native Windows directory dialog for Windows XP using SHlib-functions. @@ -2050,8 +2034,6 @@ QString QWindowsXpFileDialogHelper::selectedNameFilter() const return m_data.selectedNameFilter(); } -#endif // Q_OS_WINCE - /*! \class QWindowsNativeColorDialog \brief Native Windows color dialog. @@ -2209,17 +2191,13 @@ QPlatformDialogHelper *createHelper(QPlatformTheme::DialogType type) if (QWindowsIntegration::instance()->options() & QWindowsIntegration::NoNativeDialogs) return 0; switch (type) { - case QPlatformTheme::FileDialog: -#ifndef Q_OS_WINCE // Note: "Windows XP Professional x64 Edition has version number WV_5_2 (WV_2003). + case QPlatformTheme::FileDialog: // Note: "Windows XP Professional x64 Edition has version number WV_5_2 (WV_2003). if (QWindowsIntegration::instance()->options() & QWindowsIntegration::XpNativeDialogs || QSysInfo::windowsVersion() <= QSysInfo::WV_2003) { return new QWindowsXpFileDialogHelper(); } if (QSysInfo::windowsVersion() > QSysInfo::WV_2003) return new QWindowsFileDialogHelper(); -#else - return new QWindowsFileDialogHelper(); -#endif // Q_OS_WINCE case QPlatformTheme::ColorDialog: #ifdef USE_NATIVE_COLOR_DIALOG return new QWindowsColorDialogHelper(); diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index 42caeb1c89..96cabb20e4 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -95,13 +95,9 @@ static void *resolveFunc(HMODULE lib, const char *name) return proc; } #else -static void *resolveFunc(HMODULE lib, const char *name) +static inline void *resolveFunc(HMODULE lib, const char *name) { -# ifndef Q_OS_WINCE - return (void *) ::GetProcAddress(lib, name); -# else - return (void *) ::GetProcAddress(lib, (const wchar_t *) QString::fromLatin1(name).utf16()); -# endif // Q_OS_WINCE + return ::GetProcAddress(lib, name); } #endif // Q_CC_MINGW @@ -121,7 +117,7 @@ void *QWindowsLibEGL::resolve(const char *name) bool QWindowsLibEGL::init() { const char dllName[] = QT_STRINGIFY(LIBEGL_NAME) -#if defined(QT_DEBUG) && !defined(Q_OS_WINCE) +#if defined(QT_DEBUG) "d" #endif ""; @@ -178,7 +174,7 @@ bool QWindowsLibGLESv2::init() { const char dllName[] = QT_STRINGIFY(LIBGLESV2_NAME) -#if defined(QT_DEBUG) && !defined(Q_OS_WINCE) +#if defined(QT_DEBUG) "d" #endif ""; diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 966be8c991..e81841d3da 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -57,10 +57,6 @@ #include <wchar.h> -#ifdef Q_OS_WINCE -# include "qplatformfunctions_wince.h" -#endif - #if !defined(QT_NO_DIRECTWRITE) # include <dwrite.h> # include <d2d1.h> @@ -931,17 +927,6 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet, quint32 codePageRange[2] = { signature->fsCsb[0], signature->fsCsb[1] }; -#ifdef Q_OS_WINCE - if (signature->fsUsb[0] == 0) { - // If the unicode ranges bit mask is zero then - // EnumFontFamiliesEx failed to determine it properly. - // In this case we just pretend that the font supports all languages. - unicodeRange[0] = 0xbfffffff; // second most significant bit must be zero - unicodeRange[1] = 0xffffffff; - unicodeRange[2] = 0xffffffff; - unicodeRange[3] = 0xffffffff; - } -#endif writingSystems = QPlatformFontDatabase::writingSystemsFromTrueTypeBits(unicodeRange, codePageRange); // ### 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. @@ -1101,9 +1086,8 @@ QWindowsFontEngineDataPtr sharedFontData() } #endif // QT_NO_THREAD -#ifndef Q_OS_WINCE extern Q_GUI_EXPORT bool qt_needs_a8_gamma_correction; -#endif + QWindowsFontDatabase::QWindowsFontDatabase() { // Properties accessed by QWin32PrintEngine (Qt Print Support) @@ -1117,9 +1101,7 @@ QWindowsFontDatabase::QWindowsFontDatabase() qCDebug(lcQpaFonts) << __FUNCTION__ << "Clear type: " << data->clearTypeEnabled << "gamma: " << data->fontSmoothingGamma; } -#ifndef Q_OS_WINCE qt_needs_a8_gamma_correction = true; -#endif } QWindowsFontDatabase::~QWindowsFontDatabase() @@ -1570,14 +1552,12 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request) int strat = OUT_DEFAULT_PRECIS; if (request.styleStrategy & QFont::PreferBitmap) { strat = OUT_RASTER_PRECIS; -#ifndef Q_OS_WINCE } 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; -#endif } lf.lfOutPrecision = strat; @@ -1586,10 +1566,8 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request) if (request.styleStrategy & QFont::PreferMatch) qual = DRAFT_QUALITY; -#ifndef Q_OS_WINCE else if (request.styleStrategy & QFont::PreferQuality) qual = PROOF_QUALITY; -#endif if (request.styleStrategy & QFont::PreferAntialias) { if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && !(request.styleStrategy & QFont::NoSubpixelAntialias)) { diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index fb75e75dcd..d782519c68 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -53,10 +53,6 @@ #include <QtGui/QFontDatabase> #include <wchar.h> -#ifdef Q_OS_WINCE -#include <QtCore/QFile> -#include <QtEndian> -#endif QT_BEGIN_NAMESPACE @@ -108,8 +104,6 @@ static FontFile * createFontFile(const QString &fileName, int index) extern bool localizedName(const QString &name); extern QString getEnglishName(const QString &familyName); -#ifndef Q_OS_WINCE - namespace { struct FontKey { @@ -165,223 +159,6 @@ static const FontKey *findFontKey(const QString &name, int *indexIn = Q_NULLPTR) return Q_NULLPTR; } -#else // Q_OS_WINCE - -typedef struct { - quint16 majorVersion; - quint16 minorVersion; - quint16 numTables; - quint16 searchRange; - quint16 entrySelector; - quint16 rangeShift; -} OFFSET_TABLE; - -typedef struct { - quint32 tag; - quint32 checkSum; - quint32 offset; - quint32 length; -} TABLE_DIRECTORY; - -typedef struct { - quint16 fontSelector; - quint16 nrCount; - quint16 storageOffset; -} NAME_TABLE_HEADER; - -typedef struct { - quint16 platformID; - quint16 encodingID; - quint16 languageID; - quint16 nameID; - quint16 stringLength; - quint16 stringOffset; -} NAME_RECORD; - -typedef struct { - quint32 tag; - quint16 majorVersion; - quint16 minorVersion; - quint32 numFonts; -} TTC_TABLE_HEADER; - -static QString fontNameFromTTFile(const QString &filename, int startPos = 0) -{ - QFile f(filename); - QString retVal; - qint64 bytesRead; - qint64 bytesToRead; - - if (f.open(QIODevice::ReadOnly)) { - f.seek(startPos); - OFFSET_TABLE ttOffsetTable; - bytesToRead = sizeof(OFFSET_TABLE); - bytesRead = f.read((char*)&ttOffsetTable, bytesToRead); - if (bytesToRead != bytesRead) - return retVal; - ttOffsetTable.numTables = qFromBigEndian(ttOffsetTable.numTables); - ttOffsetTable.majorVersion = qFromBigEndian(ttOffsetTable.majorVersion); - ttOffsetTable.minorVersion = qFromBigEndian(ttOffsetTable.minorVersion); - - if (ttOffsetTable.majorVersion != 1 || ttOffsetTable.minorVersion != 0) - return retVal; - - TABLE_DIRECTORY tblDir; - bool found = false; - - for (int i = 0; i < ttOffsetTable.numTables; i++) { - bytesToRead = sizeof(TABLE_DIRECTORY); - bytesRead = f.read((char*)&tblDir, bytesToRead); - if (bytesToRead != bytesRead) - return retVal; - if (qFromBigEndian(tblDir.tag) == MAKE_TAG('n', 'a', 'm', 'e')) { - found = true; - tblDir.length = qFromBigEndian(tblDir.length); - tblDir.offset = qFromBigEndian(tblDir.offset); - break; - } - } - - if (found) { - f.seek(tblDir.offset); - NAME_TABLE_HEADER ttNTHeader; - bytesToRead = sizeof(NAME_TABLE_HEADER); - bytesRead = f.read((char*)&ttNTHeader, bytesToRead); - if (bytesToRead != bytesRead) - return retVal; - ttNTHeader.nrCount = qFromBigEndian(ttNTHeader.nrCount); - ttNTHeader.storageOffset = qFromBigEndian(ttNTHeader.storageOffset); - NAME_RECORD ttRecord; - found = false; - - for (int i = 0; i < ttNTHeader.nrCount; i++) { - bytesToRead = sizeof(NAME_RECORD); - bytesRead = f.read((char*)&ttRecord, bytesToRead); - if (bytesToRead != bytesRead) - return retVal; - ttRecord.nameID = qFromBigEndian(ttRecord.nameID); - if (ttRecord.nameID == 1) { - ttRecord.stringLength = qFromBigEndian(ttRecord.stringLength); - ttRecord.stringOffset = qFromBigEndian(ttRecord.stringOffset); - int nPos = f.pos(); - f.seek(tblDir.offset + ttRecord.stringOffset + ttNTHeader.storageOffset); - - QByteArray nameByteArray = f.read(ttRecord.stringLength); - if (!nameByteArray.isEmpty()) { - if (ttRecord.encodingID == 256 || ttRecord.encodingID == 768) { - //This is UTF-16 in big endian - int stringLength = ttRecord.stringLength / 2; - retVal.resize(stringLength); - QChar *data = retVal.data(); - const ushort *srcData = (const ushort *)nameByteArray.data(); - for (int i = 0; i < stringLength; ++i) - data[i] = qFromBigEndian(srcData[i]); - return retVal; - } else if (ttRecord.encodingID == 0) { - //This is Latin1 - retVal = QString::fromLatin1(nameByteArray); - } else { - qWarning("Could not retrieve Font name from file: %s", qPrintable(QDir::toNativeSeparators(filename))); - } - break; - } - f.seek(nPos); - } - } - } - f.close(); - } - return retVal; -} - -static QStringList fontNamesFromTTCFile(const QString &filename) -{ - QFile f(filename); - QStringList retVal; - qint64 bytesRead; - qint64 bytesToRead; - - if (f.open(QIODevice::ReadOnly)) { - TTC_TABLE_HEADER ttcTableHeader; - bytesToRead = sizeof(TTC_TABLE_HEADER); - bytesRead = f.read((char*)&ttcTableHeader, bytesToRead); - if (bytesToRead != bytesRead) - return retVal; - ttcTableHeader.majorVersion = qFromBigEndian(ttcTableHeader.majorVersion); - ttcTableHeader.minorVersion = qFromBigEndian(ttcTableHeader.minorVersion); - ttcTableHeader.numFonts = qFromBigEndian(ttcTableHeader.numFonts); - - if (ttcTableHeader.majorVersion < 1 || ttcTableHeader.majorVersion > 2) - return retVal; - QVarLengthArray<quint32> offsetTable(ttcTableHeader.numFonts); - bytesToRead = sizeof(quint32) * ttcTableHeader.numFonts; - bytesRead = f.read((char*)offsetTable.data(), bytesToRead); - if (bytesToRead != bytesRead) - return retVal; - f.close(); - for (int i = 0; i < (int)ttcTableHeader.numFonts; ++i) - retVal << fontNameFromTTFile(filename, qFromBigEndian(offsetTable[i])); - } - return retVal; -} - -static inline QString fontSettingsOrganization() { return QStringLiteral("Qt-Project"); } -static inline QString fontSettingsApplication() { return QStringLiteral("Qtbase"); } -static inline QString fontSettingsGroup() { return QStringLiteral("CEFontCache"); } - -static QString findFontFile(const QString &faceName) -{ - static QHash<QString, QString> fontCache; - - if (fontCache.isEmpty()) { - QSettings settings(QSettings::SystemScope, fontSettingsOrganization(), fontSettingsApplication()); - settings.beginGroup(fontSettingsGroup()); - foreach (const QString &fontName, settings.allKeys()) - fontCache.insert(fontName, settings.value(fontName).toString()); - settings.endGroup(); - } - - QString value = fontCache.value(faceName); - - //Fallback if we haven't cached the font yet or the font got removed/renamed iterate again over all fonts - if (value.isEmpty() || !QFile::exists(value)) { - QSettings settings(QSettings::SystemScope, fontSettingsOrganization(), fontSettingsApplication()); - settings.beginGroup(fontSettingsGroup()); - - //empty the cache first, as it seems that it is dirty - settings.remove(QString()); - - QDirIterator it(QStringLiteral("/Windows"), QStringList() << QStringLiteral("*.ttf") << QStringLiteral("*.ttc"), QDir::Files | QDir::Hidden | QDir::System); - const QLatin1Char lowerF('f'); - const QLatin1Char upperF('F'); - while (it.hasNext()) { - const QString fontFile = it.next(); - QStringList fontNames; - const QChar c = fontFile[fontFile.size() - 1]; - if (c == lowerF || c == upperF) - fontNames << fontNameFromTTFile(fontFile); - else - fontNames << fontNamesFromTTCFile(fontFile); - foreach (const QString fontName, fontNames) { - if (fontName.isEmpty()) - continue; - fontCache.insert(fontName, fontFile); - settings.setValue(fontName, fontFile); - - if (localizedName(fontName)) { - QString englishFontName = getEnglishName(fontName); - fontCache.insert(englishFontName, fontFile); - settings.setValue(englishFontName, fontFile); - } - } - } - settings.endGroup(); - value = fontCache.value(faceName); - } - return value; -} -#endif // Q_OS_WINCE - static bool addFontToDatabase(const QString &faceName, const QString &fullName, uchar charSet, @@ -453,7 +230,6 @@ static bool addFontToDatabase(const QString &faceName, } int index = 0; -#ifndef Q_OS_WINCE const FontKey *key = findFontKey(faceName, &index); if (!key) { key = findFontKey(fullName, &index); @@ -465,19 +241,11 @@ static bool addFontToDatabase(const QString &faceName, return false; } QString value = key->fileName; -#else - QString value = findFontFile(faceName); -#endif - if (value.isEmpty()) return false; if (!QDir::isAbsolutePath(value)) -#ifndef Q_OS_WINCE value.prepend(QFile::decodeName(qgetenv("windir") + "\\Fonts\\")); -#else - value.prepend(QFile::decodeName("/Windows/")); -#endif QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, weight, style, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index)); @@ -501,24 +269,6 @@ static bool addFontToDatabase(const QString &faceName, return true; } -#ifdef Q_OS_WINCE -static QByteArray getFntTable(HFONT hfont, uint tag) -{ - HDC hdc = GetDC(0); - HGDIOBJ oldFont = SelectObject(hdc, hfont); - quint32 t = qFromBigEndian<quint32>(tag); - QByteArray buffer; - - DWORD length = GetFontData(hdc, t, 0, NULL, 0); - if (length != GDI_ERROR) { - buffer.resize(length); - GetFontData(hdc, t, 0, reinterpret_cast<uchar *>(buffer.data()), length); - } - SelectObject(hdc, oldFont); - return buffer; -} -#endif - static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *textmetric, DWORD type, LPARAM) { @@ -576,8 +326,6 @@ struct PopulateFamiliesContext }; } // namespace -#ifndef Q_OS_WINCE - // Delayed population of font families static int QT_WIN_CALLBACK populateFontFamilies(const LOGFONT *logFont, const TEXTMETRIC *textmetric, @@ -633,74 +381,6 @@ void QWindowsFontDatabaseFT::populateFontDatabase() QPlatformFontDatabase::registerFontFamily(context.systemDefaultFont); } -#else // !Q_OS_WINCE - -// Non-delayed population of fonts (Windows CE). - -static int QT_WIN_CALLBACK populateFontCe(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric, - int type, LPARAM lparam) -{ - // the "@family" fonts are just the same as "family". Ignore them. - const wchar_t *faceNameW = f->elfLogFont.lfFaceName; - if (faceNameW[0] && faceNameW[0] != L'@' && wcsncmp(faceNameW, L"WST_", 4)) { - const uchar charSet = f->elfLogFont.lfCharSet; - - FONTSIGNATURE signature; - QByteArray table; - - if (type & TRUETYPE_FONTTYPE) { - HFONT hfont = CreateFontIndirect(&f->elfLogFont); - table = getFntTable(hfont, MAKE_TAG('O', 'S', '/', '2')); - DeleteObject((HGDIOBJ)hfont); - } - - if (table.length() >= 86) { - // See also qfontdatabase_mac.cpp, offsets taken from OS/2 table in the TrueType spec - uchar *tableData = reinterpret_cast<uchar *>(table.data()); - - signature.fsUsb[0] = qFromBigEndian<quint32>(tableData + 42); - signature.fsUsb[1] = qFromBigEndian<quint32>(tableData + 46); - signature.fsUsb[2] = qFromBigEndian<quint32>(tableData + 50); - signature.fsUsb[3] = qFromBigEndian<quint32>(tableData + 54); - - signature.fsCsb[0] = qFromBigEndian<quint32>(tableData + 78); - signature.fsCsb[1] = qFromBigEndian<quint32>(tableData + 82); - } else { - memset(&signature, 0, sizeof(signature)); - } - - // 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 - const QString faceName = QString::fromWCharArray(f->elfLogFont.lfFaceName); - if (addFontToDatabase(faceName, QString::fromWCharArray(f->elfFullName), - charSet, (TEXTMETRIC *)textmetric, &signature, type, true)) { - PopulateFamiliesContext *context = reinterpret_cast<PopulateFamiliesContext *>(lparam); - if (!context->seenSystemDefaultFont && faceName == context->systemDefaultFont) - context->seenSystemDefaultFont = true; - } - } - - // keep on enumerating - return 1; -} - -void QWindowsFontDatabaseFT::populateFontDatabase() -{ - LOGFONT lf; - lf.lfCharSet = DEFAULT_CHARSET; - HDC dummy = GetDC(0); - lf.lfFaceName[0] = 0; - lf.lfPitchAndFamily = 0; - PopulateFamiliesContext context(QWindowsFontDatabase::systemDefaultFont().family()); - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)populateFontCe, reinterpret_cast<LPARAM>(&context), 0); - ReleaseDC(0, dummy); - // Work around EnumFontFamiliesEx() not listing the system font, see below. - if (!context.seenSystemDefaultFont) - populateFamily(context.systemDefaultFont); -} -#endif // Q_OS_WINCE - QFontEngine * QWindowsFontDatabaseFT::fontEngine(const QFontDef &fontDef, void *handle) { QFontEngine *fe = QBasicFontDatabase::fontEngine(fontDef, handle); @@ -718,21 +398,8 @@ QFontEngine *QWindowsFontDatabaseFT::fontEngine(const QByteArray &fontData, qrea QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const { QStringList result; - result.append(QWindowsFontDatabase::familyForStyleHint(styleHint)); - -#ifdef Q_OS_WINCE - QSettings settings(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\FontLink\\SystemLink"), QSettings::NativeFormat); - const QStringList fontList = settings.value(family).toStringList(); - foreach (const QString &fallback, fontList) { - const int sep = fallback.indexOf(QLatin1Char(',')); - if (sep > 0) - result << fallback.mid(sep + 1); - } -#endif - result.append(QWindowsFontDatabase::extraTryFontsForFamily(family)); - result.append(QBasicFontDatabase::fallbacksForFamily(family, style, styleHint, script)); qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 806af6458b..0c213b933c 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -65,10 +65,6 @@ #include <limits.h> -#ifdef Q_OS_WINCE -# include "qplatformfunctions_wince.h" -#endif - #if !defined(QT_NO_DIRECTWRITE) # include <dwrite.h> #endif @@ -205,9 +201,6 @@ int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLa { int glyph_pos = 0; { -#if defined(Q_OS_WINCE) - { -#else if (symbol) { QStringIterator it(str, str + numChars); while (it.hasNext()) { @@ -225,7 +218,6 @@ int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLa ++glyph_pos; } } else { -#endif QStringIterator it(str, str + numChars); while (it.hasNext()) { const uint uc = it.next(); @@ -329,21 +321,16 @@ QWindowsFontEngine::~QWindowsFontEngine() glyph_t QWindowsFontEngine::glyphIndex(uint ucs4) const { - glyph_t glyph; + glyph_t glyph = 0; -#if !defined(Q_OS_WINCE) if (symbol) { glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4); if (glyph == 0 && ucs4 < 0x100) glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4 + 0xf000); } else if (ttf) { glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4); - } else -#endif - if (ucs4 >= tm.tmFirstChar && ucs4 <= tm.tmLastChar) { + } else if (ucs4 >= tm.tmFirstChar && ucs4 <= tm.tmLastChar) { glyph = ucs4; - } else { - glyph = 0; } return glyph; @@ -377,12 +364,8 @@ bool QWindowsFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *g inline void calculateTTFGlyphWidth(HDC hdc, UINT glyph, int &width) { -#if defined(Q_OS_WINCE) - GetCharWidth32(hdc, glyph, glyph, &width); -#else if (ptrGetCharWidthI) ptrGetCharWidthI(hdc, glyph, 1, 0, &width); -#endif } void QWindowsFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const @@ -467,7 +450,7 @@ glyph_metrics_t QWindowsFontEngine::boundingBox(const QGlyphLayout &glyphs) return glyph_metrics_t(0, -tm.tmAscent, w - lastRightBearing(glyphs), tm.tmHeight, w, 0); } -#ifndef Q_OS_WINCE + bool QWindowsFontEngine::getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const { Q_ASSERT(metrics != 0); @@ -520,11 +503,9 @@ bool QWindowsFontEngine::getOutlineMetrics(glyph_t glyph, const QTransform &t, g return false; } } -#endif glyph_metrics_t QWindowsFontEngine::boundingBox(glyph_t glyph, const QTransform &t) { -#ifndef Q_OS_WINCE HDC hdc = m_fontEngineData->hdc; SelectObject(hdc, hfont); @@ -542,34 +523,6 @@ glyph_metrics_t QWindowsFontEngine::boundingBox(glyph_t glyph, const QTransform } return glyphMetrics; -#else - HDC hdc = m_fontEngineData->hdc; - HGDIOBJ oldFont = SelectObject(hdc, hfont); - - ABC abc; - int width; - int advance; -#ifdef GWES_MGTT // true type fonts - if (GetCharABCWidths(hdc, glyph, glyph, &abc)) { - width = qAbs(abc.abcA) + abc.abcB + qAbs(abc.abcC); - advance = abc.abcA + abc.abcB + abc.abcC; - } - else -#endif -#if defined(GWES_MGRAST) || defined(GWES_MGRAST2) // raster fonts - if (GetCharWidth32(hdc, glyph, glyph, &width)) { - advance = width; - } - else -#endif - { // fallback - width = tm.tmMaxCharWidth; - advance = width; - } - - SelectObject(hdc, oldFont); - return glyph_metrics_t(0, -tm.tmAscent, width, tm.tmHeight, advance, 0).transformed(t); -#endif } QFixed QWindowsFontEngine::ascent() const @@ -636,22 +589,16 @@ void QWindowsFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qre HDC hdc = m_fontEngineData->hdc; SelectObject(hdc, hfont); -#ifndef Q_OS_WINCE - if (ttf) -#endif - { + if (ttf) { ABC abcWidths; GetCharABCWidthsI(hdc, glyph, 1, 0, &abcWidths); if (leftBearing) *leftBearing = abcWidths.abcA; if (rightBearing) *rightBearing = abcWidths.abcC; - } -#ifndef Q_OS_WINCE - else { + } else { QFontEngine::getGlyphBearings(glyph, leftBearing, rightBearing); } -#endif } #endif // Q_CC_MINGW @@ -670,7 +617,6 @@ qreal QWindowsFontEngine::minLeftBearing() const qreal QWindowsFontEngine::minRightBearing() const { -#ifndef Q_OS_WINCE if (rbearing == SHRT_MIN) { int ml = 0; int mr = 0; @@ -726,40 +672,6 @@ qreal QWindowsFontEngine::minRightBearing() const } return rbearing; -#else // !Q_OS_WINCE - 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; - } - lbearing = ml; - rbearing = mr; - } - - return rbearing; -#endif // Q_OS_WINCE } static inline double qt_fixed_to_double(const FIXED &p) { @@ -786,7 +698,6 @@ static bool addGlyphToPath(glyph_t glyph, const QFixedPoint &position, HDC hdc, GLYPHMETRICS gMetric; memset(&gMetric, 0, sizeof(GLYPHMETRICS)); -#ifndef Q_OS_WINCE if (metric) { // If metrics requested, retrieve first using GGO_METRICS, because the returned // values are incorrect for OpenType PS fonts if obtained at the same time as the @@ -801,7 +712,6 @@ static bool addGlyphToPath(glyph_t glyph, const QFixedPoint &position, HDC hdc, int(gMetric.gmBlackBoxX), int(gMetric.gmBlackBoxY), gMetric.gmCellIncX, gMetric.gmCellIncY); } -#endif uint glyphFormat = GGO_NATIVE; @@ -820,15 +730,6 @@ static bool addGlyphToPath(glyph_t glyph, const QFixedPoint &position, HDC hdc, return false; } -#ifdef Q_OS_WINCE - if (metric) { - // #### obey scale - *metric = glyph_metrics_t(gMetric.gmptGlyphOrigin.x, -gMetric.gmptGlyphOrigin.y, - (int)gMetric.gmBlackBoxX, (int)gMetric.gmBlackBoxY, - gMetric.gmCellIncX, gMetric.gmCellIncY); - } -#endif - DWORD offset = 0; DWORD headerOffset = 0; @@ -1052,7 +953,6 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph, bool has_transformation = t.type() > QTransform::TxTranslate; -#ifndef Q_OS_WINCE unsigned int options = ttf ? ETO_GLYPH_INDEX : 0; XFORM xform; @@ -1095,13 +995,6 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph, xform.eDx -= tgm.gmptGlyphOrigin.x; xform.eDy += tgm.gmptGlyphOrigin.y; } -#else // else wince - unsigned int options = 0; - if (has_transformation) { - qWarning() << "QWindowsFontEngine is unable to apply transformations other than translations for fonts on Windows CE." - << "If you need them anyway, start your application with -platform windows:fontengine=freetype."; - } -#endif // wince // The padding here needs to be kept in sync with the values in alphaMapBoundingBox. QWindowsNativeImage *ni = new QWindowsNativeImage(iw + 2 * margin, @@ -1123,14 +1016,11 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph, HGDIOBJ old_font = SelectObject(hdc, font); -#ifndef Q_OS_WINCE if (has_transformation) { SetGraphicsMode(hdc, GM_ADVANCED); SetWorldTransform(hdc, &xform); ExtTextOut(hdc, 0, 0, options, 0, reinterpret_cast<LPCWSTR>(&glyph), 1, 0); - } else -#endif // !Q_OS_WINCE - { + } else { ExtTextOut(hdc, -gx + margin, -gy + margin, options, 0, reinterpret_cast<LPCWSTR>(&glyph), 1, 0); } diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index cc2f05b6d1..48439e9523 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -149,15 +149,9 @@ QT_BEGIN_NAMESPACE QWindowsOpengl32DLL QOpenGLStaticContext::opengl32; -void *QWindowsOpengl32DLL::resolve(const char *name) +FARPROC QWindowsOpengl32DLL::resolve(const char *name) { -#ifndef Q_OS_WINCE - void *proc = m_lib ? (void *) ::GetProcAddress(m_lib, name) : 0; -#else - void *proc = m_lib ? (void *) ::GetProcAddress(m_lib, (const wchar_t *) QString::fromLatin1(name).utf16()) : 0; -#endif - - return proc; + return m_lib ? ::GetProcAddress(m_lib, name) : nullptr; } bool QWindowsOpengl32DLL::init(bool softwareRendering) diff --git a/src/plugins/platforms/windows/qwindowsglcontext.h b/src/plugins/platforms/windows/qwindowsglcontext.h index e8c78860f2..3ebf5b7bc2 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.h +++ b/src/plugins/platforms/windows/qwindowsglcontext.h @@ -122,7 +122,7 @@ struct QWindowsOpengl32DLL void (APIENTRY * glGetIntegerv)(GLenum pname, GLint* params); const GLubyte * (APIENTRY * glGetString)(GLenum name); - void *resolve(const char *name); + FARPROC resolve(const char *name); private: HMODULE m_lib; bool m_nonOpengl32; diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp index ea68ba8cab..ddadbbea5d 100644 --- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp @@ -190,11 +190,7 @@ bool QWindowsInputContext::hasCapability(Capability capability) const { switch (capability) { case QPlatformInputContext::HiddenTextCapability: -#ifndef Q_OS_WINCE return false; // QTBUG-40691, do not show IME on desktop for password entry fields. -#else - break; // Windows CE: Show software keyboard. -#endif default: break; } diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index e0ebb142f5..941b014588 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -64,7 +64,7 @@ #include <qpa/qplatformnativeinterface.h> #include <qpa/qwindowsysteminterface.h> -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#ifndef QT_NO_SESSIONMANAGER # include "qwindowssessionmanager.h" #endif #include <QtGui/qtouchdevice.h> @@ -102,7 +102,7 @@ QT_BEGIN_NAMESPACE It should compile with: \list - \li Microsoft Visual Studio 2008 or later (using the Microsoft Windows SDK, + \li Microsoft Visual Studio 2013 or later (using the Microsoft Windows SDK, (\c Q_CC_MSVC). \li Stock \l{http://mingw.org/}{MinGW} (\c Q_CC_MINGW). This version ships with headers that are missing a lot of WinAPI. @@ -112,7 +112,6 @@ QT_BEGIN_NAMESPACE (\c Q_CC_MINGW and \c __MINGW64_VERSION_MAJOR indicating the version). MinGW-w64 provides more complete headers (compared to stock MinGW from mingw.org), including a considerable part of the Windows SDK. - \li Visual Studio 2008 for Windows Embedded (\c Q_OS_WINCE). \endlist The file \c qtwindows_additional.h contains defines and declarations that @@ -214,9 +213,7 @@ QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList ¶mL : m_options(0) , m_fontDatabase(0) { -#ifndef Q_OS_WINCE Q_INIT_RESOURCE(openglblacklists); -#endif static bool dpiAwarenessSet = false; int tabletAbsoluteRange = -1; @@ -467,46 +464,16 @@ QWindowsStaticOpenGLContext *QWindowsIntegration::staticOpenGLContext() } #endif // !QT_NO_OPENGL -/* Workaround for QTBUG-24205: In 'Auto', pick the FreeType engine for - * QML2 applications. */ - -#ifdef Q_OS_WINCE -// It's not easy to detect if we are running a QML application -// Let's try to do so by checking if the Qt Quick module is loaded. -inline bool isQMLApplication() -{ - // check if the Qt Quick module is loaded -#ifdef _DEBUG - HMODULE handle = GetModuleHandle(L"Qt5Quick" QT_LIBINFIX L"d.dll"); -#else - HMODULE handle = GetModuleHandle(L"Qt5Quick" QT_LIBINFIX L".dll"); -#endif - return (handle != NULL); -} -#endif - QPlatformFontDatabase *QWindowsIntegration::fontDatabase() const { if (!d->m_fontDatabase) { #ifdef QT_NO_FREETYPE d->m_fontDatabase = new QWindowsFontDatabase(); #else // QT_NO_FREETYPE - if (d->m_options & QWindowsIntegration::FontDatabaseFreeType) { + if (d->m_options & QWindowsIntegration::FontDatabaseFreeType) d->m_fontDatabase = new QWindowsFontDatabaseFT; - } else if (d->m_options & QWindowsIntegration::FontDatabaseNative){ - d->m_fontDatabase = new QWindowsFontDatabase; - } else { -#ifndef Q_OS_WINCE + else d->m_fontDatabase = new QWindowsFontDatabase; -#else - if (isQMLApplication()) { - qCDebug(lcQpaFonts) << "QML application detected, using FreeType rendering"; - d->m_fontDatabase = new QWindowsFontDatabaseFT; - } - else - d->m_fontDatabase = new QWindowsFontDatabase; -#endif - } #endif // QT_NO_FREETYPE } return d->m_fontDatabase; @@ -594,7 +561,7 @@ unsigned QWindowsIntegration::options() const return d->m_options; } -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) QPlatformSessionManager *QWindowsIntegration::createPlatformSessionManager(const QString &id, const QString &key) const { return new QWindowsSessionManager(id, key); diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h index 9658ef711d..437253cedc 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.h +++ b/src/plugins/platforms/windows/qwindowsintegration.h @@ -104,7 +104,7 @@ public: void beep() const Q_DECL_OVERRIDE; -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const Q_DECL_OVERRIDE; #endif diff --git a/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp b/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp index 2dfe7fc5f9..21ebee6262 100644 --- a/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp +++ b/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp @@ -39,7 +39,6 @@ #include "qwindowsinternalmimedata.h" #include "qwindowscontext.h" -#include "qplatformfunctions_wince.h" #include "qwindowsmime.h" #include <QDebug> /*! diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 5b2370b69d..8d6e83298e 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -552,34 +552,6 @@ inline quint32 winceKeyBend(quint32 keyCode) return KeyTbl[keyCode]; } -#ifdef Q_OS_WINCE -QT_BEGIN_INCLUDE_NAMESPACE -int ToUnicode(UINT vk, int /*scancode*/, unsigned char* /*kbdBuffer*/, LPWSTR unicodeBuffer, int, int) -{ - QT_USE_NAMESPACE - QChar* buf = reinterpret_cast< QChar*>(unicodeBuffer); - if (KeyTbl[vk] == 0) { - buf[0] = vk; - return 1; - } - return 0; -} - -int ToAscii(UINT vk, int scancode, unsigned char *kbdBuffer, LPWORD unicodeBuffer, int flag) -{ - return ToUnicode(vk, scancode, kbdBuffer, (LPWSTR) unicodeBuffer, 0, flag); - -} - -bool GetKeyboardState(unsigned char* kbuffer) -{ - for (int i=0; i< 256; ++i) - kbuffer[i] = GetAsyncKeyState(i); - return true; -} -QT_END_INCLUDE_NAMESPACE -#endif // Q_OS_WINCE - // Translate a VK into a Qt key code, or unicode character static inline quint32 toKeyOrUnicode(quint32 vk, quint32 scancode, unsigned char *kbdBuffer, bool *isDeadkey = 0) { @@ -780,7 +752,6 @@ static void showSystemMenu(QWindow* w) if (!menu) return; // no menu for this window -#ifndef Q_OS_WINCE #define enabled (MF_BYCOMMAND | MF_ENABLED) #define disabled (MF_BYCOMMAND | MF_GRAYED) @@ -805,7 +776,6 @@ static void showSystemMenu(QWindow* w) #undef enabled #undef disabled -#endif // !Q_OS_WINCE const QPoint pos = QHighDpi::toNativePixels(topLevel->geometry().topLeft(), topLevel); const int ret = TrackPopupMenuEx(menu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_NONOTIFY | TPM_RETURNCMD, @@ -1172,7 +1142,6 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms modifiers, scancode, quint32(msg.wParam), nModifiers, text, false); result =true; bool store = true; -#ifndef Q_OS_WINCE // Alt+<alphanumerical> go to the Win32 menu system if unhandled by Qt if (msgType == WM_SYSKEYDOWN && !result && a) { HWND parent = GetParent(QWindowsWindow::handleOf(receiver)); @@ -1186,7 +1155,6 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms parent = GetParent(parent); } } -#endif // !Q_OS_WINCE if (!store) key_recorder.findKey(int(msg.wParam), true); } @@ -1216,7 +1184,6 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms nModifiers, (rec ? rec->text : QString()), false); result = true; -#ifndef Q_OS_WINCE // 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(); @@ -1229,7 +1196,6 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms parent = GetParent(parent); } } -#endif } } return result; diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp index cb112446fc..d6375693d8 100644 --- a/src/plugins/platforms/windows/qwindowsmime.cpp +++ b/src/plugins/platforms/windows/qwindowsmime.cpp @@ -403,11 +403,9 @@ QDebug operator<<(QDebug d, const FORMATETC &tc) case CF_UNICODETEXT: d << "CF_UNICODETEXT"; break; -#ifndef Q_OS_WINCE case CF_ENHMETAFILE: d << "CF_ENHMETAFILE"; break; -#endif // !Q_OS_WINCE default: d << QWindowsMimeConverter::clipboardFormatName(tc.cfFormat); break; diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index 78fff65d84..fcba0d9e9b 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -203,7 +203,6 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized; -#ifndef Q_OS_WINCE // Check for events synthesized from touch. Lower byte is touch index, 0 means pen. static const bool passSynthesizedMouseEvents = !(QWindowsIntegration::instance()->options() & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch); @@ -218,7 +217,6 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, return false; } } -#endif // !Q_OS_WINCE const QPoint winEventPosition(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam)); if (et & QtWindows::NonClientEventFlag) { @@ -320,7 +318,6 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, const bool hasCapture = platformWindow->hasMouseCapture(); const bool currentNotCapturing = hasCapture && currentWindowUnderMouse != window; -#ifndef Q_OS_WINCE // Enter new window: track to generate leave event. // If there is an active capture, only track if the current window is capturing, // so we don't get extra leave when cursor leaves the application. @@ -334,7 +331,6 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, qWarning("TrackMouseEvent failed."); m_trackedWindow = window; } -#endif // !Q_OS_WINCE // No enter or leave events are sent as long as there is an autocapturing window. if (!hasCapture || !platformWindow->testFlag(QWindowsWindow::AutoMouseCapture)) { @@ -487,7 +483,6 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, QtWindows::WindowsEventType, MSG msg, LRESULT *) { -#ifndef Q_OS_WINCE typedef QWindowSystemInterface::TouchPoint QTouchPoint; typedef QList<QWindowSystemInterface::TouchPoint> QTouchPointList; @@ -563,109 +558,17 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, QWindowSystemInterface::handleTouchEvent(window, m_touchDevice, touchPoints); -#else // !Q_OS_WINCE - Q_UNUSED(window) - Q_UNUSED(msg) -#endif return true; - } bool QWindowsMouseHandler::translateGestureEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType, MSG msg, LRESULT *) { -#ifndef Q_OS_WINCE Q_UNUSED(window) Q_UNUSED(hwnd) Q_UNUSED(msg) return false; -#else // !Q_OS_WINCE - GESTUREINFO gi; - memset(&gi, 0, sizeof(GESTUREINFO)); - gi.cbSize = sizeof(GESTUREINFO); - - if (!GetGestureInfo((HGESTUREINFO)msg.lParam, &gi)) - return false; - - const QPoint position = QPoint(gi.ptsLocation.x, gi.ptsLocation.y); - - if (gi.dwID != GID_DIRECTMANIPULATION) - return true; - static QPoint lastTouchPos; - const QScreen *screen = window->screen(); - if (!screen) - screen = QGuiApplication::primaryScreen(); - if (!screen) - return true; - const QRect screenGeometry = screen->geometry(); - QWindowSystemInterface::TouchPoint touchPoint; - static QWindowSystemInterface::TouchPoint touchPoint2; - touchPoint.id = 0;//gi.dwInstanceID; - touchPoint.pressure = 1.0; - - if (gi.dwFlags & GF_BEGIN) - touchPoint.state = Qt::TouchPointPressed; - else if (gi.dwFlags & GF_END) - touchPoint.state = Qt::TouchPointReleased; - else if (gi.dwFlags == 0) - touchPoint.state = Qt::TouchPointMoved; - else - return true; - touchPoint2.pressure = 1.0; - touchPoint2.id = 1; - const QPoint winEventPosition = position; - const int deltaX = GID_DIRECTMANIPULATION_DELTA_X(gi.ullArguments); - const int deltaY = GID_DIRECTMANIPULATION_DELTA_Y(gi.ullArguments); - //Touch points are taken from the whole screen so map the position to the screen - const QPoint globalPosition = QWindowsGeometryHint::mapToGlobal(hwnd, winEventPosition); - const QPoint globalPosition2 = QWindowsGeometryHint::mapToGlobal(hwnd, QPoint(position.x() + deltaX, position.y() + deltaY)); - - touchPoint.normalPosition = - QPointF( (qreal)globalPosition.x() / screenGeometry.width(), (qreal)globalPosition.y() / screenGeometry.height() ); - - touchPoint.area.moveCenter(globalPosition); - - QList<QWindowSystemInterface::TouchPoint> pointList; - pointList.append(touchPoint); - if (deltaX != 0 && deltaY != 0) { - touchPoint2.state = m_had2ndTouchPoint ? Qt::TouchPointMoved : Qt::TouchPointPressed; - m_had2ndTouchPoint = true; - touchPoint2.normalPosition = - QPointF( (qreal)globalPosition2.x() / screenGeometry.width(), (qreal)globalPosition2.y() / screenGeometry.height() ); - - touchPoint2.area.moveCenter(globalPosition2); - lastTouchPos = globalPosition2; - pointList.append(touchPoint2); - } else if (m_had2ndTouchPoint) { - touchPoint2.normalPosition = - QPointF( (qreal)lastTouchPos.x() / screenGeometry.width(), (qreal)lastTouchPos.y() / screenGeometry.height() ); - - touchPoint2.area.moveCenter(lastTouchPos); - touchPoint2.state = Qt::TouchPointReleased; - pointList.append(touchPoint2); - m_had2ndTouchPoint = false; - } - - if (!m_touchDevice) { - m_touchDevice = new QTouchDevice; - // TODO: Device used to be hardcoded to screen in previous code. - m_touchDevice->setType(QTouchDevice::TouchScreen); - m_touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::NormalizedPosition); - QWindowSystemInterface::registerTouchDevice(m_touchDevice); - } - - QWindowSystemInterface::handleTouchEvent(window, m_touchDevice, pointList); - // handle window focusing in/out - if (window != m_windowUnderMouse) { - if (m_windowUnderMouse) - QWindowSystemInterface::handleLeaveEvent(m_windowUnderMouse); - if (window) - QWindowSystemInterface::handleEnterEvent(window); - m_windowUnderMouse = window; - } - return true; -#endif // Q_OS_WINCE } QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.h b/src/plugins/platforms/windows/qwindowsmousehandler.h index d16c9f9e02..3eacc5f1a5 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.h +++ b/src/plugins/platforms/windows/qwindowsmousehandler.h @@ -91,10 +91,6 @@ private: QTouchDevice *m_touchDevice; bool m_leftButtonDown; QWindow *m_previousCaptureWindow; -#ifdef Q_OS_WINCE -//This is required to send a touch up if we don't get a second touch position any more - bool m_had2ndTouchPoint; -#endif }; Qt::MouseButtons QWindowsMouseHandler::keyStateToMouseButtons(int wParam) diff --git a/src/plugins/platforms/windows/qwindowsnativeimage.cpp b/src/plugins/platforms/windows/qwindowsnativeimage.cpp index bc8bfda32b..ec9683ea8d 100644 --- a/src/plugins/platforms/windows/qwindowsnativeimage.cpp +++ b/src/plugins/platforms/windows/qwindowsnativeimage.cpp @@ -126,9 +126,7 @@ QWindowsNativeImage::QWindowsNativeImage(int width, int height, m_image = QImage(width, height, format); } -#ifndef Q_OS_WINCE GdiFlush(); -#endif } QWindowsNativeImage::~QWindowsNativeImage() diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp index 4ca7f0e413..d5d50a69cd 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.cpp +++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp @@ -54,17 +54,14 @@ #include <private/qopengl_p.h> #endif -#ifndef Q_OS_WINCE -# include <QtCore/qt_windows.h> -# include <private/qsystemlibrary_p.h> -# include <d3d9.h> -#endif +#include <QtCore/qt_windows.h> +#include <private/qsystemlibrary_p.h> +#include <d3d9.h> QT_BEGIN_NAMESPACE GpuDescription GpuDescription::detect() { -#ifndef Q_OS_WINCE typedef IDirect3D9 * (WINAPI *PtrDirect3DCreate9)(UINT); GpuDescription result; @@ -95,13 +92,6 @@ GpuDescription GpuDescription::detect() result.description = adapterIdentifier.Description; } return result; -#else // !Q_OS_WINCE - GpuDescription result; - result.vendorId = result.deviceId = result.revision =1; - result.driverVersion = QVersionNumber(1, 1, 1); - result.driverName = result.description = QByteArrayLiteral("Generic"); - return result; -#endif } #ifndef QT_NO_DEBUG_STREAM @@ -155,7 +145,6 @@ QVariant GpuDescription::toVariant() const QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedGlesRenderer() { -#ifndef Q_OS_WINCE const char platformVar[] = "QT_ANGLE_PLATFORM"; if (qEnvironmentVariableIsSet(platformVar)) { const QByteArray anglePlatform = qgetenv(platformVar); @@ -167,13 +156,11 @@ QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedGlesRenderer() return QWindowsOpenGLTester::AngleRendererD3d11Warp; qCWarning(lcQpaGl) << "Invalid value set for " << platformVar << ": " << anglePlatform; } -#endif // !Q_OS_WINCE return QWindowsOpenGLTester::InvalidRenderer; } QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedRenderer() { -#ifndef Q_OS_WINCE const char openGlVar[] = "QT_OPENGL"; if (QCoreApplication::testAttribute(Qt::AA_UseOpenGLES)) { const Renderer glesRenderer = QWindowsOpenGLTester::requestedGlesRenderer(); @@ -195,12 +182,9 @@ QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedRenderer() return QWindowsOpenGLTester::SoftwareRasterizer; qCWarning(lcQpaGl) << "Invalid value set for " << openGlVar << ": " << requested; } -#endif // !Q_OS_WINCE return QWindowsOpenGLTester::InvalidRenderer; } -#ifndef Q_OS_WINCE - static inline QString resolveBugListFile(const QString &fileName) { if (QFileInfo(fileName).isAbsolute()) @@ -216,12 +200,10 @@ static inline QString resolveBugListFile(const QString &fileName) return QStandardPaths::locate(QStandardPaths::ConfigLocation, fileName); } -# ifndef QT_NO_OPENGL +#ifndef QT_NO_OPENGL typedef QHash<QOpenGLConfig::Gpu, QWindowsOpenGLTester::Renderers> SupportedRenderersCache; Q_GLOBAL_STATIC(SupportedRenderersCache, supportedRenderersCache) -# endif - -#endif // !Q_OS_WINCE +#endif QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(const GpuDescription &gpu, bool glesOnly) { @@ -229,8 +211,6 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c Q_UNUSED(glesOnly) #if defined(QT_NO_OPENGL) return 0; -#elif defined(Q_OS_WINCE) - return QWindowsOpenGLTester::Gles; #else QOpenGLConfig::Gpu qgpu = QOpenGLConfig::Gpu::fromDevice(gpu.vendorId, gpu.deviceId, gpu.driverVersion, gpu.description); SupportedRenderersCache *srCache = supportedRenderersCache(); @@ -280,7 +260,7 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c } srCache->insert(qgpu, result); return result; -#endif // !Q_OS_WINCE && !QT_NO_OPENGL +#endif // !QT_NO_OPENGL } QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedGlesRenderers() @@ -301,7 +281,7 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedRenderers() bool QWindowsOpenGLTester::testDesktopGL() { -#if !defined(QT_NO_OPENGL) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_OPENGL) HMODULE lib = 0; HWND wnd = 0; HDC dc = 0; @@ -428,7 +408,7 @@ cleanup: return result; #else return false; -#endif // !QT_NO_OPENGL && !Q_OS_WINCE +#endif // !QT_NO_OPENGL } QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index b476c9be1d..93839ccf43 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -68,8 +68,6 @@ static inline QDpi deviceDPI(HDC hdc) return QDpi(GetDeviceCaps(hdc, LOGPIXELSX), GetDeviceCaps(hdc, LOGPIXELSY)); } -#ifndef Q_OS_WINCE - static inline QDpi monitorDPI(HMONITOR hMonitor) { if (QWindowsContext::shcoredll.isValid()) { @@ -81,8 +79,6 @@ static inline QDpi monitorDPI(HMONITOR hMonitor) return QDpi(0, 0); } -#endif // !Q_OS_WINCE - typedef QList<QWindowsScreenData> WindowsScreenDataList; static bool monitorData(HMONITOR hMonitor, QWindowsScreenData *data) @@ -99,20 +95,9 @@ static bool monitorData(HMONITOR hMonitor, QWindowsScreenData *data) if (data->name == QLatin1String("WinDisc")) { data->flags |= QWindowsScreenData::LockScreen; } else { -#ifdef Q_OS_WINCE - //Windows CE, just supports one Display and expects to get only DISPLAY, - //instead of DISPLAY0 and so on, which are passed by info.szDevice - HDC hdc = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL); -#else - HDC hdc = CreateDC(info.szDevice, NULL, NULL, NULL); -#endif - if (hdc) { -#ifndef Q_OS_WINCE + if (const HDC hdc = CreateDC(info.szDevice, NULL, NULL, NULL)) { const QDpi dpi = monitorDPI(hMonitor); data->dpi = dpi.first ? dpi : deviceDPI(hdc); -#else - data->dpi = deviceDPI(hdc); -#endif data->depth = GetDeviceCaps(hdc, BITSPIXEL); data->format = data->depth == 16 ? QImage::Format_RGB16 : QImage::Format_RGB32; data->physicalSizeMM = QSizeF(GetDeviceCaps(hdc, HORZSIZE), GetDeviceCaps(hdc, VERTSIZE)); @@ -330,7 +315,6 @@ enum OrientationPreference // matching Win32 API ORIENTATION_PREFERENCE bool QWindowsScreen::setOrientationPreference(Qt::ScreenOrientation o) { bool result = false; -#ifndef Q_OS_WINCE if (QWindowsContext::user32dll.setDisplayAutoRotationPreferences) { DWORD orientationPreference = 0; switch (o) { @@ -352,14 +336,12 @@ bool QWindowsScreen::setOrientationPreference(Qt::ScreenOrientation o) } result = QWindowsContext::user32dll.setDisplayAutoRotationPreferences(orientationPreference); } -#endif // !Q_OS_WINCE return result; } Qt::ScreenOrientation QWindowsScreen::orientationPreference() { Qt::ScreenOrientation result = Qt::PrimaryOrientation; -#ifndef Q_OS_WINCE if (QWindowsContext::user32dll.getDisplayAutoRotationPreferences) { DWORD orientationPreference = 0; if (QWindowsContext::user32dll.getDisplayAutoRotationPreferences(&orientationPreference)) { @@ -379,7 +361,6 @@ Qt::ScreenOrientation QWindowsScreen::orientationPreference() } } } -#endif // !Q_OS_WINCE return result; } @@ -388,7 +369,7 @@ Qt::ScreenOrientation QWindowsScreen::orientationPreference() */ QPlatformScreen::SubpixelAntialiasingType QWindowsScreen::subpixelAntialiasingTypeHint() const { -#if defined(Q_OS_WINCE) || !defined(FT_LCD_FILTER_H) || !defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING) +#if !defined(FT_LCD_FILTER_H) || !defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING) return QPlatformScreen::Subpixel_None; #else QPlatformScreen::SubpixelAntialiasingType type = QPlatformScreen::subpixelAntialiasingTypeHint(); diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h index 2afc410e07..02a9dc3bc3 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.h +++ b/src/plugins/platforms/windows/qwindowsscreen.h @@ -41,9 +41,6 @@ #define QWINDOWSSCREEN_H #include "qtwindowsglobal.h" -#ifdef Q_OS_WINCE -# include "qplatformfunctions_wince.h" -#endif #include <QtCore/QList> #include <QtCore/QVector> diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp index 3c99e3507e..5074db9051 100644 --- a/src/plugins/platforms/windows/qwindowsservices.cpp +++ b/src/plugins/platforms/windows/qwindowsservices.cpp @@ -46,9 +46,7 @@ #include <QtCore/QDir> #include <shlobj.h> -#ifndef Q_OS_WINCE -# include <intshcut.h> -#endif +#include <intshcut.h> QT_BEGIN_NAMESPACE @@ -56,7 +54,6 @@ enum { debug = 0 }; static inline bool shellExecute(const QUrl &url) { -#ifndef Q_OS_WINCE const QString nativeFilePath = url.isLocalFile() ? QDir::toNativeSeparators(url.toLocalFile()) : url.toString(QUrl::FullyEncoded); const quintptr result = @@ -69,10 +66,6 @@ static inline bool shellExecute(const QUrl &url) return false; } return true; -#else - Q_UNUSED(url); - return false; -#endif } // Retrieve the commandline for the default mail client. It contains a @@ -107,13 +100,9 @@ static inline QString mailCommand() } if (!command[0]) return QString(); -#ifndef Q_OS_WINCE wchar_t expandedCommand[MAX_PATH] = {0}; return ExpandEnvironmentStrings(command, expandedCommand, MAX_PATH) ? QString::fromWCharArray(expandedCommand) : QString::fromWCharArray(command); -#else - return QString(); -#endif } static inline bool launchMail(const QUrl &url) diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.h b/src/plugins/platforms/windows/qwindowstabletsupport.h index 4a24d62770..2c05dcddfc 100644 --- a/src/plugins/platforms/windows/qwindowstabletsupport.h +++ b/src/plugins/platforms/windows/qwindowstabletsupport.h @@ -42,7 +42,7 @@ #include "qtwindowsglobal.h" -#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_TABLETEVENT) #include <QtCore/QVector> #include <QtCore/QPointF> @@ -143,5 +143,5 @@ private: QT_END_NAMESPACE -#endif // !QT_NO_TABLETEVENT && !Q_OS_WINCE +#endif // !QT_NO_TABLETEVENT #endif // QWINDOWSTABLETSUPPORT_H diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index c64955be80..046c32a80a 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -49,17 +49,12 @@ #include "qwindowsintegration.h" #include "qt_windows.h" #include "qwindowsfontdatabase.h" -#ifdef Q_OS_WINCE -# include "qplatformfunctions_wince.h" -# include "winuser.h" -#else -# include <commctrl.h> -# include <objbase.h> -# ifndef Q_CC_MINGW -# include <commoncontrols.h> -# endif -# include <shellapi.h> +#include <commctrl.h> +#include <objbase.h> +#ifndef Q_CC_MINGW +# include <commoncontrols.h> #endif +#include <shellapi.h> #include <QtCore/QVariant> #include <QtCore/QCoreApplication> @@ -128,7 +123,6 @@ static inline QColor getSysColor(int index) return COLORREFToQColor(GetSysColor(index)); } -#ifndef QT_NO_WINCE_SHELLSDK // QTBUG-48823/Windows 10: SHGetFileInfo() (as called by item views on file system // models has been observed to trigger a WM_PAINT on the mainwindow. Suppress the // behavior by running it in a thread. @@ -161,7 +155,6 @@ static bool shGetFileInfoBackground(QWindowsThreadPoolRunner &r, } return result; } -#endif // !QT_NO_WINCE_SHELLSDK // from QStyle::standardPalette static inline QPalette standardPalette() @@ -272,14 +265,9 @@ static inline QPalette menuPalette(const QPalette &systemPalette) result.setColor(QPalette::Active, QPalette::ButtonText, menuTextColor); result.setColor(QPalette::Disabled, QPalette::WindowText, disabled); result.setColor(QPalette::Disabled, QPalette::Text, disabled); -#ifndef Q_OS_WINCE const bool isFlat = booleanSystemParametersInfo(SPI_GETFLATMENU, false); result.setColor(QPalette::Disabled, QPalette::Highlight, getSysColor(isFlat ? COLOR_MENUHILIGHT : COLOR_HIGHLIGHT)); -#else - result.setColor(QPalette::Disabled, QPalette::Highlight, - getSysColor(COLOR_HIGHLIGHT)); -#endif result.setColor(QPalette::Disabled, QPalette::HighlightedText, disabled); result.setColor(QPalette::Disabled, QPalette::Button, result.color(QPalette::Active, QPalette::Button)); @@ -305,11 +293,7 @@ static inline QPalette *menuBarPalette(const QPalette &menuPalette) QPalette *result = 0; if (booleanSystemParametersInfo(SPI_GETFLATMENU, false)) { result = new QPalette(menuPalette); -#ifndef Q_OS_WINCE const QColor menubar(getSysColor(COLOR_MENUBAR)); -#else - const QColor menubar(getSysColor(COLOR_MENU)); -#endif result->setColor(QPalette::Active, QPalette::Button, menubar); result->setColor(QPalette::Disabled, QPalette::Button, menubar); result->setColor(QPalette::Inactive, QPalette::Button, menubar); @@ -379,12 +363,10 @@ QVariant QWindowsTheme::themeHint(ThemeHint hint) const return QVariant(iconThemeSearchPaths()); case StyleNames: return QVariant(styleNames()); -#ifndef Q_OS_WINCE case TextCursorWidth: return QVariant(int(dWordSystemParametersInfo(SPI_GETCARETWIDTH, 1u))); case DropShadow: return QVariant(booleanSystemParametersInfo(SPI_GETDROPSHADOW, false)); -#endif // !Q_OS_WINCE case MaximumScrollBarDragDistance: return QVariant(qRound(qreal(QWindowsContext::instance()->defaultDPI()) * 1.375)); case KeyboardScheme: @@ -438,7 +420,6 @@ void QWindowsTheme::clearFonts() void QWindowsTheme::refreshFonts() { -#ifndef Q_OS_WINCE // ALL THIS FUNCTIONALITY IS MISSING ON WINCE clearFonts(); if (!QGuiApplication::desktopSettingsAware()) return; @@ -467,7 +448,6 @@ void QWindowsTheme::refreshFonts() m_fonts[DockWidgetTitleFont] = new QFont(titleFont); m_fonts[ItemViewFont] = new QFont(iconTitleFont); m_fonts[FixedFont] = new QFont(fixedFont); -#endif // !Q_OS_WINCE } bool QWindowsTheme::usePlatformNativeDialog(DialogType type) const @@ -491,12 +471,7 @@ Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon); static QPixmap loadIconFromShell32(int resourceId, QSizeF size) { -#ifdef Q_OS_WINCE - HMODULE hmod = LoadLibrary(L"ceshell"); -#else - HMODULE hmod = QSystemLibrary::load(L"shell32"); -#endif - if (hmod) { + if (const HMODULE hmod = QSystemLibrary::load(L"shell32")) { HICON iconHandle = static_cast<HICON>(LoadImage(hmod, MAKEINTRESOURCE(resourceId), IMAGE_ICON, int(size.width()), int(size.height()), 0)); @@ -515,7 +490,7 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) con const int scaleFactor = primaryScreen ? qRound(QHighDpiScaling::factor(primaryScreen)) : 1; const QSizeF pixmapSize = size * scaleFactor; int resourceId = -1; - int stockId = SIID_INVALID; + SHSTOCKICONID stockId = SIID_INVALID; UINT stockFlags = 0; LPCTSTR iconName = 0; switch (sp) { @@ -578,7 +553,6 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) con stockId = SIID_RECYCLER; resourceId = 191; break; -#ifndef Q_OS_WINCE case MessageBoxInformation: stockId = SIID_INFO; iconName = IDI_INFORMATION; @@ -598,30 +572,23 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) con case VistaShield: stockId = SIID_SHIELD; break; -#endif default: break; } -#ifndef Q_OS_WINCE if (stockId != SIID_INVALID) { - if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA - && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) - && QWindowsContext::shell32dll.sHGetStockIconInfo) { - QPixmap pixmap; - SHSTOCKICONINFO iconInfo; - memset(&iconInfo, 0, sizeof(iconInfo)); - iconInfo.cbSize = sizeof(iconInfo); - stockFlags |= (pixmapSize.width() > 16 ? SHGFI_LARGEICON : SHGFI_SMALLICON); - if (QWindowsContext::shell32dll.sHGetStockIconInfo(stockId, SHGFI_ICON | stockFlags, &iconInfo) == S_OK) { - pixmap = qt_pixmapFromWinHICON(iconInfo.hIcon); - pixmap.setDevicePixelRatio(scaleFactor); - DestroyIcon(iconInfo.hIcon); - return pixmap; - } + QPixmap pixmap; + SHSTOCKICONINFO iconInfo; + memset(&iconInfo, 0, sizeof(iconInfo)); + iconInfo.cbSize = sizeof(iconInfo); + stockFlags |= (pixmapSize.width() > 16 ? SHGFI_LARGEICON : SHGFI_SMALLICON); + if (SHGetStockIconInfo(stockId, SHGFI_ICON | stockFlags, &iconInfo) == S_OK) { + pixmap = qt_pixmapFromWinHICON(iconInfo.hIcon); + pixmap.setDevicePixelRatio(scaleFactor); + DestroyIcon(iconInfo.hIcon); + return pixmap; } } -#endif if (resourceId != -1) { QPixmap pixmap = loadIconFromShell32(resourceId, pixmapSize); @@ -698,14 +665,8 @@ static QPixmap pixmapFromShellImageList(int iImageList, const SHFILEINFO &info) // For MinGW: static const IID iID_IImageList = {0x46eb5926, 0x582e, 0x4017, {0x9f, 0xdf, 0xe8, 0x99, 0x8d, 0xaa, 0x9, 0x50}}; - if (!QWindowsContext::shell32dll.sHGetImageList) - return result; - if (iImageList == sHIL_JUMBO && QSysInfo::WindowsVersion < QSysInfo::WV_VISTA) - return result; - IImageList *imageList = 0; - HRESULT hr = QWindowsContext::shell32dll.sHGetImageList(iImageList, iID_IImageList, - reinterpret_cast<void **>(&imageList)); + HRESULT hr = SHGetImageList(iImageList, iID_IImageList, reinterpret_cast<void **>(&imageList)); if (hr != S_OK) return result; HICON hIcon; @@ -761,22 +722,13 @@ QPixmap QWindowsTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &s SHFILEINFO info; const unsigned int flags = -#ifndef Q_OS_WINCE SHGFI_ICON|iconSize|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS|SHGFI_OVERLAYINDEX; -#else - iconSize|SHGFI_SYSICONINDEX; -#endif // Q_OS_WINCE - -#if !defined(QT_NO_WINCE_SHELLSDK) const bool val = cacheableDirIcon && useDefaultFolderIcon ? shGetFileInfoBackground(m_threadPoolRunner, L"dummy", FILE_ATTRIBUTE_DIRECTORY, &info, flags | SHGFI_USEFILEATTRIBUTES) : shGetFileInfoBackground(m_threadPoolRunner, reinterpret_cast<const wchar_t *>(filePath.utf16()), 0, &info, flags); -#else - const bool val = false; -#endif // !QT_NO_WINCE_SHELLSDK // Even if GetFileInfo returns a valid result, hIcon can be empty in some cases if (val && info.hIcon) { diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 79f41bb6ec..c369bafafc 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -62,6 +62,8 @@ #include <QtCore/QDebug> +#include <dwmapi.h> + QT_BEGIN_NAMESPACE enum { @@ -147,7 +149,6 @@ QDebug operator<<(QDebug d, const POINT &p) return d; } -# ifndef Q_OS_WINCE QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p) { QDebugStateSaver saver(d); @@ -178,14 +179,12 @@ QDebug operator<<(QDebug d, const WINDOWPLACEMENT &wp) << ", rcNormalPosition=" << wp.rcNormalPosition; return d; } -# endif // !Q_OS_WINCE #endif // !QT_NO_DEBUG_STREAM // QTBUG-43872, for windows that do not have WS_EX_TOOLWINDOW set, WINDOWPLACEMENT // is in workspace/available area coordinates. static QPoint windowPlacementOffset(HWND hwnd, const QPoint &point) { -#ifndef Q_OS_WINCE if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) return QPoint(0, 0); const QWindowsScreenManager &screenManager = QWindowsContext::instance()->screenManager(); @@ -193,10 +192,6 @@ static QPoint windowPlacementOffset(HWND hwnd, const QPoint &point) ? screenManager.screens().constFirst() : screenManager.screenAtDp(point); if (screen) return screen->availableGeometry().topLeft() - screen->geometry().topLeft(); -#else - Q_UNUSED(hwnd) - Q_UNUSED(point) -#endif return QPoint(0, 0); } @@ -205,7 +200,6 @@ static QPoint windowPlacementOffset(HWND hwnd, const QPoint &point) static inline QRect frameGeometry(HWND hwnd, bool topLevel) { RECT rect = { 0, 0, 0, 0 }; -#ifndef Q_OS_WINCE if (topLevel) { WINDOWPLACEMENT windowPlacement; windowPlacement.length = sizeof(WINDOWPLACEMENT); @@ -215,7 +209,6 @@ static inline QRect frameGeometry(HWND hwnd, bool topLevel) return result.translated(windowPlacementOffset(hwnd, result.topLeft())); } } -#endif // !Q_OS_WINCE GetWindowRect(hwnd, &rect); // Screen coordinates. const HWND parent = GetParent(hwnd); if (parent && !topLevel) { @@ -236,7 +229,6 @@ static QWindow::Visibility windowVisibility_sys(HWND hwnd) { if (!IsWindowVisible(hwnd)) return QWindow::Hidden; -#ifndef Q_OS_WINCE WINDOWPLACEMENT windowPlacement; windowPlacement.length = sizeof(WINDOWPLACEMENT); if (GetWindowPlacement(hwnd, &windowPlacement)) { @@ -251,7 +243,6 @@ static QWindow::Visibility windowVisibility_sys(HWND hwnd) break; } } -#endif // !Q_OS_WINCE return QWindow::Windowed; } @@ -269,65 +260,27 @@ static inline bool windowIsOpenGL(const QWindow *w) static bool applyBlurBehindWindow(HWND hwnd) { -#ifdef Q_OS_WINCE - Q_UNUSED(hwnd); - return false; -#else - enum { dwmBbEnable = 0x1, dwmBbBlurRegion = 0x2 }; - - struct DwmBlurBehind { - DWORD dwFlags; - BOOL fEnable; - HRGN hRgnBlur; - BOOL fTransitionOnMaximized; - }; - - typedef HRESULT (WINAPI *PtrDwmEnableBlurBehindWindow)(HWND, const DwmBlurBehind*); - typedef HRESULT (WINAPI *PtrDwmIsCompositionEnabled)(BOOL *); - - // DWM API is available only from Windows Vista - if (QSysInfo::windowsVersion() < QSysInfo::WV_VISTA) - return false; - - static bool functionPointersResolved = false; - static PtrDwmEnableBlurBehindWindow dwmBlurBehind = 0; - static PtrDwmIsCompositionEnabled dwmIsCompositionEnabled = 0; - - if (Q_UNLIKELY(!functionPointersResolved)) { - QSystemLibrary library(QStringLiteral("dwmapi")); - if (library.load()) { - dwmBlurBehind = (PtrDwmEnableBlurBehindWindow)(library.resolve("DwmEnableBlurBehindWindow")); - dwmIsCompositionEnabled = (PtrDwmIsCompositionEnabled)(library.resolve("DwmIsCompositionEnabled")); - } - - functionPointersResolved = true; - } - - if (Q_UNLIKELY(!dwmBlurBehind || !dwmIsCompositionEnabled)) - return false; - BOOL compositionEnabled; - if (dwmIsCompositionEnabled(&compositionEnabled) != S_OK) + if (DwmIsCompositionEnabled(&compositionEnabled) != S_OK) return false; - DwmBlurBehind blurBehind = {0, 0, 0, 0}; + DWM_BLURBEHIND blurBehind = {0, 0, 0, 0}; if (compositionEnabled) { - blurBehind.dwFlags = dwmBbEnable | dwmBbBlurRegion; + blurBehind.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION; blurBehind.fEnable = TRUE; blurBehind.hRgnBlur = CreateRectRgn(0, 0, -1, -1); } else { - blurBehind.dwFlags = dwmBbEnable; + blurBehind.dwFlags = DWM_BB_ENABLE; blurBehind.fEnable = FALSE; } - const bool result = dwmBlurBehind(hwnd, &blurBehind) == S_OK; + const bool result = DwmEnableBlurBehindWindow(hwnd, &blurBehind) == S_OK; if (blurBehind.hRgnBlur) DeleteObject(blurBehind.hRgnBlur); return result; -#endif // Q_OS_WINCE } // from qwidget_win.cpp, pass flags separately in case they have been "autofixed". @@ -346,7 +299,6 @@ static bool shouldShowMaximizeButton(const QWindow *w, Qt::WindowFlags flags) // Qt::WindowTransparentForInput (in combination with WS_EX_TRANSPARENT). bool QWindowsWindow::setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal opacity) { -#ifndef Q_OS_WINCE // maybe needs revisiting WS_EX_LAYERED const LONG exStyle = GetWindowLong(hwnd, GWL_EXSTYLE); const bool needsLayered = (flags & Qt::WindowTransparentForInput) || (hasAlpha && (flags & Qt::FramelessWindowHint)) || opacity < 1.0; @@ -359,36 +311,22 @@ bool QWindowsWindow::setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool has } } return needsLayered; -#else // !Q_OS_WINCE - Q_UNUSED(hwnd); - Q_UNUSED(flags); - Q_UNUSED(hasAlpha); - Q_UNUSED(opacity); - return false; -#endif // Q_OS_WINCE } static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, bool openGL, qreal level) { -#ifdef Q_OS_WINCE // WINCE does not support that feature and microsoft explicitly warns to use those calls - Q_UNUSED(hwnd); - Q_UNUSED(flags); - Q_UNUSED(hasAlpha); - Q_UNUSED(level); -#else if (QWindowsWindow::setWindowLayered(hwnd, flags, hasAlpha, level)) { const BYTE alpha = BYTE(qRound(255.0 * level)); if (hasAlpha && !openGL && (flags & Qt::FramelessWindowHint)) { // Non-GL windows with alpha: Use blend function to update. BLENDFUNCTION blend = {AC_SRC_OVER, 0, alpha, AC_SRC_ALPHA}; - QWindowsContext::user32dll.updateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA); + UpdateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA); } else { - QWindowsContext::user32dll.setLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA); + SetLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA); } } else if (IsWindowVisible(hwnd)) { // Repaint when switching from layered. InvalidateRect(hwnd, NULL, TRUE); } -#endif // !Q_OS_WINCE } static inline void updateGLWindowSettings(const QWindow *w, HWND hwnd, Qt::WindowFlags flags, qreal opacity) @@ -602,12 +540,10 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag exStyle |= WS_EX_TOOLWINDOW; } -#ifndef Q_OS_WINCE // make mouse events fall through this window // NOTE: WS_EX_TRANSPARENT flag can make mouse inputs fall through a layered window if (flagsIn & Qt::WindowTransparentForInput) exStyle |= WS_EX_LAYERED | WS_EX_TRANSPARENT; -#endif } } @@ -648,10 +584,6 @@ QWindowsWindowData context->frameX, context->frameY, context->frameWidth, context->frameHeight, parentHandle, NULL, appinst, NULL); -#ifdef Q_OS_WINCE - if (DisableGestures(result.hwnd, TGF_GID_ALL, TGF_SCOPE_WINDOW)) - EnableGestures(result.hwnd, TGF_GID_DIRECTMANIPULATION, TGF_SCOPE_WINDOW); -#endif qCDebug(lcQpaWindows).nospace() << "CreateWindowEx: returns " << w << ' ' << result.hwnd << " obtained geometry: " << context->obtainedGeometry << ' ' << context->margins; @@ -762,9 +694,7 @@ bool QWindowsGeometryHint::validSize(const QSize &s) const QMargins QWindowsGeometryHint::frame(DWORD style, DWORD exStyle) { RECT rect = {0,0,0,0}; -#ifndef Q_OS_WINCE style &= ~(WS_OVERLAPPED); // Not permitted, see docs. -#endif if (!AdjustWindowRectEx(&rect, style, FALSE, exStyle)) qErrnoWarning("%s: AdjustWindowRectEx failed", __FUNCTION__); const QMargins result(qAbs(rect.left), qAbs(rect.top), @@ -777,7 +707,6 @@ QMargins QWindowsGeometryHint::frame(DWORD style, DWORD exStyle) bool QWindowsGeometryHint::handleCalculateSize(const QMargins &customMargins, const MSG &msg, LRESULT *result) { -#ifndef Q_OS_WINCE // NCCALCSIZE_PARAMS structure if wParam==TRUE if (!msg.wParam || customMargins.isNull()) return false; @@ -793,15 +722,8 @@ bool QWindowsGeometryHint::handleCalculateSize(const QMargins &customMargins, co << ncp->rgrc[0] << ' ' << ncp->rgrc[1] << ' ' << ncp->rgrc[2] << ' ' << ncp->lppos->cx << ',' << ncp->lppos->cy; return true; -#else - Q_UNUSED(customMargins) - Q_UNUSED(msg) - Q_UNUSED(result) - return false; -#endif } -#ifndef Q_OS_WINCE void QWindowsGeometryHint::applyToMinMaxInfo(HWND hwnd, MINMAXINFO *mmi) const { return applyToMinMaxInfo(DWORD(GetWindowLong(hwnd, GWL_STYLE)), @@ -833,7 +755,6 @@ void QWindowsGeometryHint::applyToMinMaxInfo(DWORD style, DWORD exStyle, MINMAXI << " frame=" << margins << ' ' << frameWidth << ',' << frameHeight << " out " << *mmi; } -#endif // !Q_OS_WINCE bool QWindowsGeometryHint::positionIncludesFrame(const QWindow *w) { @@ -1078,9 +999,6 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) m_dropTarget(0), m_savedStyle(0), m_format(aWindow->requestedFormat()), -#ifdef Q_OS_WINCE - m_previouslyHidden(false), -#endif m_iconSmall(0), m_iconBig(0), m_surface(0) @@ -1114,10 +1032,8 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) QWindowsWindow::~QWindowsWindow() { setFlag(WithinDestroy); -#ifndef Q_OS_WINCE if (testFlag(TouchRegistered)) QWindowsContext::user32dll.unregisterTouchWindow(m_data.hwnd); -#endif // !Q_OS_WINCE destroyWindow(); destroyIcon(); } @@ -1161,14 +1077,6 @@ void QWindowsWindow::destroyWindow() m_surface = 0; } #endif -#ifdef Q_OS_WINCE - if ((m_windowState & Qt::WindowFullScreen) && !m_previouslyHidden) { - HWND handle = FindWindow(L"HHTaskBar", L""); - if (handle) { - ShowWindow(handle, SW_SHOW); - } - } -#endif // !Q_OS_WINCE DestroyWindow(m_data.hwnd); context->removeWindow(m_data.hwnd); m_data.hwnd = 0; @@ -1336,7 +1244,6 @@ QPoint QWindowsWindow::mapFromGlobal(const QPoint &pos) const return pos; } -#ifndef Q_OS_WINCE static inline HWND transientParentHwnd(HWND hwnd) { if (GetAncestor(hwnd, GA_PARENT) == GetDesktopWindow()) { @@ -1346,7 +1253,6 @@ static inline HWND transientParentHwnd(HWND hwnd) } return 0; } -#endif // !Q_OS_WINCE // Update the transient parent for a toplevel window. The concept does not // really exist on Windows, the relationship is set by passing a parent along with !WS_CHILD @@ -1354,7 +1260,6 @@ static inline HWND transientParentHwnd(HWND hwnd) // SetParent, which would make it a real child). void QWindowsWindow::updateTransientParent() const { -#ifndef Q_OS_WINCE if (window()->type() == Qt::Popup) return; // QTBUG-34503, // a popup stays on top, no parent, see also WindowCreationData::fromWindow(). // Update transient parent. @@ -1366,7 +1271,6 @@ void QWindowsWindow::updateTransientParent() const newTransientParent = tw->handle(); if (newTransientParent != oldTransientParent) SetWindowLongPtr(m_data.hwnd, GWL_HWNDPARENT, LONG_PTR(newTransientParent)); -#endif // !Q_OS_WINCE } static inline bool testShowWithoutActivating(const QWindow *window) @@ -1484,16 +1388,12 @@ void QWindowsWindow::handleCompositionSettingsChanged() static QRect normalFrameGeometry(HWND hwnd) { -#ifndef Q_OS_WINCE WINDOWPLACEMENT wp; wp.length = sizeof(WINDOWPLACEMENT); if (GetWindowPlacement(hwnd, &wp)) { const QRect result = qrectFromRECT(wp.rcNormalPosition); return result.translated(windowPlacementOffset(hwnd, result.topLeft())); } -#else - Q_UNUSED(hwnd) -#endif return QRect(); } @@ -1613,7 +1513,6 @@ void QWindowsBaseWindow::setGeometry_sys(const QRect &rect) const << " new frame: " << frameGeometry; bool result = false; -#ifndef Q_OS_WINCE const HWND hwnd = handle(); WINDOWPLACEMENT windowPlacement; windowPlacement.length = sizeof(WINDOWPLACEMENT); @@ -1626,9 +1525,7 @@ void QWindowsBaseWindow::setGeometry_sys(const QRect &rect) const RECTfromQRect(frameGeometry.translated(-windowPlacementOffset(hwnd, frameGeometry.topLeft()))); windowPlacement.showCmd = windowPlacement.showCmd == SW_SHOWMINIMIZED ? SW_SHOWMINIMIZED : SW_HIDE; result = SetWindowPlacement(hwnd, &windowPlacement); - } else -#endif // !Q_OS_WINCE - { + } else { result = MoveWindow(hwnd, frameGeometry.x(), frameGeometry.y(), frameGeometry.width(), frameGeometry.height(), true); } @@ -1820,18 +1717,6 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) setFlag(FrameDirty); if ((oldState == Qt::WindowFullScreen) != (newState == Qt::WindowFullScreen)) { -#ifdef Q_OS_WINCE - HWND handle = FindWindow(L"HHTaskBar", L""); - if (handle) { - if (newState == Qt::WindowFullScreen) { - BOOL hidden = ShowWindow(handle, SW_HIDE); - if (!hidden) - m_previouslyHidden = true; - } else if (!m_previouslyHidden){ - ShowWindow(handle, SW_SHOW); - } - } -#endif if (newState == Qt::WindowFullScreen) { #ifndef Q_FLATTEN_EXPOSE UINT newStyle = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP; @@ -1843,17 +1728,13 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) // Window state but emulated by changing geometry and style. if (!m_savedStyle) { m_savedStyle = style(); -#ifndef Q_OS_WINCE if (oldState == Qt::WindowMinimized || oldState == Qt::WindowMaximized) { const QRect nf = normalFrameGeometry(m_data.hwnd); if (nf.isValid()) m_savedFrameGeometry = nf; } else { -#endif m_savedFrameGeometry = frameGeometry_sys(); -#ifndef Q_OS_WINCE } -#endif } if (m_savedStyle & WS_SYSMENU) newStyle |= WS_SYSMENU; @@ -1966,7 +1847,6 @@ void QWindowsWindow::propagateSizeHints() bool QWindowsWindow::handleGeometryChangingMessage(MSG *message, const QWindow *qWindow, const QMargins &margins) { -#ifndef Q_OS_WINCE if (!qWindow->isTopLevel()) // Implement hasHeightForWidth(). return false; WINDOWPOS *windowPos = reinterpret_cast<WINDOWPOS *>(message->lParam); @@ -1986,10 +1866,6 @@ bool QWindowsWindow::handleGeometryChangingMessage(MSG *message, const QWindow * windowPos->cx = correctedFrameGeometry.width(); windowPos->cy = correctedFrameGeometry.height(); return true; -#else // !Q_OS_WINCE - Q_UNUSED(message) - return false; -#endif } bool QWindowsWindow::handleGeometryChanging(MSG *message) const @@ -2047,15 +1923,13 @@ static inline void addRectToWinRegion(const QRect &rect, HRGN *winRegion) static HRGN qRegionToWinRegion(const QRegion ®ion) { - const QVector<QRect> rects = region.rects(); - if (rects.isEmpty()) - return NULL; - const int rectCount = rects.size(); - if (rectCount == 1) - return createRectRegion(region.boundingRect()); - HRGN hRegion = createRectRegion(rects.front()); - for (int i = 1; i < rectCount; ++i) - addRectToWinRegion(rects.at(i), &hRegion); + auto it = region.begin(); + const auto end = region.end(); + if (it == end) + return nullptr; + HRGN hRegion = createRectRegion(*it); + while (++it != end) + addRectToWinRegion(*it, &hRegion); return hRegion; } @@ -2084,7 +1958,6 @@ void QWindowsWindow::requestActivateWindow() // 'Active' state handling is based in focus since it needs to work for // child windows as well. if (m_data.hwnd) { -#ifndef Q_OS_WINCE const DWORD currentThread = GetCurrentThreadId(); bool attached = false; DWORD foregroundThread = 0; @@ -2101,13 +1974,10 @@ void QWindowsWindow::requestActivateWindow() attached = AttachThreadInput(foregroundThread, currentThread, TRUE) == TRUE; } } -#endif // !Q_OS_WINCE SetForegroundWindow(m_data.hwnd); SetFocus(m_data.hwnd); -#ifndef Q_OS_WINCE if (attached) AttachThreadInput(foregroundThread, currentThread, FALSE); -#endif // !Q_OS_WINCE } } @@ -2189,7 +2059,6 @@ void QWindowsWindow::setFrameStrutEventsEnabled(bool enabled) } } -#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const { const QWindowsGeometryHint hint(window(), m_data.customMargins); @@ -2260,8 +2129,6 @@ bool QWindowsWindow::handleNonClientHitTest(const QPoint &globalPos, LRESULT *re return false; } -#endif // !Q_OS_WINCE - #ifndef QT_NO_CURSOR // Return the default cursor (Arrow) from QWindowsCursor's cache. static inline CursorHandlePtr defaultCursor(const QWindow *w) @@ -2328,7 +2195,6 @@ void QWindowsWindow::setCursor(const CursorHandlePtr &c) #endif } -#ifndef Q_OS_WINCE void QWindowsWindow::setAlertState(bool enabled) { if (isAlertState() == enabled) @@ -2367,7 +2233,6 @@ void QWindowsWindow::stopAlertWindow() info.uCount = 0; FlashWindowEx(&info); } -#endif // !Q_OS_WINCE bool QWindowsWindow::isEnabled() const { @@ -2483,7 +2348,6 @@ void QWindowsWindow::setTouchWindowTouchTypeStatic(QWindow *window, QWindowsWind void QWindowsWindow::registerTouchWindow(QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes) { -#ifndef Q_OS_WINCE if ((QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch)) { ULONG touchFlags = 0; const bool ret = QWindowsContext::user32dll.isTouchWindow(m_data.hwnd, &touchFlags); @@ -2496,7 +2360,6 @@ void QWindowsWindow::registerTouchWindow(QWindowsWindowFunctions::TouchWindowTou else qErrnoWarning("RegisterTouchWindow() failed for window '%s'.", qPrintable(window()->objectName())); } -#endif // !Q_OS_WINCE } void QWindowsWindow::aboutToMakeCurrent() diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 999761f3c6..070add052b 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -41,9 +41,6 @@ #define QWINDOWSWINDOW_H #include "qtwindows_additional.h" -#ifdef Q_OS_WINCE -# include "qplatformfunctions_wince.h" -#endif #include "qwindowscursor.h" #include <qpa/qplatformwindow.h> @@ -60,10 +57,8 @@ struct QWindowsGeometryHint explicit QWindowsGeometryHint(const QWindow *w, const QMargins &customMargins); static QMargins frame(DWORD style, DWORD exStyle); static bool handleCalculateSize(const QMargins &customMargins, const MSG &msg, LRESULT *result); -#ifndef Q_OS_WINCE //MinMax maybe define struct if not available void applyToMinMaxInfo(DWORD style, DWORD exStyle, MINMAXINFO *mmi) const; void applyToMinMaxInfo(HWND hwnd, MINMAXINFO *mmi) const; -#endif bool validSize(const QSize &s) const; static inline QPoint mapToGlobal(HWND hwnd, const QPoint &); @@ -83,10 +78,8 @@ struct QWindowCreationContext QWindowCreationContext(const QWindow *w, const QRect &r, const QMargins &customMargins, DWORD style, DWORD exStyle); -#ifndef Q_OS_WINCE //MinMax maybe define struct if not available void applyToMinMaxInfo(MINMAXINFO *mmi) const { geometryHint.applyToMinMaxInfo(style, exStyle, mmi); } -#endif QWindowsGeometryHint geometryHint; const QWindow *window; @@ -293,10 +286,8 @@ public: HDC getDC(); void releaseDC(); -#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO void getSizeHints(MINMAXINFO *mmi) const; bool handleNonClientHitTest(const QPoint &globalPos, LRESULT *result) const; -#endif // !Q_OS_WINCE #ifndef QT_NO_CURSOR CursorHandlePtr cursor() const { return m_cursor; } @@ -316,12 +307,10 @@ public: void invalidateSurface() Q_DECL_OVERRIDE; void aboutToMakeCurrent(); -#ifndef Q_OS_WINCE void setAlertState(bool enabled) Q_DECL_OVERRIDE; bool isAlertState() const Q_DECL_OVERRIDE { return testFlag(AlertState); } void alertWindow(int durationMs = 0); void stopAlertWindow(); -#endif static void setTouchWindowTouchTypeStatic(QWindow *window, QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes); void registerTouchWindow(QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes = QWindowsWindowFunctions::NormalTouch); @@ -355,9 +344,6 @@ private: unsigned m_savedStyle; QRect m_savedFrameGeometry; const QSurfaceFormat m_format; -#ifdef Q_OS_WINCE - bool m_previouslyHidden; -#endif HICON m_iconSmall; HICON m_iconBig; void *m_surface; @@ -366,11 +352,9 @@ private: #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug d, const RECT &r); QDebug operator<<(QDebug d, const POINT &); -# ifndef Q_OS_WINCE QDebug operator<<(QDebug d, const MINMAXINFO &i); QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p); QDebug operator<<(QDebug d, const WINDOWPLACEMENT &); -# endif // !Q_OS_WINCE #endif // !QT_NO_DEBUG_STREAM // ---------- QWindowsGeometryHint inline functions. @@ -434,11 +418,7 @@ inline void QWindowsWindow::destroyIcon() inline bool QWindowsWindow::isLayered() const { -#ifndef Q_OS_WINCE return GetWindowLongPtr(m_data.hwnd, GWL_EXSTYLE) & WS_EX_LAYERED; -#else - return false; -#endif } QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/windows.pri b/src/plugins/platforms/windows/windows.pri index d46cfbc43a..cb784e89d2 100644 --- a/src/plugins/platforms/windows/windows.pri +++ b/src/plugins/platforms/windows/windows.pri @@ -1,14 +1,11 @@ # Note: OpenGL32 must precede Gdi32 as it overwrites some functions. -LIBS *= -lole32 -!wince: LIBS *= -luser32 -lwinspool -limm32 -lwinmm -loleaut32 +LIBS += -lole32 -luser32 -lwinspool -limm32 -lwinmm -loleaut32 contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2):!contains(QT_CONFIG, dynamicgl): LIBS *= -lopengl32 mingw: LIBS *= -luuid # For the dialog helpers: -!wince: LIBS *= -lshlwapi -lshell32 -!wince: LIBS *= -ladvapi32 -wince: DEFINES *= QT_LIBINFIX=L"\"\\\"$${QT_LIBINFIX}\\\"\"" +LIBS += -lshlwapi -lshell32 -ladvapi32 DEFINES *= QT_NO_CAST_FROM_ASCII @@ -59,7 +56,6 @@ HEADERS += \ $$PWD/qwindowstheme.h \ $$PWD/qwindowsdialoghelpers.h \ $$PWD/qwindowsservices.h \ - $$PWD/qplatformfunctions_wince.h \ $$PWD/qwindowsnativeimage.h \ $$PWD/qwindowsnativeinterface.h \ $$PWD/qwindowsopengltester.h \ @@ -98,22 +94,20 @@ contains(QT_CONFIG,dynamicgl) { } } -!wince:!contains( DEFINES, QT_NO_TABLETEVENT ) { +!contains( DEFINES, QT_NO_TABLETEVENT ) { INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/wintab HEADERS += $$PWD/qwindowstabletsupport.h SOURCES += $$PWD/qwindowstabletsupport.cpp } -!wince:!contains( DEFINES, QT_NO_SESSIONMANAGER ) { +!contains( DEFINES, QT_NO_SESSIONMANAGER ) { SOURCES += $$PWD/qwindowssessionmanager.cpp HEADERS += $$PWD/qwindowssessionmanager.h } -!wince:!contains( DEFINES, QT_NO_IMAGEFORMAT_PNG ) { - RESOURCES += $$PWD/cursors.qrc -} +!contains( DEFINES, QT_NO_IMAGEFORMAT_PNG ):RESOURCES += $$PWD/cursors.qrc -!wince: RESOURCES += $$PWD/openglblacklists.qrc +RESOURCES += $$PWD/openglblacklists.qrc contains(QT_CONFIG, freetype) { DEFINES *= QT_NO_FONTCONFIG diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro index 2e0f723693..adafa830d5 100644 --- a/src/plugins/platforms/windows/windows.pro +++ b/src/plugins/platforms/windows/windows.pro @@ -4,7 +4,7 @@ QT *= core-private QT *= gui-private QT *= platformsupport-private -!wince:LIBS *= -lgdi32 +LIBS += -lgdi32 -ldwmapi include(windows.pri) diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index f87ba0db72..8f0f683d04 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -221,14 +221,14 @@ bool QXcbShmImage::scroll(const QRegion &area, int dx, int dy) preparePaint(area); const QPoint delta(dx, dy); - foreach (const QRect &rect, area.rects()) + for (const QRect &rect : area) qt_scrollRectInImage(*image(), rect, delta); if (m_xcb_pixmap) { flushPixmap(area); ensureGC(m_xcb_pixmap); const QRect bounds(QPoint(0, 0), size()); - foreach (const QRect &src, area.rects()) { + for (const QRect &src : area) { const QRect dst = src.translated(delta).intersected(bounds); Q_XCB_CALL(xcb_copy_area(xcb_connection(), m_xcb_pixmap, @@ -457,11 +457,9 @@ void QXcbBackingStore::beginPaint(const QRegion ®ion) if (m_image->hasAlpha()) { QPainter p(paintDevice()); p.setCompositionMode(QPainter::CompositionMode_Source); - const QVector<QRect> rects = m_paintRegion.rects(); const QColor blank = Qt::transparent; - for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { - p.fillRect(*it, blank); - } + for (const QRect &rect : m_paintRegion) + p.fillRect(rect, blank); } } @@ -473,11 +471,12 @@ void QXcbBackingStore::endPaint() // Slow path: the paint device was m_rgbImage. Now copy with swapping red // and blue into m_image. - const QVector<QRect> rects = m_paintRegion.rects(); - if (rects.isEmpty()) + auto it = m_paintRegion.begin(); + const auto end = m_paintRegion.end(); + if (it == end) return; QPainter p(m_image->image()); - for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { + while (it != end) { const QRect rect = *it; p.drawImage(rect.topLeft(), m_rgbImage.copy(rect).rgbSwapped()); } diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 13eecbfb4f..a426e04721 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -2786,9 +2786,8 @@ void QXcbWindow::setMask(const QRegion ®ion) XCB_SHAPE_SK_BOUNDING, xcb_window(), 0, 0, XCB_NONE); } else { QVector<xcb_rectangle_t> rects; - const QVector<QRect> regionRects = region.rects(); - rects.reserve(regionRects.count()); - foreach (const QRect &r, regionRects) + rects.reserve(region.rectCount()); + for (const QRect &r : region) rects.push_back(qRectToXCBRectangle(r)); xcb_shape_rectangles(connection()->xcb_connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, diff --git a/src/src.pro b/src/src.pro index 4a165a2dab..88add4e807 100644 --- a/src/src.pro +++ b/src/src.pro @@ -129,7 +129,7 @@ src_plugins.depends = src_sql src_xml src_network src_android.subdir = $$PWD/android # this order is important -contains(QT_CONFIG, zlib)|cross_compile: SUBDIRS += src_qtzlib +!contains(QT_CONFIG, system-zlib)|cross_compile: SUBDIRS += src_qtzlib SUBDIRS += src_tools_bootstrap src_tools_moc src_tools_rcc !contains(QT_DISABLED_FEATURES, regularexpression):pcre { SUBDIRS += src_3rdparty_pcre diff --git a/src/testlib/qbenchmarkmetric.cpp b/src/testlib/qbenchmarkmetric.cpp index 0a9072907f..0ba55dbeb7 100644 --- a/src/testlib/qbenchmarkmetric.cpp +++ b/src/testlib/qbenchmarkmetric.cpp @@ -56,6 +56,7 @@ \value CPUTicks CPU time \value CPUMigrations Process migrations between CPUs \value CPUCycles CPU cycles + \value RefCPUCycles Reference CPU cycles \value BusCycles Bus cycles \value StalledCycles Cycles stalled \value InstructionReads Instruction reads @@ -108,6 +109,8 @@ const char * QTest::benchmarkMetricName(QBenchmarkMetric metric) return "CPUMigrations"; case CPUCycles: return "CPUCycles"; + case RefCPUCycles: + return "RefCPUCycles"; case BusCycles: return "BusCycles"; case StalledCycles: @@ -180,6 +183,8 @@ const char * QTest::benchmarkMetricUnit(QBenchmarkMetric metric) return "CPU migrations"; case CPUCycles: return "CPU cycles"; + case RefCPUCycles: + return "Reference CPU cycles"; case BusCycles: return "bus cycles"; case StalledCycles: diff --git a/src/testlib/qbenchmarkmetric.h b/src/testlib/qbenchmarkmetric.h index 44bf14b9b6..6e423473b1 100644 --- a/src/testlib/qbenchmarkmetric.h +++ b/src/testlib/qbenchmarkmetric.h @@ -78,7 +78,8 @@ enum QBenchmarkMetric { MinorPageFaults, MajorPageFaults, AlignmentFaults, - EmulationFaults + EmulationFaults, + RefCPUCycles, }; } diff --git a/src/testlib/qbenchmarkperfevents.cpp b/src/testlib/qbenchmarkperfevents.cpp index 587d3e0124..d6db40ce52 100644 --- a/src/testlib/qbenchmarkperfevents.cpp +++ b/src/testlib/qbenchmarkperfevents.cpp @@ -153,6 +153,7 @@ bool QBenchmarkPerfEventsMeasurer::isAvailable() Event type Event counter Unit Name and aliases HARDWARE CPU_CYCLES CPUCycles cycles cpu-cycles + HARDWARE REF_CPU_CYCLES RefCPUCycles ref-cycles HARDWARE INSTRUCTIONS Instructions instructions HARDWARE CACHE_REFERENCES CacheReferences cache-references HARDWARE CACHE_MISSES CacheMisses cache-misses @@ -321,6 +322,7 @@ static const char eventlist_strings[] = "migrations\0" "minor-faults\0" "page-faults\0" + "ref-cycles\0" "stalled-cycles-backend\0" "stalled-cycles-frontend\0" "task-clock\0" @@ -407,9 +409,10 @@ static const Events eventlist[] = { { 1256, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_MIGRATIONS, QTest::CPUMigrations }, { 1267, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MIN, QTest::MinorPageFaults }, { 1280, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS, QTest::PageFaults }, - { 1292, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND, QTest::StalledCycles }, - { 1315, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND, QTest::StalledCycles }, - { 1339, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK, QTest::WalltimeMilliseconds }, + { 1292, PERF_TYPE_HARDWARE, PERF_COUNT_HW_REF_CPU_CYCLES, QTest::RefCPUCycles }, + { 1303, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND, QTest::StalledCycles }, + { 1326, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND, QTest::StalledCycles }, + { 1350, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK, QTest::WalltimeMilliseconds }, { 0, PERF_TYPE_MAX, 0, QTest::Events } }; /* -- END GENERATED CODE -- */ diff --git a/src/testlib/qxunittestlogger.cpp b/src/testlib/qxunittestlogger.cpp index 72faaeb9b1..ec33c29ae5 100644 --- a/src/testlib/qxunittestlogger.cpp +++ b/src/testlib/qxunittestlogger.cpp @@ -256,7 +256,7 @@ void QXunitTestLogger::addBenchmarkResult(const QBenchmarkResult &result) benchmarkElement->addAttribute( QTest::AI_Metric, - QTest::benchmarkMetricName(QBenchmarkTestMethodData::current->result.metric)); + QTest::benchmarkMetricName(result.metric)); benchmarkElement->addAttribute(QTest::AI_Tag, result.context.tag.toUtf8().data()); const qreal valuePerIteration = qreal(result.value) / qreal(result.iterations); diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 3cfdbf3429..47aa886568 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -133,7 +133,7 @@ macx { ../../corelib/io/qstandardpaths_win.cpp } -if(contains(QT_CONFIG, zlib)|cross_compile):include(../../3rdparty/zlib.pri) +!contains(QT_CONFIG, system-zlib)|cross_compile:include(../../3rdparty/zlib.pri) else:include(../../3rdparty/zlib_dependency.pri) win32:LIBS += -luser32 -lole32 -ladvapi32 -lshell32 diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 026d099dc0..8c8141f9e5 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -770,22 +770,22 @@ void WriteInitialization::acceptWidget(DomWidget *node) // // Special handling for qtableview/qtreeview fake header attributes // - static QStringList realPropertyNames = - (QStringList() << QLatin1String("visible") - << QLatin1String("cascadingSectionResizes") - << QLatin1String("defaultSectionSize") - << QLatin1String("highlightSections") - << QLatin1String("minimumSectionSize") - << QLatin1String("showSortIndicator") - << QLatin1String("stretchLastSection")); + static const QLatin1String realPropertyNames[] = { + QLatin1String("visible"), + QLatin1String("cascadingSectionResizes"), + QLatin1String("defaultSectionSize"), + QLatin1String("highlightSections"), + QLatin1String("minimumSectionSize"), + QLatin1String("showSortIndicator"), + QLatin1String("stretchLastSection"), + }; if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QTreeView")) || m_uic->customWidgetsInfo()->extends(className, QLatin1String("QTreeWidget"))) { DomPropertyList headerProperties; - foreach (const QString &realPropertyName, realPropertyNames) { - const QString upperPropertyName = realPropertyName.at(0).toUpper() - + realPropertyName.mid(1); - const QString fakePropertyName = QLatin1String("header") + upperPropertyName; + for (auto realPropertyName : realPropertyNames) { + const QString fakePropertyName = QLatin1String("header") + + QChar(realPropertyName.at(0)).toUpper() + realPropertyName.mid(1); if (DomProperty *fakeProperty = attributes.value(fakePropertyName)) { fakeProperty->setAttributeName(realPropertyName); headerProperties << fakeProperty; @@ -797,16 +797,16 @@ void WriteInitialization::acceptWidget(DomWidget *node) } else if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QTableView")) || m_uic->customWidgetsInfo()->extends(className, QLatin1String("QTableWidget"))) { - static QStringList headerPrefixes = - (QStringList() << QLatin1String("horizontalHeader") - << QLatin1String("verticalHeader")); + static const QLatin1String headerPrefixes[] = { + QLatin1String("horizontalHeader"), + QLatin1String("verticalHeader"), + }; - foreach (const QString &headerPrefix, headerPrefixes) { + for (auto headerPrefix : headerPrefixes) { DomPropertyList headerProperties; - foreach (const QString &realPropertyName, realPropertyNames) { - const QString upperPropertyName = realPropertyName.at(0).toUpper() - + realPropertyName.mid(1); - const QString fakePropertyName = headerPrefix + upperPropertyName; + for (auto realPropertyName : realPropertyNames) { + const QString fakePropertyName = headerPrefix + + QChar(realPropertyName.at(0)).toUpper() + realPropertyName.mid(1); if (DomProperty *fakeProperty = attributes.value(fakePropertyName)) { fakeProperty->setAttributeName(realPropertyName); headerProperties << fakeProperty; diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 98f1f4870d..ad13deb044 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -92,7 +92,7 @@ public: SetColorAll = ShowColor | SelectColor }; - QColorDialogPrivate() : options(new QColorDialogOptions) + QColorDialogPrivate() : options(QColorDialogOptions::create()) #ifdef Q_OS_WIN32 , updateTimer(0) #endif diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index c4ed72edc3..defc0539c9 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -533,7 +533,7 @@ QFileDialogPrivate::QFileDialogPrivate() showHiddenAction(0), useDefaultCaption(true), qFileDialogUi(0), - options(new QFileDialogOptions) + options(QFileDialogOptions::create()) { } diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp index a0525f6fbd..c130998198 100644 --- a/src/widgets/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -110,7 +110,7 @@ static const Qt::WindowFlags DefaultWindowFlags = QFontDialogPrivate::QFontDialogPrivate() : writingSystem(QFontDatabase::Any), - options(QSharedPointer<QFontDialogOptions>::create()) + options(QFontDialogOptions::create()) { } diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 207b6e3919..ee760c38a0 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -200,7 +200,7 @@ public: #endif compatMode(false), autoAddOkButton(true), detectedEscapeButton(0), informativeLabel(0), - options(new QMessageDialogOptions) { } + options(QMessageDialogOptions::create()) { } void init(const QString &title = QString(), const QString &text = QString()); void setupLayout(); diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp index f3fe500d26..26a8fcc92d 100644 --- a/src/widgets/dialogs/qprogressdialog.cpp +++ b/src/widgets/dialogs/qprogressdialog.cpp @@ -138,9 +138,10 @@ void QProgressDialogPrivate::init(const QString &labelText, const QString &cance void QProgressDialogPrivate::layout() { Q_Q(QProgressDialog); - int sp = q->style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing); - int mtb = q->style()->pixelMetric(QStyle::PM_DefaultTopLevelMargin); - int mlr = qMin(q->width() / 10, mtb); + int sp = q->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing, 0, q); + int mb = q->style()->pixelMetric(QStyle::PM_LayoutBottomMargin, 0, q); + int ml = qMin(q->width() / 10, q->style()->pixelMetric(QStyle::PM_LayoutLeftMargin, 0, q)); + int mr = qMin(q->width() / 10, q->style()->pixelMetric(QStyle::PM_LayoutRightMargin, 0, q)); const bool centered = bool(q->style()->styleHint(QStyle::SH_ProgressDialog_CenterCancelButton, 0, q)); @@ -154,12 +155,12 @@ void QProgressDialogPrivate::layout() // dialog can be made very small if the user demands it so. for (int attempt=5; attempt--;) { cspc = cancel ? cs.height() + sp : 0; - lh = qMax(0, q->height() - mtb - bh.height() - sp - cspc); + lh = qMax(0, q->height() - mb - bh.height() - sp - cspc); if (lh < q->height()/4) { // Getting cramped sp /= 2; - mtb /= 2; + mb /= 2; if (cancel) { cs.setHeight(qMax(4,cs.height()-sp-2)); } @@ -171,14 +172,14 @@ void QProgressDialogPrivate::layout() if (cancel) { cancel->setGeometry( - centered ? q->width()/2 - cs.width()/2 : q->width() - mlr - cs.width(), - q->height() - mtb - cs.height(), + centered ? q->width()/2 - cs.width()/2 : q->width() - mr - cs.width(), + q->height() - mb - cs.height(), cs.width(), cs.height()); } if (label) - label->setGeometry(mlr, additionalSpacing, q->width() - mlr * 2, lh); - bar->setGeometry(mlr, lh + sp + additionalSpacing, q->width() - mlr * 2, bh.height()); + label->setGeometry(ml, additionalSpacing, q->width() - ml - mr, lh); + bar->setGeometry(ml, lh + sp + additionalSpacing, q->width() - ml - mr, bh.height()); } void QProgressDialogPrivate::retranslateStrings() diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index db683a4e4d..b00a950823 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -1439,9 +1439,8 @@ void QGraphicsItemPrivate::initStyleOption(QStyleOptionGraphicsItem *option, con // Determine the item's exposed area option->exposedRect = QRectF(); const QTransform reverseMap = worldTransform.inverted(); - const QVector<QRect> exposedRects(exposedRegion.rects()); - for (int i = 0; i < exposedRects.size(); ++i) { - option->exposedRect |= reverseMap.mapRect(QRectF(exposedRects.at(i))); + for (const QRect &exposedRect : exposedRegion) { + option->exposedRect |= reverseMap.mapRect(QRectF(exposedRect)); if (option->exposedRect.contains(brect)) break; } @@ -5350,8 +5349,7 @@ QRegion QGraphicsItem::boundingRegion(const QTransform &itemToDeviceTransform) c QTransform unscale = QTransform::fromScale(1 / granularity, 1 / granularity); QRegion r; QBitmap colorMask = QBitmap::fromImage(mask.createMaskFromColor(0)); - const auto rects = QRegion(colorMask).rects(); - for (const QRect &rect : rects) { + for (const QRect &rect : QRegion(colorMask)) { QRect xrect = unscale.mapRect(rect).translated(deviceRect.topLeft() - QPoint(pad, pad)); r += xrect.adjusted(-1, -1, 1, 1) & deviceRect; } @@ -5915,9 +5913,8 @@ void QGraphicsItem::scroll(qreal dx, qreal dy, const QRectF &rect) // Append newly exposed areas. Note that the exposed region is currently // in pixmap coordinates, so we have to translate it to item coordinates. exposed.translate(cache->boundingRect.topLeft()); - const QVector<QRect> exposedRects = exposed.rects(); - for (int i = 0; i < exposedRects.size(); ++i) - cache->exposed += exposedRects.at(i); + for (const QRect &exposedRect : exposed) + cache->exposed += exposedRect; // Trigger update. This will redraw the newly exposed area and make sure // the pixmap is re-blitted in case there are overlapping items. diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index cb1d1e68d1..7b67f332e1 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -4657,8 +4657,7 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte for (int i = 0; i < exposed.size(); ++i) br |= exposed.at(i); QTransform pixmapToItem = itemToPixmap.inverted(); - const auto rects = scrollExposure.rects(); - for (const QRect &r : rects) + for (const QRect &r : scrollExposure) br |= pixmapToItem.mapRect(r); } styleOptionTmp = *option; diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index fc5dbdd80a..44e80ebeb9 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -1029,9 +1029,7 @@ bool QGraphicsViewPrivate::updateRegion(const QRectF &rect, const QTransform &xf if (!intersectsViewport(viewRect, viewport->width(), viewport->height())) return false; // Update region for sure outside viewport. - const QVector<QRect> &rects = region.rects(); - for (int i = 0; i < rects.size(); ++i) { - viewRect = rects.at(i); + for (QRect viewRect : region) { if (dontAdjustForAntialiasing) viewRect.adjust(-1, -1, 1, 1); else @@ -1146,8 +1144,7 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg // the expose region, convert it to a path, and then search for items // using QGraphicsScene::items(QPainterPath); QRegion adjustedRegion; - const auto rects = exposedRegion.rects(); - for (const QRect &r : rects) + for (const QRect &r : exposedRegion) adjustedRegion += r.adjusted(-1, -1, 1, 1); const QPainterPath exposedScenePath(q->mapToScene(qt_regionToPath(adjustedRegion))); @@ -2676,11 +2673,9 @@ void QGraphicsView::updateScene(const QList<QRectF> &rects) // Extract and reset dirty scene rect info. QVector<QRect> dirtyViewportRects; - const QVector<QRect> &dirtyRects = d->dirtyRegion.rects(); - const int dirtyRectsCount = dirtyRects.size(); - dirtyViewportRects.reserve(dirtyRectsCount + rects.count()); - for (int i = 0; i < dirtyRectsCount; ++i) - dirtyViewportRects += dirtyRects.at(i); + dirtyViewportRects.reserve(d->dirtyRegion.rectCount() + rects.count()); + for (const QRect &dirtyRect : d->dirtyRegion) + dirtyViewportRects += dirtyRect; d->dirtyRegion = QRegion(); d->dirtyBoundingRect = QRect(); diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index e045d60fc8..ff3832e499 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -1398,8 +1398,7 @@ void QTableView::paintEvent(QPaintEvent *event) firstVisualRow, lastVisualRow, firstVisualColumn, lastVisualColumn); } - const QVector<QRect> rects = region.rects(); - for (auto dirtyArea : rects) { + for (QRect dirtyArea : region) { dirtyArea.setBottom(qMin(dirtyArea.bottom(), int(y))); if (rightToLeft) { dirtyArea.setLeft(qMax(dirtyArea.left(), d->viewport->width() - int(x))); diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 8031d538a6..e9d866525d 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -1477,13 +1477,12 @@ void QTreeView::drawTree(QPainter *painter, const QRegion ®ion) const QPoint hoverPos = d->viewport->mapFromGlobal(QCursor::pos()); d->hoverBranch = d->itemDecorationAt(hoverPos); - QVector<QRect> rects = region.rects(); QVector<int> drawn; - bool multipleRects = (rects.size() > 1); - for (int a = 0; a < rects.size(); ++a) { + bool multipleRects = (region.rectCount() > 1); + for (const QRect &a : region) { const QRect area = (multipleRects - ? QRect(0, rects.at(a).y(), viewportWidth, rects.at(a).height()) - : rects.at(a)); + ? QRect(0, a.y(), viewportWidth, a.height()) + : a); d->leftAndRight = d->startAndEndColumns(area); int i = firstVisibleItem; // the first item at the top of the viewport diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 281567cede..986f1d0218 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -2404,9 +2404,8 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus painter->fillRect(0, 0, painter->device()->width(), painter->device()->height(), brush); painter->restore(); } else { - const QVector<QRect> &rects = rgn.rects(); - for (int i = 0; i < rects.size(); ++i) - painter->fillRect(rects.at(i), brush); + for (const QRect &rect : rgn) + painter->fillRect(rect, brush); } } @@ -10745,10 +10744,8 @@ void QWidget::scroll(int dx, int dy) // Graphics View maintains its own dirty region as a list of rects; // until we can connect item updates directly to the view, we must // separately add a translated dirty region. - if (!d->dirty.isEmpty()) { - foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects()) - proxy->update(rect); - } + for (const QRect &rect : d->dirty) + proxy->update(rect.translated(dx, dy)); proxy->scroll(dx, dy, proxy->subWidgetRect(this)); return; } @@ -10788,7 +10785,7 @@ void QWidget::scroll(int dx, int dy, const QRect &r) // until we can connect item updates directly to the view, we must // separately add a translated dirty region. if (!d->dirty.isEmpty()) { - foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects()) + for (const QRect &rect : d->dirty.translated(dx, dy) & r) proxy->update(rect); } proxy->scroll(dx, dy, r.translated(proxy->subWidgetRect(this).topLeft().toPoint())); diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index 9025160e5c..7a4a6d862d 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -158,7 +158,7 @@ static void showYellowThing_win(QWidget *widget, const QRegion ®ion, int msec } i = (i + 1) & 3; - foreach (const QRect &rect, region.rects()) { + for (const QRect &rect : region) { RECT winRect; SetRect(&winRect, rect.left(), rect.top(), rect.right(), rect.bottom()); FillRect(hdc, &winRect, brush); @@ -1311,9 +1311,8 @@ void QWidgetBackingStore::doSync() updateStaticContentsSize(); dirty = QRegion(); updateRequestSent = false; - const QVector<QRect> rects(toClean.rects()); - for (int i = 0; i < rects.size(); ++i) - tlw->d_func()->extra->proxyWidget->update(rects.at(i)); + for (const QRect &rect : toClean) + tlw->d_func()->extra->proxyWidget->update(rect); return; } #endif diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index e51f750916..4b60654448 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -587,7 +587,7 @@ HIMutableShapeRef qt_mac_toHIMutableShape(const QRegion ®ion) CGRect cgRect = CGRectMake(qtRect.x(), qtRect.y(), qtRect.width(), qtRect.height()); HIShapeUnionWithRect(shape, &cgRect); } else { - foreach (const QRect &qtRect, region.rects()) { + for (const QRect &qtRect : region) { CGRect cgRect = CGRectMake(qtRect.x(), qtRect.y(), qtRect.width(), qtRect.height()); HIShapeUnionWithRect(shape, &cgRect); } @@ -2253,9 +2253,7 @@ void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush CGContextSaveGState(cg); HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationInverted); - const QVector<QRect> &rects = rgn.rects(); - for (int i = 0; i < rects.size(); ++i) { - const QRect rect(rects.at(i)); + for (const QRect &rect : rgn) { // Anchor the pattern to the top so it stays put when the window is resized. CGContextSetPatternPhase(cg, CGSizeMake(rect.width(), rect.height())); CGRect mac_rect = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()); @@ -7117,11 +7115,11 @@ void qt_mac_scale_region(QRegion *region, qreal scaleFactor) return; QVector<QRect> scaledRects; - scaledRects.reserve(region->rects().count()); + scaledRects.reserve(region->rectCount()); - foreach (const QRect &rect, region->rects()) { + for (const QRect &rect : *region) scaledRects.append(QRect(rect.topLeft() * scaleFactor, rect.size() * scaleFactor)); - } + region->setRects(&scaledRects[0], scaledRects.count()); } diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index c33e4167c1..c3072303de 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -269,7 +269,7 @@ static HRGN qt_hrgn_from_qregion(const QRegion ®ion) qt_add_rect(hRegion, region.boundingRect()); return hRegion; } - foreach (const QRect &rect, region.rects()) + for (const QRect &rect : region) qt_add_rect(hRegion, rect); return hRegion; } @@ -1087,11 +1087,8 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa painter->setClipRegion(newRegion); #if defined(DEBUG_XP_STYLE) && 0 printf("Using region:\n"); - QVector<QRect> rects = newRegion.rects(); - for (int i = 0; i < rects.count(); ++i) { - const QRect &r = rects.at(i); + for (const QRect &r : newRegion) printf(" (%d, %d, %d, %d)\n", r.x(), r.y(), r.right(), r.bottom()); - } #endif } diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 3cdd7dc0f0..e93ed11930 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -1899,13 +1899,19 @@ void QLineEdit::paintEvent(QPaintEvent *) if (d->shouldShowPlaceholderText()) { if (!d->placeholderText.isEmpty()) { + const Qt::LayoutDirection layoutDir = d->placeholderText.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight; + const Qt::Alignment alignPhText = QStyle::visualAlignment(layoutDir, QFlag(d->alignment)); QColor col = pal.text().color(); col.setAlpha(128); QPen oldpen = p.pen(); p.setPen(col); - QString elidedText = fm.elidedText(d->placeholderText, Qt::ElideRight, lineRect.width()); - p.drawText(lineRect, va, elidedText); + Qt::LayoutDirection oldLayoutDir = p.layoutDirection(); + p.setLayoutDirection(layoutDir); + + const QString elidedText = fm.elidedText(d->placeholderText, Qt::ElideRight, lineRect.width()); + p.drawText(lineRect, alignPhText, elidedText); p.setPen(oldpen); + p.setLayoutDirection(oldLayoutDir); } } diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index b42ebe7e48..5f3aff5e10 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -2670,9 +2670,8 @@ void QMdiArea::paintEvent(QPaintEvent *paintEvent) { Q_D(QMdiArea); QPainter painter(d->viewport); - const QVector<QRect> &exposedRects = paintEvent->region().rects(); - for (int i = 0; i < exposedRects.size(); ++i) - painter.fillRect(exposedRects.at(i), d->background); + for (const QRect &exposedRect : paintEvent->region()) + painter.fillRect(exposedRect, d->background); } /*! diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h index 7dda38456a..2e579899bc 100644 --- a/src/widgets/widgets/qmenu.h +++ b/src/widgets/widgets/qmenu.h @@ -85,11 +85,17 @@ public: QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0); #ifdef Q_QDOC + template<typename PointerToMemberFunction> QAction *addAction(const QString &text, const QObject *receiver, PointerToMemberFunction method, const QKeySequence &shortcut = 0); + template<typename Functor> QAction *addAction(const QString &text, Functor functor, const QKeySequence &shortcut = 0); + template<typename Functor> QAction *addAction(const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut = 0); + template<typename PointerToMemberFunction> QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, PointerToMemberFunction method, const QKeySequence &shortcut = 0); + template<typename Functor> QAction *addAction(const QIcon &icon, const QString &text, Functor functor, const QKeySequence &shortcut = 0); + template<typename Functor> QAction *addAction(const QIcon &icon, const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut = 0); #else // addAction(QString): Connect to a QObject slot / functor or function pointer (with context) diff --git a/src/widgets/widgets/qtoolbar.h b/src/widgets/widgets/qtoolbar.h index 774d47b913..c1d765598f 100644 --- a/src/widgets/widgets/qtoolbar.h +++ b/src/widgets/widgets/qtoolbar.h @@ -100,11 +100,17 @@ public: QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member); #ifdef Q_QDOC + template<typename PointerToMemberFunction> QAction *addAction(const QString &text, const QObject *receiver, PointerToMemberFunction method); + template<typename Functor> QAction *addAction(const QString &text, Functor functor); + template<typename Functor> QAction *addAction(const QString &text, const QObject *context, Functor functor); + template<typename PointerToMemberFunction> QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, PointerToMemberFunction method); + template<typename Functor> QAction *addAction(const QIcon &icon, const QString &text, Functor functor); + template<typename Functor> QAction *addAction(const QIcon &icon, const QString &text, const QObject *context, Functor functor); #else // addAction(QString): Connect to a QObject slot / functor or function pointer (with context) diff --git a/src/winmain/qtmain_win.cpp b/src/winmain/qtmain_win.cpp index bf416e11d3..7087176110 100644 --- a/src/winmain/qtmain_win.cpp +++ b/src/winmain/qtmain_win.cpp @@ -53,9 +53,7 @@ #include "qstring.h" #include "qvector.h" -#ifndef Q_OS_WINCE -# include <shlobj.h> -#endif +#include <shlobj.h> /* This file contains the code in the qtmain library for Windows. @@ -69,11 +67,7 @@ QT_BEGIN_NAMESPACE -#if defined(Q_OS_WINCE) -extern void __cdecl qWinMain(HINSTANCE, HINSTANCE, LPSTR, int, int &, QVector<char *> &); -#else extern void qWinMain(HINSTANCE, HINSTANCE, LPSTR, int, int &, QVector<char *> &); -#endif QT_END_NAMESPACE @@ -84,12 +78,8 @@ QT_USE_NAMESPACE int qMain(int, char **); #define main qMain #else -#ifdef Q_OS_WINCE -extern "C" int __cdecl main(int, char **); -#else extern "C" int main(int, char **); #endif -#endif /* WinMain() - Initializes Windows and calls user's startup function main(). @@ -97,8 +87,6 @@ extern "C" int main(int, char **); application. */ -#ifndef Q_OS_WINCE - // Convert a wchar_t to char string, equivalent to QString::toLocal8Bit() // when passed CP_ACP. static inline char *wideToMulti(int codePage, const wchar_t *aw) @@ -126,48 +114,3 @@ extern "C" int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR /*cmdParamarg*/, int delete [] argv; return exitCode; } - -#else // !Q_OS_WINCE - -int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR /*wCmdParam*/, int cmdShow) -{ - QByteArray cmdParam = QString::fromWCharArray(GetCommandLine()).toLocal8Bit(); - - wchar_t appName[MAX_PATH]; - GetModuleFileName(0, appName, MAX_PATH); - cmdParam.prepend(QString(QLatin1String("\"%1\" ")).arg(QString::fromWCharArray(appName)).toLocal8Bit()); - - int argc = 0; - QVector<char *> argv(8); - qWinMain(instance, prevInstance, cmdParam.data(), cmdShow, argc, argv); - - wchar_t uniqueAppID[MAX_PATH]; - GetModuleFileName(0, uniqueAppID, MAX_PATH); - QString uid = QString::fromWCharArray(uniqueAppID).toLower().replace(QLatin1String("\\"), QLatin1String("_")); - - // If there exists an other instance of this application - // it will be the owner of a mutex with the unique ID. - HANDLE mutex = CreateMutex(NULL, TRUE, (LPCWSTR)uid.utf16()); - if (mutex && ERROR_ALREADY_EXISTS == GetLastError()) { - CloseHandle(mutex); - - // The app is already running, so we use the unique - // ID to create a unique messageNo, which is used - // as the registered class name for the windows - // created. Set the first instance's window to the - // foreground, else just terminate. - // Use bitwise 0x01 OR to reactivate window state if - // it was hidden - UINT msgNo = RegisterWindowMessage((LPCWSTR)uid.utf16()); - HWND aHwnd = FindWindow((LPCWSTR)QString::number(msgNo).utf16(), 0); - if (aHwnd) - SetForegroundWindow((HWND)(((ULONG)aHwnd) | 0x01)); - return 0; - } - - int result = main(argc, argv.data()); - CloseHandle(mutex); - return result; -} - -#endif // Q_OS_WINCE diff --git a/src/winmain/winmain.pro b/src/winmain/winmain.pro index e8c9ace03b..828ef6cf5a 100644 --- a/src/winmain/winmain.pro +++ b/src/winmain/winmain.pro @@ -21,7 +21,7 @@ winrt { } else { SOURCES = qtmain_win.cpp - !wince: LIBS += -lshell32 + LIBS += -lshell32 } load(qt_installs) @@ -31,5 +31,3 @@ TARGET = $$qtLibraryTarget($$TARGET$$QT_LIBINFIX) #do this towards the end load(qt_targets) load(qt_build_paths) load(qt_common) - -wince: QMAKE_POST_LINK = diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp index 320e0095d3..a8d64f1cd9 100644 --- a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp +++ b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp @@ -62,8 +62,8 @@ private slots: void tst_QParallelAnimationGroup::initTestCase() { qRegisterMetaType<QAbstractAnimation::State>("QAbstractAnimation::State"); -#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) - // give the mac/wince app start event queue time to clear +#if defined(Q_OS_DARWIN) + // give the Darwin app start event queue time to clear QTest::qWait(1000); #endif } diff --git a/tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro b/tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro index 9f2e4f9c92..302d887fc7 100644 --- a/tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro +++ b/tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro @@ -1,4 +1,2 @@ TEMPLATE = subdirs -SUBDIRS = test - -!wince: SUBDIRS += echo +SUBDIRS = test echo diff --git a/tests/auto/corelib/global/qtendian/qtendian.pro b/tests/auto/corelib/global/qtendian/qtendian.pro index 2b0af4fa4c..214c706ca5 100644 --- a/tests/auto/corelib/global/qtendian/qtendian.pro +++ b/tests/auto/corelib/global/qtendian/qtendian.pro @@ -2,7 +2,3 @@ CONFIG += testcase TARGET = tst_qtendian QT = core testlib SOURCES = tst_qtendian.cpp -wince* { # QTBUG-37194 , internal compiler errors with MSVC2008 for Windows CE - QMAKE_CFLAGS_RELEASE -= -O2 - QMAKE_CXXFLAGS_RELEASE -= -O2 -} diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro index 29717b3a1c..24c762ed84 100644 --- a/tests/auto/corelib/io/io.pro +++ b/tests/auto/corelib/io/io.pro @@ -35,7 +35,7 @@ SUBDIRS=\ qurlquery \ qwinoverlappedionotifier \ -!win32|wince* { +!win32 { SUBDIRS -=\ qwinoverlappedionotifier } diff --git a/tests/auto/corelib/io/largefile/largefile.pro b/tests/auto/corelib/io/largefile/largefile.pro index caef116684..6c1bb8d7ea 100644 --- a/tests/auto/corelib/io/largefile/largefile.pro +++ b/tests/auto/corelib/io/largefile/largefile.pro @@ -2,5 +2,3 @@ CONFIG += testcase TARGET = tst_largefile QT = core testlib SOURCES = tst_largefile.cpp - -wince: SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp index e448093062..a19a5ce58d 100644 --- a/tests/auto/corelib/io/largefile/tst_largefile.cpp +++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp @@ -39,18 +39,12 @@ #include <cstdio> #ifdef Q_OS_WIN - -#include <windows.h> - -#ifndef Q_OS_WINCE -#include <io.h> -#endif - -#ifndef FSCTL_SET_SPARSE +# include <qt_windows.h> +# include <io.h> +# ifndef FSCTL_SET_SPARSE // MinGW doesn't define this. -#define FSCTL_SET_SPARSE (0x900C4) -#endif - +# define FSCTL_SET_SPARSE (0x900C4) +# endif #endif // Q_OS_WIN class tst_LargeFile diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp index f5a546ebf1..8fb367482c 100644 --- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp @@ -88,10 +88,8 @@ private slots: void stream_QPen_data(); void stream_QPen(); -#ifndef Q_OS_WINCE void stream_QPixmap_data(); void stream_QPixmap(); -#endif void stream_QPoint_data(); void stream_QPoint(); @@ -123,10 +121,8 @@ private slots: void stream_qint64_data(); void stream_qint64(); -#ifndef Q_OS_WINCE void stream_QIcon_data(); void stream_QIcon(); -#endif void stream_QEasingCurve_data(); void stream_QEasingCurve(); @@ -1542,24 +1538,16 @@ void tst_QDataStream::readQPen(QDataStream *s) // pixmap testing is currently limited to one pixmap only. // -#ifndef Q_OS_WINCE -// Test depends on more memory than available on Qt/CE void tst_QDataStream::stream_QPixmap_data() { stream_data(1); } -#endif -#ifndef Q_OS_WINCE -// Test depends on more memory than available on Qt/CE void tst_QDataStream::stream_QPixmap() { STREAM_IMPL(QPixmap); } -#endif -#ifndef Q_OS_WINCE -// Test depends on more memory than available on Qt/CE void tst_QDataStream::stream_QIcon_data() { stream_data(1); @@ -1569,7 +1557,6 @@ void tst_QDataStream::stream_QIcon() { STREAM_IMPL(QIcon); } -#endif void tst_QDataStream::writeQPixmap(QDataStream *s) { @@ -1844,7 +1831,7 @@ static QRegion qRegionData(int index) case 4: return QRegion(100, -100, 2048, 4096, QRegion::Rectangle); case 5: return QRegion(-100, 100, 4096, 2048, QRegion::Rectangle); case 6: return QRegion(0, 0, 0, 0, QRegion::Ellipse); -#if (!defined(Q_OS_UNIX) && !defined(Q_OS_WINCE)) // all our Unix platforms use X regions. +#if !defined(Q_OS_UNIX) // all our Unix platforms use X regions. case 7: return QRegion(1, 2, 300, 400, QRegion::Ellipse); case 8: return QRegion(100, 100, 1024, 768, QRegion::Ellipse); case 9: return QRegion(-100, -100, 1024, 1024, QRegion::Ellipse); @@ -2496,12 +2483,10 @@ void tst_QDataStream::status_charptr_QByteArray_data() QTest::addColumn<int>("expectedStatus"); QTest::addColumn<QByteArray>("expectedString"); -#if !defined(Q_OS_WINCE) QByteArray oneMbMinus1(1024 * 1024 - 1, '\0'); for (int i = 0; i < oneMbMinus1.size(); ++i) oneMbMinus1[i] = 0x1 | (8 * ((uchar)i / 9)); QByteArray threeMbMinus1 = oneMbMinus1 + 'j' + oneMbMinus1 + 'k' + oneMbMinus1; -#endif // ok QTest::newRow("size 0") << QByteArray("\x00\x00\x00\x00", 4) << (int) QDataStream::Ok << QByteArray(); @@ -2510,14 +2495,12 @@ void tst_QDataStream::status_charptr_QByteArray_data() QTest::newRow("size 3") << QByteArray("\x00\x00\x00\x03jkl", 7) << (int) QDataStream::Ok << QByteArray("jkl"); QTest::newRow("size 4") << QByteArray("\x00\x00\x00\x04jklm", 8) << (int) QDataStream::Ok << QByteArray("jklm"); QTest::newRow("size 4j") << QByteArray("\x00\x00\x00\x04jklmj", 8) << (int) QDataStream::Ok << QByteArray("jklm"); -#if !defined(Q_OS_WINCE) QTest::newRow("size 1MB-1") << QByteArray("\x00\x0f\xff\xff", 4) + oneMbMinus1 + QByteArray("j") << (int) QDataStream::Ok << oneMbMinus1; QTest::newRow("size 1MB") << QByteArray("\x00\x10\x00\x00", 4) + oneMbMinus1 + QByteArray("jkl") << (int) QDataStream::Ok << oneMbMinus1 + "j"; QTest::newRow("size 1MB+1") << QByteArray("\x00\x10\x00\x01", 4) + oneMbMinus1 + QByteArray("jkl") << (int) QDataStream::Ok << oneMbMinus1 + "jk"; QTest::newRow("size 3MB-1") << QByteArray("\x00\x2f\xff\xff", 4) + threeMbMinus1 + QByteArray("j") << (int) QDataStream::Ok << threeMbMinus1; QTest::newRow("size 3MB") << QByteArray("\x00\x30\x00\x00", 4) + threeMbMinus1 + QByteArray("jkl") << (int) QDataStream::Ok << threeMbMinus1 + "j"; QTest::newRow("size 3MB+1") << QByteArray("\x00\x30\x00\x01", 4) + threeMbMinus1 + QByteArray("jkl") << (int) QDataStream::Ok << threeMbMinus1 + "jk"; -#endif // past end QTest::newRow("empty") << QByteArray() << (int) QDataStream::ReadPastEnd << QByteArray(); @@ -2530,12 +2513,10 @@ void tst_QDataStream::status_charptr_QByteArray_data() QTest::newRow("badsize 2") << QByteArray("\x00\x00\x00\x02j", 5) << (int) QDataStream::ReadPastEnd << QByteArray(); QTest::newRow("badsize 3") << QByteArray("\x00\x00\x00\x03jk", 6) << (int) QDataStream::ReadPastEnd << QByteArray(); QTest::newRow("badsize 4") << QByteArray("\x00\x00\x00\x04jkl", 7) << (int) QDataStream::ReadPastEnd << QByteArray(); -#if !defined(Q_OS_WINCE) QTest::newRow("badsize 1MB") << QByteArray("\x00\x10\x00\x00", 4) + oneMbMinus1 << (int) QDataStream::ReadPastEnd << QByteArray(); QTest::newRow("badsize 1MB+1") << QByteArray("\x00\x10\x00\x01", 4) + oneMbMinus1 + QByteArray("j") << (int) QDataStream::ReadPastEnd << QByteArray(); QTest::newRow("badsize 3MB") << QByteArray("\x00\x30\x00\x00", 4) + threeMbMinus1 << (int) QDataStream::ReadPastEnd << QByteArray(); QTest::newRow("badsize 3MB+1") << QByteArray("\x00\x30\x00\x01", 4) + threeMbMinus1 + QByteArray("j") << (int) QDataStream::ReadPastEnd << QByteArray(); -#endif QTest::newRow("size -1") << QByteArray("\xff\xff\xff\xff", 4) << (int) QDataStream::ReadPastEnd << QByteArray(); QTest::newRow("size -2") << QByteArray("\xff\xff\xff\xfe", 4) << (int) QDataStream::ReadPastEnd << QByteArray(); } @@ -2600,7 +2581,6 @@ void tst_QDataStream::status_QString_data() QTest::addColumn<int>("expectedStatus"); QTest::addColumn<QString>("expectedString"); -#if !defined(Q_OS_WINCE) QString oneMbMinus1; oneMbMinus1.resize(1024 * 1024 - 1); for (int i = 0; i < oneMbMinus1.size(); ++i) @@ -2609,7 +2589,6 @@ void tst_QDataStream::status_QString_data() QByteArray threeMbMinus1Data = qstring2qbytearray(threeMbMinus1); QByteArray oneMbMinus1Data = qstring2qbytearray(oneMbMinus1); -#endif // ok QTest::newRow("size 0") << QByteArray("\x00\x00\x00\x00", 4) << (int) QDataStream::Ok << QString(); @@ -2618,14 +2597,12 @@ void tst_QDataStream::status_QString_data() QTest::newRow("size 3") << QByteArray("\x00\x00\x00\x06\x00j\x00k\x00l", 10) << (int) QDataStream::Ok << QString("jkl"); QTest::newRow("size 4") << QByteArray("\x00\x00\x00\x08\x00j\x00k\x00l\x00m", 12) << (int) QDataStream::Ok << QString("jklm"); QTest::newRow("size 4j") << QByteArray("\x00\x00\x00\x08\x00j\x00k\x00l\x00mjj", 14) << (int) QDataStream::Ok << QString("jklm"); -#if !defined(Q_OS_WINCE) QTest::newRow("size 1MB-1") << QByteArray("\x00\x1f\xff\xfe", 4) + oneMbMinus1Data + QByteArray("jj") << (int) QDataStream::Ok << oneMbMinus1; QTest::newRow("size 1MB") << QByteArray("\x00\x20\x00\x00", 4) + oneMbMinus1Data + QByteArray("\x00j\x00k\x00l", 6) << (int) QDataStream::Ok << oneMbMinus1 + "j"; QTest::newRow("size 1MB+1") << QByteArray("\x00\x20\x00\x02", 4) + oneMbMinus1Data + QByteArray("\x00j\x00k\x00l", 6) << (int) QDataStream::Ok << oneMbMinus1 + "jk"; QTest::newRow("size 3MB-1") << QByteArray("\x00\x5f\xff\xfe", 4) + threeMbMinus1Data + QByteArray("jj") << (int) QDataStream::Ok << threeMbMinus1; QTest::newRow("size 3MB") << QByteArray("\x00\x60\x00\x00", 4) + threeMbMinus1Data + QByteArray("\x00j\x00k\x00l", 6) << (int) QDataStream::Ok << threeMbMinus1 + "j"; QTest::newRow("size 3MB+1") << QByteArray("\x00\x60\x00\x02", 4) + threeMbMinus1Data + QByteArray("\x00j\x00k\x00l", 6) << (int) QDataStream::Ok << threeMbMinus1 + "jk"; -#endif // past end QTest::newRow("empty") << QByteArray() << (int) QDataStream::ReadPastEnd << QString(); @@ -2638,14 +2615,12 @@ void tst_QDataStream::status_QString_data() QTest::newRow("badsize 2") << QByteArray("\x00\x00\x00\x04jj", 6) << (int) QDataStream::ReadPastEnd << QString(); QTest::newRow("badsize 3") << QByteArray("\x00\x00\x00\x06jjkk", 8) << (int) QDataStream::ReadPastEnd << QString(); QTest::newRow("badsize 4") << QByteArray("\x00\x00\x00\x08jjkkll", 10) << (int) QDataStream::ReadPastEnd << QString(); -#if !defined(Q_OS_WINCE) QTest::newRow("badsize 1MB") << QByteArray("\x00\x20\x00\x00", 4) + oneMbMinus1Data << (int) QDataStream::ReadPastEnd << QString(); QTest::newRow("badsize 1MB+1") << QByteArray("\x00\x20\x00\x02", 4) + oneMbMinus1Data + QByteArray("j") << (int) QDataStream::ReadPastEnd << QString(); QTest::newRow("badsize 3MB") << QByteArray("\x00\x60\x00\x00", 4) + threeMbMinus1Data << (int) QDataStream::ReadPastEnd << QString(); QTest::newRow("badsize 3MB+1") << QByteArray("\x00\x60\x00\x02", 4) + threeMbMinus1Data + QByteArray("j") << (int) QDataStream::ReadPastEnd << QString(); QTest::newRow("size -2") << QByteArray("\xff\xff\xff\xfe", 4) << (int) QDataStream::ReadPastEnd << QString(); QTest::newRow("size MAX") << QByteArray("\x7f\xff\xff\xfe", 4) << (int) QDataStream::ReadPastEnd << QString(); -#endif // corrupt data QTest::newRow("corrupt1") << QByteArray("yyyy") << (int) QDataStream::ReadCorruptData << QString(); diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 703e9c5b07..3924716b55 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -35,7 +35,7 @@ #include <qregexp.h> #include <qstringlist.h> -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) +#if defined(Q_OS_WIN) #include <QtCore/private/qfsfileengine_p.h> #include "../../../network-settings.h" #endif @@ -163,9 +163,8 @@ private slots: void operator_eq(); -#ifndef Q_OS_WINCE void dotAndDotDot(); -#endif + void homePath(); void tempPath(); void rootPath(); @@ -316,7 +315,7 @@ void tst_QDir::setPath_data() QTest::addColumn<QString>("dir2"); QTest::newRow("data0") << QString(".") << QString(".."); -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) +#if defined(Q_OS_WIN) QTest::newRow("data1") << QString("c:/") << QDir::currentPath(); #endif } @@ -543,7 +542,7 @@ void tst_QDir::exists_data() QTest::newRow("simple dir") << (m_dataPath + "/resources") << true; QTest::newRow("simple dir with slash") << (m_dataPath + "/resources/") << true; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); QTest::newRow("unc 1") << uncRoot << true; QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true; @@ -555,7 +554,7 @@ void tst_QDir::exists_data() QTest::newRow("unc 8") << uncRoot + "/asharethatshouldnotexist" << false; QTest::newRow("unc 9") << "//ahostthatshouldnotexist" << false; #endif -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)) +#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT)) QTest::newRow("This drive should exist") << "C:/" << true; // find a non-existing drive and check if it does not exist #ifdef QT_BUILD_INTERNAL @@ -596,7 +595,7 @@ void tst_QDir::isRelativePath_data() QTest::addColumn<bool>("relative"); QTest::newRow("data0") << "../somedir" << true; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) +#if defined(Q_OS_WIN) QTest::newRow("data1") << "C:/sOmedir" << false; #endif QTest::newRow("data2") << "somedir" << true; @@ -802,12 +801,6 @@ void tst_QDir::entryList() QFile::remove(entrylistPath + "brokenlink.lnk"); QFile::remove(entrylistPath + "brokenlink"); - // WinCE does not have . and .. in the directory listing -#if defined(Q_OS_WINCE) - expected.removeAll("."); - expected.removeAll(".."); -#endif - #ifndef Q_NO_SYMLINKS #if defined(Q_OS_WIN) // ### Sadly, this is a platform difference right now. @@ -900,15 +893,10 @@ void tst_QDir::entryListSimple_data() QTest::addColumn<int>("countMin"); QTest::newRow("data2") << "do_not_expect_this_path_to_exist/" << 0; -#if defined(Q_OS_WINCE) - QTest::newRow("simple dir") << (m_dataPath + "/resources") << 0; - QTest::newRow("simple dir with slash") << (m_dataPath + "/resources/") << 0; -#else QTest::newRow("simple dir") << (m_dataPath + "/resources") << 2; QTest::newRow("simple dir with slash") << (m_dataPath + "/resources/") << 2; -#endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); QTest::newRow("unc 1") << uncRoot << 2; QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << 2; @@ -1170,7 +1158,6 @@ tst_QDir::cleanPath_data() QTest::newRow("data2") << "/" << "/"; QTest::newRow("data3") << QDir::cleanPath("../.") << ".."; QTest::newRow("data4") << QDir::cleanPath("../..") << "../.."; -#if !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) QTest::newRow("data5") << "d:\\a\\bc\\def\\.." << "d:/a/bc"; QTest::newRow("data6") << "d:\\a\\bc\\def\\../../.." << "d:/"; @@ -1178,17 +1165,14 @@ tst_QDir::cleanPath_data() QTest::newRow("data5") << "d:\\a\\bc\\def\\.." << "d:\\a\\bc\\def\\.."; QTest::newRow("data6") << "d:\\a\\bc\\def\\../../.." << ".."; #endif -#endif QTest::newRow("data7") << ".//file1.txt" << "file1.txt"; QTest::newRow("data8") << "/foo/bar/..//file1.txt" << "/foo/file1.txt"; QTest::newRow("data9") << "//" << "/"; -#if !defined(Q_OS_WINCE) #if defined Q_OS_WIN QTest::newRow("data10") << "c:\\" << "c:/"; #else QTest::newRow("data10") << "/:/" << "/:"; #endif -#endif #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QTest::newRow("data11") << "//foo//bar" << "//foo/bar"; #endif @@ -1350,7 +1334,7 @@ void tst_QDir::absolutePath_data() QTest::addColumn<QString>("expectedPath"); QTest::newRow("0") << "/machine/share/dir1" << "/machine/share/dir1"; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)) +#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT)) QTest::newRow("1") << "\\machine\\share\\dir1" << "/machine/share/dir1"; QTest::newRow("2") << "//machine/share/dir1" << "//machine/share/dir1"; QTest::newRow("3") << "\\\\machine\\share\\dir1" << "//machine/share/dir1"; @@ -1399,7 +1383,7 @@ void tst_QDir::relativeFilePath_data() QTest::newRow("same path 1") << "/tmp" << "/tmp" << "."; QTest::newRow("same path 2") << "//tmp" << "/tmp/" << "."; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) +#if defined(Q_OS_WIN) QTest::newRow("12") << "C:/foo/bar" << "ding" << "ding"; QTest::newRow("13") << "C:/foo/bar" << "C:/ding/dong" << "../../ding/dong"; QTest::newRow("14") << "C:/foo/bar" << "/ding/dong" << "../../ding/dong"; @@ -1575,7 +1559,6 @@ void tst_QDir::operator_eq() dir1.setPath(".."); } -#ifndef Q_OS_WINCE // WinCE does not have . nor .. void tst_QDir::dotAndDotDot() { @@ -1585,7 +1568,6 @@ void tst_QDir::dotAndDotDot() entryList = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); QCOMPARE(entryList, QStringList() << QString("dir") << QString("spaces")); } -#endif void tst_QDir::homePath() { @@ -1829,16 +1811,9 @@ void tst_QDir::updateFileLists() QDir dir(fs.absoluteFilePath(dirName)); -#if defined(Q_OS_WINCE) - //no . and .. on these OS. - QCOMPARE(dir.count(), uint(4)); - QCOMPARE(dir.entryList().size(), 4); - QCOMPARE(dir.entryInfoList().size(), 4); -#else QCOMPARE(dir.count(), uint(6)); QCOMPARE(dir.entryList().size(), 6); QCOMPARE(dir.entryInfoList().size(), 6); -#endif dir.setFilter(QDir::AllEntries | QDir::NoDotAndDotDot); diff --git a/tests/auto/corelib/io/qdiriterator/qdiriterator.pro b/tests/auto/corelib/io/qdiriterator/qdiriterator.pro index 2d8dfba996..b5ac614ad1 100644 --- a/tests/auto/corelib/io/qdiriterator/qdiriterator.pro +++ b/tests/auto/corelib/io/qdiriterator/qdiriterator.pro @@ -7,6 +7,4 @@ RESOURCES += qdiriterator.qrc TESTDATA += entrylist contains(CONFIG, builtin_testdata): DEFINES += BUILTIN_TESTDATA -wince*mips*|wincewm50smart-msvc200*: DEFINES += WINCE_BROKEN_ITERATE=1 - win32: CONFIG += insignificant_test # Crashes on Windows in release builds diff --git a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp index 0fbce74055..6450e9af7b 100644 --- a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp +++ b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp @@ -41,7 +41,7 @@ #define Q_NO_SYMLINKS #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) # include "../../../network-settings.h" #endif @@ -103,7 +103,7 @@ private slots: void longPath(); void dirorder(); void relativePaths(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) void uncPaths_data(); void uncPaths(); #endif @@ -196,7 +196,7 @@ void tst_QDirIterator::initTestCase() # endif #endif -#if !defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN) createDirectory("hiddenDirs_hiddenFiles"); createFile("hiddenDirs_hiddenFiles/normalFile"); createFile("hiddenDirs_hiddenFiles/.hiddenFile"); @@ -239,10 +239,8 @@ void tst_QDirIterator::iterateRelativeDirectory_data() << QString("entrylist") << QDirIterator::IteratorFlags(0) << QDir::Filters(QDir::NoFilter) << QStringList("*") << QString( -#if !defined(Q_OS_WINCE) "entrylist/.," "entrylist/..," -#endif "entrylist/file," #ifndef Q_NO_SYMLINKS "entrylist/linktofile.lnk," @@ -257,9 +255,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data() << QString("entrylist") << QDirIterator::IteratorFlags(0) << QDir::Filters(QDir::AllEntries | QDir::NoDot) << QStringList("*") << QString( -#if !defined(Q_OS_WINCE) "entrylist/..," -#endif "entrylist/file," #ifndef Q_NO_SYMLINKS "entrylist/linktofile.lnk," @@ -274,9 +270,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data() << QString("entrylist") << QDirIterator::IteratorFlags(0) << QDir::Filters(QDir::AllEntries | QDir::NoDotDot) << QStringList("*") << QString( -#if !defined(Q_OS_WINCE) "entrylist/.," -#endif "entrylist/file," #ifndef Q_NO_SYMLINKS "entrylist/linktofile.lnk," @@ -305,12 +299,10 @@ void tst_QDirIterator::iterateRelativeDirectory_data() << QString("entrylist") << QDirIterator::IteratorFlags(QDirIterator::Subdirectories | QDirIterator::FollowSymlinks) << QDir::Filters(QDir::NoFilter) << QStringList("*") << QString( -#if !defined(Q_OS_WINCE) "entrylist/.," "entrylist/..," "entrylist/directory/.," "entrylist/directory/..," -#endif "entrylist/file," #ifndef Q_NO_SYMLINKS "entrylist/linktofile.lnk," @@ -345,11 +337,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data() QTest::newRow("empty, default") << QString("empty") << QDirIterator::IteratorFlags(0) << QDir::Filters(QDir::NoFilter) << QStringList("*") -#if defined(Q_OS_WINCE) - << QStringList(); -#else << QString("empty/.,empty/..").split(','); -#endif QTest::newRow("empty, QDir::NoDotAndDotDot") << QString("empty") << QDirIterator::IteratorFlags(0) @@ -562,13 +550,6 @@ void tst_QDirIterator::longPath() while (dir.exists(dirName) || dir.mkdir(dirName)) { ++n; dirName.append('x'); -#if defined(Q_OS_WINCE) && defined(WINCE_BROKEN_ITERATE) - // Some Windows CE devices/emulators are broken. - // though one can create directories of length <= 217, - // FindNextFile only reports entries until ~ 214. - if (n >= 210) - break; -#endif } QDirIterator it(dir.absolutePath(), QDir::NoDotAndDotDot|QDir::Dirs, QDirIterator::Subdirectories); @@ -606,7 +587,7 @@ void tst_QDirIterator::relativePaths() } } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) void tst_QDirIterator::uncPaths_data() { QTest::addColumn<QString>("dirName"); diff --git a/tests/auto/corelib/io/qfile/qfile.pro b/tests/auto/corelib/io/qfile/qfile.pro index 10c8d918f7..0735daedb3 100644 --- a/tests/auto/corelib/io/qfile/qfile.pro +++ b/tests/auto/corelib/io/qfile/qfile.pro @@ -1,7 +1,2 @@ TEMPLATE = subdirs -wince* { - SUBDIRS = test -} else { - SUBDIRS = test stdinprocess -} - +SUBDIRS = test stdinprocess diff --git a/tests/auto/corelib/io/qfile/test/test.pro b/tests/auto/corelib/io/qfile/test/test.pro index c9ba96cc1b..c0c4b9d5d2 100644 --- a/tests/auto/corelib/io/qfile/test/test.pro +++ b/tests/auto/corelib/io/qfile/test/test.pro @@ -6,7 +6,6 @@ else: DEFINES += QT_NO_NETWORK TARGET = ../tst_qfile SOURCES = ../tst_qfile.cpp -wince: SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp RESOURCES += ../qfile.qrc ../rename-fallback.qrc ../copy-fallback.qrc diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 0d912d7b3c..dd449a37d4 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -47,7 +47,7 @@ extern Q_CORE_EXPORT int qt_ntfs_permission_lookup; QT_END_NAMESPACE #endif -#if !defined(Q_OS_WINCE) && !defined(QT_NO_NETWORK) +#if !defined(QT_NO_NETWORK) #include <QHostInfo> #endif #include <QProcess> @@ -66,8 +66,6 @@ QT_END_NAMESPACE # include <sys/mount.h> #elif defined(Q_OS_IRIX) # include <sys/statfs.h> -#elif defined(Q_OS_WINCE) -# include <qplatformdefs.h> #elif defined(Q_OS_VXWORKS) # include <fcntl.h> #if defined(_WRS_KERNEL) @@ -85,7 +83,7 @@ QT_END_NAMESPACE #include <stdio.h> #include <errno.h> -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) #include "../../../network-settings.h" #endif @@ -135,11 +133,9 @@ private slots: void readAll_data(); void readAll(); void readAllBuffer(); -#if !defined(Q_OS_WINCE) void readAllStdin(); void readLineStdin(); void readLineStdin_lineByLine(); -#endif void text(); void missingEndOfLine(); void readBlock(); @@ -169,7 +165,7 @@ private slots: void writeTextFile_data(); void writeTextFile(); /* void largeFileSupport(); */ -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void largeUncFileSupport(); #endif void flush(); @@ -225,10 +221,8 @@ private slots: void mapWrittenFile_data(); void mapWrittenFile(); -#ifndef Q_OS_WINCE void openStandardStreamsFileDescriptors(); void openStandardStreamsBufferedStreams(); -#endif void resize_data(); void resize(); @@ -491,7 +485,7 @@ void tst_QFile::exists() file.remove(); QVERIFY(!file.exists()); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) const QString uncPath = "//" + QtNetworkSettings::winServerName() + "/testshare/readme.txt"; QFile unc(uncPath); QVERIFY2(unc.exists(), msgFileDoesNotExist(uncPath).constData()); @@ -539,7 +533,7 @@ void tst_QFile::open_data() << false << QFile::OpenError; QTest::newRow("noreadfile") << QString::fromLatin1(noReadFile) << int(QIODevice::ReadOnly) << false << QFile::OpenError; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //opening devices requires administrative privileges (and elevation). HANDLE hTest = CreateFile(_T("\\\\.\\PhysicalDrive0"), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); if (hTest != INVALID_HANDLE_VALUE) { @@ -570,7 +564,7 @@ void tst_QFile::open() QSKIP("Running this test as root doesn't make sense"); #endif -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) +#if defined(Q_OS_WIN32) QEXPECT_FAIL("noreadfile", "Windows does not currently support non-readable files.", Abort); #endif if (filename.isEmpty()) @@ -622,7 +616,7 @@ void tst_QFile::size_data() QTest::addColumn<qint64>("size"); QTest::newRow( "exist01" ) << m_testFile << (qint64)245; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // Only test UNC on Windows./ QTest::newRow("unc") << "//" + QString(QtNetworkSettings::winServerName() + "/testshare/test.pri") << (qint64)34; #endif @@ -633,10 +627,6 @@ void tst_QFile::size() QFETCH( QString, filename ); QFETCH( qint64, size ); -#ifdef Q_OS_WINCE - filename = QFileInfo(filename).absoluteFilePath(); -#endif - { QFile f( filename ); QCOMPARE( f.size(), size ); @@ -656,9 +646,6 @@ void tst_QFile::size() fclose(stream); } - // Currently low level file I/O is not well supported on Windows CE, so - // skip this part of the test. -#ifndef Q_OS_WINCE { QFile f; @@ -671,7 +658,6 @@ void tst_QFile::size() f.close(); QT_CLOSE(fd); } -#endif } void tst_QFile::sizeNoExist() @@ -916,7 +902,6 @@ private: }; #endif // !QT_NO_PROCESS -#if !defined(Q_OS_WINCE) void tst_QFile::readAllStdin() { #ifdef QT_NO_PROCESS @@ -1007,7 +992,6 @@ void tst_QFile::readLineStdin_lineByLine() } #endif } -#endif void tst_QFile::text() { @@ -1108,7 +1092,7 @@ void tst_QFile::ungetChar() QCOMPARE(buf[2], '4'); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QString driveLetters() { wchar_t volumeName[MAX_PATH]; @@ -1145,7 +1129,7 @@ void tst_QFile::invalidFile_data() #if !defined(Q_OS_WIN) QTest::newRow( "x11" ) << QString( "qwe//" ); #else -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) QTest::newRow( "colon2" ) << invalidDriveLetter() + QString::fromLatin1(":ail:invalid"); #endif QTest::newRow( "colon3" ) << QString( ":failinvalid" ); @@ -1207,13 +1191,11 @@ void tst_QFile::permissions_data() QTest::newRow("data0") << QCoreApplication::instance()->applicationFilePath() << uint(QFile::ExeUser) << true << false; QTest::newRow("data1") << m_testSourceFile << uint(QFile::ReadUser) << true << false; QTest::newRow("readonly") << QString::fromLatin1("readonlyfile") << uint(QFile::WriteUser) << false << false; -#ifndef Q_OS_WINCE QTest::newRow("longfile") << QString::fromLatin1("longFileNamelongFileNamelongFileNamelongFileName" "longFileNamelongFileNamelongFileNamelongFileName" "longFileNamelongFileNamelongFileNamelongFileName" "longFileNamelongFileNamelongFileNamelongFileName" "longFileNamelongFileNamelongFileNamelongFileName.txt") << uint(QFile::ReadUser) << true << true; -#endif QTest::newRow("resource1") << ":/tst_qfileinfo/resources/file1.ext1" << uint(QFile::ReadUser) << true << false; QTest::newRow("resource2") << ":/tst_qfileinfo/resources/file1.ext1" << uint(QFile::WriteUser) << false << false; QTest::newRow("resource3") << ":/tst_qfileinfo/resources/file1.ext1" << uint(QFile::ExeUser) << false << false; @@ -1365,15 +1347,9 @@ void tst_QFile::copyFallback() QVERIFY(QFile::exists("file-copy-destination.txt")); QVERIFY(!file.isOpen()); -#ifdef Q_OS_WINCE - // Need to reset permissions on Windows to be able to delete - QVERIFY(QFile::setPermissions("file-copy-destination.txt", - QFile::WriteOther)); -#else // Need to reset permissions on Windows to be able to delete QVERIFY(QFile::setPermissions("file-copy-destination.txt", QFile::ReadOwner | QFile::WriteOwner)); -#endif QVERIFY(QFile::remove("file-copy-destination.txt")); // Fallback copy of open file. @@ -1394,7 +1370,7 @@ void tst_QFile::copyFallback() #endif #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) static QString getWorkingDirectoryForLink(const QString &linkFileName) { bool neededCoInit = false; @@ -1453,7 +1429,7 @@ void tst_QFile::link() QCOMPARE(QFile::symLinkTarget("myLink.lnk"), referenceTarget); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QString wd = getWorkingDirectoryForLink(info2.absoluteFilePath()); QCOMPARE(QDir::fromNativeSeparators(wd), QDir::cleanPath(info1.absolutePath())); #endif @@ -1591,7 +1567,7 @@ void tst_QFile::writeTextFile() QCOMPARE(file.readAll(), out); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void tst_QFile::largeUncFileSupport() { qint64 size = Q_INT64_C(8589934592); @@ -1670,11 +1646,7 @@ void tst_QFile::bufferedRead() file.write("abcdef"); file.close(); -#if defined(Q_OS_WINCE) - FILE *stdFile = fopen((QCoreApplication::applicationDirPath() + "/stdfile.txt").toLatin1() , "r"); -#else FILE *stdFile = fopen("stdfile.txt", "r"); -#endif QVERIFY(stdFile); char c; QCOMPARE(int(fread(&c, 1, 1, stdFile)), 1); @@ -1819,11 +1791,7 @@ void tst_QFile::FILEReadWrite() f.close(); } -#ifdef Q_OS_WINCE - FILE *fp = fopen(qPrintable(QCoreApplication::applicationDirPath() + "\\FILEReadWrite.txt"), "r+b"); -#else FILE *fp = fopen("FILEReadWrite.txt", "r+b"); -#endif QVERIFY(fp); QFile file; QVERIFY2(file.open(fp, QFile::ReadWrite), msgOpenFailed(file).constData()); @@ -2028,10 +1996,6 @@ void tst_QFile::longFileName() } { QFile file(fileName); -#if defined(Q_OS_WINCE) - QEXPECT_FAIL("244 chars", "Full pathname must be less than 260 chars", Abort); - QEXPECT_FAIL("244 chars to absolutepath", "Full pathname must be less than 260 chars", Abort); -#endif QVERIFY2(file.open(QFile::WriteOnly | QFile::Text), msgOpenFailed(file).constData()); QTextStream ts(&file); ts << fileName << endl; @@ -2299,7 +2263,7 @@ void tst_QFile::writeLargeDataBlock_data() QTest::newRow("localfile-Fd") << "./largeblockfile.txt" << (int)OpenFd; QTest::newRow("localfile-Stream") << "./largeblockfile.txt" << (int)OpenStream; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) && !defined(QT_NO_NETWORK) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !defined(QT_NO_NETWORK) // Some semi-randomness to avoid collisions. QTest::newRow("unc file") << QString("//" + QtNetworkSettings::winServerName() + "/TESTSHAREWRITABLE/largefile-%1-%2.txt") @@ -2314,8 +2278,8 @@ static QByteArray getLargeDataBlock() if (array.isNull()) { -#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS) - int resizeSize = 1024 * 1024; // WinCE does not have much space +#if defined(Q_OS_VXWORKS) + int resizeSize = 1024 * 1024; // VxWorks does not have much space #else int resizeSize = 64 * 1024 * 1024; #endif @@ -2443,9 +2407,7 @@ void tst_QFile::virtualFile() void tst_QFile::textFile() { -#if defined(Q_OS_WINCE) - FILE *fs = ::fopen((QCoreApplication::applicationDirPath() + "/writeabletextfile").toLatin1() , "wt"); -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) FILE *fs = ::fopen("writeabletextfile", "wt"); #else FILE *fs = ::fopen("writeabletextfile", "w"); @@ -2658,7 +2620,7 @@ void tst_QFile::appendAndRead() void tst_QFile::miscWithUncPathAsCurrentDir() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QString current = QDir::currentPath(); const QString path = QLatin1String("//") + QtNetworkSettings::winServerName() + QLatin1String("/testshare"); @@ -2682,7 +2644,6 @@ void tst_QFile::standarderror() void tst_QFile::handle() { int fd; -#if !defined(Q_OS_WINCE) QFile file(m_testSourceFile); QVERIFY2(file.open(QIODevice::ReadOnly), msgOpenFailed(file).constData()); fd = int(file.handle()); @@ -2710,7 +2671,6 @@ void tst_QFile::handle() #endif QCOMPARE(c, '*'); -#endif //test round trip of adopted stdio file handle QFile file2; @@ -2953,10 +2913,6 @@ void tst_QFile::map() QString fileName = QDir::currentPath() + '/' + "qfile_map_testfile"; -#ifdef Q_OS_WINCE - fileName = QFileInfo(fileName).absoluteFilePath(); -#endif - if (QFile::exists(fileName)) { QVERIFY(QFile::setPermissions(fileName, QFile::WriteOwner | QFile::ReadOwner | QFile::WriteUser | QFile::ReadUser)); @@ -2998,7 +2954,7 @@ void tst_QFile::map() QCOMPARE(file.error(), QFile::NoError); // hpux won't let you map multiple times. -#if !defined(Q_OS_HPUX) && !defined(Q_USE_DEPRECATED_MAP_API) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_HPUX) && !defined(Q_USE_DEPRECATED_MAP_API) // exotic test to make sure that multiple maps work // note: windows ce does not reference count mutliple maps @@ -3121,10 +3077,6 @@ void tst_QFile::mapOpenMode() QVERIFY2(file.open(om), msgOpenFailed(om, file).constData()); uchar *memory = file.map(0, fileSize, QFileDevice::MemoryMapFlags(flags)); -#if defined(Q_OS_WINCE) - QEXPECT_FAIL("ReadOnly + MapPrivate" , "Windows CE does not support MapPrivateOption.", Abort); - QEXPECT_FAIL("ReadWrite + MapPrivate", "Windows CE does not support MapPrivateOption.", Abort); -#endif QVERIFY(memory); QVERIFY(memcmp(memory, pattern, fileSize) == 0); @@ -3157,10 +3109,6 @@ void tst_QFile::mapWrittenFile() QString fileName = QDir::currentPath() + '/' + "qfile_map_testfile"; -#ifdef Q_OS_WINCE - fileName = QFileInfo(fileName).absoluteFilePath(); -#endif - if (QFile::exists(fileName)) { QVERIFY(QFile::setPermissions(fileName, QFile::WriteOwner | QFile::ReadOwner | QFile::WriteUser | QFile::ReadUser)); @@ -3259,10 +3207,6 @@ protected: bool MessageHandler::ok = true; QtMessageHandler MessageHandler::oldMessageHandler = 0; - //allthough Windows CE (not mobile!) has functions that allow redirecting - //the standard file descriptors to a file (see SetStdioPathW/GetStdioPathW) - //it does not have functions to simply open them like below . -#ifndef Q_OS_WINCE void tst_QFile::openStandardStreamsFileDescriptors() { @@ -3322,7 +3266,6 @@ void tst_QFile::openStandardStreamsBufferedStreams() QVERIFY(msgHandler.testPassed()); } -#endif void tst_QFile::writeNothing() { diff --git a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro index 8aa81896cc..8d443c27ec 100644 --- a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro +++ b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro @@ -5,6 +5,6 @@ SOURCES = tst_qfileinfo.cpp RESOURCES += qfileinfo.qrc \ testdata.qrc -win32:!wince:!winrt:LIBS += -ladvapi32 -lnetapi32 +win32:!winrt:LIBS += -ladvapi32 -lnetapi32 win32: CONFIG += insignificant_test # Crashes on Windows in release builds diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 8d62a38e6b..eea79406c3 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -49,13 +49,13 @@ #ifdef Q_OS_WIN #include <qt_windows.h> #include <qlibrary.h> -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) #include <lm.h> #endif #endif #include <qplatformdefs.h> #include <qdebug.h> -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) #include "../../../network-settings.h" #endif #include <private/qfileinfo_p.h> @@ -256,7 +256,7 @@ private slots: void refresh(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void ntfsJunctionPointsAndSymlinks_data(); void ntfsJunctionPointsAndSymlinks(); void brokenShortcut(); @@ -273,7 +273,7 @@ private slots: void detachingOperations(); -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) void owner(); #endif void group(); @@ -354,17 +354,8 @@ void tst_QFileInfo::copy() file.flush(); QTest::qWait(250); -#if defined(Q_OS_WIN) || defined(Q_OS_WINCE) - if (QSysInfo::windowsVersion() & QSysInfo::WV_VISTA || - QSysInfo::windowsVersion() & QSysInfo::WV_CE_based) - file.close(); -#endif -#if defined(Q_OS_WINCE) - // On Windows CE we need to close the file. - // Otherwise the content will be cached and not - // flushed to the storage, although we flushed it - // manually!!! CE has interim cache, we cannot influence. - QTest::qWait(5000); +#if defined(Q_OS_WIN) + file.close(); #endif info3.refresh(); privateInfo3 = getPrivate(info3); @@ -422,12 +413,12 @@ void tst_QFileInfo::isDir_data() QTest::newRow("broken link") << "brokenlink.lnk" << false; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)) +#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT)) QTest::newRow("drive 1") << "c:" << true; QTest::newRow("drive 2") << "c:/" << true; //QTest::newRow("drive 2") << "t:s" << false; #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); QTest::newRow("unc 1") << uncRoot << true; QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true; @@ -464,13 +455,13 @@ void tst_QFileInfo::isRoot_data() QTest::newRow("simple dir") << m_resourcesDir << false; QTest::newRow("simple dir with slash") << (m_resourcesDir + QLatin1Char('/')) << false; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)) +#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT)) QTest::newRow("drive 1") << "c:" << false; QTest::newRow("drive 2") << "c:/" << true; QTest::newRow("drive 3") << "p:/" << false; #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); QTest::newRow("unc 1") << uncRoot << true; QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true; @@ -519,7 +510,7 @@ void tst_QFileInfo::exists_data() QTest::newRow("simple dir") << m_resourcesDir << true; QTest::newRow("simple dir with slash") << (m_resourcesDir + QLatin1Char('/')) << true; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); QTest::newRow("unc 1") << uncRoot << true; QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true; @@ -554,7 +545,7 @@ void tst_QFileInfo::absolutePath_data() QTest::addColumn<QString>("filename"); QString drivePrefix; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)) +#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT)) drivePrefix = QDir::currentPath().left(2); QString nonCurrentDrivePrefix = drivePrefix.left(1).compare("X", Qt::CaseInsensitive) == 0 ? QString("Y:") : QString("X:"); @@ -573,7 +564,7 @@ void tst_QFileInfo::absolutePath_data() QTest::newRow("3") << "/usr/local/bin/" << drivePrefix + "/usr/local/bin" << ""; QTest::newRow("/test") << "/test" << drivePrefix + "/" << "test"; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QTest::newRow("c:\\autoexec.bat") << "c:\\autoexec.bat" << "C:/" << "autoexec.bat"; QTest::newRow("c:autoexec.bat") << QDir::currentPath().left(2) + "autoexec.bat" << QDir::currentPath() @@ -606,7 +597,7 @@ void tst_QFileInfo::absFilePath_data() QTest::newRow("relativeFile") << "tmp.txt" << QDir::currentPath() + "/tmp.txt"; QTest::newRow("relativeFileInSubDir") << "temp/tmp.txt" << QDir::currentPath() + "/" + "temp/tmp.txt"; QString drivePrefix; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) +#if defined(Q_OS_WIN) QString curr = QDir::currentPath(); curr.remove(0, 2); // Make it a absolute path with no drive specifier: \depot\qt-4.2\tests\auto\qfileinfo @@ -774,7 +765,7 @@ void tst_QFileInfo::fileName_data() QTest::newRow("relativeFile") << "tmp.txt" << "tmp.txt"; QTest::newRow("relativeFileInSubDir") << "temp/tmp.txt" << "tmp.txt"; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) +#if defined(Q_OS_WIN) QTest::newRow("absFilePath") << "c:\\home\\andy\\tmp.txt" << "tmp.txt"; QTest::newRow("driveWithNoSlash") << "c:tmp.txt" << "tmp.txt"; #else @@ -1024,7 +1015,7 @@ void tst_QFileInfo::size() void tst_QFileInfo::systemFiles() { -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if !defined(Q_OS_WIN) || defined(Q_OS_WINRT) QSKIP("This is a Windows only test"); #endif QFileInfo fi("c:\\pagefile.sys"); @@ -1121,11 +1112,7 @@ void tst_QFileInfo::fileTimes_data() void tst_QFileInfo::fileTimes() { -#if defined(Q_OS_WINCE) - int sleepTime = 3000; -#else int sleepTime = 2000; -#endif QFETCH(QString, fileName); if (QFile::exists(fileName)) { QVERIFY(QFile::remove(fileName)); @@ -1133,10 +1120,6 @@ void tst_QFileInfo::fileTimes() QTest::qSleep(sleepTime); { QFile file(fileName); -#if defined(Q_OS_WINCE) - QEXPECT_FAIL("longfile", "No long filenames on WinCE", Abort); - QEXPECT_FAIL("longfile absolutepath", "No long filenames on WinCE", Abort); -#endif QVERIFY(file.open(QFile::WriteOnly | QFile::Text)); #if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS) if (qIsLikelyToBeNfs(file.handle())) @@ -1162,7 +1145,7 @@ void tst_QFileInfo::fileTimes() { QFileInfo fileInfo(fileName); // On unix created() returns the same as lastModified(). -#if !defined(Q_OS_UNIX) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_UNIX) QVERIFY(fileInfo.created() < beforeWrite); #endif QVERIFY(fileInfo.lastModified() > beforeWrite); @@ -1174,7 +1157,7 @@ void tst_QFileInfo::fileTimes() } QFileInfo fileInfo(fileName); -#if !defined(Q_OS_UNIX) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_UNIX) QVERIFY(fileInfo.created() < beforeWrite); #endif //In Vista the last-access timestamp is not updated when the file is accessed/touched (by default). @@ -1193,9 +1176,7 @@ void tst_QFileInfo::fileTimes() RegCloseKey(key); } #endif -#if defined(Q_OS_WINCE) - QEXPECT_FAIL("simple", "WinCE only stores date of access data, not the time", Continue); -#elif defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) QEXPECT_FAIL("", "WinRT does not allow timestamp handling change in the filesystem due to sandboxing", Continue); #elif defined(Q_OS_QNX) QEXPECT_FAIL("", "QNX uses the noatime filesystem option", Continue); @@ -1211,8 +1192,8 @@ void tst_QFileInfo::fileTimes() void tst_QFileInfo::fileTimes_oldFile() { - // This is not supported on WinCE or WinRT -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) + // This is not supported on WinRT +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // All files are opened in share mode (both read and write). DWORD shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; @@ -1310,7 +1291,7 @@ void tst_QFileInfo::isHidden_data() QTest::newRow(qPrintable("drive." + info.path())) << info.path() << false; } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) QVERIFY(QDir("./hidden-directory").exists() || QDir().mkdir("./hidden-directory")); QVERIFY(SetFileAttributesW(reinterpret_cast<LPCWSTR>(QString("./hidden-directory").utf16()),FILE_ATTRIBUTE_HIDDEN)); QTest::newRow("C:/path/to/hidden-directory") << QDir::currentPath() + QString::fromLatin1("/hidden-directory") << true; @@ -1413,7 +1394,7 @@ void tst_QFileInfo::isNativePath() void tst_QFileInfo::refresh() { -#if defined(Q_OS_WINCE) || defined(Q_OS_WIN) +#if defined(Q_OS_WIN) int sleepTime = 3000; #else int sleepTime = 2000; @@ -1436,17 +1417,8 @@ void tst_QFileInfo::refresh() QCOMPARE(info.lastModified(), lastModified); QCOMPARE(info.size(), qint64(7)); -#if defined(Q_OS_WIN) || defined(Q_OS_WINCE) - if (QSysInfo::windowsVersion() & QSysInfo::WV_VISTA || - QSysInfo::windowsVersion() & QSysInfo::WV_CE_based) - file.close(); -#endif -#if defined(Q_OS_WINCE) - // On Windows CE we need to close the file. - // Otherwise the content will be cached and not - // flushed to the storage, although we flushed it - // manually!!! CE has interim cache, we cannot influence. - QTest::qWait(5000); +#if defined(Q_OS_WIN) + file.close(); #endif info.refresh(); QCOMPARE(info.size(), qint64(13)); @@ -1459,7 +1431,7 @@ void tst_QFileInfo::refresh() QCOMPARE(info2.size(), info.size()); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data() { QTest::addColumn<QString>("path"); @@ -1633,11 +1605,7 @@ void tst_QFileInfo::isWritable() tempfile.remove(); #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) -#ifdef Q_OS_WINCE - QFileInfo fi("\\Windows\\wince.nls"); -#else QFileInfo fi("c:\\pagefile.sys"); -#endif QVERIFY2(fi.exists(), msgDoesNotExist(fi.absoluteFilePath()).constData()); QVERIFY(!fi.isWritable()); #endif @@ -1813,8 +1781,7 @@ void tst_QFileInfo::detachingOperations() QVERIFY(!info1.caching()); } -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) -#if defined (Q_OS_WIN) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) BOOL IsUserAdmin() { BOOL b; @@ -1835,14 +1802,14 @@ BOOL IsUserAdmin() return(b); } -#endif -#if defined(Q_OS_WIN) QT_BEGIN_NAMESPACE extern Q_CORE_EXPORT int qt_ntfs_permission_lookup; QT_END_NAMESPACE -#endif +#endif // Q_OS_WIN && !Q_OS_WINRT + +#ifndef Q_OS_WINRT void tst_QFileInfo::owner() { QString userName; @@ -1904,7 +1871,7 @@ void tst_QFileInfo::owner() qt_ntfs_permission_lookup = 0; #endif } -#endif +#endif // !Q_OS_WINRT void tst_QFileInfo::group() { diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 187f72d095..fe2a1a562d 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -146,12 +146,7 @@ void tst_QFileSystemWatcher::basicTest() // resolution of the modification time is system dependent, but it's at most 1 second when using // the polling engine. I've heard rumors that FAT32 has a 2 second resolution. So, we have to // wait a bit before we can modify the file (hrmph)... -#ifndef Q_OS_WINCE QTest::qWait(2000); -#else - // WinCE is always a little bit slower. Give it a little bit more time - QTest::qWait(5000); -#endif testFile.open(QIODevice::WriteOnly | QIODevice::Append); testFile.write(QByteArray("world")); @@ -309,9 +304,6 @@ void tst_QFileSystemWatcher::watchDirectory() QVERIFY(temporaryDir.rmdir(testDirName)); // waiting max 5 seconds for notification for directory removal to trigger -#ifdef Q_OS_WINCE - QEXPECT_FAIL("poller", "Directory does not get updated on file removal(See #137910)", Abort); -#endif QTRY_COMPARE(changedSpy.count(), 2); QCOMPARE(changedSpy.at(0).count(), 1); QCOMPARE(changedSpy.at(1).count(), 1); @@ -553,9 +545,6 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() QEXPECT_FAIL("", "See QTBUG-30943", Continue); #endif QCOMPARE(fileChangedSpyCount, 0); -#ifdef Q_OS_WINCE - QEXPECT_FAIL("poller", "Directory does not get updated on file removal(See #137910)", Abort); -#endif QCOMPARE(dirChangedSpy.count(), 1); dirChangedSpy.clear(); diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp index 30eaa5aab9..5cb532f76b 100644 --- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp @@ -100,9 +100,6 @@ void tst_QIODevice::getSetCheck() //---------------------------------------------------------------------------------- void tst_QIODevice::constructing_QTcpSocket() { -#if defined(Q_OS_WINCE) && defined(WINCE_EMULATOR_TEST) - QSKIP("Networking tests in a WinCE emulator are unstable"); -#endif if (!QtNetworkSettings::verifyTestNetworkSettings()) QSKIP("No network test server available"); @@ -205,9 +202,6 @@ void tst_QIODevice::read_QByteArray() //-------------------------------------------------------------------- void tst_QIODevice::unget() { -#if defined(Q_OS_WINCE) && defined(WINCE_EMULATOR_TEST) - QSKIP("Networking tests in a WinCE emulator are unstable"); -#endif #if defined(Q_OS_MAC) QSKIP("The unget network test is unstable on Mac. See QTBUG-39983."); #endif diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp index 00b82cb377..b7dc3e9ac0 100644 --- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp +++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp @@ -34,7 +34,7 @@ #include <qsysinfo.h> #if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS) #include <unistd.h> -#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT) # include <qt_windows.h> #endif @@ -281,7 +281,7 @@ void tst_QLockFile::staleLockFromCrashedProcessReusedPid() { #if defined(QT_NO_PROCESS) QSKIP("This test requires QProcess support"); -#elif defined(Q_OS_WINRT) || defined(Q_OS_WINCE) || defined(Q_OS_IOS) +#elif defined(Q_OS_WINRT) || defined(Q_OS_IOS) QSKIP("We cannot retrieve information about other processes on this platform."); #else const QString fileName = dir.path() + "/staleLockFromCrashedProcessReusedPid"; @@ -455,7 +455,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(ProcessProperties) static inline ProcessProperties processProperties() { ProcessProperties result; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) HANDLE processToken = NULL; if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &processToken)) { DWORD elevation; // struct containing a DWORD, not present in some MinGW headers. @@ -484,7 +484,7 @@ void tst_QLockFile::noPermissionsWindows() { // Windows: Do the permissions test in a system directory in which // files cannot be created. -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if !defined(Q_OS_WIN) || defined(Q_OS_WINRT) QSKIP("This test is for desktop Windows only"); #endif #ifdef Q_OS_WIN diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro b/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro index 6eb72343bc..7b83d5dbe8 100644 --- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro +++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro @@ -4,4 +4,4 @@ TARGET = tst_qlockfile SOURCES += tst_qlockfile.cpp QT = core testlib concurrent -win32:!wince:!winrt:LIBS += -ladvapi32 +win32:!winrt:LIBS += -ladvapi32 diff --git a/tests/auto/corelib/io/qprocess/qprocess.pri b/tests/auto/corelib/io/qprocess/qprocess.pri index a43c823846..d5a7532ee1 100644 --- a/tests/auto/corelib/io/qprocess/qprocess.pri +++ b/tests/auto/corelib/io/qprocess/qprocess.pri @@ -10,13 +10,12 @@ SUBPROGRAMS = \ testProcessDeadWhileReading \ testProcessEOF \ testExitCodes \ + testForwarding \ testGuiProcess \ testDetached \ fileWriterProcess \ testSetWorkingDirectory \ testSoftExit -!contains(QMAKE_PLATFORM, wince): SUBPROGRAMS += testForwarding - !qtHaveModule(widgets): SUBPROGRAMS -= \ testGuiProcess diff --git a/tests/auto/corelib/io/qprocess/qprocess.pro b/tests/auto/corelib/io/qprocess/qprocess.pro index 6ba54b1e92..3867ac5741 100644 --- a/tests/auto/corelib/io/qprocess/qprocess.pro +++ b/tests/auto/corelib/io/qprocess/qprocess.pro @@ -8,7 +8,7 @@ SUBDIRS += testProcessSpacesArgs/nospace.pro \ testProcessSpacesArgs/twospaces.pro \ testSpaceInName -win32:!wince* { +win32 { SUBDIRS += \ testProcessEchoGui \ testSetNamedPipeHandleState diff --git a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp index 494d8147a7..0d40a9b83c 100644 --- a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp +++ b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp @@ -31,21 +31,10 @@ int main(int argc, char ** argv) { -#if defined(WINCE) || defined(_WIN32_WCE) - // No pipes on this "OS" - FILE* file = fopen("\\temp\\qprocess_args_test.txt","w+"); - for (int i = 0; i < argc; ++i) { - if (i) - fprintf(file, "|"); - fprintf(file, argv[i]); - } - fclose(file); -#else for (int i = 0; i < argc; ++i) { if (i) printf("|"); printf("%s", argv[i]); } -#endif return 0; } diff --git a/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro b/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro index d19a631cae..80e8bcad98 100644 --- a/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro +++ b/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro @@ -1,6 +1,6 @@ win32 { SOURCES = main_win.cpp - !wince: LIBS += -luser32 + LIBS += -luser32 } unix { SOURCES = main_unix.cpp diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 1f0ace0dd3..0bc1e77925 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -64,7 +64,6 @@ private slots: void startDetached(); void crashTest(); void crashTest2(); -#ifndef Q_OS_WINCE void echoTest_data(); void echoTest(); void echoTest2(); @@ -110,7 +109,6 @@ private slots: void discardUnwantedOutput(); void setWorkingDirectory(); void setNonExistentWorkingDirectory(); -#endif // not Q_OS_WINCE void exitStatus_data(); void exitStatus(); @@ -154,11 +152,9 @@ protected slots: void readFromProcess(); void exitLoopSlot(); void processApplicationEvents(); -#ifndef Q_OS_WINCE void restartProcess(); void waitForReadyReadInAReadyReadSlotSlot(); void waitForBytesWrittenInABytesWrittenSlotSlot(); -#endif private: qint64 bytesAvailable; @@ -406,8 +402,6 @@ void tst_QProcess::crashTest2() QCOMPARE(process.exitStatus(), QProcess::CrashExit); } -#ifndef Q_OS_WINCE -//Reading and writing to a process is not supported on Qt/CE void tst_QProcess::echoTest_data() { QTest::addColumn<QByteArray>("input"); @@ -462,7 +456,6 @@ void tst_QProcess::echoTest() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); } -#endif void tst_QProcess::exitLoopSlot() { @@ -474,8 +467,6 @@ void tst_QProcess::processApplicationEvents() QCoreApplication::processEvents(); } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::echoTest2() { @@ -523,10 +514,8 @@ void tst_QProcess::echoTest2() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); } -#endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) -// Reading and writing to a process is not supported on Qt/CE +#if defined(Q_OS_WIN) void tst_QProcess::echoTestGui() { QProcess process; @@ -555,10 +544,9 @@ void tst_QProcess::testSetNamedPipeHandleState() QCOMPARE(process.exitCode(), 0); QCOMPARE(process.exitStatus(), QProcess::NormalExit); } -#endif // !Q_OS_WINCE && Q_OS_WIN +#endif // Q_OS_WIN -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) -// Batch files are not supported on Windows CE +#if defined(Q_OS_WIN) void tst_QProcess::batFiles_data() { QTest::addColumn<QString>("batFile"); @@ -585,7 +573,7 @@ void tst_QProcess::batFiles() QVERIFY(proc.readAll().startsWith(output)); } -#endif // !Q_OS_WINCE && Q_OS_WIN +#endif // Q_OS_WIN void tst_QProcess::exitStatus_data() { @@ -627,8 +615,6 @@ void tst_QProcess::exitStatus() } } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::loopBackTest() { @@ -649,10 +635,7 @@ void tst_QProcess::loopBackTest() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::readTimeoutAndThenCrash() { @@ -683,7 +666,6 @@ void tst_QProcess::readTimeoutAndThenCrash() QCOMPARE(spy2.count(), 1); QCOMPARE(*static_cast<const QProcess::ProcessError *>(spy2.at(0).at(0).constData()), QProcess::Crashed); } -#endif void tst_QProcess::waitForFinished() { @@ -694,9 +676,6 @@ void tst_QProcess::waitForFinished() QVERIFY(process.waitForFinished()); QCOMPARE(process.exitStatus(), QProcess::NormalExit); -#if defined (Q_OS_WINCE) - QEXPECT_FAIL("", "Reading and writing to a process is not supported on Qt/CE", Continue); -#endif QString output = process.readAll(); QCOMPARE(output.count("\n"), 10*1024); @@ -705,8 +684,6 @@ void tst_QProcess::waitForFinished() QCOMPARE(process.error(), QProcess::FailedToStart); } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::deadWhileReading() { QProcess process; @@ -724,10 +701,7 @@ void tst_QProcess::deadWhileReading() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::restartProcessDeadlock() { @@ -757,10 +731,7 @@ void tst_QProcess::restartProcess() QVERIFY(process); process->start("testProcessEcho/testProcessEcho"); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::closeWriteChannel() { QProcess more; @@ -786,10 +757,7 @@ void tst_QProcess::closeWriteChannel() QCOMPARE(more.exitStatus(), QProcess::NormalExit); QCOMPARE(more.exitCode(), 0); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE" void tst_QProcess::closeReadChannel() { for (int i = 0; i < 10; ++i) { @@ -819,10 +787,7 @@ void tst_QProcess::closeReadChannel() QCOMPARE(proc.exitCode(), 0); } } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::openModes() { QProcess proc; @@ -863,10 +828,7 @@ void tst_QProcess::openModes() QVERIFY(!proc.isWritable()); QCOMPARE(proc.state(), QProcess::NotRunning); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives() { @@ -900,17 +862,12 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives() QCOMPARE(proc.exitStatus(), QProcess::NormalExit); QCOMPARE(proc.exitCode(), 0); } -#endif void tst_QProcess::hardExit() { QProcess proc; -#if defined(Q_OS_WINCE) - proc.start("testSoftExit/testSoftExit"); -#else proc.start("testProcessEcho/testProcessEcho"); -#endif QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString())); @@ -937,9 +894,7 @@ void tst_QProcess::softExit() proc.start("testSoftExit/testSoftExit"); QVERIFY(proc.waitForStarted(10000)); -#if !defined(Q_OS_WINCE) QVERIFY(proc.waitForReadyRead(10000)); -#endif QVERIFY(proc.processId() > 0); @@ -950,8 +905,6 @@ void tst_QProcess::softExit() QCOMPARE(int(proc.error()), int(QProcess::UnknownError)); } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE class SoftExitProcess : public QProcess { Q_OBJECT @@ -1073,10 +1026,7 @@ void tst_QProcess::softExitInSlots() QTRY_VERIFY_WITH_TIMEOUT(proc.waitedForFinished, 10000); QCOMPARE(proc.state(), QProcess::NotRunning); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::mergedChannels() { QProcess process; @@ -1099,10 +1049,6 @@ void tst_QProcess::mergedChannels() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); } -#endif - -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::forwardedChannels_data() { @@ -1155,10 +1101,7 @@ void tst_QProcess::forwardedChannels() QCOMPARE(process.readAllStandardOutput(), outdata); QCOMPARE(process.readAllStandardError(), errdata); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::atEnd() { QProcess process; @@ -1180,7 +1123,6 @@ void tst_QProcess::atEnd() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); } -#endif class TestThread : public QThread { @@ -1202,9 +1144,7 @@ protected: process.start("testProcessEcho/testProcessEcho"); -#if !defined(Q_OS_WINCE) QCOMPARE(process.write("abc\0", 4), qint64(4)); -#endif exitCode = exec(); } @@ -1253,8 +1193,6 @@ void tst_QProcess::processesInMultipleThreads() } } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::waitForFinishedWithTimeout() { QProcess process; @@ -1268,10 +1206,7 @@ void tst_QProcess::waitForFinishedWithTimeout() QVERIFY(process.waitForFinished()); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::waitForReadyReadInAReadyReadSlot() { QProcess process; @@ -1297,10 +1232,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot() QCOMPARE(process.exitCode(), 0); QVERIFY(process.bytesAvailable() > bytesAvailable); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::waitForReadyReadInAReadyReadSlotSlot() { QProcess *process = qobject_cast<QProcess *>(sender()); @@ -1310,10 +1242,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlotSlot() QVERIFY(process->waitForReadyRead(5000)); QTestEventLoop::instance().exitLoop(); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot() { QProcess process; @@ -1336,10 +1265,7 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::waitForBytesWrittenInABytesWrittenSlotSlot() { QProcess *process = qobject_cast<QProcess *>(sender()); @@ -1348,7 +1274,6 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlotSlot() QVERIFY(process->waitForBytesWritten(5000)); QTestEventLoop::instance().exitLoop(); } -#endif void tst_QProcess::spaceArgsTest_data() { @@ -1427,14 +1352,12 @@ void tst_QProcess::spaceArgsTest() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); -#if !defined(Q_OS_WINCE) QStringList actual = QString::fromLatin1(process.readAll()).split("|"); QVERIFY(!actual.isEmpty()); // not interested in the program name, it might be different. actual.removeFirst(); QCOMPARE(actual, args); -#endif if (program.contains(QLatin1Char(' '))) program = QLatin1Char('"') + program + QLatin1Char('"'); @@ -1451,14 +1374,12 @@ void tst_QProcess::spaceArgsTest() QVERIFY2(started, errorMessage.constData()); QVERIFY(process.waitForFinished(5000)); -#if !defined(Q_OS_WINCE) actual = QString::fromLatin1(process.readAll()).split("|"); QVERIFY(!actual.isEmpty()); // not interested in the program name, it might be different. actual.removeFirst(); QCOMPARE(actual, args); -#endif } } @@ -1479,26 +1400,12 @@ void tst_QProcess::nativeArguments() QCOMPARE(proc.exitStatus(), QProcess::NormalExit); QCOMPARE(proc.exitCode(), 0); -#if defined(Q_OS_WINCE) - // WinCE test outputs to a file, so check that - FILE* file = fopen("\\temp\\qprocess_args_test.txt","r"); - QVERIFY(file); - char buf[256]; - fgets(buf, 256, file); - fclose(file); - QStringList actual = QString::fromLatin1(buf).split(QLatin1Char('|')); -#else QStringList actual = QString::fromLatin1(proc.readAll()).split(QLatin1Char('|')); -#endif QVERIFY(!actual.isEmpty()); // not interested in the program name, it might be different. actual.removeFirst(); QStringList expected; -#if defined(Q_OS_WINCE) - expected << "hello" << "kitty," << "\"*\"!"; // Weird, weird ... -#else expected << "hello" << "kitty," << "*!"; -#endif QCOMPARE(actual, expected); } @@ -1703,8 +1610,6 @@ void tst_QProcess::failToStartEmptyArgs() QCOMPARE(process.error(), QProcess::FailedToStart); } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::removeFileWhileProcessIsRunning() { QFile file(m_temporaryDir.path() + QLatin1String("/removeFile.txt")); @@ -1722,9 +1627,7 @@ void tst_QProcess::removeFileWhileProcessIsRunning() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); } -#endif -#ifndef Q_OS_WINCE -// OS doesn't support environment variables + void tst_QProcess::setEnvironment_data() { QTest::addColumn<QString>("name"); @@ -1799,9 +1702,7 @@ void tst_QProcess::setEnvironment() QCOMPARE(process.readAll(), value.toLocal8Bit()); } } -#endif -#ifndef Q_OS_WINCE -// OS doesn't support environment variables + void tst_QProcess::setProcessEnvironment_data() { setEnvironment_data(); @@ -1839,25 +1740,16 @@ void tst_QProcess::setProcessEnvironment() QCOMPARE(process.readAll(), value.toLocal8Bit()); } } -#endif void tst_QProcess::systemEnvironment() { -#if defined (Q_OS_WINCE) - // there is no concept of system variables on Windows CE as there is no console - QVERIFY(QProcess::systemEnvironment().isEmpty()); - QVERIFY(QProcessEnvironment::systemEnvironment().isEmpty()); -#else QVERIFY(!QProcess::systemEnvironment().isEmpty()); QVERIFY(!QProcessEnvironment::systemEnvironment().isEmpty()); QVERIFY(QProcessEnvironment::systemEnvironment().contains("PATH")); QVERIFY(!QProcess::systemEnvironment().filter(QRegExp("^PATH=", Qt::CaseInsensitive)).isEmpty()); -#endif } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::spaceInName() { QProcess process; @@ -1868,7 +1760,6 @@ void tst_QProcess::spaceInName() QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); } -#endif void tst_QProcess::lockupsInStartDetached() { @@ -1883,8 +1774,6 @@ void tst_QProcess::lockupsInStartDetached() QProcess::startDetached("yjhbrty"); } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::atEnd2() { QProcess process; @@ -1899,7 +1788,6 @@ void tst_QProcess::atEnd2() } QCOMPARE(lines.size(), 7); } -#endif void tst_QProcess::waitForReadyReadForNonexistantProcess() { @@ -1929,8 +1817,6 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess() QCOMPARE(finishedSpy2.count(), 0); } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::setStandardInputFile() { static const char data[] = "A bunch\1of\2data\3\4\5\6\7..."; @@ -1958,10 +1844,7 @@ void tst_QProcess::setStandardInputFile() all = process2.readAll(); QCOMPARE(all.size(), 0); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::setStandardOutputFile_data() { QTest::addColumn<int>("channelToTest"); @@ -2079,10 +1962,7 @@ void tst_QProcess::setStandardOutputFileAndWaitForBytesWritten() QCOMPARE(all, QByteArray::fromRawData(testdata, sizeof testdata - 1)); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::setStandardOutputProcess_data() { QTest::addColumn<bool>("merged"); @@ -2123,10 +2003,7 @@ void tst_QProcess::setStandardOutputProcess() else QCOMPARE(all, QByteArray("HHeelllloo,, WWoorrlldd")); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::fileWriterProcess() { const QByteArray line = QByteArrayLiteral(" -- testing testing 1 2 3\n"); @@ -2160,16 +2037,11 @@ void tst_QProcess::fileWriterProcess() QCOMPARE(QFile(fileName).size(), qint64(stdinStr.size())); } while (stopWatch.elapsed() < 3000); } -#endif void tst_QProcess::detachedWorkingDirectoryAndPid() { qint64 pid; -#ifdef Q_OS_WINCE - QTest::qSleep(1000); -#endif - QFile infoFile(m_temporaryDir.path() + QLatin1String("/detachedinfo.txt")); if (infoFile.exists()) QVERIFY(infoFile.remove()); @@ -2206,8 +2078,6 @@ void tst_QProcess::detachedWorkingDirectoryAndPid() QCOMPARE(actualPid, pid); } -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::switchReadChannels() { const char data[] = "ABCD"; @@ -2236,10 +2106,7 @@ void tst_QProcess::switchReadChannels() process.setReadChannel(QProcess::StandardOutput); QCOMPARE(process.read(1), QByteArray("D")); } -#endif -#ifndef Q_OS_WINCE -// Reading and writing to a process is not supported on Qt/CE void tst_QProcess::discardUnwantedOutput() { QProcess process; @@ -2257,11 +2124,8 @@ void tst_QProcess::discardUnwantedOutput() process.setReadChannel(QProcess::StandardError); QCOMPARE(process.bytesAvailable(), Q_INT64_C(0)); } -#endif -#ifndef Q_OS_WINCE // Q_OS_WIN - setWorkingDirectory will chdir before starting the process on unices -// Windows CE does not support working directory logic void tst_QProcess::setWorkingDirectory() { QProcess process; @@ -2297,7 +2161,6 @@ void tst_QProcess::setNonExistentWorkingDirectory() QVERIFY2(process.errorString().startsWith("chdir:"), process.errorString().toLocal8Bit()); #endif } -#endif void tst_QProcess::startFinishStartFinish() { @@ -2307,11 +2170,9 @@ void tst_QProcess::startFinishStartFinish() QCOMPARE(process.state(), QProcess::NotRunning); process.start("testProcessOutput/testProcessOutput"); -#if !defined(Q_OS_WINCE) QVERIFY(process.waitForReadyRead(10000)); QCOMPARE(QString::fromLatin1(process.readLine().trimmed()), QString("0 -this is a number")); -#endif if (process.state() != QProcess::NotRunning) { QVERIFY(process.waitForFinished(10000)); QCOMPARE(process.exitStatus(), QProcess::NormalExit); diff --git a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp index a4a5d5b0c7..af5078a3dc 100644 --- a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp +++ b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp @@ -44,9 +44,7 @@ private slots: void caseSensitivity(); void systemEnvironment(); -#ifndef Q_OS_WINCE void putenv(); -#endif }; void tst_QProcessEnvironment::operator_eq() @@ -257,12 +255,6 @@ void tst_QProcessEnvironment::systemEnvironment() QVERIFY(nonexistant.isNull()); -#ifdef Q_OS_WINCE - // Windows CE has no environment - QVERIFY(path.isEmpty()); - QVERIFY(!system.contains("PATH")); - QVERIFY(system.isEmpty()); -#else // all other system have environments if (path.isEmpty()) QFAIL("Could not find the PATH environment variable -- please correct the test environment"); @@ -272,18 +264,15 @@ void tst_QProcessEnvironment::systemEnvironment() QVERIFY(!system.contains(envname)); -# ifdef Q_OS_WIN +#ifdef Q_OS_WIN // check case-insensitive too QVERIFY(system.contains("path")); QCOMPARE(system.value("path"), QString::fromLocal8Bit(path)); QVERIFY(!system.contains(QString(envname).toLower())); -# endif #endif } -#ifndef Q_OS_WINCE -//Windows CE has no environment void tst_QProcessEnvironment::putenv() { static const char envname[] = "WE_RE_SETTING_THIS_ENVIRONMENT_VARIABLE"; @@ -317,7 +306,6 @@ void tst_QProcessEnvironment::putenv() QCOMPARE(eAfter.value(lower), QString("Hello, World")); # endif } -#endif QTEST_MAIN(tst_QProcessEnvironment) diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 87a801c9dd..60252a91de 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -1521,7 +1521,7 @@ void tst_QSettings::sync() // Now "some other app" will change other.software.org.ini QString userConfDir = settingsPath("__user__") + QDir::separator(); -#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_WINRT) unlink((userConfDir + "other.software.org.ini").toLatin1()); rename((userConfDir + "software.org.ini").toLatin1(), (userConfDir + "other.software.org.ini").toLatin1()); diff --git a/tests/auto/corelib/io/qstorageinfo/BLACKLIST b/tests/auto/corelib/io/qstorageinfo/BLACKLIST new file mode 100644 index 0000000000..ab4f888dd9 --- /dev/null +++ b/tests/auto/corelib/io/qstorageinfo/BLACKLIST @@ -0,0 +1,2 @@ +[storageList] +opensuse-42.1 diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp index 72a57c5905..f0b9c05810 100644 --- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp +++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp @@ -266,7 +266,7 @@ void tst_QTemporaryDir::nonWritableCurrentDir() void tst_QTemporaryDir::openOnRootDrives() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) unsigned int lastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); #endif // If it's possible to create a file in the root directory, it @@ -280,7 +280,7 @@ void tst_QTemporaryDir::openOnRootDrives() QVERIFY(dir.isValid()); } } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) SetErrorMode(lastErrorMode); #endif } diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index 9645ca9ba2..921136e79b 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -374,9 +374,7 @@ void tst_QTemporaryFile::size() // On CE it takes more time for the filesystem to update // the information. Usually you have to close it or seek // to get latest information. flush() does not help either. -#if !defined(Q_OS_WINCE) QCOMPARE(file.size(), qint64(6)); -#endif file.seek(0); QCOMPARE(file.size(), qint64(6)); } @@ -395,7 +393,7 @@ void tst_QTemporaryFile::resize() void tst_QTemporaryFile::openOnRootDrives() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) unsigned int lastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); #endif // If it's possible to create a file in the root directory, it @@ -409,19 +407,14 @@ void tst_QTemporaryFile::openOnRootDrives() QVERIFY(file.open()); } } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) SetErrorMode(lastErrorMode); #endif } void tst_QTemporaryFile::stressTest() { -#if defined(Q_OS_WINCE) - // 200 is still ok, first colision happens after ~30 - const int iterations = 200; -#else const int iterations = 1000; -#endif QSet<QString> names; for (int i = 0; i < iterations; ++i) { diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp index 104873b85e..9533989b9d 100644 --- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp @@ -175,20 +175,16 @@ private slots: void octTest(); void zeroTermination(); void ws_manipulator(); -#ifndef Q_OS_WINCE void stillOpenWhenAtEnd(); -#endif void readNewlines_data(); void readNewlines(); void seek(); void pos(); void pos2(); void pos3LargeFile(); -#if !defined(Q_OS_WINCE) void readStdin(); void readAllFromStdin(); void readLineFromStdin(); -#endif void read(); void qbool(); void forcePoint(); @@ -1207,8 +1203,6 @@ void tst_QTextStream::ws_manipulator() } // ------------------------------------------------------------------------------ -#ifndef Q_OS_WINCE -// Qt/CE: Cannot test network on emulator void tst_QTextStream::stillOpenWhenAtEnd() { QFile file(QFINDTESTDATA("tst_qtextstream.cpp")); @@ -1229,7 +1223,6 @@ void tst_QTextStream::stillOpenWhenAtEnd() while (!stream2.readLine().isNull()) {} QVERIFY(socket.isOpen()); } -#endif // ------------------------------------------------------------------------------ void tst_QTextStream::readNewlines_data() @@ -1498,8 +1491,6 @@ void tst_QTextStream::pos3LargeFile() } // ------------------------------------------------------------------------------ -// Qt/CE has no stdin/out support for processes -#if !defined(Q_OS_WINCE) void tst_QTextStream::readStdin() { #ifdef QT_NO_PROCESS @@ -1527,7 +1518,6 @@ void tst_QTextStream::readStdin() } // ------------------------------------------------------------------------------ -// Qt/CE has no stdin/out support for processes void tst_QTextStream::readAllFromStdin() { #ifdef QT_NO_PROCESS @@ -1549,7 +1539,6 @@ void tst_QTextStream::readAllFromStdin() } // ------------------------------------------------------------------------------ -// Qt/CE has no stdin/out support for processes void tst_QTextStream::readLineFromStdin() { #ifdef QT_NO_PROCESS @@ -1572,7 +1561,6 @@ void tst_QTextStream::readLineFromStdin() QVERIFY(stdinProcess.waitForFinished(5000)); #endif } -#endif // ------------------------------------------------------------------------------ void tst_QTextStream::read() @@ -2799,12 +2787,7 @@ void tst_QTextStream::status_real_read() void tst_QTextStream::status_integer_read() { -#ifdef Q_OS_WINCE - QString text = QLatin1String("123 abc "); - QTextStream s(&text); -#else QTextStream s("123 abc "); -#endif int i; QString w; s >> i; @@ -2822,12 +2805,7 @@ void tst_QTextStream::status_integer_read() void tst_QTextStream::status_word_read() { -#ifdef Q_OS_WINCE - QString text = QLatin1String("abc "); - QTextStream s(&text); -#else QTextStream s("abc "); -#endif QString w; s >> w; QCOMPARE(s.status(), QTextStream::Ok); diff --git a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp index 4b3f76a78e..6ea7a38137 100644 --- a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp +++ b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp @@ -239,18 +239,10 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) // Basic tree StandardItemModel QModelIndex parent; QVariant blue = QVariant(QColor(Qt::blue)); -#ifndef Q_OS_WINCE for (int i = 0; i < 4; ++i) { -#else - for (int i = 0; i < 2; ++i) { -#endif parent = model->index(0, 0, parent); model->insertRows(0, 26 + i, parent); -#ifndef Q_OS_WINCE - model->insertColumns(0, 26 + i, parent); -#else model->insertColumns(0, 4 + i, parent); -#endif // Fill in some values to make it easier to debug /* for (int x = 0; x < 26 + i; ++x) { @@ -272,18 +264,10 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) // Basic tree StandardItemModel QModelIndex parent; QVariant blue = QVariant(QColor(Qt::blue)); -#ifndef Q_OS_WINCE for (int i = 0; i < 4; ++i) { -#else - for (int i = 0; i < 2; ++i) { -#endif parent = realModel->index(0, 0, parent); realModel->insertRows(0, 26+i, parent); -#ifndef Q_OS_WINCE - realModel->insertColumns(0, 26+i, parent); -#else realModel->insertColumns(0, 4, parent); -#endif // Fill in some values to make it easier to debug /* for (int x = 0; x < 26+i; ++x) { @@ -324,11 +308,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) QSqlQuery q; q.exec("CREATE TABLE test(id int primary key, name varchar(30))"); q.prepare("INSERT INTO test(id, name) values (?, ?)"); -#ifndef Q_OS_WINCE for (int i = 0; i < 1024; ++i) { -#else - for (int i = 0; i < 512; ++i) { -#endif q.addBindValue(i); q.addBindValue("Mr. Smith" + QString::number(i)); q.exec(); @@ -344,11 +324,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) } if (QListWidget *listWidget = qobject_cast<QListWidget *>(model->parent())) { -#ifndef Q_OS_WINCE - int items = 100; -#else int items = 50; -#endif while (items--) listWidget->addItem(QLatin1String("item ") + QString::number(items)); return QModelIndex(); diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp index a8de5b7a9a..0691297497 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp @@ -155,7 +155,7 @@ void tst_QCoreApplication::qAppName() void tst_QCoreApplication::argc() { -#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) QSKIP("QCoreApplication::arguments() parses arguments from actual command line on this platform."); #endif { diff --git a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro index 5cd043b584..50072dc612 100644 --- a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro +++ b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro @@ -3,6 +3,6 @@ TARGET = tst_qeventloop QT = core network testlib core-private SOURCES = $$PWD/tst_qeventloop.cpp -win32:!wince:!winrt: LIBS += -luser32 +win32:!winrt: LIBS += -luser32 contains(QT_CONFIG, glib): DEFINES += HAVE_GLIB diff --git a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro index 1d4e647a4b..b5f1d0fe00 100644 --- a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro +++ b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro @@ -6,11 +6,11 @@ SOURCES = tst_qmetatype.cpp TESTDATA=./typeFlags.bin DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -win32-msvc*|wince|winrt { +win32-msvc*|winrt { # Prevents "fatal error C1128: number of sections exceeded object file format limit". QMAKE_CXXFLAGS += /bigobj # Reduce compile time - win32-msvc2012|wince|winrt { + win32-msvc2012|winrt { QMAKE_CXXFLAGS_RELEASE -= -O2 QMAKE_CFLAGS_RELEASE -= -O2 } diff --git a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro index 125915047a..cc51b4c661 100644 --- a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro +++ b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro @@ -2,9 +2,6 @@ CONFIG -= app_bundle debug_and_release CONFIG += console DESTDIR = ./ QT = core -wince { - LIBS += coredll.lib -} HEADERS += signalbug.h SOURCES += signalbug.cpp diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 23f8ff5857..6898fa717e 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -1572,11 +1572,7 @@ Q_DECLARE_METATYPE(PropertyObject::Priority) void tst_QObject::threadSignalEmissionCrash() { -#if defined(Q_OS_WINCE) - int loopCount = 100; -#else int loopCount = 1000; -#endif for (int i = 0; i < loopCount; ++i) { QTcpSocket socket; socket.connectToHost("localhost", 80); diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp index b6f6d2a7f3..26caff4301 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp +++ b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp @@ -90,7 +90,7 @@ private slots: // extreme cases void useTooMuchMemory(); -#if !defined(Q_OS_HPUX) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_HPUX) void attachTooMuch(); #endif @@ -516,8 +516,7 @@ void tst_QSharedMemory::useTooMuchMemory() attach before the system runs out of resources. */ // HPUX doesn't allow for multiple attaches per process. -// For WinCE, this test nearly kills the system, so skip it. -#if !defined(Q_OS_HPUX) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_HPUX) void tst_QSharedMemory::attachTooMuch() { QSKIP("disabled"); @@ -576,9 +575,7 @@ void tst_QSharedMemory::simpleProducerConsumer() char *get = (char*)consumer.data(); // On Windows CE you always have ReadWrite access. Thus // ViewMapOfFile returns the same pointer -#if !defined(Q_OS_WINCE) QVERIFY(put != get); -#endif for (int i = 0; i < size; ++i) { put[i] = 'Q'; QCOMPARE(get[i], 'Q'); diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index 6fd192c357..de7a3721d8 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -295,9 +295,6 @@ void tst_QTimer::livelock() QTRY_COMPARE(tester.timeoutsForFirst, 1); QCOMPARE(tester.timeoutsForExtra, 0); QTRY_COMPARE(tester.timeoutsForSecond, 1); -#if defined(Q_OS_WINCE) - QEXPECT_FAIL("non-zero timer", "Windows CE devices often too slow", Continue); -#endif QVERIFY(tester.postEventAtRightTime); } diff --git a/tests/auto/corelib/plugin/qlibrary/lib/lib.pro b/tests/auto/corelib/plugin/qlibrary/lib/lib.pro index 44bd0be14e..3e15861021 100644 --- a/tests/auto/corelib/plugin/qlibrary/lib/lib.pro +++ b/tests/auto/corelib/plugin/qlibrary/lib/lib.pro @@ -6,7 +6,6 @@ TARGET = mylib DESTDIR = ../ QT = core -wince: DEFINES += WIN32_MSVC win32-msvc: DEFINES += WIN32_MSVC # This project is testdata for tst_qlibrary diff --git a/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro b/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro index d55747501c..bd73227b3d 100644 --- a/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro +++ b/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro @@ -7,7 +7,6 @@ DESTDIR = ../ VERSION = 2 QT = core -wince: DEFINES += WIN32_MSVC win32-msvc: DEFINES += WIN32_MSVC # Force a copy of the library to have an extension that is non-standard. diff --git a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp index ed41ab51e1..dec8448ce3 100644 --- a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp +++ b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp @@ -189,7 +189,7 @@ void tst_QLibrary::load_data() QTest::newRow("ok (libmylib ver. 1)") << appDir + "/libmylib" <<true; #endif -# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) +# if defined(Q_OS_WIN32) QTest::newRow( "ok01 (with suffix)" ) << appDir + "/mylib.dll" << true; QTest::newRow( "ok02 (with non-standard suffix)" ) << appDir + "/mylib.dl2" << true; QTest::newRow( "ok03 (with many dots)" ) << appDir + "/system.qt.test.mylib.dll" << true; @@ -346,11 +346,7 @@ void tst_QLibrary::errorString_data() QTest::newRow("bad load()") << (int)Load << QString("nosuchlib") << false << QString("Cannot load library nosuchlib: .*"); QTest::newRow("call errorString() on QLibrary with no d-pointer (crashtest)") << (int)(Load | DontSetFileName) << QString() << false << QString("Unknown error"); -#ifdef Q_OS_WINCE - QTest::newRow("bad resolve") << (int)Resolve << appDir + "/mylib" << false << QString("Cannot resolve symbol \"nosuchsymbol\" in .*: .*"); -#else QTest::newRow("bad resolve") << (int)Resolve << appDir + "/mylib" << false << QString("Cannot resolve symbol \"nosuchsymbol\" in \\S+: .*"); -#endif QTest::newRow("good resolve") << (int)Resolve << appDir + "/mylib" << true << QString("Unknown error"); #ifdef Q_OS_WIN @@ -414,7 +410,7 @@ void tst_QLibrary::loadHints_data() QString appDir = QCoreApplication::applicationDirPath(); lh |= QLibrary::ResolveAllSymbolsHint; -# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +# if defined(Q_OS_WIN32) || defined(Q_OS_WINRT) QTest::newRow( "ok01 (with suffix)" ) << appDir + "/mylib.dll" << int(lh) << true; QTest::newRow( "ok02 (with non-standard suffix)" ) << appDir + "/mylib.dl2" << int(lh) << true; QTest::newRow( "ok03 (with many dots)" ) << appDir + "/system.qt.test.mylib.dll" << int(lh) << true; @@ -467,13 +463,8 @@ void tst_QLibrary::fileName_data() QTest::newRow( "ok02" ) << sys_qualifiedLibraryName(QLatin1String("mylib")) << sys_qualifiedLibraryName(QLatin1String("mylib")); #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) -#ifndef Q_OS_WINCE QTest::newRow( "ok03" ) << "user32" << "USER32.dll"; -#else - QTest::newRow( "ok03" ) << "coredll" - << "coredll.dll"; -#endif #endif } diff --git a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp index bc853de24e..499d276ef8 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp +++ b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp @@ -140,11 +140,6 @@ void tst_QPluginLoader::cleanup() void tst_QPluginLoader::errorString() { -#if defined(Q_OS_WINCE) - // On WinCE we need an QCoreApplication object for current dir - int argc = 0; - QCoreApplication app(argc,0); -#endif const QString unknown(QLatin1String("Unknown error")); { diff --git a/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp b/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp index 341bd21e5a..8597bf1a6d 100644 --- a/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp +++ b/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp @@ -350,15 +350,9 @@ const int AlphabetSize = sizeof(alphabet) - 1; const int BufferSize = 4096; // GCD of BufferSize and alphabet size must be 1 char buffer[BufferSize]; -#ifndef Q_OS_WINCE const int ProducerChunkSize = 3; const int ConsumerChunkSize = 7; const int Multiplier = 10; -#else -const int ProducerChunkSize = 2; -const int ConsumerChunkSize = 5; -const int Multiplier = 3; -#endif // note: the code depends on the fact that DataSize is a multiple of // ProducerChunkSize, ConsumerChunkSize, and BufferSize diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index b4d0866d01..06b27f79cd 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -95,9 +95,7 @@ private slots: void requestTermination(); -#ifndef Q_OS_WINCE void stressTest(); -#endif void quitLock(); }; @@ -664,7 +662,7 @@ void NativeThreadWrapper::start(FunctionPointer functionPointer, void *data) #if defined Q_OS_UNIX const int state = pthread_create(&nativeThreadHandle, 0, NativeThreadWrapper::runUnix, this); Q_UNUSED(state); -#elif defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#elif defined(Q_OS_WINRT) nativeThreadHandle = CreateThread(NULL, 0 , (LPTHREAD_START_ROUTINE)NativeThreadWrapper::runWin , this, 0, NULL); #elif defined Q_OS_WIN unsigned thrdid = 0; @@ -684,11 +682,7 @@ void NativeThreadWrapper::join() #if defined Q_OS_UNIX pthread_join(nativeThreadHandle, 0); #elif defined Q_OS_WIN -#ifndef Q_OS_WINCE WaitForSingleObjectEx(nativeThreadHandle, INFINITE, FALSE); -#else - WaitForSingleObject(nativeThreadHandle, INFINITE); -#endif CloseHandle(nativeThreadHandle); #endif } @@ -874,13 +868,8 @@ void tst_QThread::adoptedThreadExecFinished() void tst_QThread::adoptMultipleThreads() { #if defined(Q_OS_WIN) - // Windows CE is not capable of handling that many threads. On the emulator it is dead with 26 threads already. -# if defined(Q_OS_WINCE) - const int numThreads = 20; -# else // need to test lots of threads, so that we exceed MAXIMUM_WAIT_OBJECTS in qt_adopted_thread_watcher() const int numThreads = 200; -# endif #else const int numThreads = 5; #endif @@ -911,13 +900,8 @@ void tst_QThread::adoptMultipleThreads() void tst_QThread::adoptMultipleThreadsOverlap() { #if defined(Q_OS_WIN) - // Windows CE is not capable of handling that many threads. On the emulator it is dead with 26 threads already. -# if defined(Q_OS_WINCE) - const int numThreads = 20; -# else // need to test lots of threads, so that we exceed MAXIMUM_WAIT_OBJECTS in qt_adopted_thread_watcher() const int numThreads = 200; -# endif #else const int numThreads = 5; #endif @@ -950,7 +934,6 @@ void tst_QThread::adoptMultipleThreadsOverlap() QCOMPARE(recorder.activationCount.load(), numThreads); } -#ifndef Q_OS_WINCE // Disconnects on WinCE void tst_QThread::stressTest() { @@ -962,7 +945,6 @@ void tst_QThread::stressTest() t.wait(one_minute); } } -#endif class Syncronizer : public QObject { Q_OBJECT diff --git a/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp b/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp index ba64bf2963..a9af182ed8 100644 --- a/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp +++ b/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp @@ -120,7 +120,7 @@ void tst_QThreadOnce::sameThread() void tst_QThreadOnce::multipleThreads() { -#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS) +#if defined(Q_OS_VXWORKS) const int NumberOfThreads = 20; #else const int NumberOfThreads = 100; diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp index f3eba5c823..4e582cc346 100644 --- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp +++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp @@ -40,10 +40,8 @@ #include <pthread.h> #endif #ifdef Q_OS_WIN -#ifndef Q_OS_WINCE -#include <process.h> -#endif -#include <windows.h> +# include <process.h> +# include <qt_windows.h> #endif class tst_QThreadStorage : public QObject @@ -221,11 +219,7 @@ void tst_QThreadStorage::adoptedThreads() pthread_join(thread, 0); #elif defined Q_OS_WIN && !defined(Q_OS_WINRT) HANDLE thread; -#if defined(Q_OS_WINCE) - thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)testAdoptedThreadStorageWin, &pointers, 0, NULL); -#else thread = (HANDLE)_beginthread(testAdoptedThreadStorageWin, 0, &pointers); -#endif QVERIFY(thread); WaitForSingleObject(thread, INFINITE); #endif diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp index 910d7abf51..586a4446b4 100644 --- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp @@ -34,9 +34,6 @@ #include <qhash.h> #include <limits.h> #include <private/qtools_p.h> -#if defined(Q_OS_WINCE) -#include <qcoreapplication.h> -#endif class tst_QByteArray : public QObject { @@ -246,11 +243,7 @@ void tst_QByteArray::qCompress_data() { QTest::addColumn<QByteArray>("ba"); -#ifndef Q_OS_WINCE const int size1 = 1024*1024; -#else - const int size1 = 1024; -#endif QByteArray ba1( size1, 0 ); QTest::newRow( "00" ) << QByteArray(); @@ -267,11 +260,6 @@ void tst_QByteArray::qCompress_data() ba1.fill( 'A' ); QTest::newRow( "03" ) << ba1; -#if defined(Q_OS_WINCE) - int tmpArgc = 0; - char** tmpArgv = 0; - QCoreApplication app(tmpArgc, tmpArgv); -#endif QFile file( QFINDTESTDATA("rfc3252.txt") ); QVERIFY( file.open(QIODevice::ReadOnly) ); QTest::newRow( "04" ) << file.readAll(); @@ -728,7 +716,7 @@ void tst_QByteArray::qvsnprintf() memset(buf, 42, sizeof(buf)); #ifdef Q_OS_WIN // VS 2005 uses the Qt implementation of vsnprintf. -# if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE) +# if defined(_MSC_VER) QCOMPARE(::qsnprintf(buf, 3, "%s", "bubu"), -1); QCOMPARE(static_cast<const char*>(buf), "bu"); # else diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp index e51f5d4694..92585fd471 100644 --- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp @@ -31,9 +31,6 @@ #include <qfile.h> #include <qstringlist.h> #include <private/qunicodetables_p.h> -#if defined(Q_OS_WINCE) -#include <qcoreapplication.h> -#endif class tst_QChar : public QObject { diff --git a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp index 36bc8621d2..30c7b1bf69 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp @@ -71,8 +71,12 @@ int main(int argc, char *argv[]) // A hidden option QCommandLineOption hiddenOption(QStringList() << QStringLiteral("hidden")); hiddenOption.setDescription(QStringLiteral("THIS SHOULD NEVER APPEAR")); - hiddenOption.setHidden(true); + hiddenOption.setFlags(QCommandLineOption::HiddenFromHelp); parser.addOption(hiddenOption); + QCommandLineOption hiddenOption2(QStringList() << QStringLiteral("hidden2")); + hiddenOption2.setDescription(QStringLiteral("NEITHER SHOULD THIS")); + hiddenOption2.setHidden(true); + parser.addOption(hiddenOption2); // This program supports different options depending on the "command" (first argument). // Call parse() to find out the positional arguments. diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp index 9552152136..a54ad3d9c9 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp @@ -450,6 +450,13 @@ void tst_QCommandLineParser::testSingleDashWordOptionModes_data() << QStringList("abc") << QStringList("val"); QTest::newRow("implicitlylong_with_space") << QCommandLineParser::ParseAsCompactedShortOptions << (QStringList() << "-c" << "val") << QStringList("c") << QStringList("val"); + + QTest::newRow("forceshort_detached") << QCommandLineParser::ParseAsLongOptions << (QStringList() << "-I" << "45") + << QStringList("I") << QStringList("45"); + QTest::newRow("forceshort_attached") << QCommandLineParser::ParseAsLongOptions << (QStringList() << "-I46") + << QStringList("I") << QStringList("46"); + QTest::newRow("forceshort_mixed") << QCommandLineParser::ParseAsLongOptions << (QStringList() << "-I45" << "-nn") + << (QStringList() << "I" << "nn") << QStringList("45"); } void tst_QCommandLineParser::testSingleDashWordOptionModes() @@ -468,6 +475,10 @@ void tst_QCommandLineParser::testSingleDashWordOptionModes() parser.addOption(QCommandLineOption("b", QStringLiteral("b option."))); parser.addOption(QCommandLineOption(QStringList() << "c" << "abc", QStringLiteral("c option."), QStringLiteral("value"))); parser.addOption(QCommandLineOption("nn", QStringLiteral("nn option."))); + QCommandLineOption forceShort(QStringLiteral("I"), QStringLiteral("always short option"), + QStringLiteral("path"), QStringLiteral("default")); + forceShort.setFlags(QCommandLineOption::ShortOptionStyle); + parser.addOption(forceShort); QVERIFY(parser.parse(commandLine)); QCOMPARE(parser.optionNames(), expectedOptionNames); for (int i = 0; i < expectedOptionValues.count(); ++i) @@ -501,9 +512,6 @@ void tst_QCommandLineParser::testVersionOption() #ifdef QT_NO_PROCESS QSKIP("This test requires QProcess support"); #else -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE"); -#endif #if defined(Q_OS_ANDROID) QSKIP("Deploying executable applications to file system on Android not supported."); #endif @@ -570,9 +578,6 @@ void tst_QCommandLineParser::testHelpOption() #ifdef QT_NO_PROCESS QSKIP("This test requires QProcess support"); #else -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE"); -#endif #if defined(Q_OS_ANDROID) QSKIP("Deploying executable applications to file system on Android not supported."); #endif diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index cfec327319..3b791fec70 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -28,10 +28,7 @@ ****************************************************************************/ #include <QtTest/QtTest> -#ifndef Q_OS_WINCE #include <time.h> -#endif - #include <qdatetime.h> #include <private/qdatetime_p.h> @@ -108,10 +105,8 @@ private slots: void msecsTo(); void operator_eqeq_data(); void operator_eqeq(); -#ifndef Q_OS_WINCE void operator_insert_extract_data(); void operator_insert_extract(); -#endif void currentDateTime(); void currentDateTimeUtc(); void currentDateTimeUtc2(); @@ -259,9 +254,7 @@ void tst_QDateTime::initTestCase() void tst_QDateTime::init() { -#if defined(Q_OS_WINCE) - SetUserDefaultLCID(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); -#elif defined(Q_OS_WIN32) +#if defined(Q_OS_WIN32) SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); #endif } @@ -1429,13 +1422,8 @@ void tst_QDateTime::msecsTo() void tst_QDateTime::currentDateTime() { -#if defined(Q_OS_WINCE) - __time64_t buf1, buf2; - ::_time64(&buf1); -#else time_t buf1, buf2; ::time(&buf1); -#endif QDateTime lowerBound; lowerBound.setTime_t(buf1); @@ -1443,11 +1431,8 @@ void tst_QDateTime::currentDateTime() QDateTime dt2 = QDateTime::currentDateTime().toLocalTime(); QDateTime dt3 = QDateTime::currentDateTime().toUTC(); -#if defined(Q_OS_WINCE) - ::_time64(&buf2); -#else ::time(&buf2); -#endif + QDateTime upperBound; upperBound.setTime_t(buf2); // Note we must add 2 seconds here because time() may return up to @@ -1482,13 +1467,9 @@ void tst_QDateTime::currentDateTime() void tst_QDateTime::currentDateTimeUtc() { -#if defined(Q_OS_WINCE) - __time64_t buf1, buf2; - ::_time64(&buf1); -#else time_t buf1, buf2; ::time(&buf1); -#endif + QDateTime lowerBound; lowerBound.setTime_t(buf1); @@ -1496,11 +1477,8 @@ void tst_QDateTime::currentDateTimeUtc() QDateTime dt2 = QDateTime::currentDateTimeUtc().toLocalTime(); QDateTime dt3 = QDateTime::currentDateTimeUtc().toUTC(); -#if defined(Q_OS_WINCE) - ::_time64(&buf2); -#else ::time(&buf2); -#endif + QDateTime upperBound; upperBound.setTime_t(buf2); // Note we must add 2 seconds here because time() may return up to @@ -1859,7 +1837,6 @@ void tst_QDateTime::operator_eqeq() } } -#ifndef Q_OS_WINCE Q_DECLARE_METATYPE(QDataStream::Version) void tst_QDateTime::operator_insert_extract_data() @@ -1988,7 +1965,6 @@ void tst_QDateTime::operator_insert_extract() qputenv("TZ", previousTimeZone.constData()); tzset(); } -#endif void tst_QDateTime::toString_strformat() { diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp index 4336d02b2c..1ec0924254 100644 --- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp +++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp @@ -996,11 +996,7 @@ void tst_QHash::rehash_isnt_quadratic() // this test should be incredibly slow if rehash() is quadratic for (int j = 0; j < 5; ++j) { QHash<int, int> testHash; -#if defined(Q_OS_WINCE) // mobiles do not have infinite mem... - for (int i = 0; i < 50000; ++i) -#else for (int i = 0; i < 500000; ++i) -#endif testHash.insertMulti(1, 1); } } diff --git a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp index 1295a36c1a..3c22770fba 100644 --- a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp +++ b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp @@ -35,10 +35,40 @@ class tst_QLatin1String : public QObject Q_OBJECT private Q_SLOTS: + void at(); + void midLeftRight(); void nullString(); void emptyString(); }; + +void tst_QLatin1String::at() +{ + const QLatin1String l1("Hello World"); + QCOMPARE(l1.at(0), QLatin1Char('H')); + QCOMPARE(l1.at(l1.size() - 1), QLatin1Char('d')); + QCOMPARE(l1[0], QLatin1Char('H')); + QCOMPARE(l1[l1.size() - 1], QLatin1Char('d')); +} + +void tst_QLatin1String::midLeftRight() +{ + const QLatin1String l1("Hello World"); + QCOMPARE(l1.mid(0), l1); + QCOMPARE(l1.mid(0, l1.size()), l1); + QCOMPARE(l1.left(l1.size()), l1); + QCOMPARE(l1.right(l1.size()), l1); + + QCOMPARE(l1.mid(6), QLatin1String("World")); + QCOMPARE(l1.mid(6, 5), QLatin1String("World")); + QCOMPARE(l1.right(5), QLatin1String("World")); + + QCOMPARE(l1.mid(6, 1), QLatin1String("W")); + QCOMPARE(l1.right(5).left(1), QLatin1String("W")); + + QCOMPARE(l1.left(5), QLatin1String("Hello")); +} + void tst_QLatin1String::nullString() { // default ctor diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 352d82796d..80f354671a 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -52,15 +52,6 @@ # include <fenv.h> #endif -#ifdef Q_OS_WINCE -#include <windows.h> // needed for GetUserDefaultLCID -#define _control87 _controlfp -extern "C" DWORD GetThreadLocale(void) { - return GetUserDefaultLCID(); -} - -#endif - #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) # include <stdlib.h> #endif @@ -85,9 +76,7 @@ private slots: #endif void ctor(); -#if !defined(Q_OS_WINCE) void emptyCtor(); -#endif void legacyNames(); void unixLocaleName(); void matchingLocales(); @@ -394,10 +383,7 @@ void tst_QLocale::ctor() #undef TEST_CTOR } -#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS) -// Not when Q_OS_WINCE is defined because the test uses unsupported -// Windows CE QProcess functionality (std streams, env) -// Also Qt needs to be compiled without QT_NO_PROCESS +#if !defined(QT_NO_PROCESS) static inline bool runSysApp(const QString &binary, const QStringList &env, QString *output, @@ -447,7 +433,6 @@ static inline bool runSysAppTest(const QString &binary, } #endif -#if !defined(Q_OS_WINCE) void tst_QLocale::emptyCtor() { #ifdef QT_NO_PROCESS @@ -517,7 +502,6 @@ void tst_QLocale::emptyCtor() #undef TEST_CTOR #endif } -#endif void tst_QLocale::legacyNames() { diff --git a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp index 2f285f3393..a98d37d733 100644 --- a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp +++ b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp @@ -927,11 +927,7 @@ void tst_QRegExp::rainersSlowRegExpCopyBug() { // this test should take an extreme amount of time if QRegExp is broken QRegExp original(email); -#if defined(Q_OS_WINCE) - for (int i = 0; i < 100; ++i) { -#else for (int i = 0; i < 100000; ++i) { -#endif QRegExp copy = original; (void)copy.exactMatch("~"); QRegExp copy2 = original; @@ -980,13 +976,9 @@ void Thread::run() str += "abbbdekcz"; int x; -#if defined(Q_OS_WINCE) - for (int j = 0; j < 100; ++j) { -#else - for (int j = 0; j < 10000; ++j) { -#endif + for (int j = 0; j < 10000; ++j) x = rx.indexIn(str); - } + QCOMPARE(x, 3072); } @@ -1022,13 +1014,9 @@ void Thread2::run() str += "abbbdekcz"; int x; -#if defined(Q_OS_WINCE) - for (int j = 0; j < 100; ++j) { -#else - for (int j = 0; j < 10000; ++j) { -#endif + for (int j = 0; j < 10000; ++j) x = rx.indexIn(str); - } + QCOMPARE(x, 3072); } diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp index 0cccdb8262..7bebe5e9e0 100644 --- a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp @@ -342,7 +342,7 @@ namespace QTest { "\n" "#ifdef Q_OS_WIN\n" "#include <windows.h>\n" - "#if defined(Q_CC_MSVC) && !defined(Q_OS_WINCE)\n" + "#if defined(Q_CC_MSVC)\n" "#include <crtdbg.h>\n" "#endif\n" "static void q_test_setup()\n" @@ -358,7 +358,7 @@ namespace QTest { "#endif\n" "int main(int argc, char **argv)\n" "{\n" - "#if defined(Q_CC_MSVC) && defined(QT_DEBUG) && defined(_DEBUG) && defined(_CRT_ERROR) && !defined(Q_OS_WINCE)\n" + "#if defined(Q_CC_MSVC) && defined(QT_DEBUG) && defined(_DEBUG) && defined(_CRT_ERROR)\n" " _CrtSetReportHook2(_CRT_RPTHOOK_INSTALL, CrtDbgHook);\n" "#endif\n"; diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp index b5912badf2..cefe1e526d 100644 --- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp @@ -1771,13 +1771,11 @@ void tst_QSharedPointer::threadStressTest_data() QTest::newRow("1+1") << 1 << 1; QTest::newRow("2+10") << 2 << 10; -#ifndef Q_OS_WINCE - // Windows CE cannot run this many threads + QTest::newRow("5+10") << 5 << 10; QTest::newRow("5+30") << 5 << 30; QTest::newRow("100+100") << 100 << 100; -#endif } void tst_QSharedPointer::threadStressTest() @@ -1811,11 +1809,7 @@ void tst_QSharedPointer::threadStressTest() base.clear(); -#ifdef Q_OS_WINCE - srand(QDateTime::currentDateTime().toTime_t()); -#else srand(time(NULL)); -#endif // start threads for (int i = 0; i < allThreads.count(); ++i) if (allThreads[i]) allThreads[i]->start(); diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 0a81e3f6bb..9dc564a361 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -37,10 +37,6 @@ # undef QT_ASCII_CAST_WARNINGS #endif -#if defined(Q_OS_WIN) && defined(Q_OS_WINCE) -#define Q_OS_WIN_AND_WINCE -#endif - #include <QtTest/QtTest> #include <qregexp.h> #include <qregularexpression.h> @@ -527,7 +523,7 @@ private slots: void integer_conversion(); void tortureSprintfDouble(); void toNum(); -#if !defined(Q_OS_WIN) || defined(Q_OS_WIN_AND_WINCE) +#if !defined(Q_OS_WIN) void localeAwareCompare_data(); void localeAwareCompare(); #endif @@ -1053,10 +1049,6 @@ void tst_QString::acc_01() QVERIFY(a.isNull()); QVERIFY(*a.toLatin1().constData() == '\0'); { -#if defined(Q_OS_WINCE) - int argc = 0; - QCoreApplication app(argc, 0); -#endif QFile f("COMPARE.txt"); f.open(QIODevice::ReadOnly); QTextStream ts( &f ); @@ -5309,15 +5301,11 @@ void tst_QString::tortureSprintfDouble() #include <locale.h> -#if !defined(Q_OS_WIN) || defined(Q_OS_WIN_AND_WINCE) -// On Q_OS_WIN others than Win CE, we cannot set the system or user locale +#if !defined(Q_OS_WIN) +// On Q_OS_WIN, we cannot set the system or user locale void tst_QString::localeAwareCompare_data() { -#ifdef Q_OS_WIN_AND_WINCE - QTest::addColumn<ulong>("locale"); -#else QTest::addColumn<QString>("locale"); -#endif QTest::addColumn<QString>("s1"); QTest::addColumn<QString>("s2"); QTest::addColumn<int>("result"); @@ -5327,15 +5315,9 @@ void tst_QString::localeAwareCompare_data() Latin-1-specific characters (I think). Compare with Swedish below. */ -#ifdef Q_OS_WIN_AND_WINCE // assume c locale to be english - QTest::newRow("c1") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << 1; - QTest::newRow("c2") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; - QTest::newRow("c3") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1; -#else QTest::newRow("c1") << QString("C") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << 1; QTest::newRow("c2") << QString("C") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; QTest::newRow("c3") << QString("C") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1; -#endif /* It's hard to test English, because it's treated differently @@ -5345,15 +5327,9 @@ void tst_QString::localeAwareCompare_data() comparison of Latin-1 values, although I'm not sure. So I just test digits to make sure that it's not totally broken. */ -#ifdef Q_OS_WIN_AND_WINCE - QTest::newRow("english1") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString("5") << QString("4") << 1; - QTest::newRow("english2") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString("4") << QString("6") << -1; - QTest::newRow("english3") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString("5") << QString("6") << -1; -#else QTest::newRow("english1") << QString("en_US") << QString("5") << QString("4") << 1; QTest::newRow("english2") << QString("en_US") << QString("4") << QString("6") << -1; QTest::newRow("english3") << QString("en_US") << QString("5") << QString("6") << -1; -#endif /* In Swedish, a with ring above (E5) comes before a with diaresis (E4), which comes before o diaresis (F6), which @@ -5364,11 +5340,6 @@ void tst_QString::localeAwareCompare_data() QTest::newRow("swedish2") << QString("sv_SE.ISO8859-1") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; QTest::newRow("swedish3") << QString("sv_SE.ISO8859-1") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1; QTest::newRow("swedish4") << QString("sv_SE.ISO8859-1") << QString::fromLatin1("z") << QString::fromLatin1("\xe5") << -1; -#elif defined(Q_OS_WIN_AND_WINCE) - QTest::newRow("swedish1") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << -1; - QTest::newRow("swedish2") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; - QTest::newRow("swedish3") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1; - QTest::newRow("swedish4") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("z") << QString::fromLatin1("\xe5") << -1; #else QTest::newRow("swedish1") << QString("sv_SE") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << -1; QTest::newRow("swedish2") << QString("sv_SE") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; @@ -5394,10 +5365,6 @@ void tst_QString::localeAwareCompare_data() QTest::newRow("german1") << QString("de_DE.ISO8859-1") << QString::fromLatin1("z") << QString::fromLatin1("\xe4") << 1; QTest::newRow("german2") << QString("de_DE.ISO8859-1") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; QTest::newRow("german3") << QString("de_DE.ISO8859-1") << QString::fromLatin1("z") << QString::fromLatin1("\xf6") << 1; -#elif defined(Q_OS_WIN_AND_WINCE) - QTest::newRow("german1") << MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) << QString::fromLatin1("z") << QString::fromLatin1("\xe4") << 1; - QTest::newRow("german2") << MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; - QTest::newRow("german3") << MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) << QString::fromLatin1("z") << QString::fromLatin1("\xf6") << 1; #else QTest::newRow("german1") << QString("de_DE") << QString::fromLatin1("z") << QString::fromLatin1("\xe4") << 1; QTest::newRow("german2") << QString("de_DE") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; @@ -5407,11 +5374,7 @@ void tst_QString::localeAwareCompare_data() void tst_QString::localeAwareCompare() { -#ifdef Q_OS_WIN_AND_WINCE - QFETCH(ulong, locale); -#else QFETCH(QString, locale); -#endif QFETCH(QString, s1); QFETCH(QString, s2); QFETCH(int, result); @@ -5419,11 +5382,7 @@ void tst_QString::localeAwareCompare() QStringRef r1(&s1, 0, s1.length()); QStringRef r2(&s2, 0, s2.length()); -#ifdef Q_OS_WIN_AND_WINCE - DWORD oldLcid = GetUserDefaultLCID(); - SetUserDefaultLCID(locale); - QCOMPARE(locale, GetUserDefaultLCID()); -#elif defined (Q_OS_MAC) || defined(QT_USE_ICU) +#if defined (Q_OS_DARWIN) || defined(QT_USE_ICU) QSKIP("Setting the locale is not supported on OS X or ICU (you can set the C locale, but that won't affect localeAwareCompare)"); #else if (!locale.isEmpty()) { @@ -5485,14 +5444,10 @@ void tst_QString::localeAwareCompare() QVERIFY(testres == 0); } -#ifdef Q_OS_WIN_AND_WINCE - SetUserDefaultLCID(oldLcid); -#else if (!locale.isEmpty()) setlocale(LC_ALL, ""); -#endif } -#endif //!defined(Q_OS_WIN) || defined(Q_OS_WIN_AND_WINCE) +#endif //!defined(Q_OS_WIN) void tst_QString::reverseIterators() { diff --git a/tests/auto/corelib/tools/qstringapisymmetry/.gitignore b/tests/auto/corelib/tools/qstringapisymmetry/.gitignore new file mode 100644 index 0000000000..d28de05438 --- /dev/null +++ b/tests/auto/corelib/tools/qstringapisymmetry/.gitignore @@ -0,0 +1 @@ +tst_qstringapisymmetry diff --git a/tests/auto/corelib/tools/qstringapisymmetry/qstringapisymmetry.pro b/tests/auto/corelib/tools/qstringapisymmetry/qstringapisymmetry.pro new file mode 100644 index 0000000000..76e89c9acd --- /dev/null +++ b/tests/auto/corelib/tools/qstringapisymmetry/qstringapisymmetry.pro @@ -0,0 +1,5 @@ +CONFIG += testcase +TARGET = tst_qstringapisymmetry +QT = core testlib +SOURCES = tst_qstringapisymmetry.cpp +contains(QT_CONFIG,c++14): CONFIG += c++14 diff --git a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp new file mode 100644 index 0000000000..1557bd6076 --- /dev/null +++ b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp @@ -0,0 +1,191 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com> +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#undef QT_NO_CAST_FROM_ASCII +#undef QT_NO_CAST_TO_ASCII +#undef QT_ASCII_CAST_WARNINGS + +#include <QString> +#include <QChar> +#include <QStringRef> +#include <QLatin1String> + +#include <QTest> + +Q_DECLARE_METATYPE(QLatin1String) +Q_DECLARE_METATYPE(QStringRef) + +template <typename T> +QString toQString(const T &t) { return QString(t); } +QString toQString(const QStringRef &ref) { return ref.toString(); } + +// FIXME: these are missing at the time of writing, add them, then remove the dummies here: +#define MAKE_RELOP(op, A1, A2) \ + static bool operator op (const A1 &lhs, const A2 &rhs) \ + { return toQString(lhs) op toQString(rhs); } \ + /*end*/ +#define MAKE_LESS_ETC(A1, A2) \ + MAKE_RELOP(<, A1, A2) \ + MAKE_RELOP(>, A1, A2) \ + MAKE_RELOP(<=, A1, A2) \ + MAKE_RELOP(>=, A1, A2) \ + /*end*/ +MAKE_RELOP(==, QChar, QLatin1String) +MAKE_RELOP(!=, QChar, QLatin1String) +MAKE_LESS_ETC(QChar, QLatin1String) + +MAKE_LESS_ETC(QChar, QStringRef) +MAKE_LESS_ETC(QStringRef, QChar) + +#undef MAKE_LESS_ETC +#undef MAKE_RELOP +// END FIXME + +class tst_QStringApiSymmetry : public QObject +{ + Q_OBJECT + + void compare_data(bool hasConceptOfNullAndEmpty=true); + template <typename LHS, typename RHS> + void compare_impl() const; + +private Q_SLOTS: + // test all combinations of {QChar, QStringRef, QString, QLatin1String} + void compare_QChar_QChar_data() { compare_data(false); } + void compare_QChar_QChar() { compare_impl<QChar, QChar>(); } + void compare_QChar_QStringRef_data() { compare_data(false); } + void compare_QChar_QStringRef() { compare_impl<QChar, QStringRef>(); } + void compare_QChar_QString_data() { compare_data(false); } + void compare_QChar_QString() { compare_impl<QChar, QString>(); } + void compare_QChar_QLatin1String_data() { compare_data(false); } + void compare_QChar_QLatin1String() { compare_impl<QChar, QLatin1String>(); } + + void compare_QStringRef_QChar_data() { compare_data(false); } + void compare_QStringRef_QChar() { compare_impl<QStringRef, QChar>(); } + void compare_QStringRef_QStringRef_data() { compare_data(); } + void compare_QStringRef_QStringRef() { compare_impl<QStringRef, QStringRef>(); } + void compare_QStringRef_QString_data() { compare_data(); } + void compare_QStringRef_QString() { compare_impl<QStringRef, QString>(); } + void compare_QStringRef_QLatin1String_data() { compare_data(); } + void compare_QStringRef_QLatin1String() { compare_impl<QStringRef, QLatin1String>(); } + + void compare_QString_QChar_data() { compare_data(false); } + void compare_QString_QChar() { compare_impl<QString, QChar>(); } + void compare_QString_QStringRef_data() { compare_data(); } + void compare_QString_QStringRef() { compare_impl<QString, QStringRef>(); } + void compare_QString_QString_data() { compare_data(); } + void compare_QString_QString() { compare_impl<QString, QString>(); } + void compare_QString_QLatin1String_data() { compare_data(); } + void compare_QString_QLatin1String() { compare_impl<QString, QLatin1String>(); } + + void compare_QLatin1String_QChar_data() { compare_data(false); } + void compare_QLatin1String_QChar() { compare_impl<QLatin1String, QChar>(); } + void compare_QLatin1String_QStringRef_data() { compare_data(); } + void compare_QLatin1String_QStringRef() { compare_impl<QLatin1String, QStringRef>(); } + void compare_QLatin1String_QString_data() { compare_data(); } + void compare_QLatin1String_QString() { compare_impl<QLatin1String, QString>(); } + void compare_QLatin1String_QLatin1String_data() { compare_data(); } + void compare_QLatin1String_QLatin1String() { compare_impl<QLatin1String, QLatin1String>(); } + +}; + +void tst_QStringApiSymmetry::compare_data(bool hasConceptOfNullAndEmpty) +{ + QTest::addColumn<QStringRef>("lhsUnicode"); + QTest::addColumn<QLatin1String>("lhsLatin1"); + QTest::addColumn<QStringRef>("rhsUnicode"); + QTest::addColumn<QLatin1String>("rhsLatin1"); + QTest::addColumn<int>("caseSensitiveCompareResult"); + QTest::addColumn<int>("caseInsensitiveCompareResult"); + + if (hasConceptOfNullAndEmpty) { + QTest::newRow("null <> null") << QStringRef() << QLatin1String() + << QStringRef() << QLatin1String() + << 0 << 0; + static const QString empty(""); + QTest::newRow("null <> empty") << QStringRef() << QLatin1String() + << QStringRef(&empty) << QLatin1String("") + << 0 << 0; + } + +#define ROW(lhs, rhs) \ + do { \ + static const QString pinned[] = { \ + QString(QLatin1String(lhs)), \ + QString(QLatin1String(rhs)), \ + }; \ + QTest::newRow("'" lhs "' <> '" rhs "'") \ + << QStringRef(&pinned[0]) << QLatin1String(lhs) \ + << QStringRef(&pinned[1]) << QLatin1String(rhs) \ + << qstrcmp(lhs, rhs) << qstricmp(lhs, rhs); \ + } while (false) + ROW("", "0"); + ROW("0", ""); + ROW("0", "1"); + ROW("0", "0"); +#undef ROW +} + +template <typename String> String make(const QStringRef &sf, QLatin1String l1); +template <> QChar make(const QStringRef &sf, QLatin1String) +{ return sf.isEmpty() ? QChar(QLatin1Char('\0')) : sf.at(0); } +template <> QStringRef make(const QStringRef &sf, QLatin1String) { return sf; } +template <> QString make(const QStringRef &sf, QLatin1String) { return sf.toString(); } +template <> QLatin1String make(const QStringRef &, QLatin1String l1) { return l1; } + +template <typename LHS, typename RHS> +void tst_QStringApiSymmetry::compare_impl() const +{ + QFETCH(QStringRef, lhsUnicode); + QFETCH(QLatin1String, lhsLatin1); + QFETCH(QStringRef, rhsUnicode); + QFETCH(QLatin1String, rhsLatin1); + QFETCH(int, caseSensitiveCompareResult); + + const LHS lhs = make<LHS>(lhsUnicode, lhsLatin1); + const RHS rhs = make<RHS>(rhsUnicode, rhsLatin1); + +#define CHECK(op) \ + do { if (caseSensitiveCompareResult op 0) { \ + QVERIFY(lhs op rhs); \ + } else { \ + QVERIFY(!(lhs op rhs)); \ + } } while (false) + + CHECK(==); + CHECK(!=); + CHECK(<); + CHECK(>); + CHECK(<=); + CHECK(>=); +#undef CHECK +} + +QTEST_APPLESS_MAIN(tst_QStringApiSymmetry) + +#include "tst_qstringapisymmetry.moc" diff --git a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp index dc3547f9ba..0fdafd9b01 100644 --- a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp +++ b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp @@ -32,9 +32,6 @@ #include <qstringlist.h> #include <locale.h> -#ifdef Q_OS_WINCE -#include <windows.h> // needed for GetUserDefaultLCID -#endif class tst_QStringList : public QObject { @@ -205,13 +202,7 @@ void tst_QStringList::sort() list2 << "BETA" << "Gamma" << "alpha" << "beta" << "epsilon" << "gAmma" << "gamma"; QCOMPARE( list1, list2 ); -#ifdef Q_OS_WINCE - DWORD oldLcid = GetUserDefaultLCID(); - // Assume c locale to be english - SetUserDefaultLCID(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); -#else char *current_locale = setlocale(LC_ALL, "C"); -#endif QStringList list3, list4; list3 << "alpha" << "beta" << "BETA" << "gamma" << "Gamma" << "gAmma" << "epsilon"; list3.sort(Qt::CaseInsensitive); @@ -224,11 +215,7 @@ void tst_QStringList::sort() QCOMPARE(list4.at(0), QString("alpha")); QVERIFY(list4.indexOf("epsilon") > 0); QVERIFY(list4.indexOf("epsilon") < (list4.count() - 1)); -#ifdef Q_OS_WINCE - SetUserDefaultLCID(oldLcid); -#else setlocale(LC_ALL, current_locale); -#endif } void tst_QStringList::replaceInStrings() diff --git a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp index 83838570be..cd2cdab11b 100644 --- a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp +++ b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp @@ -68,11 +68,7 @@ protected: void tst_QTimeLine::range() { -#ifdef Q_OS_WINCE //On WinCE timer resolution is bad - using longer times instead - QTimeLine timeLine(2000); -#else QTimeLine timeLine(200); -#endif QCOMPARE(timeLine.startFrame(), 0); QCOMPARE(timeLine.endFrame(), 0); timeLine.setFrameRange(0, 1); diff --git a/tests/auto/corelib/tools/qtimezone/BLACKLIST b/tests/auto/corelib/tools/qtimezone/BLACKLIST index 665e78bc08..d74ec33209 100644 --- a/tests/auto/corelib/tools/qtimezone/BLACKLIST +++ b/tests/auto/corelib/tools/qtimezone/BLACKLIST @@ -1,2 +1,3 @@ [tzTest] opensuse-13.1 +opensuse-42.1 diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro index f9e1c454e7..5fe8c13e25 100644 --- a/tests/auto/corelib/tools/tools.pro +++ b/tests/auto/corelib/tools/tools.pro @@ -51,6 +51,7 @@ SUBDIRS=\ qstl \ qstring \ qstring_no_cast_from_bytearray \ + qstringapisymmetry \ qstringbuilder \ qstringiterator \ qstringlist \ diff --git a/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro index 485472c70c..46bfb2a586 100644 --- a/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro +++ b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro @@ -3,14 +3,5 @@ TARGET = tst_qicoimageformat SOURCES+= tst_qicoimageformat.cpp QT += testlib -wince { - CONFIG(debug, debug|release):{ - addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qico4d.dll - } else { - addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qico4.dll - } - addPlugins.path = imageformats - DEPLOYMENT += addPlugins -} TESTDATA += icons/* android:RESOURCES+=qicoimageformat.qrc diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp index 3c4610a892..b728d095d7 100644 --- a/tests/auto/gui/image/qicon/tst_qicon.cpp +++ b/tests/auto/gui/image/qicon/tst_qicon.cpp @@ -393,7 +393,6 @@ void tst_QIcon::addFile() icon.addFile(QLatin1String(":/styles/commonstyle/images/standardbutton-save-32.png"), QSize(), QIcon::Selected); icon.addFile(QLatin1String(":/styles/commonstyle/images/standardbutton-save-128.png"), QSize(), QIcon::Selected); -#ifndef Q_OS_WINCE QVERIFY(icon.pixmap(16, QIcon::Normal).toImage() == QPixmap(QLatin1String(":/styles/commonstyle/images/standardbutton-open-16.png")).toImage()); QVERIFY(icon.pixmap(32, QIcon::Normal).toImage() == @@ -406,13 +405,6 @@ void tst_QIcon::addFile() QPixmap(QLatin1String(":/styles/commonstyle/images/standardbutton-save-32.png")).toImage()); QVERIFY(icon.pixmap(128, QIcon::Selected).toImage() == QPixmap(QLatin1String(":/styles/commonstyle/images/standardbutton-save-128.png")).toImage()); -#else - // WinCE only includes the 16x16 images for size reasons - QVERIFY(icon.pixmap(16, QIcon::Normal).toImage() == - QPixmap(QLatin1String(":/styles/commonstyle/images/standardbutton-open-16.png")).toImage()); - QVERIFY(icon.pixmap(16, QIcon::Selected).toImage() == - QPixmap(QLatin1String(":/styles/commonstyle/images/standardbutton-save-16.png")).toImage()); -#endif } static bool sizeLess(const QSize &a, const QSize &b) diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 91df1ca520..cc75846fdd 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -290,17 +290,13 @@ void tst_QImage::swap() void tst_QImage::create() { bool cr = true; -#if !defined(Q_OS_WINCE) QT_TRY { -#endif //QImage image(7000000, 7000000, 8, 256, QImage::IgnoreEndian); QImage image(7000000, 7000000, QImage::Format_Indexed8); image.setColorCount(256); cr = !image.isNull(); -#if !defined(Q_OS_WINCE) } QT_CATCH (...) { } -#endif QVERIFY( !cr ); } @@ -1785,11 +1781,7 @@ void tst_QImage::smoothScale4() void tst_QImage::smoothScaleBig() { -#if defined(Q_OS_WINCE) - int bigValue = 2000; -#else int bigValue = 200000; -#endif QImage tall(4, bigValue, QImage::Format_ARGB32); tall.fill(0x0); diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp index c12c8a9cf4..f48fab4f0a 100644 --- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp @@ -508,9 +508,6 @@ void tst_QImageWriter::saveToTemporaryFile() QVERIFY(writer.write(image)); else qWarning() << file.errorString(); -#if defined(Q_OS_WINCE) - file.reset(); -#endif QCOMPARE(QImage(writer.fileName()), image); } { @@ -529,9 +526,6 @@ void tst_QImageWriter::saveToTemporaryFile() QVERIFY2(file.open(), qPrintable(file.errorString())); QImageWriter writer(&file, "PNG"); QVERIFY(writer.write(image)); -#if defined(Q_OS_WINCE) - file.reset(); -#endif QCOMPARE(QImage(writer.fileName()), image); } { diff --git a/tests/auto/gui/image/qpixmap/qpixmap.pro b/tests/auto/gui/image/qpixmap/qpixmap.pro index 5a4656998a..e6a020af1a 100644 --- a/tests/auto/gui/image/qpixmap/qpixmap.pro +++ b/tests/auto/gui/image/qpixmap/qpixmap.pro @@ -5,9 +5,7 @@ QT += core-private gui-private testlib qtHaveModule(widgets): QT += widgets widgets-private SOURCES += tst_qpixmap.cpp -!wince:!winrt { - win32:LIBS += -lgdi32 -luser32 -} +win32:!winrt:LIBS += -lgdi32 -luser32 RESOURCES += qpixmap.qrc TESTDATA += convertFromImage/* convertFromToHICON/* loadFromData/* images/* diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp index 6adfe05fb0..79d3a57d73 100644 --- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp @@ -442,22 +442,16 @@ void tst_QPixmap::fill_data() QTest::newRow(("syscolor_" + QByteArray::number(color)).constData()) << uint(color) << true << false; -#if defined (Q_OS_WINCE) - QPixmap pixmap(1,1); - if (QApplication::desktop()->grab().depth() >= 24) { -#else - QPixmap pixmap(1, 1); { -#endif - QTest::newRow("alpha_7f_red") << 0x7fff0000u << false << false; - QTest::newRow("alpha_3f_blue") << 0x3f0000ffu << false << false; - QTest::newRow("alpha_b7_green") << 0xbf00ff00u << false << false; - QTest::newRow("alpha_7f_white") << 0x7fffffffu << false << false; - QTest::newRow("alpha_3f_white") << 0x3fffffffu << false << false; - QTest::newRow("alpha_b7_white") << 0xb7ffffffu << false << false; - QTest::newRow("alpha_7f_black") << 0x7f000000u << false << false; - QTest::newRow("alpha_3f_black") << 0x3f000000u << false << false; - QTest::newRow("alpha_b7_black") << 0xbf000000u << false << false; - } + QPixmap pixmap(1, 1); + QTest::newRow("alpha_7f_red") << 0x7fff0000u << false << false; + QTest::newRow("alpha_3f_blue") << 0x3f0000ffu << false << false; + QTest::newRow("alpha_b7_green") << 0xbf00ff00u << false << false; + QTest::newRow("alpha_7f_white") << 0x7fffffffu << false << false; + QTest::newRow("alpha_3f_white") << 0x3fffffffu << false << false; + QTest::newRow("alpha_b7_white") << 0xb7ffffffu << false << false; + QTest::newRow("alpha_7f_black") << 0x7f000000u << false << false; + QTest::newRow("alpha_3f_black") << 0x3f000000u << false << false; + QTest::newRow("alpha_b7_black") << 0xbf000000u << false << false; QTest::newRow("bitmap_color0") << uint(Qt::color0) << true << true; QTest::newRow("bitmap_color1") << uint(Qt::color1) << true << true; @@ -891,9 +885,6 @@ void tst_QPixmap::fromWinHBITMAP() HGDIOBJ old_brush = SelectObject(bitmap_dc, CreateSolidBrush(RGB(red, green, blue))); Rectangle(bitmap_dc, 0, 0, 100, 100); -#ifdef Q_OS_WINCE //the device context has to be deleted before QPixmap::fromWinHBITMAP() - DeleteDC(bitmap_dc); -#endif QPixmap pixmap = qt_pixmapFromWinHBITMAP(bitmap); QCOMPARE(pixmap.width(), 100); QCOMPARE(pixmap.height(), 100); @@ -906,9 +897,7 @@ void tst_QPixmap::fromWinHBITMAP() DeleteObject(SelectObject(bitmap_dc, old_brush)); DeleteObject(SelectObject(bitmap_dc, bitmap)); -#ifndef Q_OS_WINCE DeleteDC(bitmap_dc); -#endif ReleaseDC(0, display_dc); } @@ -1010,7 +999,6 @@ void tst_QPixmap::fromWinHICON_data() void tst_QPixmap::fromWinHICON() { -#ifndef Q_OS_WINCE QFETCH(int, width); QFETCH(int, height); QFETCH(QString, image); @@ -1028,7 +1016,6 @@ void tst_QPixmap::fromWinHICON() // between QImage::Format_ARGB32 and QImage::Format_ARGB32_Premultiplied, or elsewhere QVERIFY(compareImages(imageFromHICON, imageFromFile)); -#endif // Q_OS_WINCE } #endif // Q_OS_WIN && !Q_OS_WINRT diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro index 5000e1a926..317d8c1ff9 100644 --- a/tests/auto/gui/kernel/kernel.pro +++ b/tests/auto/gui/kernel/kernel.pro @@ -25,7 +25,7 @@ SUBDIRS=\ qopenglwindow \ qrasterwindow -win32:!wince:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop +win32:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop !qtHaveModule(widgets): SUBDIRS -= \ qmouseevent_modal \ diff --git a/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro b/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro index a42b359f29..5e4875d1e7 100644 --- a/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro +++ b/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro @@ -5,4 +5,4 @@ QT += core-private network gui-private testlib SOURCES += tst_noqteventloop.cpp -contains(QT_CONFIG,dynamicgl):win32:!wince*:!winrt: LIBS += -luser32 +contains(QT_CONFIG,dynamicgl):win32:!winrt: LIBS += -luser32 diff --git a/tests/auto/gui/kernel/qclipboard/copier/main.cpp b/tests/auto/gui/kernel/qclipboard/copier/main.cpp index 22f2aa3bb8..32e91a9939 100644 --- a/tests/auto/gui/kernel/qclipboard/copier/main.cpp +++ b/tests/auto/gui/kernel/qclipboard/copier/main.cpp @@ -33,11 +33,9 @@ int main(int argc, char **argv) { QGuiApplication app(argc, argv); QString paste = QStringLiteral("testString.!"); -#ifndef Q_OS_WINCE const QStringList arguments = app.arguments(); if (arguments.size() > 1) paste = arguments.at(1); -#endif #ifndef QT_NO_CLIPBOARD QGuiApplication::clipboard()->setText(paste); #endif diff --git a/tests/auto/gui/kernel/qclipboard/paster/main.cpp b/tests/auto/gui/kernel/qclipboard/paster/main.cpp index c96d903fb7..7fca8af1cb 100644 --- a/tests/auto/gui/kernel/qclipboard/paster/main.cpp +++ b/tests/auto/gui/kernel/qclipboard/paster/main.cpp @@ -66,13 +66,9 @@ int main(int argc, char **argv) return 0; } -#ifndef Q_OS_WINCE QString expected; if (parser.isSet(textOption)) expected = parser.value(textOption); -#else // !Q_OS_WINCE - const QString expected = QStringLiteral("testString.!"); -#endif // Q_OS_WINCE if (!expected.isEmpty()) { #ifndef QT_NO_CLIPBOARD const QString actual = QGuiApplication::clipboard()->text(); diff --git a/tests/auto/gui/kernel/qclipboard/test/test.pro b/tests/auto/gui/kernel/qclipboard/test/test.pro index 40bf9c8d8e..59b77b11ba 100644 --- a/tests/auto/gui/kernel/qclipboard/test/test.pro +++ b/tests/auto/gui/kernel/qclipboard/test/test.pro @@ -13,10 +13,6 @@ win32 { } } -wince* { - DEPLOYMENT += rsc reg_resource -} - !winrt: TEST_HELPER_INSTALLS = \ ../copier/copier \ ../paster/paster diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp index 6bad45fefe..bfa15744c2 100644 --- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp +++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp @@ -313,10 +313,6 @@ void tst_QClipboard::setMimeData() QMimeData *mimeData = new QMimeData; const QString TestName(QLatin1String("tst_QClipboard::setMimeData() mimeData")); mimeData->setObjectName(TestName); -#if defined(Q_OS_WINCE) - // need to set text on CE - mimeData->setText(QLatin1String("Qt/CE foo")); -#endif QGuiApplication::clipboard()->setMimeData(mimeData); QCOMPARE(QGuiApplication::clipboard()->mimeData(), (const QMimeData *)mimeData); diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp index 0d0b6ae81e..6394a956bd 100644 --- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp @@ -725,7 +725,7 @@ void tst_QKeySequence::listFromString() void tst_QKeySequence::translated_data() { -#if defined (Q_OS_MAC) || defined (Q_OS_WINCE) +#if defined (Q_OS_DARWIN) QSKIP("Test not applicable"); #endif @@ -756,7 +756,7 @@ void tst_QKeySequence::translated_data() void tst_QKeySequence::translated() { -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QFETCH(QString, transKey); QFETCH(QString, compKey); diff --git a/tests/auto/gui/kernel/qwindow/qwindow.pro b/tests/auto/gui/kernel/qwindow/qwindow.pro index 08e1b1d3a0..f975e00ffa 100644 --- a/tests/auto/gui/kernel/qwindow/qwindow.pro +++ b/tests/auto/gui/kernel/qwindow/qwindow.pro @@ -5,4 +5,4 @@ QT += core-private gui-private testlib SOURCES += tst_qwindow.cpp -contains(QT_CONFIG,dynamicgl):win32:!wince:!winrt: LIBS += -luser32 +contains(QT_CONFIG,dynamicgl):win32:!winrt: LIBS += -luser32 diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 892dc0899f..1756dab70a 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -40,7 +40,7 @@ #if defined(Q_OS_QNX) #include <QOpenGLContext> -#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT) # include <QtCore/qt_windows.h> #endif @@ -2079,7 +2079,7 @@ void tst_QWindow::modalWindowEnterEventOnHide_QTBUG35109() static bool isNativeWindowVisible(const QWindow *window) { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) return IsWindowVisible(reinterpret_cast<HWND>(window->winId())); #else Q_UNIMPLEMENTED(); diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 8a97a9261f..d2cc7ce072 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -39,9 +39,7 @@ #include <qimage.h> #include <qthread.h> #include <limits.h> -#if !defined(Q_OS_WINCE) #include <math.h> -#endif #include <qpaintengine.h> #ifndef QT_NO_WIDGETS #include <qdesktopwidget.h> diff --git a/tests/auto/gui/painting/qregion/tst_qregion.cpp b/tests/auto/gui/painting/qregion/tst_qregion.cpp index d24435198e..6a297dbfc2 100644 --- a/tests/auto/gui/painting/qregion/tst_qregion.cpp +++ b/tests/auto/gui/painting/qregion/tst_qregion.cpp @@ -47,6 +47,7 @@ public: private slots: void moveSemantics(); void boundingRect(); + void rangeFor(); void rects(); void swap(); void setRects(); @@ -136,17 +137,34 @@ void tst_QRegion::boundingRect() } +void tst_QRegion::rangeFor() +{ + // compile-only test for range-for over QRegion, so really useless + // content otherwise: + QRect rect(10, -20, 30, 40); + QRegion region(rect); + int equal = 0; + for (const QRect &r : region) // check this compiles + equal += int(r == rect); // can't use QCOMPARE here b/c of the + // MSVC 201272013 parse bug re: + // do-while in range-for loops + QCOMPARE(equal, 1); +} + void tst_QRegion::rects() { { QRect rect; QRegion region(rect); QVERIFY(region.isEmpty()); + QCOMPARE(region.begin(), region.end()); QVERIFY(region.rects().isEmpty()); } { QRect rect(10, -20, 30, 40); QRegion region(rect); + QCOMPARE(region.end(), region.begin() + 1); + QCOMPARE(*region.begin(), rect); QCOMPARE(region.rects().count(), 1); QCOMPARE(region.rects()[0], rect); } @@ -192,6 +210,7 @@ void tst_QRegion::setRects() region.setRects(&rect, 0); QVERIFY(region.isEmpty()); QCOMPARE(region, QRegion()); + QCOMPARE(region.begin(), region.end()); QVERIFY(!region.boundingRect().isValid()); QVERIFY(region.rects().isEmpty()); } @@ -199,6 +218,7 @@ void tst_QRegion::setRects() QRegion region; QRect rect; region.setRects(&rect, 1); + QCOMPARE(region.begin(), region.end()); QVERIFY(!region.boundingRect().isValid()); QVERIFY(region.rects().isEmpty()); } @@ -206,8 +226,10 @@ void tst_QRegion::setRects() QRegion region; QRect rect(10, -20, 30, 40); region.setRects(&rect, 1); + QCOMPARE(region.end(), region.begin() + 1); QCOMPARE(region.rects().count(), 1); QCOMPARE(region.rects()[0], rect); + QCOMPARE(*region.begin(), rect); } } @@ -320,8 +342,12 @@ void tst_QRegion::emptyPolygonRegion() QRegion r(pa); QTEST(r.isEmpty(), "isEmpty"); + QTEST(int(std::distance(r.begin(), r.end())), "numRects"); + QVector<QRect> rects; + std::copy(r.begin(), r.end(), std::back_inserter(rects)); QTEST(r.rects().count(), "numRects"); QTEST(r.rects(), "rects"); + QCOMPARE(r.rects(), rects); } @@ -860,6 +886,7 @@ void tst_QRegion::isEmpty() QFETCH(QRegion, region); QVERIFY(region.isEmpty()); + QCOMPARE(region.begin(), region.end()); QCOMPARE(region, QRegion()); QCOMPARE(region.rectCount(), 0); QCOMPARE(region.boundingRect(), QRect()); @@ -892,6 +919,11 @@ void tst_QRegion::regionFromPath() path.addRect(0, 100, 100, 1000); QRegion rgn(path.toFillPolygon().toPolygon()); + + QCOMPARE(rgn.end(), rgn.begin() + 2); + QCOMPARE(rgn.begin()[0], QRect(0, 0, 10, 10)); + QCOMPARE(rgn.begin()[1], QRect(0, 100, 100, 1000)); + QCOMPARE(rgn.rects().size(), 2); QCOMPARE(rgn.rects().at(0), QRect(0, 0, 10, 10)); QCOMPARE(rgn.rects().at(1), QRect(0, 100, 100, 1000)); @@ -905,8 +937,14 @@ void tst_QRegion::regionFromPath() path.addRect(10, 10, 80, 80); QRegion rgn(path.toFillPolygon().toPolygon()); - QCOMPARE(rgn.rects().size(), 4); + QCOMPARE(rgn.end(), rgn.begin() + 4); + QCOMPARE(rgn.begin()[0], QRect(0, 0, 100, 10)); + QCOMPARE(rgn.begin()[1], QRect(0, 10, 10, 80)); + QCOMPARE(rgn.begin()[2], QRect(90, 10, 10, 80)); + QCOMPARE(rgn.begin()[3], QRect(0, 90, 100, 10)); + + QCOMPARE(rgn.rects().size(), 4); QCOMPARE(rgn.rects().at(0), QRect(0, 0, 100, 10)); QCOMPARE(rgn.rects().at(1), QRect(0, 10, 10, 80)); QCOMPARE(rgn.rects().at(2), QRect(90, 10, 10, 80)); diff --git a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp index e05d7dd022..a79526c434 100644 --- a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp +++ b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp @@ -114,7 +114,7 @@ void tst_QWMatrix::mapping_data() << QRect( 0, 0, 30, 40 ) << QPolygon( QRect( -300, -400, 300, 400 ) ); -#if (defined(Q_OS_WIN) || defined(Q_OS_WINCE)) && !defined(M_PI) +#if defined(Q_OS_WIN) && !defined(M_PI) #define M_PI 3.14159265897932384626433832795f #endif diff --git a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp index d3404e335a..9542d306ba 100644 --- a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp +++ b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp @@ -48,6 +48,8 @@ private slots: void getSetCheck(); void maximumBlockCount(); void anchorAt(); + void imageAt(); + void formatAt(); }; tst_QAbstractTextDocumentLayout::tst_QAbstractTextDocumentLayout() @@ -156,7 +158,7 @@ void tst_QAbstractTextDocumentLayout::anchorAt() // anchorAt on start returns link QRect linkBr = metrics.boundingRect("foo"); - QPointF linkPoint(linkBr.width() + blockStart.x(), (linkBr.height() / 2) + blockStart.y()); + QPointF linkPoint((linkBr.width() / 2) + blockStart.x(), (linkBr.height() / 2) + blockStart.y()); QCOMPARE(documentLayout->anchorAt(linkPoint), QString("link")); // anchorAt() on top of preedit at end should not assert @@ -171,5 +173,61 @@ void tst_QAbstractTextDocumentLayout::anchorAt() QCOMPARE(documentLayout->anchorAt(preeditPoint), QString()); } +void tst_QAbstractTextDocumentLayout::imageAt() +{ + QTextDocument doc; + doc.setHtml("foo<a href=\"link\"><img src=\"image\" width=\"50\" height=\"50\"/></a>"); + QAbstractTextDocumentLayout *documentLayout = doc.documentLayout(); + QTextBlock firstBlock = doc.begin(); + QTextLayout *layout = firstBlock.layout(); + layout->setPreeditArea(doc.toPlainText().length(), "xxx"); + + doc.setPageSize(QSizeF(1000, 1000)); + QFontMetrics metrics(layout->font()); + QPointF blockStart = documentLayout->blockBoundingRect(firstBlock).topLeft(); + + QRect fooBr = metrics.boundingRect("foo"); + QPointF imagePoint(fooBr.width() + blockStart.x() + 25, blockStart.y() + 25); + // imageAt on image returns source + QCOMPARE(documentLayout->imageAt(imagePoint), QString("image")); + // anchorAt on image returns link + QCOMPARE(documentLayout->anchorAt(imagePoint), QString("link")); + + // imageAt on start returns nothing (there's the "foo" text) + QPointF fooPoint(fooBr.width() + blockStart.x(), (fooBr.height() / 2) + blockStart.y()); + QCOMPARE(documentLayout->imageAt(fooPoint), QString()); +} + +void tst_QAbstractTextDocumentLayout::formatAt() +{ + QTextDocument doc; + doc.setHtml("foo<i><a href=\"link\"><img src=\"image\" width=\"50\" height=\"50\"/></a></i>"); + QAbstractTextDocumentLayout *documentLayout = doc.documentLayout(); + QTextBlock firstBlock = doc.begin(); + QTextLayout *layout = firstBlock.layout(); + layout->setPreeditArea(doc.toPlainText().length(), "xxx"); + + doc.setPageSize(QSizeF(1000, 1000)); + QFontMetrics metrics(layout->font()); + QPointF blockStart = documentLayout->blockBoundingRect(firstBlock).topLeft(); + + QRect fooBr = metrics.boundingRect("foo"); + QPointF imagePoint(fooBr.width() + blockStart.x() + 25, blockStart.y() + 25); + + QTextFormat format = documentLayout->formatAt(imagePoint); + QVERIFY(format.isCharFormat()); + QVERIFY(format.toCharFormat().isAnchor()); + QVERIFY(format.toCharFormat().fontItalic()); + QVERIFY(format.isImageFormat()); + + // move over the unformatted "foo" text) + QPointF fooPoint(fooBr.width() + blockStart.x(), (fooBr.height() / 2) + blockStart.y()); + format = documentLayout->formatAt(fooPoint); + QVERIFY(format.isCharFormat()); + QVERIFY(!format.toCharFormat().isAnchor()); + QVERIFY(!format.toCharFormat().fontItalic()); + QVERIFY(!format.isImageFormat()); +} + QTEST_MAIN(tst_QAbstractTextDocumentLayout) #include "tst_qabstracttextdocumentlayout.moc" diff --git a/tests/auto/gui/text/qcssparser/qcssparser.pro b/tests/auto/gui/text/qcssparser/qcssparser.pro index 88d1fcfd2d..b92859d4fb 100644 --- a/tests/auto/gui/text/qcssparser/qcssparser.pro +++ b/tests/auto/gui/text/qcssparser/qcssparser.pro @@ -6,14 +6,6 @@ QT += xml gui-private testlib requires(contains(QT_CONFIG,private_tests)) DEFINES += SRCDIR=\\\"$$PWD\\\" -wince* { - addFiles.files = testdata - addFiles.path = . - timesFont.files = C:/Windows/Fonts/times.ttf - timesFont.path = . - DEPLOYMENT += addFiles timesFont -} - android { RESOURCES += \ testdata.qrc diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp index 847d6e2e2f..51e9bf646a 100644 --- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp @@ -27,9 +27,6 @@ ****************************************************************************/ #include <QtTest/QtTest> #include <QtXml/QtXml> -#if defined(Q_OS_WINCE) -#include <QtGui/QFontDatabase> -#endif #include <QtGui/QFontInfo> #include <QtGui/QFontMetrics> @@ -39,10 +36,6 @@ class tst_QCssParser : public QObject { Q_OBJECT -public slots: - void initTestCase(); - void cleanupTestCase(); - private slots: void scanner_data(); void scanner(); @@ -85,33 +78,8 @@ private slots: void extractBorder(); void noTextDecoration(); void quotedAndUnquotedIdentifiers(); - -private: -#if defined(Q_OS_WINCE) - int m_timesFontId; -#endif }; -void tst_QCssParser::initTestCase() -{ -#if defined(Q_OS_WINCE) - QFontDatabase fontDB; - m_timesFontId = -1; - if (!fontDB.families().contains("Times New Roman")) { - m_timesFontId = QFontDatabase::addApplicationFont("times.ttf"); - QVERIFY(m_timesFontId != -1); - } -#endif -} - -void tst_QCssParser::cleanupTestCase() -{ -#if defined(Q_OS_WINCE) - if (m_timesFontId != -1) - QFontDatabase::removeApplicationFont(m_timesFontId); -#endif -} - void tst_QCssParser::scanner_data() { QTest::addColumn<QString>("input"); @@ -119,7 +87,7 @@ void tst_QCssParser::scanner_data() #if defined(Q_OS_ANDROID) QDir d(":/"); -#elif !defined(Q_OS_IRIX) && !defined(Q_OS_WINCE) +#elif !defined(Q_OS_IRIX) QDir d(SRCDIR); #else QDir d(QDir::current()); diff --git a/tests/auto/gui/text/qfont/BLACKLIST b/tests/auto/gui/text/qfont/BLACKLIST index d859dee03e..8890ec1ef3 100644 --- a/tests/auto/gui/text/qfont/BLACKLIST +++ b/tests/auto/gui/text/qfont/BLACKLIST @@ -1,2 +1,4 @@ [exactMatch] +# QTBUG-46054 opensuse-13.1 +opensuse-42.1 diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index 57530653c1..188c35c14c 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -656,11 +656,11 @@ void tst_QFont::defaultFamily_data() QTest::addColumn<QFont::StyleHint>("styleHint"); QTest::addColumn<QStringList>("acceptableFamilies"); - QTest::newRow("serif") << QFont::Serif << (QStringList() << "Times New Roman" << "Times" << "Droid Serif" << getPlatformGenericFont("serif")); - QTest::newRow("monospace") << QFont::Monospace << (QStringList() << "Courier New" << "Monaco" << "Droid Sans Mono" << getPlatformGenericFont("monospace")); - QTest::newRow("cursive") << QFont::Cursive << (QStringList() << "Comic Sans MS" << "Apple Chancery" << "Roboto" << "Droid Sans" << getPlatformGenericFont("cursive")); - QTest::newRow("fantasy") << QFont::Fantasy << (QStringList() << "Impact" << "Zapfino" << "Roboto" << "Droid Sans" << getPlatformGenericFont("fantasy")); - QTest::newRow("sans-serif") << QFont::SansSerif << (QStringList() << "Arial" << "Lucida Grande" << "Roboto" << "Droid Sans" << getPlatformGenericFont("sans-serif")); + QTest::newRow("serif") << QFont::Serif << (QStringList() << "Times New Roman" << "Times" << "Droid Serif" << getPlatformGenericFont("serif").split(",")); + QTest::newRow("monospace") << QFont::Monospace << (QStringList() << "Courier New" << "Monaco" << "Droid Sans Mono" << getPlatformGenericFont("monospace").split(",")); + QTest::newRow("cursive") << QFont::Cursive << (QStringList() << "Comic Sans MS" << "Apple Chancery" << "Roboto" << "Droid Sans" << getPlatformGenericFont("cursive").split(",")); + QTest::newRow("fantasy") << QFont::Fantasy << (QStringList() << "Impact" << "Zapfino" << "Roboto" << "Droid Sans" << getPlatformGenericFont("fantasy").split(",")); + QTest::newRow("sans-serif") << QFont::SansSerif << (QStringList() << "Arial" << "Lucida Grande" << "Roboto" << "Droid Sans" << getPlatformGenericFont("sans-serif").split(",")); } void tst_QFont::defaultFamily() diff --git a/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro b/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro index 5dba2fc06a..0aff8a3ac8 100644 --- a/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro +++ b/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro @@ -3,12 +3,6 @@ TARGET = tst_qfontdatabase SOURCES += tst_qfontdatabase.cpp QT += testlib core-private gui-private -wince* { - additionalFiles.files = FreeMono.ttf - additionalFiles.path = . - DEPLOYMENT += additionalFiles -} - android { RESOURCES += testdata.qrc } diff --git a/tests/auto/gui/text/qglyphrun/qglyphrun.pro b/tests/auto/gui/text/qglyphrun/qglyphrun.pro index 3abca8ce89..c08019a561 100644 --- a/tests/auto/gui/text/qglyphrun/qglyphrun.pro +++ b/tests/auto/gui/text/qglyphrun/qglyphrun.pro @@ -6,12 +6,5 @@ SOURCES += \ tst_qglyphrun.cpp -wince* { - additionalFiles.files = test.ttf - additionalFiles.path = ../../../shared/resources/ - DEPLOYMENT += additionalFiles -} else { - RESOURCES += \ - testdata.qrc -} - +RESOURCES += \ + testdata.qrc diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index 04e6bba91e..ea2b6a12f7 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -2899,15 +2899,28 @@ void tst_QTextDocument::testUndoBlocks() doc->undo(); QCOMPARE(doc->toPlainText(), QString("")); + cursor.insertText("town"); + cursor.beginEditBlock(); // Edit block 1 - Deletion/Insertion + cursor.setPosition(0, QTextCursor::KeepAnchor); + cursor.insertText("r"); + cursor.endEditBlock(); + cursor.insertText("est"); // Merged into edit block 1 + QCOMPARE(doc->toPlainText(), QString("rest")); + doc->undo(); + QCOMPARE(doc->toPlainText(), QString("town")); + doc->undo(); + QCOMPARE(doc->toPlainText(), QString("")); + + // This case would not happen in practice. If the user typed out this text, it would all be part of one + // edit block. This would cause the undo to clear all text. But for the purpose of testing the beginEditBlock + // and endEditBlock calls with respect to qtextdocument this is tested. cursor.insertText("quod"); - cursor.beginEditBlock(); + cursor.beginEditBlock(); // Edit block 1 - Insertion cursor.insertText(" erat"); cursor.endEditBlock(); - cursor.insertText(" demonstrandum"); + cursor.insertText(" demonstrandum"); // Merged into edit block 1 QCOMPARE(doc->toPlainText(), QString("quod erat demonstrandum")); doc->undo(); - QCOMPARE(doc->toPlainText(), QString("quod erat")); - doc->undo(); QCOMPARE(doc->toPlainText(), QString("quod")); doc->undo(); QCOMPARE(doc->toPlainText(), QString("")); diff --git a/tests/auto/gui/text/qzip/qzip.pro b/tests/auto/gui/text/qzip/qzip.pro index ebcd6ec022..eb3de04da6 100644 --- a/tests/auto/gui/text/qzip/qzip.pro +++ b/tests/auto/gui/text/qzip/qzip.pro @@ -3,12 +3,6 @@ TARGET = tst_qzip QT += gui-private testlib SOURCES += tst_qzip.cpp -wince* { - addFiles.files = testdata - addFiles.path = . - DEPLOYMENT += addFiles -} - android { RESOURCES += \ testdata.qrc diff --git a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp index 58164f1fa1..f57ed12ed3 100644 --- a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp +++ b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp @@ -46,7 +46,7 @@ void tst_qdesktopservices::openUrl() { // At the bare minimum check that they return false for invalid url's QCOMPARE(QDesktopServices::openUrl(QUrl()), false); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) // this test is only valid on windows on other systems it might mean open a new document in the application handling .file const QRegularExpression messagePattern("ShellExecute 'file://invalid\\.file' failed \\(error \\d+\\)\\."); QVERIFY(messagePattern.isValid()); diff --git a/tests/auto/network/access/qftp/qftp.pro b/tests/auto/network/access/qftp/qftp.pro index 4294f27e74..6f1a4a7543 100644 --- a/tests/auto/network/access/qftp/qftp.pro +++ b/tests/auto/network/access/qftp/qftp.pro @@ -4,10 +4,3 @@ SOURCES += tst_qftp.cpp requires(contains(QT_CONFIG,private_tests)) QT = core network network-private testlib - -wince { - addFiles.files = rfc3252.txt - addFiles.path = . - DEPLOYMENT += addFiles -} - diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp index eca913fe08..75e8f9fabc 100644 --- a/tests/auto/network/access/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.cpp @@ -276,14 +276,9 @@ void tst_QFtp::init() inFileDirExistsFunction = false; -#if !defined(Q_OS_WINCE) srand(time(0)); uniqueExtension = QString::number((quintptr)this) + QString::number(rand()) + QString::number((qulonglong)time(0)); -#else - srand(0); - uniqueExtension = QString::number((quintptr)this) + QString::number(rand()) + QLatin1Char('0'); -#endif } void tst_QFtp::cleanup() @@ -1352,11 +1347,7 @@ void tst_QFtp::abort_data() QTest::newRow( "get_fluke02" ) << QtNetworkSettings::serverName() << (uint)21 << QString("qtest/rfc3252") << QByteArray(); // Qt/CE test environment has too little memory for this test -#if !defined(Q_OS_WINCE) QByteArray bigData( 10*1024*1024, 0 ); -#else - QByteArray bigData( 1*1024*1024, 0 ); -#endif bigData.fill( 'B' ); QTest::newRow( "put_fluke01" ) << QtNetworkSettings::serverName() << (uint)21 << QString("qtest/upload/abort_put") << bigData; } diff --git a/tests/auto/network/access/qnetworkreply/qnetworkreply.pro b/tests/auto/network/access/qnetworkreply/qnetworkreply.pro index bd10c77252..d3a92436ac 100644 --- a/tests/auto/network/access/qnetworkreply/qnetworkreply.pro +++ b/tests/auto/network/access/qnetworkreply/qnetworkreply.pro @@ -1,5 +1,5 @@ TEMPLATE = subdirs -!winrt:!wince: SUBDIRS += echo +!winrt:SUBDIRS += echo test.depends += $$SUBDIRS SUBDIRS += test diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index bd9f3a5b72..d710fedfcf 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -205,6 +205,7 @@ private Q_SLOTS: void invalidProtocol(); void getFromData_data(); void getFromData(); + void getFromFile_data(); void getFromFile(); void getFromFileSpecial_data(); void getFromFileSpecial(); @@ -650,8 +651,10 @@ private slots: #endif void slotError(QAbstractSocket::SocketError err) { - Q_ASSERT(!client.isNull()); - qDebug() << "slotError" << err << client->errorString(); + if (client.isNull()) + qDebug() << "slotError" << err; + else + qDebug() << "slotError" << err << client->errorString(); } public slots: @@ -1674,14 +1677,26 @@ void tst_QNetworkReply::getFromData() QCOMPARE(reply->readAll(), expected); } +void tst_QNetworkReply::getFromFile_data() +{ + QTest::addColumn<bool>("backgroundAttribute"); + + QTest::newRow("no-background-attribute") << false; + QTest::newRow("background-attribute") << true; +} + void tst_QNetworkReply::getFromFile() { + QFETCH(bool, backgroundAttribute); + // create the file: QTemporaryFile file(QDir::currentPath() + "/temp-XXXXXX"); file.setAutoRemove(true); QVERIFY2(file.open(), qPrintable(file.errorString())); QNetworkRequest request(QUrl::fromLocalFile(file.fileName())); + if (backgroundAttribute) + request.setAttribute(QNetworkRequest::BackgroundRequestAttribute, QVariant::fromValue(true)); QNetworkReplyPtr reply; static const char fileData[] = "This is some data that is in the file.\r\n"; @@ -1691,6 +1706,7 @@ void tst_QNetworkReply::getFromFile() QCOMPARE(file.size(), qint64(data.size())); RUN_REQUEST(runSimpleRequest(QNetworkAccessManager::GetOperation, request, reply)); + QVERIFY(waitForFinish(reply) != Timeout); QCOMPARE(reply->url(), request.url()); QCOMPARE(reply->error(), QNetworkReply::NoError); @@ -4319,9 +4335,6 @@ void tst_QNetworkReply::ioPutToFileFromProcess() QSKIP("No qprocess support", SkipAll); #else -#if defined(Q_OS_WINCE) - QSKIP("Currently no stdin/out supported for Windows CE"); -#else #ifdef Q_OS_WIN if (qstrcmp(QTest::currentDataTag(), "small") == 0) QSKIP("When passing a CR-LF-LF sequence through Windows stdio, it gets converted, " @@ -4355,7 +4368,6 @@ void tst_QNetworkReply::ioPutToFileFromProcess() QCOMPARE(file.size(), qint64(data.size())); QByteArray contents = file.readAll(); QCOMPARE(contents, data); -#endif #endif // QT_NO_PROCESS } @@ -6561,12 +6573,7 @@ void tst_QNetworkReply::getFromHttpIntoBuffer2() QFETCH(bool, useDownloadBuffer); // On my Linux Desktop the results are already visible with 128 kB, however we use this to have good results. -#if defined(Q_OS_WINCE_WM) - // Show some mercy to non-desktop platform/s - enum {UploadSize = 4*1024*1024}; // 4 MB -#else enum {UploadSize = 32*1024*1024}; // 32 MB -#endif GetFromHttpIntoBuffer2Server server(UploadSize, true, false); diff --git a/tests/auto/network/kernel/qhostaddress/qhostaddress.pro b/tests/auto/network/kernel/qhostaddress/qhostaddress.pro index 19d74dfd9b..a79fa2f59d 100644 --- a/tests/auto/network/kernel/qhostaddress/qhostaddress.pro +++ b/tests/auto/network/kernel/qhostaddress/qhostaddress.pro @@ -5,10 +5,4 @@ SOURCES += tst_qhostaddress.cpp QT = core network testlib -win32: { -wince { - LIBS += -lws2 -} else { - LIBS += -lws2_32 -} -} +win32:LIBS += -lws2_32 diff --git a/tests/auto/network/kernel/qhostinfo/qhostinfo.pro b/tests/auto/network/kernel/qhostinfo/qhostinfo.pro index 12858c97ee..4ea415c529 100644 --- a/tests/auto/network/kernel/qhostinfo/qhostinfo.pro +++ b/tests/auto/network/kernel/qhostinfo/qhostinfo.pro @@ -6,11 +6,7 @@ SOURCES += tst_qhostinfo.cpp requires(contains(QT_CONFIG,private_tests)) QT = core-private network-private testlib -wince { - LIBS += ws2.lib -} else { - win32:LIBS += -lws2_32 -} +win32:LIBS += -lws2_32 # needed for getaddrinfo with official MinGW mingw:DEFINES += _WIN32_WINNT=0x0501 diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp index 13d4442ada..f6d9b71aa2 100644 --- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp @@ -66,11 +66,7 @@ #include "private/qhostinfo_p.h" #if !defined(QT_NO_GETADDRINFO) -# if !defined(Q_OS_WINCE) # include <sys/types.h> -# else -# include <types.h> -# endif # if defined(Q_OS_UNIX) # include <sys/socket.h> # endif @@ -399,11 +395,7 @@ protected: void tst_QHostInfo::threadSafety() { const int nattempts = 5; -#if defined(Q_OS_WINCE) - const int runs = 10; -#else const int runs = 100; -#endif LookupThread thr[nattempts]; for (int j = 0; j < runs; ++j) { for (int i = 0; i < nattempts; ++i) diff --git a/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri b/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri index a3b4e89450..6c7857ea1d 100644 --- a/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri +++ b/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri @@ -4,13 +4,7 @@ QNETWORK_SRC = $$QT_SOURCE_TREE/src/network INCLUDEPATH += $$QNETWORK_SRC -win32 { - wince { - LIBS += -lws2 - } else { - LIBS += -lws2_32 - } -} +win32:LIBS += -lws2_32 unix:contains(QT_CONFIG, reduce_exports) { SOURCES += $$QNETWORK_SRC/socket/qnativesocketengine_unix.cpp diff --git a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp index 041a0ce16c..d159d6d683 100644 --- a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp +++ b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp @@ -494,9 +494,6 @@ void tst_PlatformSocketEngine::readWriteBufferSize() qint64 bufferSize = device.receiveBufferSize(); QVERIFY(bufferSize != -1); device.setReceiveBufferSize(bufferSize + 1); -#if defined(Q_OS_WINCE) - QEXPECT_FAIL(0, "Not supported by default on WinCE", Continue); -#endif QVERIFY(device.receiveBufferSize() > bufferSize); bufferSize = device.sendBufferSize(); @@ -649,7 +646,7 @@ void tst_PlatformSocketEngine::receiveUrgentData() QByteArray response; // Native OOB data test doesn't work on HP-UX or WinCE -#if !defined(Q_OS_HPUX) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_HPUX) // The server sends an urgent message msg = 'Q'; QCOMPARE(int(::send(socketDescriptor, &msg, sizeof(msg), MSG_OOB)), 1); diff --git a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp index 7237542e5c..68f3ea059b 100644 --- a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp +++ b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp @@ -626,11 +626,7 @@ void tst_QHttpSocketEngine::downloadBigFile() QTime stopWatch; stopWatch.start(); -#if defined(Q_OS_WINCE) - QTestEventLoop::instance().enterLoop(240); -#else QTestEventLoop::instance().enterLoop(60); -#endif if (QTestEventLoop::instance().timeout()) QFAIL("Network operation timed out"); diff --git a/tests/auto/network/socket/qlocalsocket/test/test.pro b/tests/auto/network/socket/qlocalsocket/test/test.pro index 6a5df7f9b6..ab9ed90b1d 100644 --- a/tests/auto/network/socket/qlocalsocket/test/test.pro +++ b/tests/auto/network/socket/qlocalsocket/test/test.pro @@ -2,13 +2,7 @@ CONFIG += testcase DEFINES += QLOCALSERVER_DEBUG DEFINES += QLOCALSOCKET_DEBUG - -wince* { - DEFINES += QT_LOCALSOCKET_TCP - DEFINES += SRCDIR=\\\"../\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/../\\\" -} +DEFINES += SRCDIR=\\\"$$PWD/../\\\" QT = core network testlib diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index b5032c8c35..48fa4f7bcc 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -759,10 +759,8 @@ void tst_QLocalSocket::threadedConnection_data() QTest::newRow("1 client") << 1; QTest::newRow("2 clients") << 2; QTest::newRow("5 clients") << 5; -#ifndef Q_OS_WINCE QTest::newRow("10 clients") << 10; QTest::newRow("20 clients") << 20; -#endif } void tst_QLocalSocket::threadedConnection() diff --git a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp index b4955df107..c945d77cda 100644 --- a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -785,11 +785,7 @@ void tst_QSocks5SocketEngine::downloadBigFile() QTime stopWatch; stopWatch.start(); -#if !defined(Q_OS_WINCE) QTestEventLoop::instance().enterLoop(60); -#else - QTestEventLoop::instance().enterLoop(180); -#endif if (QTestEventLoop::instance().timeout()) QFAIL("Network operation timed out"); diff --git a/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp b/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp index 8408e703c0..15e9228a04 100644 --- a/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp +++ b/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp @@ -40,16 +40,8 @@ int main(int argc, char *argv[]) return 1; } -#if defined(Q_OS_WINCE) - QFile file(QLatin1String("/test_signal.txt")); - file.open(QIODevice::WriteOnly); - file.write("Listening\n"); - file.flush(); - file.close(); -#else printf("Listening\n"); fflush(stdout); -#endif server.waitForNewConnection(5000); qFatal("Crash"); diff --git a/tests/auto/network/socket/qtcpserver/test/test.pro b/tests/auto/network/socket/qtcpserver/test/test.pro index f0abfbc085..4491523383 100644 --- a/tests/auto/network/socket/qtcpserver/test/test.pro +++ b/tests/auto/network/socket/qtcpserver/test/test.pro @@ -1,16 +1,7 @@ CONFIG += testcase SOURCES += ../tst_qtcpserver.cpp -win32: { -wince { - LIBS += -lws2 - crashApp.files = ../crashingServer/crashingServer.exe - crashApp.path = crashingServer - DEPLOYMENT += crashApp -} else { - LIBS += -lws2_32 -} -} +win32:LIBS += -lws2_32 TARGET = ../tst_qtcpserver diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index 30aab3bf34..5a0baf73b5 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -106,6 +106,8 @@ private slots: void eagainBlockingAccept(); + void canAccessPendingConnectionsWhileNotListening(); + private: #ifndef QT_NO_BEARERMANAGEMENT QNetworkSession *networkSession; @@ -467,11 +469,7 @@ void tst_QTcpServer::waitForConnectionTest() ThreadConnector connector(findLocalIpSocket.localAddress(), server.serverPort()); connector.start(); -#if defined(Q_OS_WINCE) - QVERIFY(server.waitForNewConnection(9000, &timeout)); -#else QVERIFY(server.waitForNewConnection(3000, &timeout)); -#endif QVERIFY(!timeout); } @@ -562,21 +560,6 @@ void tst_QTcpServer::addressReusable() QSKIP("No proxy support"); #endif // QT_NO_NETWORKPROXY } -#if defined(Q_OS_WINCE) - QString signalName = QString::fromLatin1("/test_signal.txt"); - QFile::remove(signalName); - // The crashingServer process will crash once it gets a connection. - QProcess process; - QString processExe = crashingServerDir + "/crashingServer"; - process.start(processExe); - QVERIFY2(process.waitForStarted(), qPrintable( - QString::fromLatin1("Could not start %1: %2").arg(processExe, process.errorString()))); - int waitCount = 5; - while (waitCount-- && !QFile::exists(signalName)) - QTest::qWait(1000); - QVERIFY(QFile::exists(signalName)); - QFile::remove(signalName); -#else // The crashingServer process will crash once it gets a connection. QProcess process; QString processExe = crashingServerDir + "/crashingServer"; @@ -584,7 +567,6 @@ void tst_QTcpServer::addressReusable() QVERIFY2(process.waitForStarted(), qPrintable( QString::fromLatin1("Could not start %1: %2").arg(processExe, process.errorString()))); QVERIFY(process.waitForReadyRead(5000)); -#endif QTcpSocket socket; socket.connectToHost(QHostAddress::LocalHost, 49199); @@ -990,5 +972,22 @@ void tst_QTcpServer::eagainBlockingAccept() server.close(); } +class NonListeningTcpServer : public QTcpServer +{ +public: + void addSocketFromOutside(QTcpSocket* s) + { + addPendingConnection(s); + } +}; + +void tst_QTcpServer::canAccessPendingConnectionsWhileNotListening() +{ + NonListeningTcpServer server; + QTcpSocket socket; + server.addSocketFromOutside(&socket); + QCOMPARE(&socket, server.nextPendingConnection()); +} + QTEST_MAIN(tst_QTcpServer) #include "tst_qtcpserver.moc" diff --git a/tests/auto/network/socket/qtcpsocket/qtcpsocket.pro b/tests/auto/network/socket/qtcpsocket/qtcpsocket.pro index fe6042b8a7..5686f4a697 100644 --- a/tests/auto/network/socket/qtcpsocket/qtcpsocket.pro +++ b/tests/auto/network/socket/qtcpsocket/qtcpsocket.pro @@ -1,6 +1,6 @@ TEMPLATE = subdirs SUBDIRS = test -!wince:!vxworks: SUBDIRS += stressTest +!vxworks: SUBDIRS += stressTest requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/network/socket/qtcpsocket/test/test.pro b/tests/auto/network/socket/qtcpsocket/test/test.pro index 325abcaab8..2dc1490256 100644 --- a/tests/auto/network/socket/qtcpsocket/test/test.pro +++ b/tests/auto/network/socket/qtcpsocket/test/test.pro @@ -2,13 +2,7 @@ CONFIG += testcase QT = core-private network-private testlib SOURCES += ../tst_qtcpsocket.cpp -win32: { -wince { - LIBS += -lws2 -} else { - LIBS += -lws2_32 -} -} +win32:LIBS += -lws2_32 TARGET = tst_qtcpsocket diff --git a/tests/auto/network/socket/qudpsocket/test/test.pro b/tests/auto/network/socket/qudpsocket/test/test.pro index 8ad16c652d..efa50b21b4 100644 --- a/tests/auto/network/socket/qudpsocket/test/test.pro +++ b/tests/auto/network/socket/qudpsocket/test/test.pro @@ -15,12 +15,6 @@ win32 { DESTDIR = ../ } -wince* { - addApp.files = ../clientserver/clientserver.exe - addApp.path = clientserver - DEPLOYMENT += addApp -} - TARGET = tst_qudpsocket CONFIG+=insignificant_test # QTBUG-25367, QTBUG-25368 diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 8a0784f4e5..8c9d0d1b9f 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -434,13 +434,8 @@ void tst_QUdpSocket::ipv6Loop() char peterBuffer[16*1024]; char paulBuffer[16*1024]; -#if !defined(Q_OS_WINCE) - QVERIFY(peter.waitForReadyRead(5000)); - QVERIFY(paul.waitForReadyRead(5000)); -#else - QVERIFY(peter.waitForReadyRead(15000)); - QVERIFY(paul.waitForReadyRead(15000)); -#endif + QVERIFY(peter.waitForReadyRead(5000)); + QVERIFY(paul.waitForReadyRead(5000)); if (success) { QCOMPARE(peter.readDatagram(peterBuffer, sizeof(peterBuffer)), qint64(paulMessage.length())); QCOMPARE(paul.readDatagram(paulBuffer, sizeof(peterBuffer)), qint64(peterMessage.length())); @@ -937,9 +932,6 @@ void tst_QUdpSocket::outOfProcessConnectedClientServerTest() #ifdef QT_NO_PROCESS QSKIP("No qprocess support", SkipAll); #else -#if defined(Q_OS_WINCE) - QSKIP("This test depends on reading data from QProcess (not supported on Qt/WinCE)."); -#endif QProcess serverProcess; serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"), QIODevice::ReadWrite | QIODevice::Text); @@ -1001,9 +993,6 @@ void tst_QUdpSocket::outOfProcessUnconnectedClientServerTest() #ifdef QT_NO_PROCESS QSKIP("No qprocess support", SkipAll); #else -#if defined(Q_OS_WINCE) - QSKIP("This test depends on reading data from QProcess (not supported on Qt/WinCE)."); -#endif QProcess serverProcess; serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"), QIODevice::ReadWrite | QIODevice::Text); diff --git a/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro b/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro index 87a210c051..7c1cd5b66b 100644 --- a/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro +++ b/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro @@ -1,7 +1,7 @@ CONFIG += testcase SOURCES += tst_qsslcertificate.cpp -!wince:win32:LIBS += -lws2_32 +win32:LIBS += -lws2_32 QT = core network testlib TARGET = tst_qsslcertificate diff --git a/tests/auto/network/ssl/qsslcipher/qsslcipher.pro b/tests/auto/network/ssl/qsslcipher/qsslcipher.pro index 4cb2dfebab..81ef2d8d9a 100644 --- a/tests/auto/network/ssl/qsslcipher/qsslcipher.pro +++ b/tests/auto/network/ssl/qsslcipher/qsslcipher.pro @@ -1,7 +1,7 @@ CONFIG += testcase SOURCES += tst_qsslcipher.cpp -win32:!wince: LIBS += -lws2_32 +win32:LIBS += -lws2_32 QT = core network testlib TARGET = tst_qsslcipher diff --git a/tests/auto/network/ssl/qsslellipticcurve/qsslellipticcurve.pro b/tests/auto/network/ssl/qsslellipticcurve/qsslellipticcurve.pro index e67b64b2b7..a180086c5e 100644 --- a/tests/auto/network/ssl/qsslellipticcurve/qsslellipticcurve.pro +++ b/tests/auto/network/ssl/qsslellipticcurve/qsslellipticcurve.pro @@ -1,7 +1,7 @@ CONFIG += testcase SOURCES += tst_qsslellipticcurve.cpp -win32:!wince: LIBS += -lws2_32 +win32:LIBS += -lws2_32 QT = core network testlib TARGET = tst_qsslellipticcurve diff --git a/tests/auto/network/ssl/qsslerror/qsslerror.pro b/tests/auto/network/ssl/qsslerror/qsslerror.pro index 7737aae3f1..117fd4ac27 100644 --- a/tests/auto/network/ssl/qsslerror/qsslerror.pro +++ b/tests/auto/network/ssl/qsslerror/qsslerror.pro @@ -1,7 +1,7 @@ CONFIG += testcase SOURCES += tst_qsslerror.cpp -win32:!wince: LIBS += -lws2_32 +win32:LIBS += -lws2_32 QT = core network testlib TARGET = tst_qsslerror diff --git a/tests/auto/network/ssl/qsslkey/qsslkey.pro b/tests/auto/network/ssl/qsslkey/qsslkey.pro index 7eb04793f3..52377a9005 100644 --- a/tests/auto/network/ssl/qsslkey/qsslkey.pro +++ b/tests/auto/network/ssl/qsslkey/qsslkey.pro @@ -1,7 +1,7 @@ CONFIG += testcase SOURCES += tst_qsslkey.cpp -win32:!wince: LIBS += -lws2_32 +win32:LIBS += -lws2_32 QT = core network testlib contains(QT_CONFIG, private_tests) { QT += core-private network-private diff --git a/tests/auto/network/ssl/qsslsocket/qsslsocket.pro b/tests/auto/network/ssl/qsslsocket/qsslsocket.pro index de2be8e126..9a525408fd 100644 --- a/tests/auto/network/ssl/qsslsocket/qsslsocket.pro +++ b/tests/auto/network/ssl/qsslsocket/qsslsocket.pro @@ -1,7 +1,7 @@ CONFIG += testcase SOURCES += tst_qsslsocket.cpp -win32:!wince: LIBS += -lws2_32 +win32:LIBS += -lws2_32 QT = core core-private network-private testlib TARGET = tst_qsslsocket @@ -20,14 +20,6 @@ contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) { LIBS += $$OPENSSL_LIBS } -wince* { - DEFINES += SRCDIR=\\\"./\\\" - - certFiles.files = certs ssl.tar.gz - certFiles.path = . - DEPLOYMENT += certFiles -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} +DEFINES += SRCDIR=\\\"$$PWD/\\\" requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index f8c5b8b67b..c3cb477298 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -229,6 +229,7 @@ private slots: void simplePskConnect(); void ephemeralServerKey_data(); void ephemeralServerKey(); + void allowedProtocolNegotiation(); #endif static void exitLoop() @@ -3375,6 +3376,45 @@ void tst_QSslSocket::ephemeralServerKey() QCOMPARE(client->sslConfiguration().ephemeralServerKey().isNull(), emptyKey); } +void tst_QSslSocket::allowedProtocolNegotiation() +{ +#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_TLSEXT) + + QFETCH_GLOBAL(bool, setProxy); + if (setProxy) + return; + + const QByteArray expectedNegotiated("cool-protocol"); + QList<QByteArray> serverProtos; + serverProtos << expectedNegotiated << "not-so-cool-protocol"; + QList<QByteArray> clientProtos; + clientProtos << "uber-cool-protocol" << expectedNegotiated << "not-so-cool-protocol"; + + + SslServer server; + server.config.setAllowedNextProtocols(serverProtos); + QVERIFY(server.listen()); + + QSslSocket clientSocket; + auto configuration = clientSocket.sslConfiguration(); + configuration.setAllowedNextProtocols(clientProtos); + clientSocket.setSslConfiguration(configuration); + + clientSocket.connectToHostEncrypted("127.0.0.1", server.serverPort()); + clientSocket.ignoreSslErrors(); + + QEventLoop loop; + QTimer::singleShot(5000, &loop, SLOT(quit())); + connect(&clientSocket, SIGNAL(encrypted()), &loop, SLOT(quit())); + loop.exec(); + + QVERIFY(server.socket->sslConfiguration().nextNegotiatedProtocol() == + clientSocket.sslConfiguration().nextNegotiatedProtocol()); + QVERIFY(server.socket->sslConfiguration().nextNegotiatedProtocol() == expectedNegotiated); + +#endif // OPENSSL_VERSION_NUMBER +} + #endif // QT_NO_OPENSSL #endif // QT_NO_SSL diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro index ae911e43ed..4ea878f840 100644 --- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro +++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro @@ -2,7 +2,7 @@ CONFIG += testcase testcase.timeout = 300 # this test is slow SOURCES += tst_qsslsocket_onDemandCertificates_member.cpp -win32:!wince: LIBS += -lws2_32 +win32:LIBS += -lws2_32 QT = core core-private network-private testlib TARGET = tst_qsslsocket_onDemandCertificates_member @@ -15,10 +15,6 @@ win32 { } } -wince* { - DEFINES += SRCDIR=\\\"./\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} +DEFINES += SRCDIR=\\\"$$PWD/\\\" requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro index 25e5a5d5c7..d69ea7fb3d 100644 --- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro +++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro @@ -1,7 +1,7 @@ CONFIG += testcase SOURCES += tst_qsslsocket_onDemandCertificates_static.cpp -win32:!wince: LIBS += -lws2_32 +win32:LIBS += -lws2_32 QT = core core-private network-private testlib TARGET = tst_qsslsocket_onDemandCertificates_static @@ -14,10 +14,6 @@ win32 { } } -wince* { - DEFINES += SRCDIR=\\\"./\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} +DEFINES += SRCDIR=\\\"$$PWD/\\\" requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/other/languagechange/tst_languagechange.cpp b/tests/auto/other/languagechange/tst_languagechange.cpp index 7380398071..22c2e1fbc7 100644 --- a/tests/auto/other/languagechange/tst_languagechange.cpp +++ b/tests/auto/other/languagechange/tst_languagechange.cpp @@ -281,9 +281,6 @@ void tst_languageChange::retranslatability() fooFile.write("test"); fooFile.close(); dlg.setDirectory(temporaryDir.path()); -#ifdef Q_OS_WINCE - dlg.setDirectory("\\Windows"); -#endif dlg.setFileMode(QFileDialog::ExistingFiles); dlg.setViewMode(QFileDialog::Detail); stateMachine.start(); @@ -295,13 +292,8 @@ void tst_languageChange::retranslatability() // In case we use a Color dialog, we do not want to test for // strings non existing in the dialog and which do not get // translated. - if ((dialogType == ColorDialog) && -#ifndef Q_OS_WINCE - (qApp->desktop()->width() < 480 || qApp->desktop()->height() < 350) -#else - true // On Qt/WinCE we always use compact mode -#endif - ) { + const QSize desktopSize = QApplication::desktop()->size(); + if (dialogType == ColorDialog && (desktopSize.width() < 480 || desktopSize.height() < 350)) { expected.remove("QColorDialog::&Basic colors"); expected.remove("QColorDialog::&Custom colors"); expected.remove("QColorDialog::&Define Custom Colors >>"); diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro index 0e9f054a01..3b264e6b72 100644 --- a/tests/auto/other/other.pro +++ b/tests/auto/other/other.pro @@ -21,7 +21,6 @@ SUBDIRS=\ qsharedpointer_and_qwidget \ qprocess_and_guieventloop \ qtokenautomaton \ - windowsmobile \ toolsupport \ !qtHaveModule(gui): SUBDIRS -= \ @@ -52,7 +51,7 @@ cross_compile: SUBDIRS -= \ atwrapper \ compiler -wince*|!contains(QT_CONFIG, accessibility): SUBDIRS -= qaccessibility +!contains(QT_CONFIG, accessibility): SUBDIRS -= qaccessibility !contains(QT_CONFIG, accessibility-atspi-bridge): SUBDIRS -= qaccessibilitylinux @@ -62,7 +61,7 @@ wince*|!contains(QT_CONFIG, accessibility): SUBDIRS -= qaccessibility macplist \ qaccessibilitymac -!embedded|wince: SUBDIRS -= \ +!embedded: SUBDIRS -= \ qdirectpainter winrt: SUBDIRS -= \ diff --git a/tests/auto/other/qaccessibility/qaccessibility.pro b/tests/auto/other/qaccessibility/qaccessibility.pro index 7b3173798d..f697aee38f 100644 --- a/tests/auto/other/qaccessibility/qaccessibility.pro +++ b/tests/auto/other/qaccessibility/qaccessibility.pro @@ -7,12 +7,6 @@ HEADERS += accessiblewidgets.h unix:!darwin:!haiku:!integity: LIBS += -lm -wince { - accessneeded.files = $$QT_BUILD_TREE\\plugins\\accessible\\*.dll - accessneeded.path = accessible - DEPLOYMENT += accessneeded -} - win32 { !*g++:!winrt { include(../../../../src/3rdparty/iaccessible2/iaccessible2.pri) diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 99e3fc5bf2..046c77d6c3 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -68,20 +68,6 @@ static inline void setFrameless(QWidget *w) w->setWindowFlags(flags); } -#if defined(Q_OS_WINCE) -extern "C" bool SystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni); -#define SPI_GETPLATFORMTYPE 257 -inline bool IsValidCEPlatform() { - wchar_t tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(tszPlatform) / sizeof(*tszPlatform), tszPlatform, 0)) { - QString platform = QString::fromWCharArray(tszPlatform); - if ((platform == QLatin1String("PocketPC")) || (platform == QLatin1String("Smartphone"))) - return false; - } - return true; -} -#endif - static inline bool verifyChild(QWidget *child, QAccessibleInterface *interface, int index, const QRect &domain) { @@ -1469,10 +1455,6 @@ void tst_QAccessibility::menuTest() QCOMPARE(iHelp->role(), QAccessible::MenuItem); QCOMPARE(iAction->role(), QAccessible::MenuItem); #ifndef Q_OS_MAC -#ifdef Q_OS_WINCE - if (!IsValidCEPlatform()) - QSKIP("Tests do not work on Mobile platforms due to native menus"); -#endif QCOMPARE(mw.mapFromGlobal(interface->rect().topLeft()), mw.menuBar()->geometry().topLeft()); QCOMPARE(interface->rect().size(), mw.menuBar()->size()); @@ -3561,10 +3543,6 @@ void tst_QAccessibility::dockWidgetTest() void tst_QAccessibility::comboBoxTest() { -#if defined(Q_OS_WINCE) - if (!IsValidCEPlatform()) - QSKIP("Test skipped on Windows Mobile test hardware"); -#endif { // not editable combobox QComboBox combo; combo.addItems(QStringList() << "one" << "two" << "three"); diff --git a/tests/auto/other/windowsmobile/test/ddhelper.cpp b/tests/auto/other/windowsmobile/test/ddhelper.cpp deleted file mode 100644 index 3ce99a0ded..0000000000 --- a/tests/auto/other/windowsmobile/test/ddhelper.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifdef Q_OS_WINCE_WM - -#include <Ddraw.h> -#include <QDebug> - -static LPDIRECTDRAW g_pDD = NULL; // DirectDraw object -static LPDIRECTDRAWSURFACE g_pDDSSurface = NULL; // DirectDraw primary surface - -static DDSCAPS ddsCaps; -static DDSURFACEDESC ddsSurfaceDesc; -static void *buffer = NULL; - -static int width = 0; -static int height = 0; -static int pitch = 0; -static int bitCount = 0; -static int windowId = 0; - -static bool initialized = false; -static bool locked = false; - -void q_lock() -{ - if (locked) { - qWarning("Direct Painter already locked (QDirectPainter::lock())"); - return; - } - locked = true; - - - memset(&ddsSurfaceDesc, 0, sizeof(ddsSurfaceDesc)); - ddsSurfaceDesc.dwSize = sizeof(ddsSurfaceDesc); - - HRESULT h = g_pDDSSurface->Lock(0, &ddsSurfaceDesc, DDLOCK_WRITEONLY, 0); - if (h != DD_OK) - qDebug() << "GetSurfaceDesc failed!"; - - width = ddsSurfaceDesc.dwWidth; - height = ddsSurfaceDesc.dwHeight; - bitCount = ddsSurfaceDesc.ddpfPixelFormat.dwRGBBitCount; - pitch = ddsSurfaceDesc.lPitch; - buffer = ddsSurfaceDesc.lpSurface; -} - -void q_unlock() -{ - if( !locked) { - qWarning("Direct Painter not locked (QDirectPainter::unlock()"); - return; - } - g_pDDSSurface->Unlock(0); - locked = false; -} - -void q_initDD() -{ - if (initialized) - return; - - DirectDrawCreate(NULL, &g_pDD, NULL); - - HRESULT h; - h = g_pDD->SetCooperativeLevel(0, DDSCL_NORMAL); - - if (h != DD_OK) - qDebug() << "cooperation level failed"; - - h = g_pDD->TestCooperativeLevel(); - if (h != DD_OK) - qDebug() << "cooperation level failed test"; - - DDSURFACEDESC ddsd; - memset(&ddsd, 0, sizeof(ddsd)); - ddsd.dwSize = sizeof(ddsd); - - ddsd.dwFlags = DDSD_CAPS; - - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - - h = g_pDD->CreateSurface(&ddsd, &g_pDDSSurface, NULL); - - if (h != DD_OK) - qDebug() << "CreateSurface failed!"; - - if (g_pDDSSurface->GetCaps(&ddsCaps) != DD_OK) - qDebug() << "GetCaps failed"; - - q_lock(); - q_unlock(); - initialized = true; -} - -uchar* q_frameBuffer() -{ - return (uchar*) buffer; -} - -int q_screenDepth() -{ - return bitCount; -} - -int q_screenWidth() -{ - return width; -} - -int q_screenHeight() -{ - return height; -} - -int q_linestep() -{ - return pitch; -} - -#endif //Q_OS_WINCE_WM - - diff --git a/tests/auto/other/windowsmobile/test/ddhelper.h b/tests/auto/other/windowsmobile/test/ddhelper.h deleted file mode 100644 index ce68654b76..0000000000 --- a/tests/auto/other/windowsmobile/test/ddhelper.h +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef __DDHELPER__ -#define __DDHELPER__ - -extern uchar* q_frameBuffer(); - -extern int q_screenDepth(); - -extern int q_screenWidth(); - -extern int q_screenHeight(); - -extern int q_linestep(); - -extern void q_initDD(); - -extern void q_unlock(); - -extern void q_lock(); - -#endif //__DDHELPER__ - diff --git a/tests/auto/other/windowsmobile/test/test.pro b/tests/auto/other/windowsmobile/test/test.pro deleted file mode 100644 index 36dd15f60e..0000000000 --- a/tests/auto/other/windowsmobile/test/test.pro +++ /dev/null @@ -1,23 +0,0 @@ - -CONFIG += testcase -QT += widgets testlib -HEADERS += ddhelper.h -SOURCES += tst_windowsmobile.cpp ddhelper.cpp -RESOURCES += windowsmobile.qrc - -TARGET = ../tst_windowsmobile - -wincewm*: { - addFiles.files = $$OUT_PWD/../testQMenuBar/*.exe - - - addFiles.path = "\\Program Files\\tst_windowsmobile" - DEPLOYMENT += addFiles -} - -wincewm*: { - LIBS += Ddraw.lib -} - - - diff --git a/tests/auto/other/windowsmobile/test/testQMenuBar_current.png b/tests/auto/other/windowsmobile/test/testQMenuBar_current.png Binary files differdeleted file mode 100644 index f0042b8fe0..0000000000 --- a/tests/auto/other/windowsmobile/test/testQMenuBar_current.png +++ /dev/null diff --git a/tests/auto/other/windowsmobile/test/testSimpleWidget_current.png b/tests/auto/other/windowsmobile/test/testSimpleWidget_current.png Binary files differdeleted file mode 100644 index 8086c41ce9..0000000000 --- a/tests/auto/other/windowsmobile/test/testSimpleWidget_current.png +++ /dev/null diff --git a/tests/auto/other/windowsmobile/test/tst_windowsmobile.cpp b/tests/auto/other/windowsmobile/test/tst_windowsmobile.cpp deleted file mode 100644 index 8d0e468bd6..0000000000 --- a/tests/auto/other/windowsmobile/test/tst_windowsmobile.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtTest/QtTest> -#include <QtCore/QDate> -#include <QtCore/QDebug> -#include <QtCore/QObject> -#include <QtGui> -#ifdef Q_OS_WINCE_WM -#include <windows.h> -#include "ddhelper.h" -#endif - - - -class tst_WindowsMobile : public QObject -{ - Q_OBJECT -public: - tst_WindowsMobile() - { - qApp->setCursorFlashTime (24 * 3600 * 1000); // once a day - // qApp->setCursorFlashTime (INT_MAX); -#ifdef Q_OS_WINCE_WM - q_initDD(); -#endif - } - -#if defined(Q_OS_WINCE_WM) && defined(_WIN32_WCE) && _WIN32_WCE <= 0x501 - private slots: - void testMainWindowAndMenuBar(); - void testSimpleWidget(); -#endif -}; - -#if defined(Q_OS_WINCE_WM) && defined(_WIN32_WCE) && _WIN32_WCE <= 0x501 - -bool qt_wince_is_platform(const QString &platformString) { - wchar_t tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMTYPE, - sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) - if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform)) - return true; - return false; -} - -bool qt_wince_is_smartphone() { - return qt_wince_is_platform(QString::fromLatin1("Smartphone")); -} - -void openMenu() -{ - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,450,630,0,0); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,450,630,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,55535,0,0); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,55535,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,58535,0,0); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,58535,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,40535,55535,0,0); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,40535,55535,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,32535,55535,0,0); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,32535,55535,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,50535,0,0); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,50535,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,40535,0,0); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,40535,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,48535,45535,0,0); - QTest::qWait(2000); - ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,48535,45535,0,0); -} - -void compareScreenshots(const QString &image1, const QString &image2) -{ - QImage screenShot(image1); - QImage original(image2); - - // cut away the title bar before comparing - QDesktopWidget desktop; - QRect desktopFrameRect = desktop.frameGeometry(); - QRect desktopClientRect = desktop.availableGeometry(); - - QPainter p1(&screenShot); - QPainter p2(&original); - - //screenShot.save("scr1.png", "PNG"); - p1.fillRect(0, 0, desktopFrameRect.width(), desktopClientRect.y(), Qt::black); - p2.fillRect(0, 0, desktopFrameRect.width(), desktopClientRect.y(), Qt::black); - - //screenShot.save("scr2.png", "PNG"); - //original.save("orig1.png", "PNG"); - - QCOMPARE(original, screenShot); -} - -void takeScreenShot(const QString filename) -{ - q_lock(); - QImage image = QImage(( uchar *) q_frameBuffer(), q_screenWidth(), - q_screenHeight(), q_screenWidth() * q_screenDepth() / 8, QImage::Format_RGB16); - image.save(filename, "PNG"); - q_unlock(); -} - -void tst_WindowsMobile::testMainWindowAndMenuBar() -{ - if (qt_wince_is_smartphone()) - QSKIP("This test is only for Windows Mobile"); - - QProcess process; - process.start("testQMenuBar.exe"); - QCOMPARE(process.state(), QProcess::Running); - QTest::qWait(6000); - openMenu(); - QTest::qWait(1000); - takeScreenShot("testQMenuBar_current.png"); - process.close(); - compareScreenshots("testQMenuBar_current.png", ":/testQMenuBar_current.png"); -} - -void tst_WindowsMobile::testSimpleWidget() -{ - if (qt_wince_is_smartphone()) - QSKIP("This test is only for Windows Mobile"); - - QMenuBar menubar; - menubar.show(); - QWidget maximized; - QPalette pal = maximized.palette(); - pal.setColor(QPalette::Background, Qt::red); - maximized.setPalette(pal); - maximized.showMaximized(); - QWidget widget; - widget.setGeometry(100, 100, 200, 200); - widget.setWindowTitle("Widget"); - widget.show(); - qApp->processEvents(); - QTest::qWait(1000); - - QWidget widget2; - widget2.setGeometry(100, 380, 300, 200); - widget2.setWindowTitle("Widget 2"); - widget2.setWindowFlags(Qt::Popup); - widget2.show(); - - qApp->processEvents(); - QTest::qWait(1000); - takeScreenShot("testSimpleWidget_current.png"); - compareScreenshots("testSimpleWidget_current.png", ":/testSimpleWidget_current.png"); -} - - -#endif //Q_OS_WINCE_WM - - -QTEST_MAIN(tst_WindowsMobile) -#include "tst_windowsmobile.moc" - diff --git a/tests/auto/other/windowsmobile/test/windowsmobile.qrc b/tests/auto/other/windowsmobile/test/windowsmobile.qrc deleted file mode 100644 index 5d6f61459e..0000000000 --- a/tests/auto/other/windowsmobile/test/windowsmobile.qrc +++ /dev/null @@ -1,6 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource> - <file>testQMenuBar_current.png</file> - <file>testSimpleWidget_current.png</file> -</qresource> -</RCC> diff --git a/tests/auto/other/windowsmobile/testQMenuBar/main.cpp b/tests/auto/other/windowsmobile/testQMenuBar/main.cpp deleted file mode 100644 index 8d9071ff72..0000000000 --- a/tests/auto/other/windowsmobile/testQMenuBar/main.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtTest/QtTest> -#include <QtCore/QDate> -#include <QtCore/QDebug> -#include <QtCore/QObject> -#include <QtGui> -#include <windows.h> - -int main(int argc, char * argv[]) -{ - QList<QWidget*> widgets; - QApplication app(argc, argv); - - QMainWindow mainWindow; - mainWindow.setWindowTitle("Test"); - QMenu *fileMenu = mainWindow.menuBar()->addMenu("File"); - QMenu *editMenu = mainWindow.menuBar()->addMenu("Edit"); - QMenu *viewMenu = mainWindow.menuBar()->addMenu("View"); - QMenu *toolsMenu = mainWindow.menuBar()->addMenu("Tools"); - QMenu *optionsMenu = mainWindow.menuBar()->addMenu("Options"); - QMenu *helpMenu = mainWindow.menuBar()->addMenu("Help"); - - qApp->processEvents(); - - fileMenu->addAction("Open"); - QAction *close = fileMenu->addAction("Close"); - fileMenu->addSeparator(); - fileMenu->addAction("Exit"); - - close->setEnabled(false); - - editMenu->addAction("Cut"); - editMenu->addAction("Pase"); - editMenu->addAction("Copy"); - editMenu->addSeparator(); - editMenu->addAction("Find"); - - viewMenu->addAction("Hide"); - viewMenu->addAction("Show"); - viewMenu->addAction("Explore"); - QAction *visible = viewMenu->addAction("Visible"); - visible->setCheckable(true); - visible->setChecked(true); - - toolsMenu->addMenu("Hammer"); - toolsMenu->addMenu("Caliper"); - toolsMenu->addMenu("Helm"); - - optionsMenu->addMenu("Settings"); - optionsMenu->addMenu("Standard"); - optionsMenu->addMenu("Extended"); - - QMenu *subMenu = helpMenu->addMenu("Help"); - subMenu->addAction("Index"); - subMenu->addSeparator(); - subMenu->addAction("Vodoo Help"); - helpMenu->addAction("Contens"); - helpMenu->addSeparator(); - helpMenu->addAction("About"); - - QToolBar toolbar; - mainWindow.addToolBar(&toolbar); - toolbar.addAction(QIcon(qApp->style()->standardPixmap(QStyle::SP_FileIcon)), QString("textAction")); - - QTextEdit textEdit; - mainWindow.setCentralWidget(&textEdit); - - mainWindow.showMaximized(); - - app.exec(); -} diff --git a/tests/auto/other/windowsmobile/testQMenuBar/testQMenuBar.pro b/tests/auto/other/windowsmobile/testQMenuBar/testQMenuBar.pro deleted file mode 100644 index 12ef683c11..0000000000 --- a/tests/auto/other/windowsmobile/testQMenuBar/testQMenuBar.pro +++ /dev/null @@ -1,5 +0,0 @@ -SOURCES += main.cpp -QT += widgets -TARGET = ../testQMenuBar - -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/windowsmobile/windowsmobile.pro b/tests/auto/other/windowsmobile/windowsmobile.pro deleted file mode 100644 index 2e6b444d7b..0000000000 --- a/tests/auto/other/windowsmobile/windowsmobile.pro +++ /dev/null @@ -1,9 +0,0 @@ - -TEMPLATE = subdirs - -wincewm* { - SUBDIRS = testQMenuBar -} - SUBDIRS += test - - diff --git a/tests/auto/sql/kernel/qsql/qsql.pro b/tests/auto/sql/kernel/qsql/qsql.pro index 71e2989572..1c7452cd73 100644 --- a/tests/auto/sql/kernel/qsql/qsql.pro +++ b/tests/auto/sql/kernel/qsql/qsql.pro @@ -3,9 +3,3 @@ TARGET = tst_qsql SOURCES += tst_qsql.cpp QT = core-private sql-private testlib - -wince { - DEPLOYMENT_PLUGIN += qsqlite -} -mingw: LIBS += -lws2_32 - diff --git a/tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro b/tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro index 7da5b8bc8e..9ee414bf34 100644 --- a/tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro +++ b/tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro @@ -3,17 +3,3 @@ TARGET = tst_qsqldatabase SOURCES += tst_qsqldatabase.cpp QT = core sql testlib core-private sql-private - -win32: { - !wince: LIBS += -lws2_32 - else: LIBS += -lws2 -} - -wince { - DEPLOYMENT_PLUGIN += qsqlite - - testData.files = testdata - testData.path = . - - DEPLOYMENT += testData -} diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h index 389d3abf85..701da7d346 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h +++ b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h @@ -43,20 +43,6 @@ #include <QtSql/private/qsqldriver_p.h> #include <QtTest/QtTest> -#if defined(Q_OS_WIN) -# include <qt_windows.h> -# if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) -# include <winsock2.h> -# endif -#else -#include <unistd.h> -#endif -#if defined(Q_OS_WINRT) - static inline int qgethostname(char *name, int) { qstrcpy(name, "localhost"); return 9; } -#else -# define qgethostname gethostname -#endif - #define CHECK_DATABASE( db ) \ if ( !db.isValid() ) { qFatal( "db is Invalid" ); } @@ -71,16 +57,10 @@ static QString qGetHostName() { static QString hostname; - if ( !hostname.isEmpty() ) - return hostname; - - char hn[257]; - - if ( qgethostname( hn, 255 ) == 0 ) { - hn[256] = '\0'; - hostname = QString::fromLatin1( hn ); - hostname.replace( QLatin1Char( '.' ), QLatin1Char( '_' ) ); - hostname.replace( QLatin1Char( '-' ), QLatin1Char( '_' ) ); + if (hostname.isEmpty()) { + hostname = QSysInfo::machineHostName(); + hostname.replace(QLatin1Char( '.' ), QLatin1Char( '_' )); + hostname.replace(QLatin1Char( '-' ), QLatin1Char( '_' )); } return hostname; diff --git a/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro b/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro index 8bfe1da1ce..772dc89177 100644 --- a/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro +++ b/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro @@ -3,16 +3,3 @@ TARGET = tst_qsqldriver SOURCES += tst_qsqldriver.cpp QT = core sql testlib core-private sql-private - -wince { - plugFiles.files = ../../../plugins/sqldrivers - plugFiles.path = . - DEPLOYMENT += plugFiles - LIBS += -lws2 -} else { - mingw { - LIBS += -lws2_32 - } else:win32 { - LIBS += ws2_32.lib - } -} diff --git a/tests/auto/sql/kernel/qsqlquery/qsqlquery.pro b/tests/auto/sql/kernel/qsqlquery/qsqlquery.pro index a6be23892d..c7638f9c0b 100644 --- a/tests/auto/sql/kernel/qsqlquery/qsqlquery.pro +++ b/tests/auto/sql/kernel/qsqlquery/qsqlquery.pro @@ -4,12 +4,3 @@ CONFIG += testcase SOURCES += tst_qsqlquery.cpp QT = core sql testlib core-private sql-private - -win32:!wince: LIBS += -lws2_32 - -wince { - plugFiles.files = ../../../plugins/sqldrivers - plugFiles.path = . - DEPLOYMENT += plugFiles - LIBS += -lws2 -} diff --git a/tests/auto/sql/kernel/qsqlthread/qsqlthread.pro b/tests/auto/sql/kernel/qsqlthread/qsqlthread.pro index 64d8c5ccfb..32e0f2228f 100644 --- a/tests/auto/sql/kernel/qsqlthread/qsqlthread.pro +++ b/tests/auto/sql/kernel/qsqlthread/qsqlthread.pro @@ -3,14 +3,3 @@ TARGET = tst_qsqlthread SOURCES += tst_qsqlthread.cpp QT = core sql testlib core-private sql-private - - -wince { - plugFiles.files = ../../../plugins/sqldrivers - plugFiles.path = . - DEPLOYMENT += plugFiles - LIBS += -lws2 -} else { - win32:LIBS += -lws2_32 -} - diff --git a/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro b/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro index 2576fbad71..05eb871694 100644 --- a/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro +++ b/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro @@ -3,11 +3,3 @@ TARGET = tst_qsqlquerymodel SOURCES += tst_qsqlquerymodel.cpp QT += widgets sql testlib core-private sql-private - -wince { - DEPLOYMENT_PLUGIN += qsqlite - LIBS += -lws2 -} else { - win32:LIBS += -lws2_32 -} - diff --git a/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro b/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro index cade7c171d..5695c06b29 100644 --- a/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro +++ b/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro @@ -3,16 +3,3 @@ TARGET = tst_qsqlrelationaltablemodel SOURCES += tst_qsqlrelationaltablemodel.cpp QT = core sql testlib core-private sql-private - -wince { - plugFiles.files = ../../../plugins/sqldrivers - plugFiles.path = . - DEPLOYMENT += plugFiles - LIBS += -lws2 -} else { - mingw { - LIBS += -lws2_32 - } else:win32 { - LIBS += ws2_32.lib - } -} diff --git a/tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro b/tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro index 2af39b341f..958f0507bf 100644 --- a/tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro +++ b/tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro @@ -3,13 +3,3 @@ TARGET = tst_qsqltablemodel SOURCES += tst_qsqltablemodel.cpp QT = core core-private sql sql-private testlib - -wince { - plugFiles.files = ../../../plugins/sqldrivers - plugFiles.path = . - DEPLOYMENT += plugFiles - LIBS += -lws2 -} else { - win32:LIBS += -lws2_32 -} - diff --git a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST index 669ec50978..194ce3f556 100644 --- a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST +++ b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST @@ -1,3 +1,4 @@ [task256466_wrongStyle] opensuse-13.1 +opensuse-42.1 rhel-7.1 diff --git a/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST b/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST index cf78fb47c2..61966e684f 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST +++ b/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST @@ -1,2 +1,4 @@ [hoverColors] ubuntu-14.04 +opensuse-13.1 +opensuse-42.1 diff --git a/tests/auto/xml/dom/qdom/qdom.pro b/tests/auto/xml/dom/qdom/qdom.pro index 3248b8e0e2..dd1fa1a75b 100644 --- a/tests/auto/xml/dom/qdom/qdom.pro +++ b/tests/auto/xml/dom/qdom/qdom.pro @@ -4,9 +4,4 @@ SOURCES += tst_qdom.cpp QT = core xml testlib -wince* { - wince*|qt_not_deployed { - DEPLOYMENT_PLUGIN += qcncodecs qjpcodecs qkrcodecs qtwcodecs - } -} TESTDATA += testdata/* doubleNamespaces.xml umlaut.xml diff --git a/tests/baselineserver/shared/baselineprotocol.cpp b/tests/baselineserver/shared/baselineprotocol.cpp index 305f7318a4..3335ff8ffc 100644 --- a/tests/baselineserver/shared/baselineprotocol.cpp +++ b/tests/baselineserver/shared/baselineprotocol.cpp @@ -94,9 +94,6 @@ PlatformInfo PlatformInfo::localHostInfo() uname.start(QLS("uname"), QStringList() << QLS("-r")); if (uname.waitForFinished(3000)) pi.insert(PI_OSVersion, QString::fromLocal8Bit(uname.readAllStandardOutput().constData()).simplified()); -#elif defined(Q_OS_WINCE) - pi.insert(PI_OSName, QLS("WinCE")); - pi.insert(PI_OSVersion, QString::number(QSysInfo::windowsVersion())); #elif defined(Q_OS_WIN) pi.insert(PI_OSName, QLS("Windows")); pi.insert(PI_OSVersion, QString::number(QSysInfo::windowsVersion())); diff --git a/tests/benchmarks/corelib/io/qdiriterator/main.cpp b/tests/benchmarks/corelib/io/qdiriterator/main.cpp index a9fd7fd5ec..cd5a83e547 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/main.cpp +++ b/tests/benchmarks/corelib/io/qdiriterator/main.cpp @@ -59,10 +59,6 @@ private slots: void tst_qdiriterator::data() { -#if defined(Q_OS_WINCE) - QByteArray qtdir = qPrintable(QCoreApplication::applicationDirPath()); - qtdir += "/depot"; -#else #if defined(Q_OS_WIN) const char *qtdir = "C:\\depot\\qt\\main"; #else @@ -72,7 +68,6 @@ void tst_qdiriterator::data() fprintf(stderr, "QTDIR not set\n"); exit(1); } -#endif QTest::addColumn<QByteArray>("dirpath"); QByteArray ba = QByteArray(qtdir) + "/src/corelib"; diff --git a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro index 3cfb0b44de..061b22a5d1 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro +++ b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro @@ -6,10 +6,3 @@ CONFIG += release SOURCES += main.cpp qfilesystemiterator.cpp HEADERS += qfilesystemiterator.h - -wince* { - corelibdir.files = $$QT_SOURCE_TREE/src/corelib - corelibdir.path = ./depot/src - DEPLOYMENT += corelibdir -} - diff --git a/tests/benchmarks/corelib/io/qfile/main.cpp b/tests/benchmarks/corelib/io/qfile/main.cpp index 175dc74074..1966b30773 100644 --- a/tests/benchmarks/corelib/io/qfile/main.cpp +++ b/tests/benchmarks/corelib/io/qfile/main.cpp @@ -591,12 +591,7 @@ void tst_qfile::createSmallFiles() dir.cd("tst"); tmpDirName = dir.absolutePath(); -#if defined(Q_OS_WINCE) - for (int i = 0; i < 100; ++i) -#else - for (int i = 0; i < 1000; ++i) -#endif - { + for (int i = 0; i < 1000; ++i) { QFile f(tmpDirName + QLatin1Char('/') + QString::number(i)); f.open(QIODevice::WriteOnly); f.seek(511); diff --git a/tests/benchmarks/corelib/io/qfileinfo/main.cpp b/tests/benchmarks/corelib/io/qfileinfo/main.cpp index 24a32a7c72..5180e7c29e 100644 --- a/tests/benchmarks/corelib/io/qfileinfo/main.cpp +++ b/tests/benchmarks/corelib/io/qfileinfo/main.cpp @@ -41,7 +41,7 @@ class qfileinfo : public QObject private slots: void existsTemporary(); void existsStatic(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void symLinkTargetPerformanceLNK(); void symLinkTargetPerformanceMounpoint(); #endif @@ -71,7 +71,7 @@ void qfileinfo::existsStatic() QBENCHMARK { QFileInfo::exists(appPath); } } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void qfileinfo::symLinkTargetPerformanceLNK() { QVERIFY(QFile::link("file","link.lnk")); diff --git a/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp b/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp index d8792ed7ef..782cad94a1 100644 --- a/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp +++ b/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp @@ -33,7 +33,7 @@ class tst_QProcess : public QObject { Q_OBJECT -#if !defined(QT_NO_PROCESS) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_PROCESS) private slots: void echoTest_performance(); @@ -41,8 +41,7 @@ private slots: #endif // QT_NO_PROCESS }; -#if !defined(QT_NO_PROCESS) && !defined(Q_OS_WINCE) -// Reading and writing to a process is not supported on Qt/CE +#if !defined(QT_NO_PROCESS) void tst_QProcess::echoTest_performance() { QProcess process; @@ -88,7 +87,7 @@ void tst_QProcess::echoTest_performance() QVERIFY(process.waitForFinished()); } -#endif // QT_NO_PROCESS && Q_OS_WINCE +#endif // QT_NO_PROCESS QTEST_MAIN(tst_QProcess) #include "tst_bench_qprocess.moc" diff --git a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp index 9ce8fffa8e..64d3dd5733 100644 --- a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp +++ b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp @@ -119,12 +119,7 @@ struct Large { // A "large" item type int x[1000]; }; -// Embedded devices typically have limited memory -#if defined(Q_OS_WINCE) -# define LARGE_MAX_SIZE 2000 -#else -# define LARGE_MAX_SIZE 20000 -#endif +#define LARGE_MAX_SIZE 20000 class tst_vector_vs_std : public QObject { diff --git a/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp b/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp index 045beb17f3..5799b32b1c 100644 --- a/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp +++ b/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp @@ -34,15 +34,6 @@ #include <time.h> -#ifdef Q_OS_WINCE -// no C89 time() on Windows CE: -// http://blogs.msdn.com/b/cenet/archive/2006/04/29/time-h-on-windows-ce.aspx -uint time(void *) -{ - return uint(-1); -} -#endif - class tst_bench_QCryptographicHash : public QObject { Q_OBJECT diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 7f52bb0eba..0064ecbaaf 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -401,9 +401,6 @@ void tst_QGraphicsView::chipTester_data() void tst_QGraphicsView::chipTester() { -#ifdef Q_OS_WINCE_WM - QSKIP("WinCE WM: Fails on Windows Mobile w/o OpenGL"); -#endif QFETCH(bool, antialias); QFETCH(bool, opengl); QFETCH(int, operation); diff --git a/tests/benchmarks/gui/image/qimagereader/qimagereader.pro b/tests/benchmarks/gui/image/qimagereader/qimagereader.pro index e54e2ffce5..da1de139f2 100644 --- a/tests/benchmarks/gui/image/qimagereader/qimagereader.pro +++ b/tests/benchmarks/gui/image/qimagereader/qimagereader.pro @@ -8,19 +8,3 @@ SOURCES += tst_qimagereader.cpp !contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF !contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG QT += network - -wince { - addFiles.files = images - addFiles.path = . - - CONFIG(debug, debug|release):{ - imageFormatsPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/*d4.dll - } - - CONFIG(release, debug|release):{ - imageFormatsPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/*[^d]4.dll - } - imageFormatsPlugins.path = imageformats - DEPLOYMENT += addFiles imageFormatsPlugins -} - diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp index 73035be14f..dfa658df11 100644 --- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -668,12 +668,8 @@ void tst_qnetworkreply::uploadPerformance() void tst_qnetworkreply::httpUploadPerformance() { -#if defined(Q_OS_WINCE_WM) - // Show some mercy for non-desktop platform/s - enum {UploadSize = 4*1024*1024}; // 4 MB -#else enum {UploadSize = 128*1024*1024}; // 128 MB -#endif + ThreadedDataReaderHttpServer reader; FixedSizeDataGenerator generator(UploadSize); @@ -739,12 +735,9 @@ void tst_qnetworkreply::httpDownloadPerformance() { QFETCH(bool, serverSendsContentLength); QFETCH(bool, chunkedEncoding); -#if defined(Q_OS_WINCE_WM) - // Show some mercy to non-desktop platform/s - enum {UploadSize = 4*1024*1024}; // 4 MB -#else + enum {UploadSize = 128*1024*1024}; // 128 MB -#endif + HttpDownloadPerformanceServer server(UploadSize, serverSendsContentLength, chunkedEncoding); QNetworkRequest request(QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/?bare=1")); @@ -823,12 +816,7 @@ void tst_qnetworkreply::httpDownloadPerformanceDownloadBuffer() QFETCH(HttpDownloadPerformanceDownloadBufferTestType, testType); // On my Linux Desktop the results are already visible with 128 kB, however we use this to have good results. -#if defined(Q_OS_WINCE_WM) - // Show some mercy to non-desktop platform/s - enum {UploadSize = 4*1024*1024}; // 4 MB -#else enum {UploadSize = 32*1024*1024}; // 32 MB -#endif HttpDownloadPerformanceServer server(UploadSize, true, false); diff --git a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp index 2e4a3b3fcd..3e731bec96 100644 --- a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -166,9 +166,6 @@ void tst_QTcpServer::ipv6LoopbackPerformanceTest() QFETCH_GLOBAL(bool, setProxy); if (setProxy) return; -#if defined(Q_OS_WINCE_WM) - QSKIP("WinCE WM: Not yet supported"); -#endif QTcpServer server; if (!server.listen(QHostAddress::LocalHostIPv6, 0)) { diff --git a/tests/manual/diaglib/debugproxystyle.cpp b/tests/manual/diaglib/debugproxystyle.cpp index 667ec403b7..d4e62f5dd6 100644 --- a/tests/manual/diaglib/debugproxystyle.cpp +++ b/tests/manual/diaglib/debugproxystyle.cpp @@ -45,13 +45,36 @@ QDebug operator<<(QDebug debug, const QStyleOption *option) { #if QT_VERSION >= 0x050000 QDebugStateSaver saver(debug); +# if QT_VERSION >= 0x050400 + debug.noquote(); +# endif debug.nospace(); #endif - debug << "QStyleOption("; - if (option) - debug << "rec=" << option->rect; - else - debug << '0'; + if (!option) { + debug << "QStyleOption(0)"; + return debug; + } + if (const QStyleOptionViewItem *ivo = qstyleoption_cast<const QStyleOptionViewItem *>(option)) { + debug << "QStyleOptionViewItem("; +#if QT_VERSION >= 0x050000 + debug << ivo->index; + if (const int textSize = ivo->text.size()) + debug << ", \"" << (textSize < 20 ? ivo->text : ivo->text.left(20) + QLatin1String("...")) << '"'; + debug << ", "; +#else // Qt 5 + Q_UNUSED(ivo) +#endif + } else { + debug << "QStyleOption("; + } + debug << "rect=" << option->rect.width() << 'x' << option->rect.height() + << forcesign << option->rect.x() << option->rect.y() << noforcesign; + if (option->state != QStyle::State_None) + debug << ", state=" << option->state; +#if QT_VERSION >= 0x050000 + if (option->styleObject && !option->styleObject->isWidgetType()) + debug << ", styleObject=" << option->styleObject; +#endif debug << ')'; return debug; } @@ -132,6 +155,15 @@ QRect DebugProxyStyle::itemPixmapRect(const QRect &r, int flags, const QPixmap & return result; } +int DebugProxyStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, + QStyleHintReturn *returnData) const +{ + const int result = QProxyStyle::styleHint(hint, option, widget, returnData); + qDebug() << __FUNCTION__ << hint << option << widget << "returnData=" + << returnData << "returns" << result; + return result; +} + int DebugProxyStyle::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const { const int result = QProxyStyle::pixelMetric(metric, option, widget); diff --git a/tests/manual/diaglib/debugproxystyle.h b/tests/manual/diaglib/debugproxystyle.h index 74407e7f3e..01e1e6b6d1 100644 --- a/tests/manual/diaglib/debugproxystyle.h +++ b/tests/manual/diaglib/debugproxystyle.h @@ -48,6 +48,7 @@ public: QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const; QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const; QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const; + int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const; int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const; QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = 0) const; QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const; diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro index 8777cc6e11..05988c2160 100644 --- a/tests/manual/manual.pro +++ b/tests/manual/manual.pro @@ -56,11 +56,7 @@ contains(QT_CONFIG, opengl) { contains(QT_CONFIG, egl): SUBDIRS += qopenglcontext } -win32 { - SUBDIRS -= network_remote_stresstest network_stresstest - # disable some tests on wince because of missing dependencies - wince: SUBDIRS -= lance windowmodality -} +win32: SUBDIRS -= network_remote_stresstest network_stresstest lessThan(QT_MAJOR_VERSION, 5): SUBDIRS -= bearerex lance qnetworkaccessmanager/qget qmimedatabase qnetworkreply \ qpainfo qscreen socketengine xembed-raster xembed-widgets windowtransparency \ diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 466be701c4..c356728564 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -239,7 +239,7 @@ Configure::Configure(int& argc, char** argv) : verbose(0) dictionary[ "STATIC_RUNTIME" ] = "no"; - dictionary[ "ZLIB" ] = "auto"; + dictionary[ "SYSTEM_ZLIB" ] = "auto"; dictionary[ "PCRE" ] = "auto"; @@ -260,7 +260,6 @@ Configure::Configure(int& argc, char** argv) : verbose(0) dictionary[ "ACCESSIBILITY" ] = "yes"; dictionary[ "OPENGL" ] = "yes"; dictionary[ "OPENGL_ES_2" ] = "yes"; - dictionary[ "OPENVG" ] = "no"; dictionary[ "SSL" ] = "auto"; dictionary[ "OPENSSL" ] = "auto"; dictionary[ "LIBPROXY" ] = "auto"; @@ -555,24 +554,11 @@ void Configure::parseCmdLine() devOpt.append("\n").append(option); else devOpt = option; - } - - else if (configCmdLine.at(i) == "-no-zlib") { - // No longer supported since Qt 4.4.0 - // But save the information for later so that we can print a warning - // - // If you REALLY really need no zlib support, you can still disable - // it by doing the following: - // add "no-zlib" to mkspecs/qconfig.pri - // #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h) - // - // There's no guarantee that Qt will build under those conditions - dictionary[ "ZLIB_FORCED" ] = "yes"; } else if (configCmdLine.at(i) == "-qt-zlib") { - dictionary[ "ZLIB" ] = "qt"; + dictionary[ "SYSTEM_ZLIB" ] = "no"; } else if (configCmdLine.at(i) == "-system-zlib") { - dictionary[ "ZLIB" ] = "system"; + dictionary[ "SYSTEM_ZLIB" ] = "yes"; } else if (configCmdLine.at(i) == "-qt-pcre") { @@ -694,13 +680,6 @@ void Configure::parseCmdLine() } } - // OpenVG Support ------------------------------------------- - else if (configCmdLine.at(i) == "-openvg") { - dictionary[ "OPENVG" ] = "yes"; - } else if (configCmdLine.at(i) == "-no-openvg") { - dictionary[ "OPENVG" ] = "no"; - } - // Databases ------------------------------------------------ else if (configCmdLine.at(i) == "-qt-sql-mysql") dictionary[ "SQL_MYSQL" ] = "yes"; @@ -1614,11 +1593,10 @@ void Configure::applySpecSpecifics() dictionary[ "FREETYPE" ] = "yes"; dictionary[ "OPENGL" ] = "yes"; dictionary[ "OPENGL_ES_2" ] = "yes"; - dictionary[ "OPENVG" ] = "no"; dictionary[ "SSL" ] = "yes"; dictionary[ "OPENSSL" ] = "no"; dictionary[ "DBUS" ] = "no"; - dictionary[ "ZLIB" ] = "qt"; + dictionary[ "SYSTEM_ZLIB" ] = "no"; dictionary[ "PCRE" ] = "qt"; dictionary[ "ICU" ] = "qt"; dictionary[ "LARGE_FILE" ] = "no"; @@ -1794,8 +1772,6 @@ bool Configure::displayHelp() desc("", "no", "", " dynamic - Enable support for dynamically loaded OpenGL (either desktop or ES)", ' '); desc("OPENGL_ES_2", "yes", "", " es2 - Enable support for OpenGL ES 2.0\n", ' '); - desc("OPENVG", "no","-no-openvg", "Disables OpenVG functionality."); - desc("OPENVG", "yes","-openvg", "Enables OpenVG functionality.\n"); desc( "-force-asserts", "Activate asserts in release mode.\n"); desc( "-platform <spec>", "The operating system and compiler you are building on.\n(default %QMAKESPEC%)\n"); desc( "-xplatform <spec>", "The operating system and compiler you are cross compiling to.\n"); @@ -1856,8 +1832,8 @@ bool Configure::displayHelp() // 3rd party stuff options go below here -------------------------------------------------------------------------------- desc("Third Party Libraries:\n\n"); - desc("ZLIB", "qt", "-qt-zlib", "Use the zlib bundled with Qt."); - desc("ZLIB", "system", "-system-zlib", "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n"); + desc("SYSTEM_ZLIB", "no", "-qt-zlib", "Use the zlib bundled with Qt."); + desc("SYSTEM_ZLIB", "yes", "-system-zlib", "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n"); desc("PCRE", "qt", "-qt-pcre", "Use the PCRE library bundled with Qt."); desc("PCRE", "system", "-system-pcre", "Use the PCRE library from the operating system.\nSee http://pcre.org/\n"); @@ -2020,8 +1996,7 @@ QString Configure::locateFile(const QString &fileName) const QString Configure::defaultTo(const QString &option) { // We prefer using the system version of the 3rd party libs - if (option == "ZLIB" - || option == "PCRE" + if (option == "PCRE" || option == "LIBJPEG" || option == "LIBPNG") return "system"; @@ -2153,7 +2128,7 @@ bool Configure::checkAvailability(const QString &part) else if (part == "ATOMIC64-LIBATOMIC") available = tryCompileProject("common/atomic64", "LIBS+=-latomic"); - else if (part == "ZLIB") + else if (part == "SYSTEM_ZLIB") available = findFile("zlib.h"); else if (part == "PCRE") @@ -2297,22 +2272,6 @@ void Configure::autoDetection() } } - if (!dictionary["QMAKESPEC"].contains("msvc")) { - if (tryCompileProject("common/c++default", QString(), false)) { - QFile iiFile(buildPath + "/config.tests/common/c++default/c++default.ii"); - if (iiFile.open(QIODevice::ReadOnly)) { - QString content = QString::fromUtf8(iiFile.readAll()); - QRegExp expr("\\b([0-9]+)L\\b"); - if (expr.indexIn(content) != -1) - dictionary["CFG_STDCXX_DEFAULT"] = expr.cap(1); - } - } - if (dictionary["CFG_STDCXX_DEFAULT"].isEmpty()) { - cout << "Could not determine the C++ standard the compiler uses by default, assuming C++98." << endl; - dictionary["CFG_STDCXX_DEFAULT"] = "199711"; - } - } - if (dictionary["ATOMIC64"] == "auto") dictionary["ATOMIC64"] = checkAvailability("ATOMIC64") ? "yes" : checkAvailability("ATOMIC64-LIBATOMIC") ? "libatomic" : "no"; @@ -2324,8 +2283,8 @@ void Configure::autoDetection() dictionary["STYLE_WINDOWSVISTA"] = checkAvailability("STYLE_WINDOWSXP") ? defaultTo("STYLE_WINDOWSVISTA") : "no"; // Compression detection - if (dictionary["ZLIB"] == "auto") - dictionary["ZLIB"] = checkAvailability("ZLIB") ? defaultTo("ZLIB") : "qt"; + if (dictionary["SYSTEM_ZLIB"] == "auto") + dictionary["SYSTEM_ZLIB"] = checkAvailability("SYSTEM_ZLIB") ? "yes" : "no"; // PCRE detection if (dictionary["PCRE"] == "auto") @@ -2661,8 +2620,6 @@ void Configure::generateOutputVars() qtConfig += "c++11 c++14"; else if (dictionary[ "C++STD" ] == "c++1z") qtConfig += "c++11 c++14 c++1z"; - if (!dictionary[ "CFG_STDCXX_DEFAULT" ].isEmpty()) - qmakeVars += "QT_COMPILER_STDCXX = " + dictionary[ "CFG_STDCXX_DEFAULT" ]; if (dictionary[ "USE_GOLD_LINKER" ] == "yes") qmakeConfig += "use_gold_linker"; @@ -2687,9 +2644,7 @@ void Configure::generateOutputVars() qtConfig += "no-widgets"; // Compression -------------------------------------------------- - if (dictionary[ "ZLIB" ] == "qt") - qtConfig += "zlib"; - else if (dictionary[ "ZLIB" ] == "system") + if (dictionary[ "SYSTEM_ZLIB" ] == "yes") qtConfig += "system-zlib"; // PCRE --------------------------------------------------------- @@ -2869,11 +2824,6 @@ void Configure::generateOutputVars() qtConfig += "egl"; } - if (dictionary["OPENVG"] == "yes") { - qtConfig += "openvg"; - qtConfig += "egl"; - } - if (dictionary[ "SSL" ] == "yes") qtConfig += "ssl"; @@ -3613,16 +3563,11 @@ void Configure::generateConfigfiles() if (dictionary["GIF"] == "yes") qconfigList += "QT_BUILTIN_GIF_READER=1"; if (dictionary["PNG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_PNG"; if (dictionary["JPEG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_JPEG"; - if (dictionary["ZLIB"] == "no") { - qconfigList += "QT_NO_ZLIB"; - qconfigList += "QT_NO_COMPRESS"; - } if (dictionary["ACCESSIBILITY"] == "no") qconfigList += "QT_NO_ACCESSIBILITY"; if (dictionary["WIDGETS"] == "no") qconfigList += "QT_NO_WIDGETS"; if (dictionary["GUI"] == "no") qconfigList += "QT_NO_GUI"; if (dictionary["OPENGL"] == "no") qconfigList += "QT_NO_OPENGL"; - if (dictionary["OPENVG"] == "no") qconfigList += "QT_NO_OPENVG"; if (dictionary["SSL"] == "no") qconfigList += "QT_NO_SSL"; if (dictionary["OPENSSL"] == "no") qconfigList += "QT_NO_OPENSSL"; if (dictionary["OPENSSL"] == "linked") qconfigList += "QT_LINKED_OPENSSL"; @@ -3781,7 +3726,6 @@ void Configure::displayConfig() sout << "eventfd(7) support.........." << dictionary[ "QT_EVENTFD" ] << endl; sout << "Glib support................" << dictionary[ "QT_GLIB" ] << endl; sout << "CUPS support................" << dictionary[ "QT_CUPS" ] << endl; - sout << "OpenVG support.............." << dictionary[ "OPENVG" ] << endl; sout << "SSL support................." << dictionary[ "SSL" ] << endl; sout << "OpenSSL support............." << dictionary[ "OPENSSL" ] << endl; sout << "libproxy support............" << dictionary[ "LIBPROXY" ] << endl; @@ -3799,7 +3743,7 @@ void Configure::displayConfig() sout << endl; sout << "Third Party Libraries:" << endl; - sout << " ZLIB support............" << dictionary[ "ZLIB" ] << endl; + sout << " ZLIB support............" << (dictionary[ "SYSTEM_ZLIB" ] == QLatin1String("yes") ? QLatin1String("system") : QLatin1String("qt")) << endl; sout << " GIF support............." << dictionary[ "GIF" ] << endl; sout << " JPEG support............" << dictionary[ "JPEG" ] << endl; sout << " PNG support............." << dictionary[ "PNG" ] << endl; @@ -3895,17 +3839,6 @@ void Configure::displayConfig() sout << " configure -openssl-linked OPENSSL_LIBS=\"-lssleay32 -llibeay32\"" << endl; } } - if (dictionary[ "ZLIB_FORCED" ] == "yes") { - QString which_zlib = "supplied"; - if (dictionary[ "ZLIB" ] == "system") - which_zlib = "system"; - - sout << "NOTE: The -no-zlib option was supplied but is no longer supported." << endl - << endl - << "Qt now requires zlib support in all builds, so the -no-zlib" << endl - << "option was ignored. Qt will be built using the " << which_zlib - << "zlib" << endl; - } if (dictionary["OBSOLETE_ARCH_ARG"] == "yes") { sout << endl << "NOTE: The -arch option is obsolete." << endl |