diff --git a/.gitignore b/.gitignore index 394d405dbf..e1731c9a86 100644 --- a/.gitignore +++ b/.gitignore @@ -274,8 +274,6 @@ tags *.exe.embed.manifest *.exe_manifest.rc *.exe_manifest.res -*.appxmanifest -.qmake.winrt_uuid_* # Visual Studio Code generated files .vscode diff --git a/config_help.txt b/config_help.txt index f42a8ddd90..6a3e0c7eef 100644 --- a/config_help.txt +++ b/config_help.txt @@ -117,7 +117,7 @@ Build options: -appstore-compliant .. Disable code that is not allowed in platform app stores. This is on by default for platforms which require distribution through an app store by default, in particular Android, - iOS, tvOS, watchOS, and Universal Windows Platform. [auto] + iOS, tvOS, and watchOS. [auto] -qtnamespace .. Wrap all Qt library code in 'namespace {...}'. -qtlibinfix .. Rename all libQt5*.so to libQt5*.so. @@ -254,7 +254,7 @@ Core options: Network options: -ssl ................. Enable either SSL support method [auto] - -no-openssl .......... Do not use OpenSSL [default on Apple and WinRT] + -no-openssl .......... Do not use OpenSSL [default on Apple] -openssl-linked ...... Use OpenSSL and link to libssl [no] -openssl-runtime ..... Use OpenSSL and dynamically load libssl [auto] -schannel ............ Use Secure Channel [no] (Windows only) diff --git a/configure.cmake b/configure.cmake index b1ff2ba5b2..fa20b94333 100644 --- a/configure.cmake +++ b/configure.cmake @@ -419,7 +419,7 @@ qt_feature_config("separate_debug_info" QMAKE_PUBLIC_QT_CONFIG) qt_feature("appstore-compliant" PUBLIC LABEL "App store compliance" PURPOSE "Disables code that is not allowed in platform app stores" - AUTODETECT UIKIT OR ANDROID OR WINRT + AUTODETECT UIKIT OR ANDROID ) qt_feature("simulator_and_device" PUBLIC LABEL "Build for both simulator and device" @@ -455,7 +455,7 @@ qt_feature_config("framework" QMAKE_PUBLIC_CONFIG ) qt_feature("largefile" LABEL "Large file support" - CONDITION NOT ANDROID AND NOT INTEGRITY AND NOT WINRT AND NOT rtems + CONDITION NOT ANDROID AND NOT INTEGRITY AND NOT rtems ) qt_feature_definition("largefile" "QT_LARGEFILE_SUPPORT" VALUE "64") qt_feature_config("largefile" QMAKE_PRIVATE_CONFIG) @@ -756,7 +756,7 @@ qt_feature("concurrent" PUBLIC qt_feature_definition("concurrent" "QT_NO_CONCURRENT" NEGATE VALUE "1") qt_feature("dbus" PUBLIC PRIVATE LABEL "Qt D-Bus" - AUTODETECT NOT UIKIT AND NOT ANDROID AND NOT WINRT + AUTODETECT NOT UIKIT AND NOT ANDROID CONDITION QT_FEATURE_thread ) qt_feature_definition("dbus" "QT_NO_DBUS" NEGATE VALUE "1") @@ -930,7 +930,7 @@ qt_configure_add_summary_entry( qt_configure_add_summary_build_parts("Build parts") qt_configure_add_summary_entry( ARGS "appstore-compliant" - CONDITION APPLE OR ANDROID OR WINRT OR WIN32 + CONDITION APPLE OR ANDROID OR WIN32 ) qt_configure_end_summary_section() # end of "Build options" section qt_configure_add_summary_section(NAME "Qt modules and options") diff --git a/configure.json b/configure.json index c174b45262..fee86ede81 100644 --- a/configure.json +++ b/configure.json @@ -807,7 +807,7 @@ "appstore-compliant": { "label": "App store compliance", "purpose": "Disables code that is not allowed in platform app stores", - "autoDetect": "config.uikit || config.android || config.winrt", + "autoDetect": "config.uikit || config.android", "output": [ "publicFeature" ] }, "simulator_and_device": { @@ -859,7 +859,7 @@ }, "largefile": { "label": "Large file support", - "condition": "!config.android && !config.integrity && !config.winrt && !config.rtems", + "condition": "!config.android && !config.integrity && !config.rtems", "output": [ "privateConfig", { "type": "define", "name": "QT_LARGEFILE_SUPPORT", "value": 64 } @@ -1302,7 +1302,7 @@ }, "dbus": { "label": "Qt D-Bus", - "autoDetect": "!config.uikit && !config.android && !config.winrt", + "autoDetect": "!config.uikit && !config.android", "condition": "features.thread", "output": [ "privateFeature", "feature" ] }, @@ -1628,7 +1628,7 @@ { "type": "feature", "args": "appstore-compliant", - "condition": "config.darwin || config.android || config.winrt || config.win32" + "condition": "config.darwin || config.android || config.win32" } ] }, { diff --git a/configure.pri b/configure.pri index cba250f7b6..41d0bb81f5 100644 --- a/configure.pri +++ b/configure.pri @@ -211,9 +211,7 @@ defineReplace(qtConfFunc_licenseCheck) { showWhat = "Type 'L' to view the GNU Lesser General Public License version 3 (LGPLv3)." gpl2Ok = false gpl3Ok = false - winrt { - notTheLicense = "Note: GPL version 2 is not available on WinRT." - } else: wasm { + wasm { gpl3Ok = true theLicense = "GNU General Public License (GPL) version 3" showWhat = "Type 'G' to view the GNU General Public License version 3 (GPLv3)." diff --git a/mkspecs/common/msvc-version.conf b/mkspecs/common/msvc-version.conf index adb45582c7..046f803b75 100644 --- a/mkspecs/common/msvc-version.conf +++ b/mkspecs/common/msvc-version.conf @@ -1,6 +1,6 @@ # # qmake configuration for Microsoft Visual Studio C/C++ Compiler -# This file is used by win32-msvc and all winrt-XXX-msvcXXX specs +# This file is used by win32-msvc # # diff --git a/mkspecs/common/winrt_winphone/assets/logo_150x150.png b/mkspecs/common/winrt_winphone/assets/logo_150x150.png deleted file mode 100644 index 069171ca4d..0000000000 Binary files a/mkspecs/common/winrt_winphone/assets/logo_150x150.png and /dev/null differ diff --git a/mkspecs/common/winrt_winphone/assets/logo_30x30.png b/mkspecs/common/winrt_winphone/assets/logo_30x30.png deleted file mode 100644 index 2acac59e73..0000000000 Binary files a/mkspecs/common/winrt_winphone/assets/logo_30x30.png and /dev/null differ diff --git a/mkspecs/common/winrt_winphone/assets/logo_310x150.png b/mkspecs/common/winrt_winphone/assets/logo_310x150.png deleted file mode 100644 index 1a79482947..0000000000 Binary files a/mkspecs/common/winrt_winphone/assets/logo_310x150.png and /dev/null differ diff --git a/mkspecs/common/winrt_winphone/assets/logo_310x310.png b/mkspecs/common/winrt_winphone/assets/logo_310x310.png deleted file mode 100644 index 02144a9f39..0000000000 Binary files a/mkspecs/common/winrt_winphone/assets/logo_310x310.png and /dev/null differ diff --git a/mkspecs/common/winrt_winphone/assets/logo_44x44.png b/mkspecs/common/winrt_winphone/assets/logo_44x44.png deleted file mode 100644 index 3cc5bec19f..0000000000 Binary files a/mkspecs/common/winrt_winphone/assets/logo_44x44.png and /dev/null differ diff --git a/mkspecs/common/winrt_winphone/assets/logo_480x800.png b/mkspecs/common/winrt_winphone/assets/logo_480x800.png deleted file mode 100644 index 39a37dac5b..0000000000 Binary files a/mkspecs/common/winrt_winphone/assets/logo_480x800.png and /dev/null differ diff --git a/mkspecs/common/winrt_winphone/assets/logo_620x300.png b/mkspecs/common/winrt_winphone/assets/logo_620x300.png deleted file mode 100644 index a2be79f5d7..0000000000 Binary files a/mkspecs/common/winrt_winphone/assets/logo_620x300.png and /dev/null differ diff --git a/mkspecs/common/winrt_winphone/assets/logo_70x70.png b/mkspecs/common/winrt_winphone/assets/logo_70x70.png deleted file mode 100644 index 334b2722b5..0000000000 Binary files a/mkspecs/common/winrt_winphone/assets/logo_70x70.png and /dev/null differ diff --git a/mkspecs/common/winrt_winphone/assets/logo_71x71.png b/mkspecs/common/winrt_winphone/assets/logo_71x71.png deleted file mode 100644 index 16d0808759..0000000000 Binary files a/mkspecs/common/winrt_winphone/assets/logo_71x71.png and /dev/null differ diff --git a/mkspecs/common/winrt_winphone/assets/logo_store.png b/mkspecs/common/winrt_winphone/assets/logo_store.png deleted file mode 100644 index 417ccdcb5f..0000000000 Binary files a/mkspecs/common/winrt_winphone/assets/logo_store.png and /dev/null differ diff --git a/mkspecs/common/winrt_winphone/manifests/10.0/AppxManifest.xml.in b/mkspecs/common/winrt_winphone/manifests/10.0/AppxManifest.xml.in deleted file mode 100644 index fe9ddaf8f1..0000000000 --- a/mkspecs/common/winrt_winphone/manifests/10.0/AppxManifest.xml.in +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - $${WINRT_MANIFEST.name} - $${WINRT_MANIFEST.publisher} - $${WINRT_MANIFEST.logo_store} - - - - $${WINRT_MANIFEST.dependencies} - - - - - - - - - - - - - - - $${WINRT_MANIFEST.capabilities} - diff --git a/mkspecs/common/winrt_winphone/qmake.conf b/mkspecs/common/winrt_winphone/qmake.conf deleted file mode 100644 index 55fcbe5ab3..0000000000 --- a/mkspecs/common/winrt_winphone/qmake.conf +++ /dev/null @@ -1,103 +0,0 @@ -# -# qmake configuration for winrt and windows phone 8.1 -# -# Written for Microsoft Visual C++ -# - -MAKEFILE_GENERATOR = MSBUILD -QMAKE_COMPILER = msvc -QMAKE_PLATFORM = winrt win32 -CONFIG = package_manifest $$CONFIG incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target rtti -# MSVC 2017 15.8+ fixed std::aligned_storage but compilation fails without -# _ENABLE_EXTENDED_ALIGNED_STORAGE flag since the fix breaks binary compatibility. -DEFINES += UNICODE WIN32 QT_LARGEFILE_SUPPORT Q_BYTE_ORDER=Q_LITTLE_ENDIAN _ENABLE_EXTENDED_ALIGNED_STORAGE -DEFINES_RELEASE += NDEBUG -QMAKE_COMPILER_DEFINES += _WIN32 - -DEPLOYMENT_PLUGIN += qwinrt - -QMAKE_CC = cl -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = bison -y -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -nologo -QMAKE_CFLAGS_WARN_ON = -W3 -QMAKE_CFLAGS_WARN_OFF = -W0 -QMAKE_CFLAGS_RELEASE = -O2 -MD -QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi -QMAKE_CFLAGS_DEBUG = -Zi -MDd -QMAKE_CFLAGS_YACC = -QMAKE_CFLAGS_LTCG = -GL -QMAKE_CFLAGS_MP = -MP -QMAKE_CFLAGS_SSE2 = -arch:SSE2 -QMAKE_CFLAGS_SSE3 = -arch:SSE2 -QMAKE_CFLAGS_SSSE3 = -arch:SSE2 -QMAKE_CFLAGS_SSE4_1 = -arch:SSE2 -QMAKE_CFLAGS_SSE4_2 = -arch:SSE2 -QMAKE_CFLAGS_AVX = -arch:AVX -QMAKE_CFLAGS_AVX2 = -arch:AVX -QMAKE_CFLAGS_AESNI = -arch:SSE2 -QMAKE_CFLAGS_SHANI = -arch:SSE2 - -QMAKE_CXX = $$QMAKE_CC -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w34100 -w34189 -w44996 -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG -QMAKE_CXXFLAGS_MP = $$QMAKE_CFLAGS_MP -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 = /wd4530 /wd4577 - -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 /DYNAMICBASE /NXCOMPAT /NODEFAULTLIB:ole32.lib /APPCONTAINER -QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO -QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = /DEBUG /OPT:REF /INCREMENTAL:NO -QMAKE_LFLAGS_DEBUG = /DEBUG -QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS -QMAKE_LFLAGS_EXE = /MANIFEST:NO -QMAKE_LFLAGS_DLL = /MANIFEST:NO /DLL -QMAKE_LFLAGS_LTCG = /LTCG -QMAKE_PREFIX_SHLIB = -QMAKE_EXTENSION_SHLIB = dll -QMAKE_PREFIX_STATICLIB = -QMAKE_EXTENSION_STATICLIB = lib - -QMAKE_LIBS += runtimeobject.lib -QMAKE_LIBS_GUI = -QMAKE_LIBS_NETWORK += ws2_32.lib - -QMAKE_LIBS_QT_ENTRY = -lqtmain - -QMAKE_IDL = midl -QMAKE_LIB = lib /NOLOGO -QMAKE_RC = rc - -VCPROJ_EXTENSION = .vcxproj -VCSOLUTION_EXTENSION = .sln -VCPROJ_KEYWORD = Qt4VSv1.0 -WINRT_ASSETS_PATH = $$PWD/assets - -WINRT_MANIFEST.capabilities = defaults -WINRT_MANIFEST.capabilities_device = defaults - -WINDOWS_TARGET_PLATFORM_VERSION = $$(UCRTVERSION) - -load(qt_config) diff --git a/mkspecs/common/winrt_winphone/qplatformdefs.h b/mkspecs/common/winrt_winphone/qplatformdefs.h deleted file mode 100644 index c561e41668..0000000000 --- a/mkspecs/common/winrt_winphone/qplatformdefs.h +++ /dev/null @@ -1,139 +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_winrt.h" - -#define _POSIX_ -#include -#undef _POSIX_ - -#include -#include -#include -#include -#include -#include -#include -#include - -#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 ::_stat -#define QT_FSTAT ::_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 _fileno -#define QT_OPEN ::_open -#define QT_CLOSE ::_close -#ifdef QT_LARGEFILE_SUPPORT -#define QT_LSEEK ::_lseeki64 -#define QT_TSTAT ::_tstati64 -#else -#define QT_LSEEK ::_lseek -#define QT_TSTAT ::_tstat -#endif -#define QT_READ ::_read -#define QT_WRITE ::_write -#define QT_ACCESS ::_access -#define QT_GETCWD ::_getcwd -#define QT_CHDIR ::_chdir -#define QT_MKDIR ::_mkdir -#define QT_RMDIR ::_rmdir -#define QT_OPEN_LARGEFILE 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 -#if defined(O_TEXT) -# define QT_OPEN_TEXT _O_TEXT -# define QT_OPEN_BINARY _O_BINARY -#endif - -#include "../common/c89/qplatformdefs.h" - -#ifdef QT_LARGEFILE_SUPPORT -#undef QT_FSEEK -#undef QT_FTELL -#undef QT_OFF_T - -#define QT_FSEEK ::_fseeki64 -#define QT_FTELL ::_ftelli64 -#define QT_OFF_T __int64 -#endif - -#define QT_SIGNAL_ARGS int - -#define QT_VSNPRINTF(buffer, count, format, arg) \ - vsnprintf_s(buffer, count, count-1, 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/configure.prf b/mkspecs/features/configure.prf index 934a18a924..af5ebeddd5 100644 --- a/mkspecs/features/configure.prf +++ b/mkspecs/features/configure.prf @@ -39,12 +39,6 @@ defineTest(qtCompileTest) { # Disable qmake features which are typically counterproductive for tests qmake_configs = "\"CONFIG -= qt debug_and_release app_bundle lib_bundle\"" - # On WinRT we need to change the entry point as we cannot create windows - # applications - winrt { - qmake_configs += " \"QMAKE_LFLAGS+=/ENTRY:main\"" - } - # Clean up after previous run exists($$test_out_dir/Makefile):qtRunLoggedCommand("$$test_cmd_base $$QMAKE_MAKE distclean") diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 69d1954306..4a53b99ca1 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -226,15 +226,6 @@ for(ever) { } } QMAKE_USE$$var_sfx += $$MODULE_USES - # Add capabilities as defined by modules used in the project - winrt { - MODULE_WINRT_CAPABILITIES = $$eval(QT.$${QTLIB}.winrt_capabilities) - !isEmpty(MODULE_WINRT_CAPABILITIES): \ - WINRT_MANIFEST.capabilities_default += $$MODULE_WINRT_CAPABILITIES - MODULE_WINRT_CAPABILITIES_DEVICE = $$eval(QT.$${QTLIB}.winrt_capabilities_device) - !isEmpty(MODULE_WINRT_CAPABILITIES_DEVICE): \ - WINRT_MANIFEST.capabilities_device_default += $$MODULE_WINRT_CAPABILITIES_DEVICE - } } !isEmpty(BAD_QT):error("Unknown module(s) in QT$$var_sfx: $$replace(BAD_QT, _private$, -private)") diff --git a/mkspecs/features/qt_build_config.prf b/mkspecs/features/qt_build_config.prf index 7ca9943c32..55e01e4a65 100644 --- a/mkspecs/features/qt_build_config.prf +++ b/mkspecs/features/qt_build_config.prf @@ -85,7 +85,7 @@ CONFIG = qt_build_extra $$CONFIG cross_compile: \ CONFIG += force_bootstrap -android|uikit|winrt: \ +android|uikit: \ CONFIG += builtin_testdata # Prevent warnings about object files without any symbols diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 6537d98c5d..93448acb91 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -1225,11 +1225,6 @@ defineTest(qtConfTest_compile) { qmake_args += "\"CONFIG += $$qmake_configs\"" !$$host|!cross_compile { - # On WinRT we need to change the entry point as we cannot create windows - # applications - winrt: \ - qmake_args += " \"QMAKE_LFLAGS += /ENTRY:main\"" - # add compiler flags, these are set for the target and should not be applied to host tests !isEmpty(EXTRA_DEFINES): \ qmake_args += $$system_quote(DEFINES += $$val_escape(EXTRA_DEFINES)) diff --git a/mkspecs/features/qt_module_pris.prf b/mkspecs/features/qt_module_pris.prf index 719caf3d4a..a8cc9835a5 100644 --- a/mkspecs/features/qt_module_pris.prf +++ b/mkspecs/features/qt_module_pris.prf @@ -154,9 +154,6 @@ defineReplace(qtExportLibsForModule) { "QT_CONFIG +=$$join(QT.$${MODULE_ID}.QT_CONFIG, " ", " ")" \ "" \ "QT_MODULES += $$MODULE" - winrt: MODULE_PRI_CONT += \ - "QT.$${MODULE_ID}.winrt_capabilities =$$join(MODULE_WINRT_CAPABILITIES, " ", " ")" \ - "QT.$${MODULE_ID}.winrt_capabilities_device =$$join(MODULE_WINRT_CAPABILITIES_DEVICE, " ", " ")" write_file($$MODULE_PRI, MODULE_PRI_CONT)|error() !internal_module:!no_private_module { module_build_type += internal_module @@ -233,7 +230,6 @@ defineReplace(qtExportLibsForModule) { for(var, $$list(VERSION MAJOR_VERSION MINOR_VERSION PATCH_VERSION \ name module depends run_depends plugin_types module_config CONFIG DEFINES \ priority includes bins libs frameworks \ - winrt_capabilities winrt_capabilities_device \ )):defined(QT.$${mod}.$$var, var):cache(QT.$${mod}.$$var, transient) } cache(QT_MODULES, transient) diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf index 9d790f62bc..e03c21dea2 100644 --- a/mkspecs/features/toolchain.prf +++ b/mkspecs/features/toolchain.prf @@ -153,10 +153,10 @@ msvc { arch = amd64 else: !equals(arch, arm):!equals(arch, arm64): \ # may be "win32" or undefined arch = x86 - # Consider only WinRT and ARM64 desktop builds to be cross-builds - + # Consider only ARM64 desktop builds to be cross-builds - # the host is assumed to be Intel and capable of running the target # executables (so building for x64 on x86 will break). - winrt|equals(arch, arm64): \ + equals(arch, arm64): \ CONFIG += msvc_cross } @@ -337,7 +337,6 @@ isEmpty($${target_prefix}.INCDIRS) { error("Failed to find the Visual C installation directory.") cmd += $$system_quote($$dir\\vcvarsall.bat) $$arch } - winrt: cmd += store isEmpty(WINSDK_VER): \ error("Mkspec does not specify WINSDK_VER. Cannot continue.") diff --git a/mkspecs/features/winrt/console.prf b/mkspecs/features/winrt/console.prf deleted file mode 100644 index c4afe5b96e..0000000000 --- a/mkspecs/features/winrt/console.prf +++ /dev/null @@ -1,5 +0,0 @@ -# This is an empty prf file to overwrite the win32 version. -# On Windows RT all applications need to be windows applications -# and also link to winmain. Inside winmain we create the launch -# arguments and also initialize the UI. - diff --git a/mkspecs/features/winrt/default_pre.prf b/mkspecs/features/winrt/default_pre.prf deleted file mode 100644 index 966d24f091..0000000000 --- a/mkspecs/features/winrt/default_pre.prf +++ /dev/null @@ -1,14 +0,0 @@ -# Note that the order is important - ucrt(d) has to be first. -# Otherwise, the linker might use malloc from a different library, -# but free_dbg() from the runtime, causing an assertion failure -# due to deleting an item from a different heap. -# vcruntime(d) is necessary when we don't link to any libraries -# which would pull it in transitively. -CONFIG(debug, debug|release): \ - QMAKE_LIBS = ucrtd.lib vcruntimed.lib $$QMAKE_LIBS -else: \ - QMAKE_LIBS = ucrt.lib vcruntime.lib $$QMAKE_LIBS - -equals(TEMPLATE, "vcapp"):!static: CONFIG += windeployqt - -load(default_pre) diff --git a/mkspecs/features/winrt/package_manifest.prf b/mkspecs/features/winrt/package_manifest.prf deleted file mode 100644 index 279971bd65..0000000000 --- a/mkspecs/features/winrt/package_manifest.prf +++ /dev/null @@ -1,200 +0,0 @@ -# This performs basic variable replacement on the contents of the WinRT manifest template, as -# specified by WINRT_MANIFEST. The resulting manifest file is written to the output directory. -# While the most common options are covered by the default template, the developer is expected -# to make an application-level copy of the template in order to customize the manifest further. -# Afterwards, they can override the default template by assigning their template to WINRT_MANIFEST. -# -# All subkeys in WINRT_MANIFEST will be replaced if defined/found, so new variables can be easily -# added. - -# The manifest is generated for each build pass for normal apps, and only once for vcapps. -# - Normal apps have their package root directory in the same place as the target (one for each build pass). -# - Visual Studio requires a design-mode manifest in the same location as the vcproj. -!isEmpty(WINRT_MANIFEST): \ - if(build_pass:equals(TEMPLATE, "app"))| \ - if(!build_pass:equals(TEMPLATE, "vcapp")) { - - manifest_file.input = $$WINRT_MANIFEST - - contains(TEMPLATE, "vc.*") { - BUILD_DIR = $$OUT_PWD - } else { - load(resolve_target) - BUILD_DIR = $$dirname(QMAKE_RESOLVED_TARGET) - } - - contains(TEMPLATE, "vc.*"): \ - manifest_file.output = $$BUILD_DIR/Package.appxmanifest - else: \ - manifest_file.output = $$BUILD_DIR/AppxManifest.xml - - !contains(WINRT_MANIFEST.CONFIG, "verbatim") { - # Provide the C-runtime dependency - equals(TEMPLATE, "app") { - VCLIBS = Microsoft.VCLibs.$$replace(MSVC_VER, \\., ).00 - CONFIG(debug, debug|release): \ - VCLIBS = $${VCLIBS}.Debug - else: \ - VCLIBS = $${VCLIBS} - # VS 2017 and 2019 still use vclibs 140 - contains(MSVC_VER, "15.0"): VCLIBS = $$replace(VCLIBS, 150, 140) - contains(MSVC_VER, "16.0"): VCLIBS = $$replace(VCLIBS, 160, 140) - VCLIBS = "$${VCLIBS}\" MinVersion=\"14.0.0.0\" Publisher=\"CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" - WINRT_MANIFEST.dependencies += $$VCLIBS - } - - # Provide default values for required variables - isEmpty(WINRT_MANIFEST.target): WINRT_MANIFEST.target = $$TARGET - isEmpty(WINRT_MANIFEST.identity) { - # Reuse the existing UUID if possible - UUID_CACHE = $$OUT_PWD/.qmake.winrt_uuid_$$TARGET - exists($$UUID_CACHE) { - include($$UUID_CACHE) - } else { - WINRT_UUID = $$system(uuidgen) - isEmpty(WINRT_UUID): error("Unable to generate a UUID. Make sure uuidgen is in your PATH.") - WINRT_UUID = "WINRT_MANIFEST.identity = $$WINRT_UUID" - write_file($$UUID_CACHE, WINRT_UUID)|error("Unable to write the UUID cache; aborting.") - eval($$WINRT_UUID) - } - } - isEmpty(WINRT_MANIFEST.name): WINRT_MANIFEST.name = $$TARGET - isEmpty(WINRT_MANIFEST.architecture): WINRT_MANIFEST.architecture = $$VCPROJ_ARCH - isEmpty(WINRT_MANIFEST.version): WINRT_MANIFEST.version = 1.0.0.0 - isEmpty(WINRT_MANIFEST.publisher): WINRT_MANIFEST.publisher = Default publisher display name - isEmpty(WINRT_MANIFEST.publisherid): WINRT_MANIFEST.publisherid = CN=$$(USERNAME) - isEmpty(WINRT_MANIFEST.phone_product_id): WINRT_MANIFEST.phone_product_id = $$WINRT_MANIFEST.identity - isEmpty(WINRT_MANIFEST.phone_publisher_id): WINRT_MANIFEST.phone_publisher_id = 00000000-0000-0000-0000-000000000000 - isEmpty(WINRT_MANIFEST.description): WINRT_MANIFEST.description = Default package description - isEmpty(WINRT_MANIFEST.background): WINRT_MANIFEST.background = green - isEmpty(WINRT_MANIFEST.foreground): WINRT_MANIFEST.foreground = light - isEmpty(WINRT_MANIFEST.default_language): WINRT_MANIFEST.default_language = en - isEmpty(WINRT_MANIFEST.minVersion): \ - WINRT_MANIFEST.minVersion = $$WINDOWS_TARGET_PLATFORM_VERSION - isEmpty(WINRT_MANIFEST.maxVersionTested): \ - WINRT_MANIFEST.maxVersionTested = $$WINDOWS_TARGET_PLATFORM_MIN_VERSION - - INDENT = "$$escape_expand(\\r\\n) " - - VS_XML_NAMESPACE = "m2" - WINRT_MANIFEST.rotation_preference = $$unique(WINRT_MANIFEST.rotation_preference) - !isEmpty(WINRT_MANIFEST.rotation_preference) { - MANIFEST_ROTATION += "<$${VS_XML_NAMESPACE}:InitialRotationPreference>" - for(ROTATION, WINRT_MANIFEST.rotation_preference): \ - MANIFEST_ROTATION += " <$${VS_XML_NAMESPACE}:Rotation Preference=\"$$ROTATION\" />" - MANIFEST_ROTATION += "" - - WINRT_MANIFEST.rotation_preference = $$join(MANIFEST_ROTATION, $$INDENT, $$INDENT) - } - - INDENT = "$$escape_expand(\\r\\n) " - - # All Windows 10 applications need to have internetClient. - WINRT_MANIFEST.capabilities += internetClient - - contains(WINRT_MANIFEST.capabilities, defaults) { - WINRT_MANIFEST.capabilities -= defaults - WINRT_MANIFEST.capabilities += $$WINRT_MANIFEST.capabilities_default - } - - contains(WINRT_MANIFEST.capabilities_device, defaults) { - WINRT_MANIFEST.capabilities_device -= defaults - WINRT_MANIFEST.capabilities_device += $$WINRT_MANIFEST.capabilities_device_default - } - - UAP_CAPABILITIES += \ - appointments \ - blockedChatMessages \ - chat \ - contacts \ - enterpriseAuthentication \ - # internetClient is special, as it needs to be written without namespace - #internetClient \ - musicLibrary \ - objects3D \ - phoneCall \ - picturesLibrary \ - removableStorage \ - sharedUserCertificates \ - userAccountInformation \ - videosLibrary \ - voipCall - - UAP3_CAPABILITIES += backgroundMediaPlayback remoteSystem userNotificationListener - - IOT_CAPABILITIES += systemManagement - - # Capabilities are given as a string list and may change with the configuration (network, sensors, etc.) - WINRT_MANIFEST.capabilities = $$unique(WINRT_MANIFEST.capabilities) - WINRT_MANIFEST.capabilities_device = $$unique(WINRT_MANIFEST.capabilities_device) - !isEmpty(WINRT_MANIFEST.capabilities)|!isEmpty(WINRT_MANIFEST.capabilities_device) { - MANIFEST_CAPABILITIES += "" - for (CAPABILITY, WINRT_MANIFEST.capabilities) { - contains(UAP_CAPABILITIES, $$CAPABILITY): \ - MANIFEST_CAPABILITIES += " " - else:contains(UAP3_CAPABILITIES, $$CAPABILITY): \ - MANIFEST_CAPABILITIES += " " - else:contains(IOT_CAPABILITIES, $$CAPABILITY): \ - MANIFEST_CAPABILITIES += " " - else: \ - MANIFEST_CAPABILITIES += " " - } - for(CAPABILITY, WINRT_MANIFEST.capabilities_device): \ - MANIFEST_CAPABILITIES += " " - MANIFEST_CAPABILITIES += "" - - WINRT_MANIFEST.capabilities = $$join(MANIFEST_CAPABILITIES, $$INDENT, $$INDENT) - } - - # Dependencies are given as a string list. The CRT dependency is added automatically above. - # For MSVC2015/2017 the dependencies are added in conjunction with TargetDeviceFamily - # Due to the hard coded dependency on "Windows.Universal" the tag - # is already inside the MSVC2015 manifest. - WINRT_MANIFEST.dependencies = $$unique(WINRT_MANIFEST.dependencies) - !isEmpty(WINRT_MANIFEST.dependencies) { - for(DEPENDENCY, WINRT_MANIFEST.dependencies): \ - MANIFEST_DEPENDENCIES += " " - - WINRT_MANIFEST.dependencies = $$join(MANIFEST_DEPENDENCIES, $$INDENT, $$INDENT) - } - - # Provide default icons where needed - isEmpty(WINRT_ASSETS_PATH): WINRT_ASSETS_PATH = $$[QT_HOST_DATA/get]/mkspecs/common/winrt_winphone/assets - TEMPLATE_CONTENTS = $$cat($$WINRT_MANIFEST, lines) - ICONS_FOUND = $$find(TEMPLATE_CONTENTS, \\\$\\\$\\{WINRT_MANIFEST\\.(logo|tile)_) - ICONS_FOUND ~= s/.*\\\$\\\$\\{WINRT_MANIFEST\\.((logo|tile)_[^\}]+)\\}.*/\\1/g - for (ICON_NAME, ICONS_FOUND) { - ICON_FILE = $$eval(WINRT_MANIFEST.$$ICON_NAME) - isEmpty(ICON_FILE) { - equals(ICON_NAME, "logo_310x150"): ICON_FILE = $$eval(WINRT_MANIFEST.logo_wide) - else: equals(ICON_NAME, "logo_150x150"): ICON_FILE = $$eval(WINRT_MANIFEST.logo_large) - # Windows Phone specifics - else: equals(ICON_NAME, "logo_480x800"): ICON_FILE = $$eval(WINRT_MANIFEST.logo_splash) - else: equals(ICON_NAME, "logo_71x71"): ICON_FILE = $$eval(WINRT_MANIFEST.logo_medium) - else: equals(ICON_NAME, "logo_44x44"): ICON_FILE = $$eval(WINRT_MANIFEST.logo_small) - # Windows RT specifics - else: equals(ICON_NAME, "logo_620x300"): ICON_FILE = $$eval(WINRT_MANIFEST.logo_splash) - else: equals(ICON_NAME, "logo_70x70"): ICON_FILE = $$eval(WINRT_MANIFEST.logo_medium) - else: equals(ICON_NAME, "logo_30x30"): ICON_FILE = $$eval(WINRT_MANIFEST.logo_small) - } - isEmpty(ICON_FILE): ICON_FILE = $$WINRT_ASSETS_PATH/$${ICON_NAME}.png - icon_$${ICON_NAME}.input = $$ICON_FILE - icon_$${ICON_NAME}.output = $$BUILD_DIR/assets/$$basename(ICON_FILE) - icon_$${ICON_NAME}.CONFIG = verbatim - QMAKE_SUBSTITUTES += icon_$${ICON_NAME} - WINRT_MANIFEST.$${ICON_NAME} = assets/$$basename(ICON_FILE) - } - - !contains(TEMPLATE, "vc.*") { - winrt_manifest_install.files = $$manifest_file.output - winrt_manifest_install.path = $$target.path - winrt_assets_install.files = $$BUILD_DIR/assets/* - winrt_assets_install.path = $$target.path/assets - INSTALLS += winrt_manifest_install winrt_assets_install - } - } else { - manifest_file.CONFIG += verbatim - } - - QMAKE_SUBSTITUTES += manifest_file -} diff --git a/mkspecs/winrt-arm-msvc2015/qmake.conf b/mkspecs/winrt-arm-msvc2015/qmake.conf deleted file mode 100644 index bc113d4954..0000000000 --- a/mkspecs/winrt-arm-msvc2015/qmake.conf +++ /dev/null @@ -1,19 +0,0 @@ -# -# qmake configuration for winrt-arm-msvc2015 -# -# Written for Microsoft Visual C++ 2015 -# - -include(../common/winrt_winphone/qmake.conf) -DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PHONE_APP=1 ARM __ARM__ __arm__ - -QMAKE_CFLAGS += -FS -QMAKE_CXXFLAGS += -FS -QMAKE_LFLAGS += /MACHINE:ARM /NODEFAULTLIB:kernel32.lib - -QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib OneCore.lib - -VCPROJ_ARCH = ARM -WINSDK_VER = 10.0 -WINRT_MANIFEST = $$PWD/../common/winrt_winphone/manifests/10.0/AppxManifest.xml.in -WINRT_MANIFEST.architecture = arm diff --git a/mkspecs/winrt-arm-msvc2015/qplatformdefs.h b/mkspecs/winrt-arm-msvc2015/qplatformdefs.h deleted file mode 100644 index 2a1aef5e88..0000000000 --- a/mkspecs/winrt-arm-msvc2015/qplatformdefs.h +++ /dev/null @@ -1,40 +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/winrt_winphone/qplatformdefs.h" diff --git a/mkspecs/winrt-arm-msvc2017/qmake.conf b/mkspecs/winrt-arm-msvc2017/qmake.conf deleted file mode 100644 index 1160d5766d..0000000000 --- a/mkspecs/winrt-arm-msvc2017/qmake.conf +++ /dev/null @@ -1,19 +0,0 @@ -# -# qmake configuration for winrt-arm-msvc2017 -# -# Written for Microsoft Visual C++ 2017 -# - -include(../common/winrt_winphone/qmake.conf) -DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PHONE_APP=1 ARM __ARM__ __arm__ - -QMAKE_CFLAGS += -FS -QMAKE_CXXFLAGS += -FS -QMAKE_LFLAGS += /MACHINE:ARM /NODEFAULTLIB:kernel32.lib - -QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib OneCore.lib - -VCPROJ_ARCH = ARM -WINSDK_VER = 10.0 -WINRT_MANIFEST = $$PWD/../common/winrt_winphone/manifests/10.0/AppxManifest.xml.in -WINRT_MANIFEST.architecture = arm diff --git a/mkspecs/winrt-arm-msvc2017/qplatformdefs.h b/mkspecs/winrt-arm-msvc2017/qplatformdefs.h deleted file mode 100644 index 907834d385..0000000000 --- a/mkspecs/winrt-arm-msvc2017/qplatformdefs.h +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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/winrt_winphone/qplatformdefs.h" diff --git a/mkspecs/winrt-arm-msvc2019/qmake.conf b/mkspecs/winrt-arm-msvc2019/qmake.conf deleted file mode 100644 index fe30a843eb..0000000000 --- a/mkspecs/winrt-arm-msvc2019/qmake.conf +++ /dev/null @@ -1,19 +0,0 @@ -# -# qmake configuration for winrt-arm-msvc2019 -# -# Written for Microsoft Visual C++ 2019 -# - -include(../common/winrt_winphone/qmake.conf) -DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PHONE_APP=1 ARM __ARM__ __arm__ - -QMAKE_CFLAGS += -FS -QMAKE_CXXFLAGS += -FS -QMAKE_LFLAGS += /MACHINE:ARM /NODEFAULTLIB:kernel32.lib - -QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib OneCore.lib - -VCPROJ_ARCH = ARM -WINSDK_VER = 10.0 -WINRT_MANIFEST = $$PWD/../common/winrt_winphone/manifests/10.0/AppxManifest.xml.in -WINRT_MANIFEST.architecture = arm diff --git a/mkspecs/winrt-arm-msvc2019/qplatformdefs.h b/mkspecs/winrt-arm-msvc2019/qplatformdefs.h deleted file mode 100644 index 4222bca8e1..0000000000 --- a/mkspecs/winrt-arm-msvc2019/qplatformdefs.h +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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/winrt_winphone/qplatformdefs.h" diff --git a/mkspecs/winrt-arm64-msvc2017/qmake.conf b/mkspecs/winrt-arm64-msvc2017/qmake.conf deleted file mode 100644 index e53c9ba748..0000000000 --- a/mkspecs/winrt-arm64-msvc2017/qmake.conf +++ /dev/null @@ -1,19 +0,0 @@ -# -# qmake configuration for winrt-arm64-msvc2017 -# -# Written for Microsoft Visual C++ 2017 -# - -include(../common/winrt_winphone/qmake.conf) -DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PHONE_APP=1 arm64 __arm64__ __arm64__ - -QMAKE_CFLAGS += -FS -QMAKE_CXXFLAGS += -FS -QMAKE_LFLAGS += /MACHINE:arm64 /NODEFAULTLIB:kernel32.lib - -QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib OneCore.lib - -VCPROJ_ARCH = arm64 -WINSDK_VER = 10.0 -WINRT_MANIFEST = $$PWD/../common/winrt_winphone/manifests/10.0/AppxManifest.xml.in -WINRT_MANIFEST.architecture = arm64 diff --git a/mkspecs/winrt-arm64-msvc2017/qplatformdefs.h b/mkspecs/winrt-arm64-msvc2017/qplatformdefs.h deleted file mode 100644 index 4222bca8e1..0000000000 --- a/mkspecs/winrt-arm64-msvc2017/qplatformdefs.h +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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/winrt_winphone/qplatformdefs.h" diff --git a/mkspecs/winrt-arm64-msvc2019/qmake.conf b/mkspecs/winrt-arm64-msvc2019/qmake.conf deleted file mode 100644 index 8c16e93d26..0000000000 --- a/mkspecs/winrt-arm64-msvc2019/qmake.conf +++ /dev/null @@ -1,19 +0,0 @@ -# -# qmake configuration for winrt-arm64-msvc2019 -# -# Written for Microsoft Visual C++ 2019 -# - -include(../common/winrt_winphone/qmake.conf) -DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PHONE_APP=1 arm64 __arm64__ __arm64__ - -QMAKE_CFLAGS += -FS -QMAKE_CXXFLAGS += -FS -QMAKE_LFLAGS += /MACHINE:arm64 /NODEFAULTLIB:kernel32.lib - -QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib OneCore.lib - -VCPROJ_ARCH = arm64 -WINSDK_VER = 10.0 -WINRT_MANIFEST = $$PWD/../common/winrt_winphone/manifests/10.0/AppxManifest.xml.in -WINRT_MANIFEST.architecture = arm64 diff --git a/mkspecs/winrt-arm64-msvc2019/qplatformdefs.h b/mkspecs/winrt-arm64-msvc2019/qplatformdefs.h deleted file mode 100644 index 4222bca8e1..0000000000 --- a/mkspecs/winrt-arm64-msvc2019/qplatformdefs.h +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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/winrt_winphone/qplatformdefs.h" diff --git a/mkspecs/winrt-x64-msvc2015/qmake.conf b/mkspecs/winrt-x64-msvc2015/qmake.conf deleted file mode 100644 index d1d1eb6513..0000000000 --- a/mkspecs/winrt-x64-msvc2015/qmake.conf +++ /dev/null @@ -1,19 +0,0 @@ -# -# qmake configuration for winrt-x64-msvc2015 -# -# Written for Microsoft Visual C++ 2015 -# - -include(../common/winrt_winphone/qmake.conf) -DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PHONE_APP=1 X64 __X64__ __x64__ - -QMAKE_CFLAGS += -FS -QMAKE_CXXFLAGS += -FS -QMAKE_LFLAGS += /MACHINE:X64 /NODEFAULTLIB:kernel32.lib - -QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib OneCore.lib - -VCPROJ_ARCH = x64 -WINSDK_VER = 10.0 -WINRT_MANIFEST = $$PWD/../common/winrt_winphone/manifests/10.0/AppxManifest.xml.in -WINRT_MANIFEST.architecture = x64 diff --git a/mkspecs/winrt-x64-msvc2015/qplatformdefs.h b/mkspecs/winrt-x64-msvc2015/qplatformdefs.h deleted file mode 100644 index 2a1aef5e88..0000000000 --- a/mkspecs/winrt-x64-msvc2015/qplatformdefs.h +++ /dev/null @@ -1,40 +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/winrt_winphone/qplatformdefs.h" diff --git a/mkspecs/winrt-x64-msvc2017/qmake.conf b/mkspecs/winrt-x64-msvc2017/qmake.conf deleted file mode 100644 index dce896bd47..0000000000 --- a/mkspecs/winrt-x64-msvc2017/qmake.conf +++ /dev/null @@ -1,19 +0,0 @@ -# -# qmake configuration for winrt-x64-msvc2017 -# -# Written for Microsoft Visual C++ 2017 -# - -include(../common/winrt_winphone/qmake.conf) -DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PHONE_APP=1 X64 __X64__ __x64__ - -QMAKE_CFLAGS += -FS -QMAKE_CXXFLAGS += -FS -QMAKE_LFLAGS += /MACHINE:X64 /NODEFAULTLIB:kernel32.lib - -QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib OneCore.lib - -VCPROJ_ARCH = x64 -WINSDK_VER = 10.0 -WINRT_MANIFEST = $$PWD/../common/winrt_winphone/manifests/10.0/AppxManifest.xml.in -WINRT_MANIFEST.architecture = x64 diff --git a/mkspecs/winrt-x64-msvc2017/qplatformdefs.h b/mkspecs/winrt-x64-msvc2017/qplatformdefs.h deleted file mode 100644 index 2a1aef5e88..0000000000 --- a/mkspecs/winrt-x64-msvc2017/qplatformdefs.h +++ /dev/null @@ -1,40 +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/winrt_winphone/qplatformdefs.h" diff --git a/mkspecs/winrt-x64-msvc2019/qmake.conf b/mkspecs/winrt-x64-msvc2019/qmake.conf deleted file mode 100644 index 0d3b6d2196..0000000000 --- a/mkspecs/winrt-x64-msvc2019/qmake.conf +++ /dev/null @@ -1,19 +0,0 @@ -# -# qmake configuration for winrt-x64-msvc2019 -# -# Written for Microsoft Visual C++ 2019 -# - -include(../common/winrt_winphone/qmake.conf) -DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PHONE_APP=1 X64 __X64__ __x64__ - -QMAKE_CFLAGS += -FS -QMAKE_CXXFLAGS += -FS -QMAKE_LFLAGS += /MACHINE:X64 /NODEFAULTLIB:kernel32.lib - -QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib OneCore.lib - -VCPROJ_ARCH = x64 -WINSDK_VER = 10.0 -WINRT_MANIFEST = $$PWD/../common/winrt_winphone/manifests/10.0/AppxManifest.xml.in -WINRT_MANIFEST.architecture = x64 diff --git a/mkspecs/winrt-x64-msvc2019/qplatformdefs.h b/mkspecs/winrt-x64-msvc2019/qplatformdefs.h deleted file mode 100644 index 4222bca8e1..0000000000 --- a/mkspecs/winrt-x64-msvc2019/qplatformdefs.h +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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/winrt_winphone/qplatformdefs.h" diff --git a/mkspecs/winrt-x86-msvc2015/qmake.conf b/mkspecs/winrt-x86-msvc2015/qmake.conf deleted file mode 100644 index 06f059b600..0000000000 --- a/mkspecs/winrt-x86-msvc2015/qmake.conf +++ /dev/null @@ -1,18 +0,0 @@ -# -# qmake configuration for winrt-x86-msvc2015 -# -# Written for Microsoft Visual C++ 2015 -# - -include(../common/winrt_winphone/qmake.conf) -DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PHONE_APP=1 X86 __X86__ __x86__ - -QMAKE_CFLAGS += -FS -QMAKE_CXXFLAGS += -FS -QMAKE_LFLAGS += /SAFESEH /MACHINE:X86 /NODEFAULTLIB:kernel32.lib - -QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib OneCore.lib -VCPROJ_ARCH = Win32 -WINSDK_VER = 10.0 -WINRT_MANIFEST = $$PWD/../common/winrt_winphone/manifests/10.0/AppxManifest.xml.in -WINRT_MANIFEST.architecture = x86 diff --git a/mkspecs/winrt-x86-msvc2015/qplatformdefs.h b/mkspecs/winrt-x86-msvc2015/qplatformdefs.h deleted file mode 100644 index 2a1aef5e88..0000000000 --- a/mkspecs/winrt-x86-msvc2015/qplatformdefs.h +++ /dev/null @@ -1,40 +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/winrt_winphone/qplatformdefs.h" diff --git a/mkspecs/winrt-x86-msvc2017/qmake.conf b/mkspecs/winrt-x86-msvc2017/qmake.conf deleted file mode 100644 index 94fb68f6c0..0000000000 --- a/mkspecs/winrt-x86-msvc2017/qmake.conf +++ /dev/null @@ -1,18 +0,0 @@ -# -# qmake configuration for winrt-x86-msvc2017 -# -# Written for Microsoft Visual C++ 2017 -# - -include(../common/winrt_winphone/qmake.conf) -DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PHONE_APP=1 X86 __X86__ __x86__ - -QMAKE_CFLAGS += -FS -QMAKE_CXXFLAGS += -FS -QMAKE_LFLAGS += /SAFESEH /MACHINE:X86 /NODEFAULTLIB:kernel32.lib - -QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib OneCore.lib -VCPROJ_ARCH = Win32 -WINSDK_VER = 10.0 -WINRT_MANIFEST = $$PWD/../common/winrt_winphone/manifests/10.0/AppxManifest.xml.in -WINRT_MANIFEST.architecture = x86 diff --git a/mkspecs/winrt-x86-msvc2017/qplatformdefs.h b/mkspecs/winrt-x86-msvc2017/qplatformdefs.h deleted file mode 100644 index 2a1aef5e88..0000000000 --- a/mkspecs/winrt-x86-msvc2017/qplatformdefs.h +++ /dev/null @@ -1,40 +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/winrt_winphone/qplatformdefs.h" diff --git a/mkspecs/winrt-x86-msvc2019/qmake.conf b/mkspecs/winrt-x86-msvc2019/qmake.conf deleted file mode 100644 index 8948e20ab1..0000000000 --- a/mkspecs/winrt-x86-msvc2019/qmake.conf +++ /dev/null @@ -1,18 +0,0 @@ -# -# qmake configuration for winrt-x86-msvc2019 -# -# Written for Microsoft Visual C++ 2019 -# - -include(../common/winrt_winphone/qmake.conf) -DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PHONE_APP=1 X86 __X86__ __x86__ - -QMAKE_CFLAGS += -FS -QMAKE_CXXFLAGS += -FS -QMAKE_LFLAGS += /SAFESEH /MACHINE:X86 /NODEFAULTLIB:kernel32.lib - -QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib OneCore.lib -VCPROJ_ARCH = Win32 -WINSDK_VER = 10.0 -WINRT_MANIFEST = $$PWD/../common/winrt_winphone/manifests/10.0/AppxManifest.xml.in -WINRT_MANIFEST.architecture = x86 diff --git a/mkspecs/winrt-x86-msvc2019/qplatformdefs.h b/mkspecs/winrt-x86-msvc2019/qplatformdefs.h deleted file mode 100644 index 4222bca8e1..0000000000 --- a/mkspecs/winrt-x86-msvc2019/qplatformdefs.h +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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/winrt_winphone/qplatformdefs.h" diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index 95a0f42625..9b37756b79 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -3219,9 +3219,6 @@ On desktop Windows, the default value is the value of the environment variable \c{WindowsSDKVersion}. - On Universal Windows Platform (UWP), the default value is the value of the - environment variable \c{UCRTVERSION}. - \target WINDOWS_TARGET_PLATFORM_MIN_VERSION \section1 WINDOWS_TARGET_PLATFORM_MIN_VERSION @@ -3230,172 +3227,6 @@ Defaults to \c{WINDOWS_TARGET_PLATFORM_VERSION}. - \target WINRT_MANIFEST - \section1 WINRT_MANIFEST - - Specifies parameters to be passed to the application manifest on - \l{Qt for UWP}{UWP}. The allowed values are: - - \table - \header - \li Member - \li Description - \row - \li architecture - \li The target architecture. Defaults to \c VCPROJ_ARCH. - \row - \li background - \li Tile background color. Defaults to \c{green}. - \row - \li capabilities - \li Specifies capabilities to add to the capability list. - \row - \li capabilities_device - \li Specifies device capabilities to add to the capability list - (location, webcam, and so on). - \row - \li CONFIG - \li Specifies additional flags for processing the input manifest file. - Currently, \c{verbatim} is the only available option. - \row - \li default_language - \li The default language code of the application. Defaults to "en". - \row - \li dependencies - \li Specifies dependencies required by the package. - \row - \li description - \li Package description. Defaults to \c{Default package description}. - \row - \li foreground - \li Tile foreground (text) color. Defaults to \c{light}. - \row - \li iconic_tile_icon - \li Image file for the \c{iconic} tile template icon. Default provided by - the mkspec. - \row - \li iconic_tile_small - \li Image file for the small \c{iconic} tile template logo. Default provided - by the mkspec. - \row - \li identity - \li The unique ID of the app. Defaults to reusing the existing generated - manifest's UUID, or generates a new UUID if none is present. - \row - \li logo_30x30 - \li Logo image file of size 30x30 pixels. - \row - \li logo_41x41 - \li Logo image file of size 41x41 pixels. This parameter is obsolete. - \row - \li logo_70x70 - \li Logo image file of size 70x70 pixels. - \row - \li logo_71x71 - \li Logo image file of size 71x71 pixels. This parameter is obsolete. - \row - \li logo_150x150 - \li Logo image file of size 150x150 pixels. This is supported on all Windows - Store App platforms. - \row - \li logo_310x150 - \li Logo image file of size 310x150 pixels. This is supported on all Windows - Store App platforms. - \row - \li logo_310x310 - \li Logo image file of size 310x310 pixels. This is supported on all Windows - Store App platforms. - \row - \li logo_620x300 - \li Splash screen image file of size 620x300 pixels. - \row - \li logo_480x800 - \li Splash screen image file of size 480x800 pixels. - This parameter is obsolete. - \row - \li logo_large - \li Large logo image file. This has to be 150x150 pixels. Supported on all - Windows Store App platforms. Default provided by the mkspec. - \row - \li logo_medium - \li Medium logo image file. The image must have a pixel size of 70x70. - Default provided by the mkspec. - \row - \li logo_small - \li Small logo image file. The image must have a pixel size of 30x30. - Default provided by the mkspec. - \row - \li logo_splash - \li Splash screen image file. The image must have a pixel size of - 620x300. Default provided by the mkspec. - \row - \li logo_store - \li Logo image file for Windows Store. Default provided by the mkspec. - \row - \li logo_wide - \li Wide logo image file. This has to be 310x150 pixels. Supported on all - Windows Store App platforms. Default provided by the mkspec. - \row - \li name - \li The name of the package as displayed to the user. Defaults to TARGET. - \row - \li phone_product_id - \li The GUID of the product. - This parameter is obsolete. - \row - \li phone_publisher_id - \li The GUID of the publisher. - This parameter is obsolete. - \row - \li publisher - \li Display name of the publisher. Defaults to \c{Default publisher display name}. - \row - \li publisher_id - \li The publisher's distinguished name (default: \c{CN=MyCN}). - \row - \li target - \li The name of the target (.exe). Defaults to TARGET. - \row - \li version - \li The version number of the package. Defaults to \c{1.0.0.0}. - \row - \li minVersion - \li The minimum required Windows version to run the package. - Defaults to \c{WINDOWS_TARGET_PLATFORM_VERSION}. - \row - \li maxVersionTested - \li The maximum Windows version the package has been tested against. - Defaults to \c{WINDOWS_TARGET_PLATFORM_MIN_VERSION}. - - \endtable - - You can use any combination of those values. - - For example: - - \code - WINRT_MANIFEST.publisher = MyCompany - WINRT_MANIFEST.logo_store = someImage.png - WINRT_MANIFEST.capabilities += internetClient - WINRT_MANIFEST.capabilities_device += location - \endcode - - Additionally, an input manifest file can be specified by using WINRT_MANIFEST. - - For example: - - \code - WINRT_MANIFEST = someManifest.xml.in - \endcode - - In case the input manifest file should not be processed and only copied to - the target directory, the verbatim configuration needs to be set. - - \code - WINRT_MANIFEST = someManifest.xml.in - WINRT_MANIFEST.CONFIG += verbatim - \endcode - \target YACCSOURCES \section1 YACCSOURCES diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 82c0983272..4129482990 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -612,16 +612,6 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) << tag("ItemGroup") << attrTag("Label", "ProjectConfigurations"); - bool isWinRT = false; - for (int i = 0; i < tool.SingleProjects.count(); ++i) { - xml << tag("ProjectConfiguration") - << attrTag("Include" , tool.SingleProjects.at(i).Configuration.Name) - << tagValue("Configuration", tool.SingleProjects.at(i).Configuration.ConfigurationName) - << tagValue("Platform", tool.SingleProjects.at(i).PlatformName) - << closetag(); - isWinRT = isWinRT || tool.SingleProjects.at(i).Configuration.WinRT; - } - xml << closetag() << tag("PropertyGroup") << attrTag("Label", "Globals") @@ -629,13 +619,6 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) << tagValue("RootNamespace", tool.Name) << tagValue("Keyword", tool.Keyword); - if (isWinRT) { - xml << tagValue("MinimumVisualStudioVersion", tool.Version) - << tagValue("DefaultLanguage", "en") - << tagValue("AppContainerApplication", "true") - << tagValue("ApplicationType", "Windows Store") - << tagValue("ApplicationTypeRevision", tool.SdkVersion); - } if (!tool.WindowsTargetPlatformVersion.isEmpty()) xml << tagValue("WindowsTargetPlatformVersion", tool.WindowsTargetPlatformVersion); if (!tool.WindowsTargetPlatformMinVersion.isEmpty()) @@ -825,41 +808,6 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) } outputFilter(tool, xml, xmlFilter, "Root Files"); - // App manifest - if (isWinRT) { - const QString manifest = QStringLiteral("Package.appxmanifest"); - - // Find all icons referenced in the manifest - QSet icons; - QFile manifestFile(Option::output_dir + QLatin1Char('/') + manifest); - if (manifestFile.open(QFile::ReadOnly)) { - const QString contents = manifestFile.readAll(); - QRegularExpression regexp("[\\\\/a-zA-Z0-9_\\-\\!]*\\.(png|jpg|jpeg)"); - int pos = 0; - while (pos > -1) { - QRegularExpressionMatch m; - pos = contents.indexOf(regexp, pos, &m); - if (pos >= 0) { - const QString match = m.captured(0); - icons.insert(match); - pos += match.length(); - } - } - } - - // Write out manifest + icons as content items - xml << tag(_ItemGroup) - << tag("AppxManifest") - << attrTag("Include", manifest) - << closetag(); - for (const QString &icon : qAsConst(icons)) { - xml << tag("Image") - << attrTag("Include", icon) - << closetag(); - } - xml << closetag(); - } - xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets") << tag("ImportGroup") << attrTag("Label", "ExtensionTargets") diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 9e93fe51f3..15e13a1c32 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -2166,8 +2166,7 @@ VCPreLinkEventTool::VCPreLinkEventTool() // VCConfiguration -------------------------------------------------- VCConfiguration::VCConfiguration() - : WinRT(false), - ATLMinimizesCRunTimeLibraryUsage(unset), + : ATLMinimizesCRunTimeLibraryUsage(unset), BuildBrowserInformation(unset), CharacterSet(charSetNotSet), ConfigurationType(typeApplication), diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 33eff0d914..8793c793ef 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -872,7 +872,6 @@ public: bool suppressUnknownOptionWarnings; DotNET CompilerVersion; - bool WinRT; // Variables triState ATLMinimizesCRunTimeLibraryUsage; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index e117f472e0..e679cf4f31 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -642,7 +642,6 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) for(QList::Iterator it = solution_cleanup.begin(); it != solution_cleanup.end(); ++it) { QString platform = is64Bit ? "x64" : "Win32"; QString xplatform = platform; - const bool isWinRT = project->isActiveConfig("winrt"); if (!project->isEmpty("VCPROJ_ARCH")) { xplatform = project->first("VCPROJ_ARCH").toQString(); } @@ -650,12 +649,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) platform = xplatform; t << "\n\t\t" << (*it)->uuid << QString(_slnProjDbgConfTag1).arg(xplatform) << platform; t << "\n\t\t" << (*it)->uuid << QString(_slnProjDbgConfTag2).arg(xplatform) << platform; - if (isWinRT) - t << "\n\t\t" << (*it)->uuid << QString(_slnProjDbgConfTag3).arg(xplatform) << platform; t << "\n\t\t" << (*it)->uuid << QString(_slnProjRelConfTag1).arg(xplatform) << platform; t << "\n\t\t" << (*it)->uuid << QString(_slnProjRelConfTag2).arg(xplatform) << platform; - if (isWinRT) - t << "\n\t\t" << (*it)->uuid << QString(_slnProjRelConfTag3).arg(xplatform) << platform; } t << _slnProjConfEnd; t << _slnExtSections; @@ -960,16 +955,6 @@ void VcprojGenerator::initConfiguration() conf.suppressUnknownOptionWarnings = project->isActiveConfig("suppress_vcproj_warnings"); conf.CompilerVersion = vsVersionFromString(project->first("MSVC_VER")); - if (conf.CompilerVersion >= NET2012) { - conf.WinRT = project->isActiveConfig("winrt"); - if (conf.WinRT) { - // Saner defaults - conf.compiler.UsePrecompiledHeader = pchNone; - conf.compiler.CompileAsWinRT = _False; - conf.linker.GenerateWindowsMetadata = _False; - } - } - initCompilerTool(); // Only on configuration per build @@ -1028,7 +1013,7 @@ void VcprojGenerator::initConfiguration() conf.ATLMinimizesCRunTimeLibraryUsage = (project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True); conf.BuildBrowserInformation = triState(temp.isEmpty() ? (short)unset : temp.toShort()); temp = project->first("CharacterSet"); - conf.CharacterSet = charSet(temp.isEmpty() ? short(conf.WinRT ? charSetUnicode : charSetNotSet) : temp.toShort()); + conf.CharacterSet = charSet(temp.isEmpty() ? short(charSetNotSet) : temp.toShort()); conf.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean").toQString(); conf.ImportLibrary = conf.linker.ImportLibrary; conf.IntermediateDirectory = project->first("OBJECTS_DIR").toQString(); @@ -1046,7 +1031,7 @@ void VcprojGenerator::initConfiguration() initPreBuildEventTools(); initPostBuildEventTools(); // Only deploy for crosscompiled projects - if (!project->isHostBuild() || conf.WinRT) + if (!project->isHostBuild()) initDeploymentTool(); initWinDeployQtTool(); initPreLinkEventTools(); @@ -1193,23 +1178,15 @@ void VcprojGenerator::initDeploymentTool() { VCConfiguration &conf = vcProject.Configuration; QString targetPath; - if (conf.WinRT) { - vcProject.DeploymentFiles.Name = "Deployment Files"; - vcProject.DeploymentFiles.ParseFiles = _False; - vcProject.DeploymentFiles.Filter = "deploy"; - vcProject.DeploymentFiles.Guid = _GUIDDeploymentFiles; - } else { - targetPath = project->values("deploy.path").join(' '); - if (targetPath.isEmpty()) - targetPath = QString("%CSIDL_PROGRAM_FILES%\\") + project->first("TARGET"); - if (targetPath.endsWith("/") || targetPath.endsWith("\\")) - targetPath.chop(1); - conf.deployment.RemoteDirectory = targetPath; - } + targetPath = project->values("deploy.path").join(' '); + if (targetPath.isEmpty()) + targetPath = QString("%CSIDL_PROGRAM_FILES%\\") + project->first("TARGET"); + if (targetPath.endsWith("/") || targetPath.endsWith("\\")) + targetPath.chop(1); + conf.deployment.RemoteDirectory = targetPath; const ProStringList dllPaths = project->values("QMAKE_DLL_PATHS"); // Only deploy Qt libs for shared build - if (!dllPaths.isEmpty() && - !(conf.WinRT && project->first("MSVC_VER").toQString() == "14.0")) { + if (!dllPaths.isEmpty()) { // FIXME: This code should actually resolve the libraries from all Qt modules. ProStringList arg = project->values("LIBS") + project->values("LIBS_PRIVATE") + project->values("QMAKE_LIBS") + project->values("QMAKE_LIBS_PRIVATE"); @@ -1238,39 +1215,35 @@ void VcprojGenerator::initDeploymentTool() if (!info.exists()) continue; - if (conf.WinRT) { - QString absoluteFilePath(QDir::toNativeSeparators(info.absoluteFilePath())); - vcProject.DeploymentFiles.addFile(absoluteFilePath); - } else { - conf.deployment.AdditionalFiles += info.fileName() - + "|" + QDir::toNativeSeparators(info.absolutePath()) - + "|" + targetPath - + "|0;"; - if (!qpaPluginDeployed) { - QString debugInfix; - bool foundGuid = dllName.contains(QLatin1String("Guid")); - if (foundGuid) - debugInfix = QLatin1Char('d'); - if (foundGuid || dllName.contains(QLatin1String("Gui"))) { - QFileInfo info2; - for (const ProString &dllPath : dllPaths) { - QString absoluteDllFilePath = dllPath.toQString(); - if (!absoluteDllFilePath.endsWith(QLatin1Char('/'))) - absoluteDllFilePath += QLatin1Char('/'); - absoluteDllFilePath += QLatin1String("../plugins/platforms/qwindows") - + debugInfix + QLatin1String(".dll"); - info2 = QFileInfo(absoluteDllFilePath); - if (info2.exists()) - break; - } - if (info2.exists()) { - conf.deployment.AdditionalFiles += QLatin1String("qwindows") + debugInfix + QLatin1String(".dll") - + QLatin1Char('|') + QDir::toNativeSeparators(info2.absolutePath()) - + QLatin1Char('|') + targetPath + QLatin1String("\\platforms") - + QLatin1String("|0;"); - qpaPluginDeployed = true; - } + conf.deployment.AdditionalFiles += info.fileName() + + "|" + QDir::toNativeSeparators(info.absolutePath()) + + "|" + targetPath + + "|0;"; + if (!qpaPluginDeployed) { + QString debugInfix; + bool foundGuid = dllName.contains(QLatin1String("Guid")); + if (foundGuid) + debugInfix = QLatin1Char('d'); + + if (foundGuid || dllName.contains(QLatin1String("Gui"))) { + QFileInfo info2; + for (const ProString &dllPath : dllPaths) { + QString absoluteDllFilePath = dllPath.toQString(); + if (!absoluteDllFilePath.endsWith(QLatin1Char('/'))) + absoluteDllFilePath += QLatin1Char('/'); + absoluteDllFilePath += QLatin1String("../plugins/platforms/qwindows") + + debugInfix + QLatin1String(".dll"); + info2 = QFileInfo(absoluteDllFilePath); + if (info2.exists()) + break; + } + if (info2.exists()) { + conf.deployment.AdditionalFiles += QLatin1String("qwindows") + debugInfix + QLatin1String(".dll") + + QLatin1Char('|') + QDir::toNativeSeparators(info2.absolutePath()) + + QLatin1Char('|') + targetPath + QLatin1String("\\platforms") + + QLatin1String("|0;"); + qpaPluginDeployed = true; } } } @@ -1280,16 +1253,14 @@ void VcprojGenerator::initDeploymentTool() for (const ProString &item : project->values("INSTALLS")) { // get item.path QString devicePath = project->first(ProKey(item + ".path")).toQString(); - if (!conf.WinRT) { - if (devicePath.isEmpty()) - devicePath = targetPath; - // check if item.path is relative (! either /,\ or %) - if (!(devicePath.at(0) == QLatin1Char('/') - || devicePath.at(0) == QLatin1Char('\\') - || devicePath.at(0) == QLatin1Char('%'))) { - // create output path - devicePath = Option::fixPathToTargetOS(targetPath + QLatin1Char('\\') + devicePath); - } + if (devicePath.isEmpty()) + devicePath = targetPath; + // check if item.path is relative (! either /,\ or %) + if (!(devicePath.at(0) == QLatin1Char('/') + || devicePath.at(0) == QLatin1Char('\\') + || devicePath.at(0) == QLatin1Char('%'))) { + // create output path + devicePath = Option::fixPathToTargetOS(targetPath + QLatin1Char('\\') + devicePath); } // foreach d in item.files for (const ProString &src : project->values(ProKey(item + ".files"))) { @@ -1314,25 +1285,16 @@ void VcprojGenerator::initDeploymentTool() // foreach dirIterator-entry in d while(iterator.hasNext()) { iterator.next(); - if (conf.WinRT) { - QString absoluteItemFilePath = Option::fixPathToTargetOS(QFileInfo(iterator.filePath()).absoluteFilePath()); - vcProject.DeploymentFiles.addFile(absoluteItemFilePath); - } else { - QString absoluteItemPath = Option::fixPathToTargetOS(QFileInfo(iterator.filePath()).absolutePath()); - // Identify if it is just another subdir - int diffSize = absoluteItemPath.size() - pathSize; - // write out rules - conf.deployment.AdditionalFiles += iterator.fileName() - + "|" + absoluteItemPath - + "|" + itemDevicePath + (diffSize ? (absoluteItemPath.right(diffSize)) : QLatin1String("")) - + "|0;"; - } - } - } - if (conf.WinRT) { - vcProject.DeploymentFiles.Project = this; - vcProject.DeploymentFiles.Config = &(vcProject.Configuration); + QString absoluteItemPath = Option::fixPathToTargetOS(QFileInfo(iterator.filePath()).absolutePath()); + // Identify if it is just another subdir + int diffSize = absoluteItemPath.size() - pathSize; + // write out rules + conf.deployment.AdditionalFiles += iterator.fileName() + + "|" + absoluteItemPath + + "|" + itemDevicePath + (diffSize ? (absoluteItemPath.right(diffSize)) : QLatin1String("")) + + "|0;"; + } } } } diff --git a/src/3rdparty/libjpeg.pri b/src/3rdparty/libjpeg.pri index 5effbe9d26..9af79e58dc 100644 --- a/src/3rdparty/libjpeg.pri +++ b/src/3rdparty/libjpeg.pri @@ -1,5 +1,3 @@ -winrt: DEFINES += NO_GETENV - # Disable warnings in 3rdparty code due to unused arguments gcc: QMAKE_CFLAGS_WARN_ON += -Wno-unused-parameter -Wno-main diff --git a/src/3rdparty/libpng/pngpriv.h b/src/3rdparty/libpng/pngpriv.h index 2ab9b70d73..acfc9cf280 100644 --- a/src/3rdparty/libpng/pngpriv.h +++ b/src/3rdparty/libpng/pngpriv.h @@ -557,9 +557,6 @@ #if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \ defined(_WIN32) || defined(__WIN32__) # include /* defines _WINDOWS_ macro */ -# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) -# define _WINRT_ /* Define a macro for Windows Runtime builds */ -# endif #endif #endif /* PNG_VERSION_INFO_ONLY */ @@ -570,7 +567,7 @@ /* Memory model/platform independent fns */ #ifndef PNG_ABORT -# if (defined(_WINDOWS_) || defined(_WIN32_WCE)) && !defined(_WINRT_) +# if (defined(_WINDOWS_) || defined(_WIN32_WCE)) # define PNG_ABORT() ExitProcess(0) # else # define PNG_ABORT() abort() diff --git a/src/3rdparty/libpng/qtpatches.diff b/src/3rdparty/libpng/qtpatches.diff index 7ec8388ed0..f90558103b 100644 --- a/src/3rdparty/libpng/qtpatches.diff +++ b/src/3rdparty/libpng/qtpatches.diff @@ -31,9 +31,6 @@ index 583c26f9bd..2ab9b70d73 100644 #if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \ defined(_WIN32) || defined(__WIN32__) # include /* defines _WINDOWS_ macro */ -+# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) -+# define _WINRT_ /* Define a macro for Windows Runtime builds */ -+# endif #endif #endif /* PNG_VERSION_INFO_ONLY */ @@ -42,7 +39,7 @@ index 583c26f9bd..2ab9b70d73 100644 /* Memory model/platform independent fns */ #ifndef PNG_ABORT -# ifdef _WINDOWS_ -+# if (defined(_WINDOWS_) || defined(_WIN32_WCE)) && !defined(_WINRT_) ++# if (defined(_WINDOWS_) || defined(_WIN32_WCE)) # define PNG_ABORT() ExitProcess(0) # else # define PNG_ABORT() abort() diff --git a/src/3rdparty/pcre2/CMakeLists.txt b/src/3rdparty/pcre2/CMakeLists.txt index 796f54c463..1a63de4d54 100644 --- a/src/3rdparty/pcre2/CMakeLists.txt +++ b/src/3rdparty/pcre2/CMakeLists.txt @@ -52,7 +52,7 @@ qt_set_symbol_visibility_hidden(BundledPcre2) ## Scopes: ##################################################################### -qt_extend_target(BundledPcre2 CONDITION QNX OR UIKIT OR WINRT +qt_extend_target(BundledPcre2 CONDITION QNX OR UIKIT DEFINES PCRE2_DISABLE_JIT ) diff --git a/src/3rdparty/pcre2/pcre2.pro b/src/3rdparty/pcre2/pcre2.pro index a3915fa2fa..7b2b430f63 100644 --- a/src/3rdparty/pcre2/pcre2.pro +++ b/src/3rdparty/pcre2/pcre2.pro @@ -8,7 +8,7 @@ CONFIG += \ include(pcre2.pri) # platform/compiler specific definitions -uikit|qnx|winrt: DEFINES += PCRE2_DISABLE_JIT +uikit|qnx: DEFINES += PCRE2_DISABLE_JIT win32:contains(QT_ARCH, "arm"): DEFINES += PCRE2_DISABLE_JIT win32:contains(QT_ARCH, "arm64"): DEFINES += PCRE2_DISABLE_JIT diff --git a/src/3rdparty/sqlite.pri b/src/3rdparty/sqlite.pri index cc8c12a6da..f4c8062468 100644 --- a/src/3rdparty/sqlite.pri +++ b/src/3rdparty/sqlite.pri @@ -3,12 +3,8 @@ QT_FOR_CONFIG += core-private DEFINES += SQLITE_ENABLE_COLUMN_METADATA SQLITE_OMIT_COMPLETE SQLITE_ENABLE_FTS3 SQLITE_ENABLE_FTS3_PARENTHESIS SQLITE_ENABLE_FTS5 SQLITE_ENABLE_RTREE SQLITE_ENABLE_JSON1 !contains(CONFIG, largefile):DEFINES += SQLITE_DISABLE_LFS qtConfig(posix_fallocate): DEFINES += HAVE_POSIX_FALLOCATE=1 -winrt { - DEFINES += SQLITE_OS_WINRT - QMAKE_CFLAGS += -Gy -} qnx: DEFINES += _QNX_SOURCE -!win32:!winrt:!winphone: DEFINES += HAVE_USLEEP=1 +!win32: DEFINES += HAVE_USLEEP=1 qtConfig(dlopen) { QMAKE_USE += libdl } else { diff --git a/src/corelib/.prev_CMakeLists.txt b/src/corelib/.prev_CMakeLists.txt index 51bb15fc3c..59e670e5db 100644 --- a/src/corelib/.prev_CMakeLists.txt +++ b/src/corelib/.prev_CMakeLists.txt @@ -338,28 +338,23 @@ qt_extend_target(Core CONDITION WIN32 io/qfilesystemengine_win.cpp io/qfsfileengine_win.cpp io/qlockfile_win.cpp + io/qstandardpaths_win.cpp + io/qstorageinfo_win.cpp + io/qwindowspipereader.cpp io/qwindowspipereader_p.h + io/qwindowspipewriter.cpp io/qwindowspipewriter_p.h kernel/qcoreapplication_win.cpp kernel/qelapsedtimer_win.cpp + kernel/qeventdispatcher_win.cpp kernel/qeventdispatcher_win_p.h + kernel/qfunctions_winrt_p.h kernel/qsharedmemory_win.cpp kernel/qsystemsemaphore_win.cpp kernel/qwineventnotifier.cpp kernel/qwineventnotifier.h kernel/qwineventnotifier_p.h + kernel/qwinregistry.cpp kernel/qwinregistry_p.h plugin/qsystemlibrary.cpp plugin/qsystemlibrary_p.h thread/qatomic_msvc.h thread/qthread_win.cpp DEFINES -QT_NO_CAST_TO_ASCII - LIBRARIES - ws2_32 -) - -qt_extend_target(Core CONDITION WIN32 AND NOT WINRT - SOURCES - io/qstandardpaths_win.cpp - io/qstorageinfo_win.cpp - io/qwindowspipereader.cpp io/qwindowspipereader_p.h - io/qwindowspipewriter.cpp io/qwindowspipewriter_p.h - kernel/qeventdispatcher_win.cpp kernel/qeventdispatcher_win_p.h - kernel/qwinregistry.cpp kernel/qwinregistry_p.h LIBRARIES advapi32 kernel32 @@ -370,6 +365,7 @@ qt_extend_target(Core CONDITION WIN32 AND NOT WINRT uuid version winmm + ws2_32 PUBLIC_LIBRARIES mpr userenv @@ -413,27 +409,27 @@ qt_extend_target(Core CONDITION INTEGRITY --pending_instantiations=128 ) -#### Keys ignored in scope 15:.:.:corelib.pro:pathIsAbsolute(_ss_CMAKE_HOST_DATA_DIR): +#### Keys ignored in scope 14:.:.:corelib.pro:pathIsAbsolute(_ss_CMAKE_HOST_DATA_DIR): # CMAKE_HOST_DATA_DIR = "$$[QT_HOST_DATA/src]/" # CMAKE_HOST_DATA_DIR_IS_ABSOLUTE = "True" -#### Keys ignored in scope 16:.:.:corelib.pro:pathIsAbsolute(_ss_CMAKE_INSTALL_DATA_DIR): +#### Keys ignored in scope 15:.:.:corelib.pro:pathIsAbsolute(_ss_CMAKE_INSTALL_DATA_DIR): # CMAKE_INSTALL_DATA_DIR = "$$[QT_HOST_DATA]/" # CMAKE_INSTALL_DATA_DIR_IS_ABSOLUTE = "True" -#### Keys ignored in scope 21:.:global:global/global.pri:QT_CPU_FEATURES__ss_QT_ARCH___contains___f16c: +#### Keys ignored in scope 20:.:global:global/global.pri:QT_CPU_FEATURES__ss_QT_ARCH___contains___f16c: # f16c_cxx = "true" -#### Keys ignored in scope 23:.:global:global/global.pri:CLANG OR intel_icl OR ICC: +#### Keys ignored in scope 22:.:global:global/global.pri:CLANG OR intel_icl OR ICC: # f16c_cxx = "false" -#### Keys ignored in scope 25:.:global:global/global.pri:GCC AND f16c AND x86SimdAlways: +#### Keys ignored in scope 24:.:global:global/global.pri:GCC AND f16c AND x86SimdAlways: # f16c_cxx = "true" -#### Keys ignored in scope 27:.:global:global/global.pri:MSVC AND QT_CPU_FEATURES__ss_QT_ARCH___contains___avx: +#### Keys ignored in scope 26:.:global:global/global.pri:MSVC AND QT_CPU_FEATURES__ss_QT_ARCH___contains___avx: # f16c_cxx = "true" -#### Keys ignored in scope 28:.:global:global/global.pri:else: +#### Keys ignored in scope 27:.:global:global/global.pri:else: # f16c_cxx = "false" qt_extend_target(Core CONDITION _ss_f16c_cxx @@ -460,7 +456,7 @@ qt_extend_target(Core CONDITION LINUX AND NOT static global/minimum-linux_p.h ) -#### Keys ignored in scope 35:.:global:global/global.pri:precompile_header: +#### Keys ignored in scope 34:.:global:global/global.pri:precompile_header: # NO_PCH_ASM = "global/minimum-linux.S" # QMAKE_EXTRA_COMPILERS = "no_pch_assembler" # no_pch_assembler.commands = "$$QMAKE_CC" "-c" "$(CFLAGS)" "$(INCPATH)" "${QMAKE_FILE_IN}" "-o" "${QMAKE_FILE_OUT}" @@ -469,7 +465,7 @@ qt_extend_target(Core CONDITION LINUX AND NOT static # no_pch_assembler.name = "compiling[no_pch]" "${QMAKE_FILE_IN}" # no_pch_assembler.output = "${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${firstQMAKE_EXT_OBJ}" -#### Keys ignored in scope 36:.:global:global/global.pri:silent: +#### Keys ignored in scope 35:.:global:global/global.pri:silent: # no_pch_assembler.commands = "@echo" "compiling[no_pch]" "${QMAKE_FILE_IN}" "&&" qt_extend_target(Core CONDITION LINUX AND NOT precompile_header AND NOT static @@ -487,7 +483,7 @@ qt_extend_target(Core CONDITION QT_FEATURE_journald PkgConfig::Libsystemd ) -#### Keys ignored in scope 40:.:global:global/global.pri:GCC AND ltcg: +#### Keys ignored in scope 39:.:global:global/global.pri:GCC AND ltcg: # QMAKE_EXTRA_COMPILERS = "versiontagging_compiler" # versiontagging_compiler.commands = "$$QMAKE_CXX" "-c" "$(CXXFLAGS)" "$(INCPATH)" "-fno-lto" "-o" "${QMAKE_FILE_OUT}" "${QMAKE_FILE_IN}" # versiontagging_compiler.dependency_type = "TYPE_C" @@ -496,7 +492,7 @@ qt_extend_target(Core CONDITION QT_FEATURE_journald # versiontagging_compiler.output = "${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${firstQMAKE_EXT_OBJ}" # versiontagging_compiler.variable_out = "OBJECTS" -#### Keys ignored in scope 41:.:global:global/global.pri:silent: +#### Keys ignored in scope 40:.:global:global/global.pri:silent: # versiontagging_compiler.commands = "@echo" "compiling[versiontagging]" "${QMAKE_FILE_IN}" "&&" qt_extend_target(Core CONDITION NOT GCC OR NOT ltcg @@ -797,7 +793,7 @@ qt_extend_target(Core CONDITION QT_FEATURE_processenvironment io/qprocess.cpp io/qprocess.h io/qprocess_p.h ) -qt_extend_target(Core CONDITION QT_FEATURE_processenvironment AND WIN32 AND NOT WINRT +qt_extend_target(Core CONDITION QT_FEATURE_processenvironment AND WIN32 SOURCES io/qprocess_win.cpp ) @@ -812,16 +808,11 @@ qt_extend_target(Core CONDITION QT_FEATURE_settings io/qsettings.cpp io/qsettings.h io/qsettings_p.h ) -qt_extend_target(Core CONDITION QT_FEATURE_settings AND WIN32 AND NOT WINRT +qt_extend_target(Core CONDITION QT_FEATURE_settings AND WIN32 SOURCES io/qsettings_win.cpp ) -qt_extend_target(Core CONDITION QT_FEATURE_settings AND WINRT - SOURCES - io/qsettings_winrt.cpp -) - qt_extend_target(Core CONDITION APPLE AND QT_FEATURE_settings AND NOT NACL SOURCES io/qsettings_mac.cpp @@ -837,15 +828,6 @@ qt_extend_target(Core CONDITION QT_FEATURE_filesystemiterator AND WIN32 io/qfilesystemiterator_win.cpp ) -qt_extend_target(Core CONDITION WINRT - SOURCES - io/qstandardpaths_winrt.cpp - io/qstorageinfo_stub.cpp - kernel/qeventdispatcher_winrt.cpp kernel/qeventdispatcher_winrt_p.h - kernel/qfunctions_fake_env_p.h - kernel/qfunctions_winrt.cpp kernel/qfunctions_winrt.h -) - qt_extend_target(Core CONDITION QT_FEATURE_process AND UNIX SOURCES ../3rdparty/forkfd/forkfd.h @@ -1076,7 +1058,7 @@ qt_extend_target(Core CONDITION QT_FEATURE_mimetype mimetypes/qmimetypeparser.cpp mimetypes/qmimetypeparser_p.h ) -#### Keys ignored in scope 197:.:mimetypes:mimetypes/mimetypes.pri:QT_FEATURE_mimetype: +#### Keys ignored in scope 188:.:mimetypes:mimetypes/mimetypes.pri:QT_FEATURE_mimetype: # MIME_DATABASE = "mimetypes/mime/packages/freedesktop.org.xml" # OTHER_FILES = "$$MIME_DATABASE" @@ -1085,7 +1067,7 @@ qt_extend_target(Core CONDITION QT_FEATURE_mimetype AND QT_FEATURE_mimetype_data .rcc ) -#### Keys ignored in scope 198:.:mimetypes:mimetypes/mimetypes.pri:QT_FEATURE_mimetype_database: +#### Keys ignored in scope 189:.:mimetypes:mimetypes/mimetypes.pri:QT_FEATURE_mimetype_database: # QMAKE_EXTRA_COMPILERS = "mimedb" # mimedb.commands = "${QMAKE_FILE_IN}" ">" "${QMAKE_FILE_OUT}" # mimedb.depends = "$$PWD/mime/generate.pl" @@ -1093,23 +1075,23 @@ qt_extend_target(Core CONDITION QT_FEATURE_mimetype AND QT_FEATURE_mimetype_data # mimedb.output = "$$outpath/qmimeprovider_database.cpp" # mimedb.variable_out = "INCLUDED_SOURCES" -#### Keys ignored in scope 199:.:mimetypes:mimetypes/mimetypes.pri:ANDROID: +#### Keys ignored in scope 190:.:mimetypes:mimetypes/mimetypes.pri:ANDROID: # outpath = "$$outpath/$${QT_ARCH}" -#### Keys ignored in scope 201:.:mimetypes:mimetypes/mimetypes.pri:(CMAKE_BUILD_TYPE STREQUAL Debug): +#### Keys ignored in scope 192:.:mimetypes:mimetypes/mimetypes.pri:(CMAKE_BUILD_TYPE STREQUAL Debug): # outpath = "$$outpath/debug" -#### Keys ignored in scope 202:.:mimetypes:mimetypes/mimetypes.pri:else: +#### Keys ignored in scope 193:.:mimetypes:mimetypes/mimetypes.pri:else: # outpath = "$$outpath/release" -#### Keys ignored in scope 203:.:mimetypes:mimetypes/mimetypes.pri:MAKEFILE_GENERATOR___equals___MSVC.NET OR MAKEFILE_GENERATOR___equals___MSBUILD OR QMAKE_SH_ISEMPTY: +#### Keys ignored in scope 194:.:mimetypes:mimetypes/mimetypes.pri:MAKEFILE_GENERATOR___equals___MSVC.NET OR MAKEFILE_GENERATOR___equals___MSBUILD OR QMAKE_SH_ISEMPTY: # mimedb.commands = "cmd" "/c" "$$shell_path($$PWD/mime/generate.bat)" # mimedb.depends = "$$PWD/mime/generate.bat" "$$PWD/mime/hexdump.ps1" -#### Keys ignored in scope 204:.:mimetypes:mimetypes/mimetypes.pri:else: +#### Keys ignored in scope 195:.:mimetypes:mimetypes/mimetypes.pri:else: # mimedb.commands = "perl" "$${mimedb.depends}" -#### Keys ignored in scope 205:.:mimetypes:mimetypes/mimetypes.pri:QT_FEATURE_zstd: +#### Keys ignored in scope 196:.:mimetypes:mimetypes/mimetypes.pri:QT_FEATURE_zstd: # mimedb.commands = "--zstd" qt_extend_target(Core CONDITION WASM diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index 269891f91a..1f832504d1 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -446,27 +446,22 @@ qt_extend_target(Core CONDITION WIN32 io/qfilesystemengine_win.cpp io/qfsfileengine_win.cpp io/qlockfile_win.cpp - kernel/qcoreapplication_win.cpp - kernel/qelapsedtimer_win.cpp - kernel/qsharedmemory_win.cpp - kernel/qsystemsemaphore_win.cpp - kernel/qwineventnotifier.cpp kernel/qwineventnotifier.h kernel/qwineventnotifier_p.h - plugin/qsystemlibrary.cpp plugin/qsystemlibrary_p.h - thread/qatomic_msvc.h - thread/qthread_win.cpp - # DEFINES # special case: remove - LIBRARIES - ws2_32 -) - -qt_extend_target(Core CONDITION WIN32 AND NOT WINRT - SOURCES io/qstandardpaths_win.cpp io/qstorageinfo_win.cpp io/qwindowspipereader.cpp io/qwindowspipereader_p.h io/qwindowspipewriter.cpp io/qwindowspipewriter_p.h + kernel/qcoreapplication_win.cpp + kernel/qelapsedtimer_win.cpp kernel/qeventdispatcher_win.cpp kernel/qeventdispatcher_win_p.h + kernel/qfunctions_winrt_p.h + kernel/qsharedmemory_win.cpp + kernel/qsystemsemaphore_win.cpp + kernel/qwineventnotifier.cpp kernel/qwineventnotifier.h kernel/qwineventnotifier_p.h kernel/qwinregistry.cpp kernel/qwinregistry_p.h + plugin/qsystemlibrary.cpp plugin/qsystemlibrary_p.h + thread/qatomic_msvc.h + thread/qthread_win.cpp + # DEFINES # special case: remove LIBRARIES advapi32 kernel32 @@ -477,6 +472,7 @@ qt_extend_target(Core CONDITION WIN32 AND NOT WINRT uuid version winmm + ws2_32 PUBLIC_LIBRARIES mpr userenv @@ -520,27 +516,27 @@ qt_extend_target(Core CONDITION INTEGRITY --pending_instantiations=128 ) -#### Keys ignored in scope 15:.:.:corelib.pro:pathIsAbsolute(_ss_CMAKE_HOST_DATA_DIR): +#### Keys ignored in scope 14:.:.:corelib.pro:pathIsAbsolute(_ss_CMAKE_HOST_DATA_DIR): # CMAKE_HOST_DATA_DIR = "$$[QT_HOST_DATA/src]/" # CMAKE_HOST_DATA_DIR_IS_ABSOLUTE = "True" -#### Keys ignored in scope 16:.:.:corelib.pro:pathIsAbsolute(_ss_CMAKE_INSTALL_DATA_DIR): +#### Keys ignored in scope 15:.:.:corelib.pro:pathIsAbsolute(_ss_CMAKE_INSTALL_DATA_DIR): # CMAKE_INSTALL_DATA_DIR = "$$[QT_HOST_DATA]/" # CMAKE_INSTALL_DATA_DIR_IS_ABSOLUTE = "True" -#### Keys ignored in scope 21:.:global:global/global.pri:QT_CPU_FEATURES__ss_QT_ARCH___contains___f16c: +#### Keys ignored in scope 20:.:global:global/global.pri:QT_CPU_FEATURES__ss_QT_ARCH___contains___f16c: # f16c_cxx = "true" -#### Keys ignored in scope 23:.:global:global/global.pri:CLANG OR intel_icl OR ICC: +#### Keys ignored in scope 22:.:global:global/global.pri:CLANG OR intel_icl OR ICC: # f16c_cxx = "false" -#### Keys ignored in scope 25:.:global:global/global.pri:GCC AND f16c AND x86SimdAlways: +#### Keys ignored in scope 24:.:global:global/global.pri:GCC AND f16c AND x86SimdAlways: # f16c_cxx = "true" -#### Keys ignored in scope 27:.:global:global/global.pri:MSVC AND QT_CPU_FEATURES__ss_QT_ARCH___contains___avx: +#### Keys ignored in scope 26:.:global:global/global.pri:MSVC AND QT_CPU_FEATURES__ss_QT_ARCH___contains___avx: # f16c_cxx = "true" -#### Keys ignored in scope 28:.:global:global/global.pri:else: +#### Keys ignored in scope 27:.:global:global/global.pri:else: # f16c_cxx = "false" # extend_target(Core CONDITION _ss_f16c_cxx ... # special case remove: Handled manually @@ -560,7 +556,7 @@ qt_extend_target(Core CONDITION LINUX AND NOT static global/minimum-linux_p.h ) -#### Keys ignored in scope 35:.:global:global/global.pri:precompile_header: +#### Keys ignored in scope 34:.:global:global/global.pri:precompile_header: # NO_PCH_ASM = "global/minimum-linux.S" # QMAKE_EXTRA_COMPILERS = "no_pch_assembler" # no_pch_assembler.commands = "$$QMAKE_CC" "-c" "$(CFLAGS)" "$(INCPATH)" "${QMAKE_FILE_IN}" "-o" "${QMAKE_FILE_OUT}" @@ -569,7 +565,7 @@ qt_extend_target(Core CONDITION LINUX AND NOT static # no_pch_assembler.name = "compiling[no_pch]" "${QMAKE_FILE_IN}" # no_pch_assembler.output = "${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${firstQMAKE_EXT_OBJ}" -#### Keys ignored in scope 36:.:global:global/global.pri:silent: +#### Keys ignored in scope 35:.:global:global/global.pri:silent: # no_pch_assembler.commands = "@echo" "compiling[no_pch]" "${QMAKE_FILE_IN}" "&&" qt_extend_target(Core CONDITION LINUX AND NOT precompile_header AND NOT static @@ -587,7 +583,7 @@ qt_extend_target(Core CONDITION QT_FEATURE_journald PkgConfig::Libsystemd ) -#### Keys ignored in scope 40:.:global:global/global.pri:GCC AND ltcg: +#### Keys ignored in scope 39:.:global:global/global.pri:GCC AND ltcg: # QMAKE_EXTRA_COMPILERS = "versiontagging_compiler" # versiontagging_compiler.commands = "$$QMAKE_CXX" "-c" "$(CXXFLAGS)" "$(INCPATH)" "-fno-lto" "-o" "${QMAKE_FILE_OUT}" "${QMAKE_FILE_IN}" # versiontagging_compiler.dependency_type = "TYPE_C" @@ -596,7 +592,7 @@ qt_extend_target(Core CONDITION QT_FEATURE_journald # versiontagging_compiler.output = "${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${firstQMAKE_EXT_OBJ}" # versiontagging_compiler.variable_out = "OBJECTS" -#### Keys ignored in scope 41:.:global:global/global.pri:silent: +#### Keys ignored in scope 40:.:global:global/global.pri:silent: # versiontagging_compiler.commands = "@echo" "compiling[versiontagging]" "${QMAKE_FILE_IN}" "&&" qt_extend_target(Core CONDITION NOT GCC OR NOT ltcg @@ -897,7 +893,7 @@ qt_extend_target(Core CONDITION QT_FEATURE_processenvironment io/qprocess.cpp io/qprocess.h io/qprocess_p.h ) -qt_extend_target(Core CONDITION QT_FEATURE_processenvironment AND WIN32 AND NOT WINRT +qt_extend_target(Core CONDITION QT_FEATURE_processenvironment AND WIN32 SOURCES io/qprocess_win.cpp ) @@ -912,16 +908,11 @@ qt_extend_target(Core CONDITION QT_FEATURE_settings io/qsettings.cpp io/qsettings.h io/qsettings_p.h ) -qt_extend_target(Core CONDITION QT_FEATURE_settings AND WIN32 AND NOT WINRT +qt_extend_target(Core CONDITION QT_FEATURE_settings AND WIN32 SOURCES io/qsettings_win.cpp ) -qt_extend_target(Core CONDITION QT_FEATURE_settings AND WINRT - SOURCES - io/qsettings_winrt.cpp -) - qt_extend_target(Core CONDITION APPLE AND QT_FEATURE_settings AND NOT NACL SOURCES io/qsettings_mac.cpp @@ -937,15 +928,6 @@ qt_extend_target(Core CONDITION QT_FEATURE_filesystemiterator AND WIN32 io/qfilesystemiterator_win.cpp ) -qt_extend_target(Core CONDITION WINRT - SOURCES - io/qstandardpaths_winrt.cpp - io/qstorageinfo_stub.cpp - kernel/qeventdispatcher_winrt.cpp kernel/qeventdispatcher_winrt_p.h - kernel/qfunctions_fake_env_p.h - kernel/qfunctions_winrt.cpp kernel/qfunctions_winrt.h -) - qt_extend_target(Core CONDITION QT_FEATURE_process AND UNIX SOURCES ../3rdparty/forkfd/forkfd.h @@ -1176,7 +1158,7 @@ qt_extend_target(Core CONDITION QT_FEATURE_mimetype mimetypes/qmimetypeparser.cpp mimetypes/qmimetypeparser_p.h ) -#### Keys ignored in scope 197:.:mimetypes:mimetypes/mimetypes.pri:QT_FEATURE_mimetype: +#### Keys ignored in scope 188:.:mimetypes:mimetypes/mimetypes.pri:QT_FEATURE_mimetype: # MIME_DATABASE = "mimetypes/mime/packages/freedesktop.org.xml" # OTHER_FILES = "$$MIME_DATABASE" @@ -1187,7 +1169,7 @@ qt_extend_target(Core CONDITION QT_FEATURE_mimetype #) # special case end -#### Keys ignored in scope 198:.:mimetypes:mimetypes/mimetypes.pri:QT_FEATURE_mimetype_database: +#### Keys ignored in scope 189:.:mimetypes:mimetypes/mimetypes.pri:QT_FEATURE_mimetype_database: # QMAKE_EXTRA_COMPILERS = "mimedb" # mimedb.commands = "${QMAKE_FILE_IN}" ">" "${QMAKE_FILE_OUT}" # mimedb.depends = "$$PWD/mime/generate.pl" @@ -1195,23 +1177,23 @@ qt_extend_target(Core CONDITION QT_FEATURE_mimetype # mimedb.output = "$$outpath/qmimeprovider_database.cpp" # mimedb.variable_out = "INCLUDED_SOURCES" -#### Keys ignored in scope 199:.:mimetypes:mimetypes/mimetypes.pri:ANDROID: +#### Keys ignored in scope 190:.:mimetypes:mimetypes/mimetypes.pri:ANDROID: # outpath = "$$outpath/$${QT_ARCH}" -#### Keys ignored in scope 201:.:mimetypes:mimetypes/mimetypes.pri:(CMAKE_BUILD_TYPE STREQUAL Debug): +#### Keys ignored in scope 192:.:mimetypes:mimetypes/mimetypes.pri:(CMAKE_BUILD_TYPE STREQUAL Debug): # outpath = "$$outpath/debug" -#### Keys ignored in scope 202:.:mimetypes:mimetypes/mimetypes.pri:else: +#### Keys ignored in scope 193:.:mimetypes:mimetypes/mimetypes.pri:else: # outpath = "$$outpath/release" -#### Keys ignored in scope 203:.:mimetypes:mimetypes/mimetypes.pri:MAKEFILE_GENERATOR___equals___MSVC.NET OR MAKEFILE_GENERATOR___equals___MSBUILD OR QMAKE_SH_ISEMPTY: +#### Keys ignored in scope 194:.:mimetypes:mimetypes/mimetypes.pri:MAKEFILE_GENERATOR___equals___MSVC.NET OR MAKEFILE_GENERATOR___equals___MSBUILD OR QMAKE_SH_ISEMPTY: # mimedb.commands = "cmd" "/c" "$$shell_path($$PWD/mime/generate.bat)" # mimedb.depends = "$$PWD/mime/generate.bat" "$$PWD/mime/hexdump.ps1" -#### Keys ignored in scope 204:.:mimetypes:mimetypes/mimetypes.pri:else: +#### Keys ignored in scope 195:.:mimetypes:mimetypes/mimetypes.pri:else: # mimedb.commands = "perl" "$${mimedb.depends}" -#### Keys ignored in scope 205:.:mimetypes:mimetypes/mimetypes.pri:QT_FEATURE_zstd: +#### Keys ignored in scope 196:.:mimetypes:mimetypes/mimetypes.pri:QT_FEATURE_zstd: # mimedb.commands = "--zstd" # Resources: # special case begin diff --git a/src/corelib/configure.cmake b/src/corelib/configure.cmake index a601ebb437..5df72d869e 100644 --- a/src/corelib/configure.cmake +++ b/src/corelib/configure.cmake @@ -788,14 +788,14 @@ qt_feature("process" PUBLIC SECTION "File I/O" LABEL "QProcess" PURPOSE "Supports external process invocation." - CONDITION QT_FEATURE_processenvironment AND ( QT_FEATURE_thread OR NOT UNIX ) AND NOT WINRT AND NOT UIKIT AND NOT INTEGRITY AND NOT VXWORKS AND NOT rtems + CONDITION QT_FEATURE_processenvironment AND ( QT_FEATURE_thread OR NOT UNIX ) AND NOT UIKIT AND NOT INTEGRITY AND NOT VXWORKS AND NOT rtems ) qt_feature_definition("process" "QT_NO_PROCESS" NEGATE VALUE "1") qt_feature("processenvironment" PUBLIC SECTION "File I/O" LABEL "QProcessEnvironment" PURPOSE "Provides a higher-level abstraction of environment variables." - CONDITION NOT WINRT AND NOT INTEGRITY AND NOT rtems + CONDITION NOT INTEGRITY AND NOT rtems ) qt_feature("temporaryfile" PUBLIC SECTION "File I/O" @@ -820,7 +820,6 @@ qt_feature("filesystemwatcher" PUBLIC SECTION "File I/O" LABEL "QFileSystemWatcher" PURPOSE "Provides an interface for monitoring files and directories for modifications." - CONDITION NOT WINRT ) qt_feature_definition("filesystemwatcher" "QT_NO_FILESYSTEMWATCHER" NEGATE VALUE "1") qt_feature("filesystemiterator" PUBLIC diff --git a/src/corelib/configure.json b/src/corelib/configure.json index 4d34089295..67c01bd8a9 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -895,14 +895,14 @@ "label": "QProcess", "purpose": "Supports external process invocation.", "section": "File I/O", - "condition": "features.processenvironment && (features.thread || !config.unix) && !config.winrt && !config.uikit && !config.integrity && !config.vxworks && !config.rtems", + "condition": "features.processenvironment && (features.thread || !config.unix) && !config.uikit && !config.integrity && !config.vxworks && !config.rtems", "output": [ "publicFeature", "feature" ] }, "processenvironment": { "label": "QProcessEnvironment", "purpose": "Provides a higher-level abstraction of environment variables.", "section": "File I/O", - "condition": "!config.winrt && !config.integrity && !config.rtems", + "condition": "!config.integrity && !config.rtems", "output": [ "publicFeature" ] }, "temporaryfile": { @@ -928,7 +928,6 @@ "label": "QFileSystemWatcher", "purpose": "Provides an interface for monitoring files and directories for modifications.", "section": "File I/O", - "condition": "!config.winrt", "output": [ "publicFeature", "feature" ] }, "filesystemiterator": { diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 3430154d13..efeba221c5 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -52,7 +52,7 @@ include(platform/platform.pri) win32 { QMAKE_USE_PRIVATE += ws2_32 - !winrt: QMAKE_USE_PRIVATE += advapi32 kernel32 ole32 shell32 uuid user32 winmm + QMAKE_USE_PRIVATE += advapi32 kernel32 ole32 shell32 uuid user32 winmm } darwin { diff --git a/src/corelib/global/archdetect.cpp b/src/corelib/global/archdetect.cpp index 1d00b7f5a5..b758b2326c 100644 --- a/src/corelib/global/archdetect.cpp +++ b/src/corelib/global/archdetect.cpp @@ -95,7 +95,7 @@ #endif // pointer type -#if defined(Q_OS_WIN64) || (defined(Q_OS_WINRT) && defined(_M_X64)) +#if defined(Q_OS_WIN64) # define ARCH_POINTER "llp64" #elif defined(__LP64__) || QT_POINTER_SIZE - 0 == 8 # define ARCH_POINTER "lp64" diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 798e445ee4..4d990f5bb5 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -46,11 +46,9 @@ #include "qdatetime.h" #include "qoperatingsystemversion.h" #include "qoperatingsystemversion_p.h" -#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) # include "qoperatingsystemversion_win_p.h" -# ifndef Q_OS_WINRT -# include "private/qwinregistry_p.h" -# endif +# include "private/qwinregistry_p.h" #endif // Q_OS_WIN || Q_OS_CYGWIN #include @@ -72,10 +70,6 @@ # include #endif -#ifdef Q_OS_WINRT -#include -#endif // Q_OS_WINRT - #ifdef Q_OS_WIN # include #endif @@ -1463,7 +1457,7 @@ bool qSharedBuild() noexcept \relates Defined on all supported versions of Windows. That is, if - \l Q_OS_WIN32, \l Q_OS_WIN64, or \l Q_OS_WINRT is defined. + \l Q_OS_WIN32 or \l Q_OS_WIN64 is defined. */ /*! @@ -1487,14 +1481,6 @@ bool qSharedBuild() noexcept Defined on 64-bit versions of Windows. */ -/*! - \macro Q_OS_WINRT - \relates - - Defined for Windows Runtime (Windows Store apps) on Windows 8, Windows RT, - and Windows Phone 8. -*/ - /*! \macro Q_OS_CYGWIN \relates @@ -2165,7 +2151,7 @@ static const char *osVer_helper(QOperatingSystemVersion version = QOperatingSyst } #endif -#elif defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINRT) +#elif defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) QT_BEGIN_INCLUDE_NAMESPACE #include "qt_windows.h" @@ -2223,7 +2209,7 @@ QT_WARNING_POP static QString readVersionRegistryString(const wchar_t *subKey) { -#if !defined(QT_BUILD_QMAKE) && !defined(Q_OS_WINRT) +#if !defined(QT_BUILD_QMAKE) return QWinRegistryKey(HKEY_LOCAL_MACHINE, LR"(SOFTWARE\Microsoft\Windows NT\CurrentVersion)") .stringValue(subKey); #else @@ -2834,8 +2820,7 @@ QString QSysInfo::kernelVersion() \b{FreeBSD note}: this function returns "debian" for Debian/kFreeBSD and "unknown" otherwise. - \b{Windows note}: this function "winrt" for WinRT builds, and "windows" - for normal desktop builds. + \b{Windows note}: this function return "windows" For other Unix-type systems, this function usually returns "unknown". @@ -2844,9 +2829,7 @@ QString QSysInfo::kernelVersion() QString QSysInfo::productType() { // similar, but not identical to QFileSelectorPrivate::platformSelectors -#if defined(Q_OS_WINRT) - return QStringLiteral("winrt"); -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) return QStringLiteral("windows"); #elif defined(Q_OS_QNX) @@ -2968,7 +2951,7 @@ QString QSysInfo::prettyProductName() if (!name) return result + versionString; result += QLatin1String(name); -# if !defined(Q_OS_WIN) || defined(Q_OS_WINRT) +# if !defined(Q_OS_WIN) return result + QLatin1String(" (") + versionString + QLatin1Char(')'); # else // (resembling winver.exe): Windows 10 "Windows 10 Version 1809" @@ -3104,7 +3087,7 @@ QByteArray QSysInfo::machineUniqueId() if (len != -1) return QByteArray(buffer, len); } -#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#elif defined(Q_OS_WIN) // Let's poke at the registry // ### Qt 6: Use new helpers from qwinregistry.cpp (once bootstrap builds are obsolete) HKEY key = NULL; @@ -3537,7 +3520,7 @@ QByteArray qgetenv(const char *varName) */ QString qEnvironmentVariable(const char *varName, const QString &defaultValue) { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) const auto locker = qt_scoped_lock(environmentMutex); QVarLengthArray wname(int(strlen(varName)) + 1); for (int i = 0; i < wname.size(); ++i) // wname.size() is correct: will copy terminating null diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index bfbc4ce1e5..b5164d1062 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -507,13 +507,6 @@ static QString prefixFromQtCoreLibraryHelper(const QString &qtCoreLibraryPath) #endif #if defined(Q_OS_WIN) -#if defined(Q_OS_WINRT) -EXTERN_C IMAGE_DOS_HEADER __ImageBase; -static HMODULE getWindowsModuleHandle() -{ - return reinterpret_cast(&__ImageBase); -} -#else // Q_OS_WINRT static HMODULE getWindowsModuleHandle() { HMODULE hModule = NULL; @@ -522,7 +515,6 @@ static HMODULE getWindowsModuleHandle() (LPCTSTR)&QLibraryInfo::isDebugBuild, &hModule); return hModule; } -#endif // !Q_OS_WINRT #endif // Q_OS_WIN static QString getRelocatablePrefix() diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 2966e609e7..4e78062ba7 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -226,10 +226,6 @@ static bool isDefaultCategory(const char *category) */ static bool systemHasStderr() { -#if defined(Q_OS_WINRT) - return false; // WinRT has no stderr -#endif - return true; } @@ -268,7 +264,7 @@ static bool stderrHasConsoleAttached() if (qEnvironmentVariableIntValue("QT_ASSUME_STDERR_HAS_CONSOLE")) return true; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) return GetConsoleWindow(); #elif defined(Q_OS_UNIX) # ifndef _PATH_TTY @@ -1851,10 +1847,7 @@ static void qt_message_print(QtMsgType msgType, const QMessageLogContext &contex static void qt_message_print(const QString &message) { -#if defined(Q_OS_WINRT) - win_outputDebugString_helper(message); - return; -#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) +#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) if (!shouldLogToStderr()) { win_outputDebugString_helper(message); return; diff --git a/src/corelib/global/qoperatingsystemversion_win.cpp b/src/corelib/global/qoperatingsystemversion_win.cpp index 798d985a76..eb58b60788 100644 --- a/src/corelib/global/qoperatingsystemversion_win.cpp +++ b/src/corelib/global/qoperatingsystemversion_win.cpp @@ -46,50 +46,17 @@ QT_BEGIN_NAMESPACE -#ifdef Q_OS_WINRT -static inline HMODULE moduleHandleForFunction(LPCVOID address) -{ - // This is a widely used, decades-old technique for retrieving the handle - // of a module and is effectively equivalent to GetModuleHandleEx - // (which is unavailable on WinRT) - MEMORY_BASIC_INFORMATION mbi = { 0, 0, 0, 0, 0, 0, 0 }; - if (VirtualQuery(address, &mbi, sizeof(mbi)) == 0) - return 0; - return reinterpret_cast(mbi.AllocationBase); -} -#endif - static inline OSVERSIONINFOEX determineWinOsVersion() { OSVERSIONINFOEX result = { sizeof(OSVERSIONINFOEX), 0, 0, 0, 0, {'\0'}, 0, 0, 0, 0, 0}; #define GetProcAddressA GetProcAddress - - // 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, - // so use some unusual but widely used techniques to get a pointer to it -#ifdef Q_OS_WINRT - // 1. Get HMODULE of kernel32.dll, using the address of some function exported by that DLL - HMODULE kernelModule = moduleHandleForFunction(reinterpret_cast(VirtualQuery)); - if (Q_UNLIKELY(!kernelModule)) - return result; - - // 2. Get pointer to GetModuleHandle so we can then load other arbitrary modules (DLLs) - typedef HMODULE(WINAPI *GetModuleHandleFunction)(LPCWSTR); - GetModuleHandleFunction pGetModuleHandle = reinterpret_cast( - GetProcAddressA(kernelModule, "GetModuleHandleW")); - if (Q_UNLIKELY(!pGetModuleHandle)) - return result; -#else #define pGetModuleHandle GetModuleHandleW -#endif HMODULE ntdll = pGetModuleHandle(L"ntdll.dll"); if (Q_UNLIKELY(!ntdll)) return result; - // NTSTATUS is not defined on WinRT - typedef LONG NTSTATUS; typedef NTSTATUS (NTAPI *RtlGetVersionFunction)(LPOSVERSIONINFO); // RtlGetVersion is documented public API but we must load it dynamically diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h index 8d65720850..f7bca43345 100644 --- a/src/corelib/global/qprocessordetection.h +++ b/src/corelib/global/qprocessordetection.h @@ -357,8 +357,7 @@ # define Q_BYTE_ORDER __BYTE_ORDER__ # elif defined(__BIG_ENDIAN__) || defined(_big_endian__) || defined(_BIG_ENDIAN) # define Q_BYTE_ORDER Q_BIG_ENDIAN -# elif defined(__LITTLE_ENDIAN__) || defined(_little_endian__) || defined(_LITTLE_ENDIAN) \ - || defined(WINAPI_FAMILY) // WinRT is always little-endian according to MSDN. +# elif defined(__LITTLE_ENDIAN__) || defined(_little_endian__) || defined(_LITTLE_ENDIAN) # define Q_BYTE_ORDER Q_LITTLE_ENDIAN # else # error "Unable to determine byte order!" diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index 3dc024e301..e35fc21d98 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -167,19 +167,13 @@ struct QRandomGenerator::SystemGenerator return qMax(n, 0); // ignore any errors } -#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#elif defined(Q_OS_WIN) qsizetype fillBuffer(void *buffer, qsizetype count) noexcept { auto RtlGenRandom = SystemFunction036; return RtlGenRandom(buffer, ULONG(count)) ? count: 0; } -#elif defined(Q_OS_WINRT) - qsizetype fillBuffer(void *, qsizetype) noexcept - { - // always use the fallback - return 0; - } -#endif // Q_OS_WINRT +#endif // Q_OS_WIN static SystemGenerator &self(); typedef quint32 result_type; diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index ab023a6cb5..2afd84bcd3 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -54,7 +54,6 @@ WATCHOS - watchOS TVOS - tvOS WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008) - WINRT - WinRT (Windows Runtime) CYGWIN - Cygwin SOLARIS - Sun Solaris HPUX - HP-UX @@ -124,20 +123,7 @@ # define Q_OS_WIN32 # define Q_OS_WIN64 #elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) -# if defined(WINAPI_FAMILY) -# ifndef WINAPI_FAMILY_PC_APP -# define WINAPI_FAMILY_PC_APP WINAPI_FAMILY_APP -# endif -# if defined(WINAPI_FAMILY_PHONE_APP) && WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP -# define Q_OS_WINRT -# elif WINAPI_FAMILY==WINAPI_FAMILY_PC_APP -# define Q_OS_WINRT -# else -# define Q_OS_WIN32 -# endif -# else # define Q_OS_WIN32 -# endif #elif defined(__sun) || defined(sun) # define Q_OS_SOLARIS #elif defined(hpux) || defined(__hpux) @@ -184,7 +170,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_WINRT) +#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) # define Q_OS_WINDOWS # define Q_OS_WIN # if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index 97b7f3970c..c062d9948b 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -111,7 +111,7 @@ qtConfig(processenvironment) { io/qprocess.h \ io/qprocess_p.h - win32:!winrt: \ + win32: \ SOURCES += io/qprocess_win.cpp else: unix: \ SOURCES += io/qprocess_unix.cpp @@ -125,11 +125,7 @@ qtConfig(settings) { io/qsettings_p.h win32 { - !winrt { - SOURCES += io/qsettings_win.cpp - } else { - SOURCES += io/qsettings_winrt.cpp - } + SOURCES += io/qsettings_win.cpp } else: darwin:!nacl { SOURCES += io/qsettings_mac.cpp } @@ -137,32 +133,26 @@ qtConfig(settings) { } win32 { - SOURCES += io/qfsfileengine_win.cpp - SOURCES += io/qlockfile_win.cpp - SOURCES += io/qfilesystemengine_win.cpp + SOURCES += io/qfsfileengine_win.cpp + SOURCES += io/qlockfile_win.cpp + SOURCES += io/qfilesystemengine_win.cpp - qtConfig(filesystemiterator) { - SOURCES += io/qfilesystemiterator_win.cpp - } - - !winrt { - HEADERS += \ - io/qwindowspipereader_p.h \ - io/qwindowspipewriter_p.h - - SOURCES += \ - io/qstandardpaths_win.cpp \ - io/qstorageinfo_win.cpp \ - io/qwindowspipereader.cpp \ - io/qwindowspipewriter.cpp - - LIBS += -lmpr -luserenv - QMAKE_USE_PRIVATE += netapi32 - } else { - SOURCES += \ - io/qstandardpaths_winrt.cpp \ - io/qstorageinfo_stub.cpp + qtConfig(filesystemiterator) { + SOURCES += io/qfilesystemiterator_win.cpp } + + HEADERS += \ + io/qwindowspipereader_p.h \ + io/qwindowspipewriter_p.h + + SOURCES += \ + io/qstandardpaths_win.cpp \ + io/qstorageinfo_win.cpp \ + io/qwindowspipereader.cpp \ + io/qwindowspipewriter.cpp + + LIBS += -lmpr -luserenv + QMAKE_USE_PRIVATE += netapi32 } else:unix { SOURCES += \ io/qfsfileengine_unix.cpp \ diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 368ad648e0..647f6746a5 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -83,7 +83,7 @@ static QString driveSpec(const QString &path) #endif enum { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) OSSupportsUncPaths = true #else OSSupportsUncPaths = false @@ -100,11 +100,6 @@ static int rootLength(const QString &name, bool allowUncPaths) const int nextSlash = name.indexOf(QLatin1Char('/'), 2); return nextSlash >= 0 ? nextSlash + 1 : len; } -#if defined(Q_OS_WINRT) - const QString rootPath = QDir::rootPath(); // rootPath contains the trailing slash - if (name.startsWith(rootPath, Qt::CaseInsensitive)) - return rootPath.size(); -#endif // Q_OS_WINRT #if defined(Q_OS_WIN) if (len >= 2 && name.at(1) == QLatin1Char(':')) { // Handle a possible drive letter @@ -196,11 +191,7 @@ inline void QDirPrivate::setPath(const QString &path) if (p.endsWith(QLatin1Char('/')) && p.length() > 1 #if defined(Q_OS_WIN) -# if defined (Q_OS_WINRT) - && (!(p.toLower() == QDir::rootPath().toLower())) -# else && (!(p.length() == 3 && p.at(1).unicode() == ':' && p.at(0).isLetter())) -# endif #endif ) { p.truncate(p.length() - 1); @@ -2373,11 +2364,7 @@ static QString qt_cleanPath(const QString &path, bool *ok) // Strip away last slash except for root directories if (ret.length() > 1 && ret.endsWith(QLatin1Char('/'))) { #if defined (Q_OS_WIN) -# if defined(Q_OS_WINRT) - if (!((ret.length() == 3 || ret.length() == QDir::rootPath().length()) && ret.at(1) == QLatin1Char(':'))) -# else if (!(ret.length() == 3 && ret.at(1) == QLatin1Char(':'))) -# endif #endif ret.chop(1); } diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 824215d1d9..f33f03262f 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -1178,7 +1178,7 @@ bool QFileInfo::isRoot() const return false; if (d->fileEngine == nullptr) { if (d->fileEntry.isRoot()) { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) //the path is a drive root, but the drive may not exist //for backward compatibility, return true only if the drive exists if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::ExistsAttribute)) diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp index 0c42a98b37..1a58da1e18 100644 --- a/src/corelib/io/qfileselector.cpp +++ b/src/corelib/io/qfileselector.cpp @@ -346,9 +346,6 @@ QStringList QFileSelectorPrivate::platformSelectors() #if defined(Q_OS_WIN) ret << QStringLiteral("windows"); ret << QSysInfo::kernelType(); // "winnt" -# if defined(Q_OS_WINRT) - ret << QStringLiteral("winrt"); -# endif #elif defined(Q_OS_UNIX) ret << QStringLiteral("unix"); # if !defined(Q_OS_ANDROID) && !defined(Q_OS_QNX) diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index a4f47cbf24..4c1b9f87c2 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -61,33 +61,16 @@ #include #include #include -#ifndef Q_OS_WINRT -# include -# include -# include -# include -# include -#endif +#include +#include +#include +#include +#include #include #include #include -#ifndef Q_OS_WINRT -# define SECURITY_WIN32 -# include -#else // !Q_OS_WINRT -# include "qstandardpaths.h" -# include "qthreadstorage.h" -# include -# include -# include -# include - -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Storage; -using namespace ABI::Windows::ApplicationModel; -#endif // Q_OS_WINRT +#define SECURITY_WIN32 +#include #ifndef SPI_GETPLATFORMTYPE #define SPI_GETPLATFORMTYPE 257 @@ -153,11 +136,11 @@ typedef struct _REPARSE_DATA_BUFFER { # define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS) #endif -#if defined(Q_OS_WINRT) || defined(QT_BOOTSTRAPPED) +#if defined(QT_BOOTSTRAPPED) # define QT_FEATURE_fslibs -1 #else # define QT_FEATURE_fslibs 1 -#endif // Q_OS_WINRT +#endif // QT_BOOTSTRAPPED #if QT_CONFIG(fslibs) #include @@ -291,7 +274,6 @@ static inline bool toFileTime(const QDateTime &date, FILETIME *fileTime) static QString readSymLink(const QFileSystemEntry &link) { QString result; -#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, @@ -346,9 +328,6 @@ static QString readSymLink(const QFileSystemEntry &link) } #endif // QT_CONFIG(fslibs) } -#else - Q_UNUSED(link); -#endif // Q_OS_WINRT return result; } @@ -416,11 +395,7 @@ static inline bool getFindData(QString path, WIN32_FIND_DATA &findData) // can't handle drives if (!path.endsWith(QLatin1Char(':'))) { -#ifndef Q_OS_WINRT HANDLE hFind = ::FindFirstFile((wchar_t*)path.utf16(), &findData); -#else - HANDLE hFind = ::FindFirstFileEx((const wchar_t*)path.utf16(), FindExInfoStandard, &findData, FindExSearchNameMatch, NULL, 0); -#endif if (hFind != INVALID_HANDLE_VALUE) { ::FindClose(hFind); return true; @@ -531,7 +506,6 @@ private: bool QFileSystemEngine::uncListSharesOnServer(const QString &server, QStringList *list) { DWORD res = ERROR_NOT_SUPPORTED; -#ifndef Q_OS_WINRT SHARE_INFO_1 *BufPtr, *p; DWORD er = 0, tr = 0, resume = 0, i; do { @@ -546,10 +520,6 @@ bool QFileSystemEngine::uncListSharesOnServer(const QString &server, QStringList } NetApiBufferFree(BufPtr); } while (res == ERROR_MORE_DATA); -#else - Q_UNUSED(server); - Q_UNUSED(list); -#endif return res == ERROR_SUCCESS; } @@ -615,16 +585,6 @@ QString QFileSystemEngine::nativeAbsoluteFilePath(const QString &path) } if (retLen != 0) absPath = QString::fromWCharArray(buf.data(), retLen); -# if defined(Q_OS_WINRT) - // Win32 returns eg C:/ as root directory with a trailing /. - // WinRT returns the sandbox root without /. - // Also C:/../.. returns C:/ on Win32, while for WinRT it steps outside the package - // and goes beyond package root. Hence force the engine to stay inside - // the package. - const QString rootPath = QDir::toNativeSeparators(QDir::rootPath()); - if (absPath.size() < rootPath.size() && rootPath.startsWith(absPath)) - absPath = rootPath; -# endif // Q_OS_WINRT // This is really ugly, but GetFullPathName strips off whitespace at the end. // If you for instance write ". " in the lineedit of QFileDialog, @@ -652,7 +612,6 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry) ret = QDir::cleanPath(QDir::currentPath() + QLatin1Char('/') + entry.filePath()); } -#ifndef Q_OS_WINRT // The path should be absolute at this point. // From the docs : // Absolute paths begin with the directory separator "/" @@ -665,7 +624,6 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry) // Force uppercase drive letters. ret[0] = ret.at(0).toUpper(); } -#endif // !Q_OS_WINRT return QFileSystemEntry(ret, QFileSystemEntry::FromInternalPath()); } @@ -681,7 +639,6 @@ typedef struct _FILE_ID_INFO { // File ID for Windows up to version 7 and FAT32 drives static inline QByteArray fileId(HANDLE handle) { -#ifndef Q_OS_WINRT BY_HANDLE_FILE_INFORMATION info; if (GetFileInformationByHandle(handle, &info)) { char buffer[sizeof "01234567:0123456701234567"]; @@ -691,10 +648,6 @@ static inline QByteArray fileId(HANDLE handle) info.nFileIndexLow); return buffer; } -#else // !Q_OS_WINRT - Q_UNUSED(handle); - Q_UNIMPLEMENTED(); -#endif // Q_OS_WINRT return QByteArray(); } @@ -727,23 +680,10 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry) QByteArray result; -#ifndef Q_OS_WINRT const HANDLE handle = CreateFile((wchar_t*)entry.nativeFilePath().utf16(), 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); -#else // !Q_OS_WINRT - CREATEFILE2_EXTENDED_PARAMETERS params; - params.dwSize = sizeof(params); - params.dwFileAttributes = FILE_ATTRIBUTE_NORMAL; - params.dwFileFlags = FILE_FLAG_BACKUP_SEMANTICS; - params.dwSecurityQosFlags = SECURITY_ANONYMOUS; - params.lpSecurityAttributes = NULL; - params.hTemplateFile = NULL; - const HANDLE handle = - CreateFile2((const wchar_t*)entry.nativeFilePath().utf16(), 0, - FILE_SHARE_READ, OPEN_EXISTING, ¶ms); -#endif // Q_OS_WINRT if (handle != INVALID_HANDLE_VALUE) { result = id(handle); CloseHandle(handle); @@ -994,7 +934,6 @@ static bool tryDriveUNCFallback(const QFileSystemEntry &fname, QFileSystemMetaDa { bool entryExists = false; DWORD fileAttrib = 0; -#if !defined(Q_OS_WINRT) if (fname.isDriveRoot()) { // a valid drive ?? const UINT oldErrorMode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); @@ -1006,7 +945,6 @@ static bool tryDriveUNCFallback(const QFileSystemEntry &fname, QFileSystemMetaDa entryExists = true; } } else { -#endif const QString &path = fname.nativeFilePath(); bool is_dir = false; if (path.startsWith(QLatin1String("\\\\?\\UNC"))) { @@ -1037,9 +975,7 @@ static bool tryDriveUNCFallback(const QFileSystemEntry &fname, QFileSystemMetaDa fileAttrib = FILE_ATTRIBUTE_DIRECTORY; entryExists = true; } -#if !defined(Q_OS_WINRT) } -#endif if (entryExists) data.fillFromFileAttribute(fileAttrib); return entryExists; @@ -1078,34 +1014,12 @@ bool QFileSystemEngine::fillMetaData(HANDLE fHandle, QFileSystemMetaData &data, { data.entryFlags &= ~what; clearWinStatData(data); -#ifndef Q_OS_WINRT BY_HANDLE_FILE_INFORMATION fileInfo; UINT oldmode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); if (GetFileInformationByHandle(fHandle , &fileInfo)) { data.fillFromFindInfo(fileInfo); } SetErrorMode(oldmode); -#else // !Q_OS_WINRT - FILE_BASIC_INFO fileBasicInfo; - if (GetFileInformationByHandleEx(fHandle, FileBasicInfo, &fileBasicInfo, sizeof(fileBasicInfo))) { - data.fillFromFileAttribute(fileBasicInfo.FileAttributes); - data.birthTime_.dwHighDateTime = fileBasicInfo.CreationTime.HighPart; - data.birthTime_.dwLowDateTime = fileBasicInfo.CreationTime.LowPart; - data.changeTime_.dwHighDateTime = fileBasicInfo.ChangeTime.HighPart; - data.changeTime_.dwLowDateTime = fileBasicInfo.ChangeTime.LowPart; - data.lastAccessTime_.dwHighDateTime = fileBasicInfo.LastAccessTime.HighPart; - data.lastAccessTime_.dwLowDateTime = fileBasicInfo.LastAccessTime.LowPart; - data.lastWriteTime_.dwHighDateTime = fileBasicInfo.LastWriteTime.HighPart; - data.lastWriteTime_.dwLowDateTime = fileBasicInfo.LastWriteTime.LowPart; - if (!(data.fileAttribute_ & FILE_ATTRIBUTE_DIRECTORY)) { - FILE_STANDARD_INFO fileStandardInfo; - if (GetFileInformationByHandleEx(fHandle, FileStandardInfo, &fileStandardInfo, sizeof(fileStandardInfo))) - data.size_ = fileStandardInfo.EndOfFile.QuadPart; - } else - data.size_ = 0; - data.knownFlagsMask |= QFileSystemMetaData::Times | QFileSystemMetaData::SizeAttribute; - } -#endif // Q_OS_WINRT return data.hasFlags(what); } @@ -1138,9 +1052,7 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM } if (what & QFileSystemMetaData::WinStatFlags) { -#ifndef Q_OS_WINRT UINT oldmode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); -#endif clearWinStatData(data); WIN32_FIND_DATA findData; // The memory structure for WIN32_FIND_DATA is same as WIN32_FILE_ATTRIBUTE_DATA @@ -1153,15 +1065,11 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM } else { if (!tryFindFallback(fname, data)) if (!tryDriveUNCFallback(fname, data)) { -#ifndef Q_OS_WINRT SetErrorMode(oldmode); -#endif return false; } } -#ifndef Q_OS_WINRT SetErrorMode(oldmode); -#endif } if (what & QFileSystemMetaData::Permissions) @@ -1201,16 +1109,7 @@ static bool isDirPath(const QString &dirPath, bool *existed) path += QLatin1Char('\\'); const QString longPath = QFSFileEnginePrivate::longFileName(path); -#ifndef Q_OS_WINRT DWORD fileAttrib = ::GetFileAttributes(reinterpret_cast(longPath.utf16())); -#else // Q_OS_WINRT - DWORD fileAttrib = INVALID_FILE_ATTRIBUTES; - WIN32_FILE_ATTRIBUTE_DATA data; - if (::GetFileAttributesEx(reinterpret_cast(longPath.utf16()), - GetFileExInfoStandard, &data)) { - fileAttrib = data.dwFileAttributes; - } -#endif // Q_OS_WINRT if (fileAttrib == INVALID_FILE_ATTRIBUTES) { int errorCode = GetLastError(); if (errorCode == ERROR_ACCESS_DENIED || errorCode == ERROR_SHARING_VIOLATION) { @@ -1314,36 +1213,10 @@ bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool remo //static QString QFileSystemEngine::rootPath() { -#if defined(Q_OS_WINRT) - // We specify the package root as root directory - QString ret = QLatin1String("/"); - // Get package location - ComPtr statics; - if (FAILED(GetActivationFactory(HStringReference(RuntimeClass_Windows_ApplicationModel_Package).Get(), &statics))) - return ret; - ComPtr package; - if (FAILED(statics->get_Current(&package))) - return ret; - ComPtr installedLocation; - if (FAILED(package->get_InstalledLocation(&installedLocation))) - return ret; - - ComPtr item; - if (FAILED(installedLocation.As(&item))) - return ret; - - HString finalWinPath; - if (FAILED(item->get_Path(finalWinPath.GetAddressOf()))) - return ret; - - const QString qtWinPath = QDir::fromNativeSeparators(QString::fromWCharArray(finalWinPath.GetRawBuffer(nullptr))); - ret = qtWinPath.endsWith(QLatin1Char('/')) ? qtWinPath : qtWinPath + QLatin1Char('/'); -#else QString ret = QString::fromLatin1(qgetenv("SystemDrive")); if (ret.isEmpty()) ret = QLatin1String("c:"); ret.append(QLatin1Char('/')); -#endif return ret; } @@ -1391,7 +1264,6 @@ QString QFileSystemEngine::homePath() QString QFileSystemEngine::tempPath() { QString ret; -#ifndef Q_OS_WINRT wchar_t tempPath[MAX_PATH]; const DWORD len = GetTempPath(MAX_PATH, tempPath); if (len) { // GetTempPath() can return short names, expand. @@ -1406,24 +1278,6 @@ QString QFileSystemEngine::tempPath() ret.chop(1); ret = QDir::fromNativeSeparators(ret); } -#else // !Q_OS_WINRT - ComPtr applicationDataStatics; - if (FAILED(GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Storage_ApplicationData).Get(), &applicationDataStatics))) - return ret; - ComPtr applicationData; - if (FAILED(applicationDataStatics->get_Current(&applicationData))) - return ret; - ComPtr tempFolder; - if (FAILED(applicationData->get_TemporaryFolder(&tempFolder))) - return ret; - ComPtr tempFolderItem; - if (FAILED(tempFolder.As(&tempFolderItem))) - return ret; - HString path; - if (FAILED(tempFolderItem->get_Path(path.GetAddressOf()))) - return ret; - ret = QDir::fromNativeSeparators(QString::fromWCharArray(path.GetRawBuffer(nullptr))); -#endif // Q_OS_WINRT if (ret.isEmpty()) { ret = QLatin1String("C:/tmp"); } else if (ret.length() >= 2 && ret[1] == QLatin1Char(':')) @@ -1478,17 +1332,8 @@ bool QFileSystemEngine::createLink(const QFileSystemEntry &source, const QFileSy //static bool QFileSystemEngine::copyFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error) { -#ifndef Q_OS_WINRT bool ret = ::CopyFile((wchar_t*)source.nativeFilePath().utf16(), (wchar_t*)target.nativeFilePath().utf16(), true) != 0; -#else // !Q_OS_WINRT - COPYFILE2_EXTENDED_PARAMETERS copyParams = { - sizeof(copyParams), COPY_FILE_FAIL_IF_EXISTS, NULL, NULL, NULL - }; - HRESULT hres = ::CopyFile2((const wchar_t*)source.nativeFilePath().utf16(), - (const wchar_t*)target.nativeFilePath().utf16(), ©Params); - bool ret = SUCCEEDED(hres); -#endif // Q_OS_WINRT if(!ret) error = QSystemError(::GetLastError(), QSystemError::NativeError); return ret; @@ -1500,13 +1345,8 @@ bool QFileSystemEngine::renameFile(const QFileSystemEntry &source, const QFileSy Q_CHECK_FILE_NAME(source, false); Q_CHECK_FILE_NAME(target, false); -#ifndef Q_OS_WINRT bool ret = ::MoveFile((wchar_t*)source.nativeFilePath().utf16(), (wchar_t*)target.nativeFilePath().utf16()) != 0; -#else // !Q_OS_WINRT - bool ret = ::MoveFileEx((const wchar_t*)source.nativeFilePath().utf16(), - (const wchar_t*)target.nativeFilePath().utf16(), 0) != 0; -#endif // Q_OS_WINRT if(!ret) error = QSystemError(::GetLastError(), QSystemError::NativeError); return ret; @@ -1547,7 +1387,6 @@ bool QFileSystemEngine::removeFile(const QFileSystemEntry &entry, QSystemError & bool QFileSystemEngine::moveFileToTrash(const QFileSystemEntry &source, QFileSystemEntry &newLocation, QSystemError &error) { -#ifndef Q_OS_WINRT // we need the "display name" of the file, so can't use nativeAbsoluteFilePath const QString sourcePath = QDir::toNativeSeparators(absoluteName(source).filePath()); @@ -1626,12 +1465,6 @@ bool QFileSystemEngine::moveFileToTrash(const QFileSystemEntry &source, } return true; -#else // Q_OS_WINRT - Q_UNUSED(source); - Q_UNUSED(newLocation); - Q_UNUSED(error); - return false; -#endif } //static diff --git a/src/corelib/io/qfilesystementry.cpp b/src/corelib/io/qfilesystementry.cpp index 3ff90bd0a3..3c8a85291a 100644 --- a/src/corelib/io/qfilesystementry.cpp +++ b/src/corelib/io/qfilesystementry.cpp @@ -166,16 +166,6 @@ void QFileSystemEntry::resolveNativeFilePath() const m_nativeFilePath = QDir::toNativeSeparators(m_filePath); #else m_nativeFilePath = QFile::encodeName(QDir::toNativeSeparators(m_filePath)); -#endif -#ifdef Q_OS_WINRT - while (m_nativeFilePath.startsWith(QLatin1Char('\\'))) - m_nativeFilePath.remove(0,1); - if (m_nativeFilePath.isEmpty()) - m_nativeFilePath.append(QLatin1Char('.')); - // WinRT/MSVC2015 allows a maximum of 256 characters for a filepath - // unless //?/ is prepended which extends the rule to have a maximum - // of 256 characters in the filename plus the preprending path - m_nativeFilePath.prepend("\\\\?\\"); #endif } } @@ -302,13 +292,9 @@ bool QFileSystemEntry::isDriveRoot() const bool QFileSystemEntry::isDriveRootPath(const QString &path) { -#ifndef Q_OS_WINRT return (path.length() == 3 && path.at(0).isLetter() && path.at(1) == QLatin1Char(':') && path.at(2) == QLatin1Char('/')); -#else // !Q_OS_WINRT - return path == QDir::rootPath(); -#endif // !Q_OS_WINRT } #endif // Q_OS_WIN diff --git a/src/corelib/io/qfilesystemmetadata_p.h b/src/corelib/io/qfilesystemmetadata_p.h index 3154658e5c..dbd89f5903 100644 --- a/src/corelib/io/qfilesystemmetadata_p.h +++ b/src/corelib/io/qfilesystemmetadata_p.h @@ -235,9 +235,7 @@ public: #if defined(Q_OS_WIN) inline void fillFromFileAttribute(DWORD fileAttribute, bool isDriveRoot = false); inline void fillFromFindData(WIN32_FIND_DATA &findData, bool setLinkType = false, bool isDriveRoot = false); -# ifndef Q_OS_WINRT inline void fillFromFindInfo(BY_HANDLE_FILE_INFORMATION &fileInfo); -# endif #endif private: friend class QFileSystemEngine; @@ -372,7 +370,6 @@ inline void QFileSystemMetaData::fillFromFindData(WIN32_FIND_DATA &findData, boo } } -#ifndef Q_OS_WINRT inline void QFileSystemMetaData::fillFromFindInfo(BY_HANDLE_FILE_INFORMATION &fileInfo) { fillFromFileAttribute(fileInfo.dwFileAttributes); @@ -388,7 +385,6 @@ inline void QFileSystemMetaData::fillFromFindInfo(BY_HANDLE_FILE_INFORMATION &fi } knownFlagsMask |= Times | SizeAttribute; } -#endif // !Q_OS_WINRT #endif // Q_OS_WIN QT_END_NAMESPACE diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp index 96d9210c1c..a5e83ac11f 100644 --- a/src/corelib/io/qfilesystemwatcher.cpp +++ b/src/corelib/io/qfilesystemwatcher.cpp @@ -105,7 +105,7 @@ void QFileSystemWatcherPrivate::init() SIGNAL(directoryChanged(QString,bool)), q, SLOT(_q_directoryChanged(QString,bool))); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) QObject::connect(static_cast(native), &QWindowsFileSystemWatcherEngine::driveLockForRemoval, q, [this] (const QString &p) { _q_winDriveLockForRemoval(p); }); @@ -115,7 +115,7 @@ void QFileSystemWatcherPrivate::init() QObject::connect(static_cast(native), &QWindowsFileSystemWatcherEngine::driveRemoved, q, [this] (const QString &p) { _q_winDriveRemoved(p); }); -#endif // !Q_OS_WINRT +#endif // Q_OS_WIN } } @@ -162,7 +162,7 @@ void QFileSystemWatcherPrivate::_q_directoryChanged(const QString &path, bool re emit q->directoryChanged(path, QFileSystemWatcher::QPrivateSignal()); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) void QFileSystemWatcherPrivate::_q_winDriveLockForRemoval(const QString &path) { @@ -201,7 +201,7 @@ void QFileSystemWatcherPrivate::_q_winDriveRemoved(const QString &path) if (!path.isEmpty()) temporarilyRemovedPaths.remove(path.at(0)); } -#endif // Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN /*! \class QFileSystemWatcher diff --git a/src/corelib/io/qfilesystemwatcher_p.h b/src/corelib/io/qfilesystemwatcher_p.h index 1997ff6c86..cecfe03ff5 100644 --- a/src/corelib/io/qfilesystemwatcher_p.h +++ b/src/corelib/io/qfilesystemwatcher_p.h @@ -108,14 +108,14 @@ public: void _q_fileChanged(const QString &path, bool removed); void _q_directoryChanged(const QString &path, bool removed); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) void _q_winDriveLockForRemoval(const QString &); void _q_winDriveLockForRemovalFailed(const QString &); void _q_winDriveRemoved(const QString &); private: QHash temporarilyRemovedPaths; -#endif // Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN }; diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp index 2f0a209b76..cc04288de5 100644 --- a/src/corelib/io/qfilesystemwatcher_win.cpp +++ b/src/corelib/io/qfilesystemwatcher_win.cpp @@ -52,7 +52,6 @@ #include -#ifndef Q_OS_WINRT # include # include # include @@ -61,7 +60,6 @@ # include # include # include -#endif // !Q_OS_WINRT QT_BEGIN_NAMESPACE @@ -85,7 +83,6 @@ static Qt::HANDLE createChangeNotification(const QString &path, uint flags) return result; } -#ifndef Q_OS_WINRT /////////// // QWindowsRemovableDriveListener // Listen for the various WM_DEVICECHANGE message indicating drive addition/removal @@ -330,7 +327,6 @@ void QWindowsRemovableDriveListener::addPath(const QString &p) m_removableDrives.push_back(re); } -#endif // !Q_OS_WINRT /////////// // QWindowsFileSystemWatcherEngine @@ -343,7 +339,6 @@ QWindowsFileSystemWatcherEngine::Handle::Handle() QWindowsFileSystemWatcherEngine::QWindowsFileSystemWatcherEngine(QObject *parent) : QFileSystemWatcherEngine(parent) { -#ifndef Q_OS_WINRT if (QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance()) { m_driveListener = new QWindowsRemovableDriveListener(this); eventDispatcher->installNativeEventFilter(m_driveListener); @@ -360,7 +355,6 @@ QWindowsFileSystemWatcherEngine::QWindowsFileSystemWatcherEngine(QObject *parent qWarning("QFileSystemWatcher: Removable drive notification will not work" " if there is no QCoreApplication instance."); } -#endif // !Q_OS_WINRT } QWindowsFileSystemWatcherEngine::~QWindowsFileSystemWatcherEngine() @@ -524,14 +518,12 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths, } } -#ifndef Q_OS_WINRT if (Q_LIKELY(m_driveListener)) { for (const QString &path : paths) { if (!unhandled.contains(path)) m_driveListener->addPath(path); } } -#endif // !Q_OS_WINRT return unhandled; } @@ -763,6 +755,4 @@ void QWindowsFileSystemWatcherEngineThread::wakeup() QT_END_NAMESPACE -#ifndef Q_OS_WINRT # include "qfilesystemwatcher_win.moc" -#endif diff --git a/src/corelib/io/qfilesystemwatcher_win_p.h b/src/corelib/io/qfilesystemwatcher_win_p.h index 9d74ca3f61..138b6badf2 100644 --- a/src/corelib/io/qfilesystemwatcher_win_p.h +++ b/src/corelib/io/qfilesystemwatcher_win_p.h @@ -126,9 +126,7 @@ signals: private: QList threads; -#ifndef Q_OS_WINRT QWindowsRemovableDriveListener *m_driveListener = nullptr; -#endif }; class QFileSystemWatcherPathKey : public QString diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index dd4882a2bc..6b1ab5739e 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -53,18 +53,14 @@ #include #include #include -#ifndef Q_OS_WINRT -# include -# include -#endif +#include +#include #include #include #include #include -#ifndef Q_OS_WINRT -# define SECURITY_WIN32 -# include -#endif +#define SECURITY_WIN32 +#include #ifndef PATH_MAX #define PATH_MAX FILENAME_MAX @@ -88,16 +84,12 @@ QString QFSFileEnginePrivate::longFileName(const QString &path) return path; QString absPath = QFileSystemEngine::nativeAbsoluteFilePath(path); -#if !defined(Q_OS_WINRT) QString prefix = QLatin1String("\\\\?\\"); if (isUncPath(absPath)) { prefix.append(QLatin1String("UNC\\")); // "\\\\?\\UNC\\" absPath.remove(0, 2); } return prefix + absPath; -#else - return absPath; -#endif } /* @@ -123,7 +115,6 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode) ? OPEN_ALWAYS : OPEN_EXISTING; // Create the file handle. -#ifndef Q_OS_WINRT SECURITY_ATTRIBUTES securityAtts = { sizeof(SECURITY_ATTRIBUTES), NULL, FALSE }; fileHandle = CreateFile((const wchar_t*)fileEntry.nativeFilePath().utf16(), accessRights, @@ -132,13 +123,6 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode) creationDisp, FILE_ATTRIBUTE_NORMAL, NULL); -#else // !Q_OS_WINRT - fileHandle = CreateFile2((const wchar_t*)fileEntry.nativeFilePath().utf16(), - accessRights, - shareMode, - creationDisp, - NULL); -#endif // Q_OS_WINRT // Bail out on error. if (fileHandle == INVALID_HANDLE_VALUE) { @@ -428,7 +412,6 @@ int QFSFileEnginePrivate::nativeHandle() const */ bool QFSFileEnginePrivate::nativeIsSequential() const { -#if !defined(Q_OS_WINRT) HANDLE handle = fileHandle; if (fh || fd != -1) handle = (HANDLE)_get_osfhandle(fh ? QT_FILENO(fh) : fd); @@ -438,9 +421,6 @@ bool QFSFileEnginePrivate::nativeIsSequential() const DWORD fileType = GetFileType(handle); return (fileType == FILE_TYPE_CHAR) || (fileType == FILE_TYPE_PIPE); -#else - return false; -#endif } bool QFSFileEngine::caseSensitive() const @@ -450,7 +430,6 @@ bool QFSFileEngine::caseSensitive() const QString QFSFileEngine::currentPath(const QString &fileName) { -#if !defined(Q_OS_WINRT) QString ret; //if filename is a drive: then get the pwd of that drive if (fileName.length() >= 2 && @@ -469,13 +448,8 @@ 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_WINRT - Q_UNUSED(fileName); - return QFileSystemEngine::currentPath().filePath(); -#endif // Q_OS_WINRT } -#if !defined(Q_OS_WINRT) // cf QStorageInfo::isReady static inline bool isDriveReady(const wchar_t *path) { @@ -485,12 +459,10 @@ static inline bool isDriveReady(const wchar_t *path) || GetVolumeInformation(path, nullptr, 0, nullptr, nullptr, &fileSystemFlags, nullptr, 0) == TRUE; } -#endif // !Q_OS_WINRT QFileInfoList QFSFileEngine::drives() { QFileInfoList ret; -#if !defined(Q_OS_WINRT) const UINT oldErrorMode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); quint32 driveBits = (quint32) GetLogicalDrives() & 0x3ffffff; wchar_t driveName[] = L"A:\\"; @@ -503,10 +475,6 @@ QFileInfoList QFSFileEngine::drives() } ::SetErrorMode(oldErrorMode); return ret; -#else // !Q_OS_WINRT - ret.append(QFileInfo(QLatin1String("/"))); - return ret; -#endif // Q_OS_WINRT } bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) const @@ -529,7 +497,6 @@ bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) cons bool QFSFileEngine::link(const QString &newName) { -#if !defined(Q_OS_WINRT) bool ret = false; QString linkName = newName; @@ -574,11 +541,6 @@ bool QFSFileEngine::link(const QString &newName) CoUninitialize(); return ret; -#else // !Q_OS_WINRT - Q_UNUSED(newName); - Q_UNIMPLEMENTED(); - return false; -#endif // Q_OS_WINRT } /*! @@ -891,11 +853,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, // first create the file mapping handle DWORD protection = (openMode & QIODevice::WriteOnly) ? PAGE_READWRITE : PAGE_READONLY; -#ifndef Q_OS_WINRT mapHandle = ::CreateFileMapping(handle, 0, protection, 0, 0, 0); -#else - mapHandle = ::CreateFileMappingFromApp(handle, 0, protection, 0, 0); -#endif if (mapHandle == NULL) { q->setError(QFile::PermissionsError, qt_error_string()); #ifdef Q_USE_DEPRECATED_MAP_API @@ -908,24 +866,15 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, DWORD offsetHi = offset >> 32; DWORD offsetLo = offset & Q_UINT64_C(0xffffffff); SYSTEM_INFO sysinfo; -#ifndef Q_OS_WINRT ::GetSystemInfo(&sysinfo); -#else - ::GetNativeSystemInfo(&sysinfo); -#endif DWORD mask = sysinfo.dwAllocationGranularity - 1; DWORD extra = offset & mask; if (extra) offsetLo &= ~mask; // attempt to create the map -#ifndef Q_OS_WINRT LPVOID mapAddress = ::MapViewOfFile(mapHandle, access, offsetHi, offsetLo, size + extra); -#else - LPVOID mapAddress = ::MapViewOfFileFromApp(mapHandle, access, - (ULONG64(offsetHi) << 32) + offsetLo, size + extra); -#endif if (mapAddress) { uchar *address = extra + static_cast(mapAddress); maps[address] = extra; diff --git a/src/corelib/io/qlockfile_win.cpp b/src/corelib/io/qlockfile_win.cpp index 277f8d4230..77cdf66694 100644 --- a/src/corelib/io/qlockfile_win.cpp +++ b/src/corelib/io/qlockfile_win.cpp @@ -65,7 +65,6 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys() // but Windows doesn't allow recreating it while this handle is open anyway, // so this would only create confusion (can't lock, but no lock file to read from). const DWORD dwShareMode = FILE_SHARE_READ; -#ifndef Q_OS_WINRT SECURITY_ATTRIBUTES securityAtts = { sizeof(SECURITY_ATTRIBUTES), NULL, FALSE }; HANDLE fh = CreateFile((const wchar_t*)fileEntry.nativeFilePath().utf16(), GENERIC_READ | GENERIC_WRITE, @@ -74,13 +73,6 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys() CREATE_NEW, // error if already exists FILE_ATTRIBUTE_NORMAL, NULL); -#else // !Q_OS_WINRT - HANDLE fh = CreateFile2((const wchar_t*)fileEntry.nativeFilePath().utf16(), - GENERIC_READ | GENERIC_WRITE, - dwShareMode, - CREATE_NEW, // error if already exists - NULL); -#endif // Q_OS_WINRT if (fh == INVALID_HANDLE_VALUE) { const DWORD lastError = GetLastError(); switch (lastError) { @@ -118,9 +110,6 @@ bool QLockFilePrivate::removeStaleLock() bool QLockFilePrivate::isProcessRunning(qint64 pid, const QString &appname) { - // On WinRT there seems to be no way of obtaining information about other - // processes due to sandboxing -#ifndef Q_OS_WINRT HANDLE procHandle = ::OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid); if (!procHandle) return false; @@ -137,17 +126,11 @@ bool QLockFilePrivate::isProcessRunning(qint64 pid, const QString &appname) if (!processName.isEmpty() && processName != appname) return false; // PID got reused by a different application. -#else // !Q_OS_WINRT - Q_UNUSED(pid); - Q_UNUSED(appname); -#endif // Q_OS_WINRT - return true; } QString QLockFilePrivate::processNameByPid(qint64 pid) { -#if !defined(Q_OS_WINRT) typedef DWORD (WINAPI *GetModuleFileNameExFunc)(HANDLE, HMODULE, LPTSTR, DWORD); HMODULE hPsapi = LoadLibraryA("psapi"); @@ -179,10 +162,6 @@ QString QLockFilePrivate::processNameByPid(qint64 pid) if (i >= 0) name.truncate(i); return name; -#else - Q_UNUSED(pid); - return QString(); -#endif } void QLockFile::unlock() diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 854752069e..633777fd5c 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -489,8 +489,7 @@ void QProcessPrivate::Channel::clear() You can also call error() to find the type of error that occurred last, and state() to find the current process state. - \note QProcess is not supported on VxWorks, iOS, tvOS, watchOS, - or the Universal Windows Platform. + \note QProcess is not supported on VxWorks, iOS, tvOS, or watchOS. \section1 Communicating via Channels diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index a15dbb772f..5d84713a67 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -78,19 +78,7 @@ #ifdef Q_OS_WIN // for homedirpath reading from registry # include -# ifndef Q_OS_WINRT -# include -# endif -#endif - -#ifdef Q_OS_WINRT -#include -#include -#include -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Storage; +# include #endif #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_ANDROID) @@ -286,7 +274,7 @@ after_loop: return result; } -// see also qsettings_win.cpp, qsettings_winrt.cpp and qsettings_mac.cpp +// see also qsettings_win.cpp and qsettings_mac.cpp #if !defined(Q_OS_WIN) && !defined(Q_OS_MAC) && !defined(Q_OS_WASM) QSettingsPrivate *QSettingsPrivate::create(QSettings::Format format, QSettings::Scope scope, @@ -945,7 +933,7 @@ void QConfFileSettingsPrivate::initAccess() sync(); // loads the files the first time } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) static QString windowsConfigPath(const KNOWNFOLDERID &type) { QString result; @@ -966,44 +954,7 @@ static QString windowsConfigPath(const KNOWNFOLDERID &type) return result; } -#elif defined(Q_OS_WINRT) // Q_OS_WIN && !Q_OS_WINRT - -enum ConfigPathType { - ConfigPath_CommonAppData, - ConfigPath_UserAppData -}; - -static QString windowsConfigPath(ConfigPathType type) -{ - static QString result; - while (result.isEmpty()) { - ComPtr applicationDataStatics; - if (FAILED(GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Storage_ApplicationData).Get(), &applicationDataStatics))) - return result; - ComPtr applicationData; - if (FAILED(applicationDataStatics->get_Current(&applicationData))) - return result; - ComPtr localFolder; - if (FAILED(applicationData->get_LocalFolder(&localFolder))) - return result; - ComPtr localFolderItem; - if (FAILED(localFolder.As(&localFolderItem))) - return result; - HString path; - if (FAILED(localFolderItem->get_Path(path.GetAddressOf()))) - return result; - result = QString::fromWCharArray(path.GetRawBuffer(nullptr)); - } - - switch (type) { - case ConfigPath_CommonAppData: - return result + QLatin1String("\\qt-common"); - case ConfigPath_UserAppData: - return result + QLatin1String("\\qt-user"); - } - return result; -} -#endif // Q_OS_WINRT +#endif // Q_OS_WIN static inline int pathHashKey(QSettings::Format format, QSettings::Scope scope) { @@ -1056,14 +1007,8 @@ static std::unique_lock initDefaultPaths(std::unique_lockinsert(pathHashKey(QSettings::IniFormat, QSettings::UserScope), Path(roamingAppDataFolder + QDir::separator(), false)); pathHash->insert(pathHashKey(QSettings::IniFormat, QSettings::SystemScope), diff --git a/src/corelib/io/qsettings_p.h b/src/corelib/io/qsettings_p.h index 8ddebd2359..548fcb591d 100644 --- a/src/corelib/io/qsettings_p.h +++ b/src/corelib/io/qsettings_p.h @@ -72,10 +72,6 @@ QT_BEGIN_NAMESPACE #define QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER #endif -#if defined(Q_OS_WINRT) -#define QT_QTSETTINGS_FORGET_ORIGINAL_KEY_ORDER -#endif - // used in testing framework #define QSETTINGS_P_H_VERSION 3 diff --git a/src/corelib/io/qsettings_winrt.cpp b/src/corelib/io/qsettings_winrt.cpp deleted file mode 100644 index a208262ab4..0000000000 --- a/src/corelib/io/qsettings_winrt.cpp +++ /dev/null @@ -1,690 +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 "qsettings.h" - -#include "qsettings_p.h" -#include "qvector.h" -#include "qmap.h" -#include "qdebug.h" -#include "qfunctions_winrt.h" - -#include -#include -#include -#include - -using namespace ABI::Windows::ApplicationModel; -using namespace ABI::Windows::Storage; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Foundation::Collections; -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; - -typedef ITypedEventHandler DataHandler; -typedef Collections::IKeyValuePair ContainerItem; -typedef Collections::IIterable ContainerIterable; -typedef Collections::IIterator ContainerIterator; - -typedef Collections::IKeyValuePair ValueItem; -typedef Collections::IIterable ValueIterable; -typedef Collections::IIterator ValueIterator; - -QT_BEGIN_NAMESPACE - -static IApplicationDataContainer *subContainer(IApplicationDataContainer *parent, const QString &name) -{ - ComPtr> childrenContainer; - HRESULT hr = parent->get_Containers(&childrenContainer); - if (FAILED(hr)) - return 0; - - ComPtr< ContainerIterable > iterable; - ComPtr< ContainerIterator > iterator; - - hr = childrenContainer.As(&iterable); - if (FAILED(hr)) - return 0; - - hr = iterable->First(&iterator); - if (FAILED(hr)) - return 0; - boolean current; - hr = iterator->get_HasCurrent(¤t); - if (FAILED(hr)) - return 0; - - while (SUCCEEDED(hr) && current) { - ComPtr item; - hr = iterator->get_Current(&item); - if (FAILED(hr)) - return 0; - - HString key; - hr = item->get_Key(key.GetAddressOf()); - if (FAILED(hr)) - continue; - QString subName = QString::fromWCharArray(key.GetRawBuffer(nullptr)); - if (name == subName) { - IApplicationDataContainer *container; - hr = item->get_Value(&container); - return SUCCEEDED(hr) ? container : 0; - } - hr = iterator->MoveNext(¤t); - } - - return 0; -} - -static QStringList subContainerNames(IApplicationDataContainer *container, bool recursive = false) -{ - QStringList result; - ComPtr> childrenContainer; - HRESULT hr = container->get_Containers(&childrenContainer); - if (FAILED(hr)) - return result; - - ComPtr< ContainerIterable > iterable; - ComPtr< ContainerIterator > iterator; - - hr = childrenContainer.As(&iterable); - if (FAILED(hr)) - return result; - - hr = iterable->First(&iterator); - if (FAILED(hr)) - return result; - boolean current; - hr = iterator->get_HasCurrent(¤t); - if (FAILED(hr)) - return result; - - while (SUCCEEDED(hr) && current) { - ComPtr item; - hr = iterator->get_Current(&item); - if (FAILED(hr)) - return result; - - HString key; - hr = item->get_Key(key.GetAddressOf()); - if (SUCCEEDED(hr)) { - QString subName = QString::fromWCharArray(key.GetRawBuffer(nullptr)); - result.append(subName); - if (recursive) { - ComPtr sub = subContainer(container, subName); - QStringList subSubNames = subContainerNames(sub.Get(), recursive); - for (int i = 0; i < subSubNames.size(); ++i) - subSubNames[i] = subName + QLatin1Char('/') + subSubNames[i]; - result.append(subSubNames); - } - hr = iterator->MoveNext(¤t); - } - } - return result; -} - -static QStringList keyNames(IApplicationDataContainer *container) { - HRESULT hr; - QStringList result; - ComPtr values; - hr = container->get_Values(&values); - if (FAILED(hr)) - return result; - - ComPtr> settingsMap; - - hr = values.As(&settingsMap); - if (FAILED(hr)) - return result; - - ComPtr> mapView; - hr = settingsMap->GetView(&mapView); - if (FAILED(hr)) - return result; - - ComPtr< ValueIterable > iterable; - ComPtr< ValueIterator > iterator; - - hr = mapView.As(&iterable); - if (FAILED(hr)) - return result; - - boolean current = false; - hr = iterable->First(&iterator); - if (FAILED(hr)) - return result; - hr = iterator->get_HasCurrent(¤t); - if (FAILED(hr)) - return result; - - while (SUCCEEDED(hr) && current){ - ComPtr item; - hr = iterator->get_Current(&item); - if (FAILED(hr)) - return result; - - HString key; - hr = item->get_Key(key.GetAddressOf()); - if (SUCCEEDED(hr)) { - result += QString::fromWCharArray(key.GetRawBuffer(nullptr)); - hr = iterator->MoveNext(¤t); - } - } - return result; -} - -static IApplicationDataContainer *createSubContainer(IApplicationDataContainer *parent, const QString &name) -{ - HStringReference childGroupNativeName((const wchar_t*)name.utf16(), name.size()); - - IApplicationDataContainer *result = subContainer(parent, name); - if (!result) - parent->CreateContainer(childGroupNativeName.Get(), ApplicationDataCreateDisposition_Always, &result); - return result; -} - -#define PROP_CASE_TO_VARIANT(TYPE, VARTYPE, QTYPE) \ - case PropertyType_##TYPE: { \ - VARTYPE v; \ - value->Get##TYPE(&v); \ - result.setValue( QTYPE(v) ); \ - break; \ - } - -static QVariant propertyValueToQVariant(IPropertyValue *value) -{ - QVariant result; - PropertyType type; - value->get_Type(&type); - switch (type) { - PROP_CASE_TO_VARIANT(Boolean, boolean, bool) - PROP_CASE_TO_VARIANT(UInt8, UINT8, quint8) - PROP_CASE_TO_VARIANT(Int16, INT16, qint16) - PROP_CASE_TO_VARIANT(UInt16, UINT16, quint16) - PROP_CASE_TO_VARIANT(Int32, INT32, qint32) - PROP_CASE_TO_VARIANT(UInt32, UINT32, quint32) - PROP_CASE_TO_VARIANT(Int64, INT64, qint64) - PROP_CASE_TO_VARIANT(UInt64, UINT64, quint64) - PROP_CASE_TO_VARIANT(Single, FLOAT, float) - PROP_CASE_TO_VARIANT(Double, DOUBLE, double) - case PropertyType_StringArray: { - UINT32 size; - HSTRING *content; - value->GetStringArray(&size, &content); - QStringList list; - // The last item is assumed to be added by us - for (UINT32 i = 0; i < size - 1; ++i) { - QString s = QString::fromWCharArray(WindowsGetStringRawBuffer(content[i], nullptr)); - list.append(s); - } - result = QSettingsPrivate::stringListToVariantList(list); - break; - } - case PropertyType_String: { - HString v; - value->GetString(v.GetAddressOf()); - result = QSettingsPrivate::stringToVariant(QString::fromWCharArray(v.GetRawBuffer(nullptr))); - break; - } - default: { - UINT32 size; - BYTE *arr; - value->GetUInt8Array(&size, &arr); - QByteArray data = QByteArray::fromRawData((const char*)arr, size); - QString s; - if (size) { - // We assume this is our qt stored data like on other platforms - // as well. QList and others are converted to byte arrays - s = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2); - result = QSettingsPrivate::stringToVariant(s); - } - break; - } - } - return result; -} - -class QWinRTSettingsPrivate : public QSettingsPrivate -{ -public: - QWinRTSettingsPrivate(QSettings::Scope scope, const QString &organization, - const QString &application); - QWinRTSettingsPrivate(const QString &rKey); - ~QWinRTSettingsPrivate(); - - void remove(const QString &uKey) override; - void set(const QString &uKey, const QVariant &value) override; - bool get(const QString &uKey, QVariant *value) const override; - QStringList children(const QString &uKey, ChildSpec spec) const override; - void clear() override; - void sync() override; - void flush() override; - bool isWritable() const override; - QString fileName() const override; - -private: - void init(QSettings::Scope scope); - IApplicationDataContainer *getContainer(IApplicationDataContainer *parent, const QString &group, bool create = false) const; - void clearContainerMaps(); - - HRESULT onDataChanged(IApplicationData*, IInspectable*); - - ComPtr applicationData; - QVector> readContainers; - ComPtr writeContainer; - EventRegistrationToken dataChangedToken; -}; - -QWinRTSettingsPrivate::QWinRTSettingsPrivate(QSettings::Scope scope, const QString &organization, - const QString &application) - : QSettingsPrivate(QSettings::NativeFormat, scope, organization, application) - , writeContainer(0) -{ - init(scope); -} - -QWinRTSettingsPrivate::QWinRTSettingsPrivate(const QString &rPath) - : QSettingsPrivate(QSettings::NativeFormat, QSettings::UserScope, rPath, QString()) - , writeContainer(0) -{ - init(QSettings::UserScope); -} - -QWinRTSettingsPrivate::~QWinRTSettingsPrivate() -{ - clearContainerMaps(); -} - -void QWinRTSettingsPrivate::remove(const QString &uKey) -{ - int lastIndex = uKey.lastIndexOf(QLatin1Char('/')); - QString groupName = (lastIndex > 0) ? uKey.left(lastIndex) : QString(); - QString groupKey = uKey.mid(lastIndex + 1); - - ComPtr container = getContainer(writeContainer.Get(), groupName, false); - if (!container) - return; - - HRESULT hr; - ComPtr values; - hr = container->get_Values(&values); - if (FAILED(hr)) - return; - - ComPtr> settingsMap; - - hr = values.As(&settingsMap); - if (FAILED(hr)) - return; - - HStringReference ref((const wchar_t*)groupKey.utf16(), groupKey.size()); - hr = settingsMap->Remove(ref.Get()); - - // groupKey can be a container as well - hr = container->DeleteContainer(ref.Get()); - init(scope); -} - -void QWinRTSettingsPrivate::set(const QString &uKey, const QVariant &value) -{ - int lastIndex = uKey.lastIndexOf(QLatin1Char('/')); - QString groupName = (lastIndex > 0) ? uKey.left(lastIndex) : QString(); - QString groupKey = uKey.mid(lastIndex + 1); - - ComPtr container = getContainer(writeContainer.Get(), groupName, true); - - ComPtr values; - HRESULT hr = container->get_Values(&values); - if (FAILED(hr)) { - qErrnoWarning(hr, "Could not access Windows container values"); - setStatus(QSettings::AccessError); - return; - } - - ComPtr> settingsMap; - hr = values.As(&settingsMap); - if (FAILED(hr)) { - setStatus(QSettings::AccessError); - return; - } - - ComPtr valueStatics; - hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Foundation_PropertyValue).Get(), &valueStatics); - if (FAILED(hr)) { - setStatus(QSettings::AccessError); - return; - } - - ComPtr val; - - switch (value.type()) { - case QVariant::List: - case QVariant::StringList: { - QStringList l = variantListToStringList(value.toList()); - QStringList::const_iterator it = l.constBegin(); - bool containsNull = false; - for (; it != l.constEnd(); ++it) { - if ((*it).length() == 0 || it->contains(QChar::Null)) { - // We can only store as binary - containsNull = true; - break; - } - } - - if (containsNull) { - // Store binary - const QString s = variantToString(value); - hr = valueStatics->CreateUInt8Array(s.length() * 2, (BYTE*) s.utf16(), &val); - } else { - // Store as native string list - int size = l.size(); - HSTRING *nativeHandleList = new HSTRING[size+1]; - for (int i = 0; i < size; ++i) - hr = WindowsCreateString((const wchar_t*)l[i].utf16(), l[i].size(), &nativeHandleList[i]); - // Add end marker - hr = WindowsCreateString((const wchar_t*)L"\0\0@", 3, &nativeHandleList[size]); - hr = valueStatics->CreateStringArray(size + 1 , nativeHandleList, &val); - for (int i = 0; i < size; ++i) - hr = WindowsDeleteString(nativeHandleList[i]); - delete [] nativeHandleList; - } - break; - } - case QVariant::Bool: - hr = valueStatics->CreateBoolean(boolean(value.toBool()), &val); - break; - case QVariant::Int: - hr = valueStatics->CreateInt32(INT32(value.toInt()), &val); - break; - case QVariant::UInt: - hr = valueStatics->CreateUInt32(UINT32(value.toUInt()), &val); - break; - case QVariant::LongLong: - hr = valueStatics->CreateInt64(INT64(value.toLongLong()), &val); - break; - case QVariant::ULongLong: - hr = valueStatics->CreateUInt64(UINT64(value.toULongLong()), &val); - break; - default: { - const QString s = variantToString(value); - if (s.contains(QChar::Null)) { - hr = valueStatics->CreateUInt8Array(s.length() * 2, (BYTE*) s.utf16(), &val); - } else { - HStringReference ref((const wchar_t*)s.utf16(), s.size()); - hr = valueStatics->CreateString(ref.Get(), &val); - } - - break; - } - } - - RETURN_VOID_IF_FAILED("QSettings: Could not save QVariant value into IInspectable"); - - HStringReference key((const wchar_t*)groupKey.utf16(), groupKey.size()); - boolean rep; - - hr = settingsMap->Insert(key.Get(), val.Get(), &rep); - RETURN_VOID_IF_FAILED("QSettings: Could not store value"); -} - -bool QWinRTSettingsPrivate::get(const QString &uKey, QVariant *value) const -{ - int lastIndex = uKey.lastIndexOf(QLatin1Char('/')); - QString groupName = (lastIndex > 0) ? uKey.left(lastIndex) : QString(); - QString groupKey = uKey.mid(lastIndex + 1); - - HRESULT hr; - - for (int i = 0; i < readContainers.size(); ++i) { - ComPtr container = const_cast(this)->getContainer(readContainers.at(i).Get(), groupName); - - if (!container) - continue; - - ComPtr values; - hr = container->get_Values(&values); - if (FAILED(hr)) - continue; - - ComPtr> settingsMap; - hr = values.As(&settingsMap); - if (FAILED(hr)) - continue; - - HStringReference key((const wchar_t*)groupKey.utf16(), groupKey.size()); - boolean exists; - - hr = settingsMap.Get()->HasKey(key.Get(), &exists); - if (FAILED(hr)) - continue; - - if (!exists) { - if (!fallbacks) - break; - else - continue; - } - - if (value) { - ComPtr val; - hr = settingsMap->Lookup(key.Get(), &val); - if (FAILED(hr)) - return false; - - ComPtr pVal; - hr = val.As(&pVal); - if (FAILED(hr)) - return false; - - *value = propertyValueToQVariant(pVal.Get()); - } - return true; - } - setStatus(QSettings::AccessError); - return false; -} - -QStringList QWinRTSettingsPrivate::children(const QString &uKey, ChildSpec spec) const -{ - QStringList result; - for (int i = 0; i < readContainers.size(); ++i) { - ComPtr container = getContainer(readContainers.at(i).Get(), uKey, false); - if (!container.Get()) - continue; - - // Get Keys in this container - if (spec == AllKeys || spec == ChildKeys) - result += keyNames(container.Get()); - - // Get Subcontainer(s) - if (spec == AllKeys || spec == ChildGroups) { - const QStringList subContainerList = subContainerNames(container.Get(), spec == AllKeys); - - if (spec == AllKeys) { - for (const QString &item : subContainerList) { - const QString subChildren = uKey.isEmpty() ? item : (uKey + QLatin1Char('/') + item); - const QStringList subResult = children(subChildren, ChildKeys); - for (const QString &subItem : subResult) - result += item + QLatin1Char('/') + subItem; - } - } - - if (spec == ChildGroups) - result += subContainerList; - } - - } - result.removeDuplicates(); - return result; -} - -void QWinRTSettingsPrivate::clear() -{ - ComPtr container; - HRESULT hr; - if (scope == QSettings::UserScope) - hr = applicationData->get_LocalSettings(&container); - else - hr = applicationData->get_RoamingSettings(&container); - - RETURN_VOID_IF_FAILED("Could not access settings container"); - - QString containerName = applicationName.isEmpty() ? organizationName : applicationName; - HStringReference containerNativeName((const wchar_t*)containerName.utf16(), containerName.size()); - - hr = container->DeleteContainer(containerNativeName.Get()); - RETURN_VOID_IF_FAILED("Could not delete Container"); - - init(scope); -} - -void QWinRTSettingsPrivate::sync() -{ - // No native sync available -} - -void QWinRTSettingsPrivate::flush() -{ - // No native flush available -} - -QString QWinRTSettingsPrivate::fileName() const -{ - Q_UNIMPLEMENTED(); - return QString(); -} - -HRESULT QWinRTSettingsPrivate::onDataChanged(IApplicationData *, IInspectable *) -{ - // This only happens, if roaming data is changed by the OS. - // To ensure sanity we clean up the map and start from scratch - init(scope); - return S_OK; -} - -void QWinRTSettingsPrivate::init(QSettings::Scope scope) -{ - clearContainerMaps(); - - ComPtr applicationDataStatics; - HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Storage_ApplicationData).Get(), &applicationDataStatics); - if (FAILED(hr)) { - qErrnoWarning(hr, "Could not access Storage Factory"); - setStatus(QSettings::AccessError); - return; - } - - hr = applicationDataStatics->get_Current(&applicationData); - if (FAILED(hr)) { - qErrnoWarning(hr, "Could not access application data statics"); - setStatus(QSettings::AccessError); - return; - } - - const QString organizationString = organizationName.isEmpty() ? QLatin1String("OrganizationDefaults") : organizationName; - ComPtr localContainer; - if (scope == QSettings::UserScope && SUCCEEDED(applicationData->get_LocalSettings(&localContainer))) { - if (!applicationName.isEmpty()) - readContainers.append(createSubContainer(localContainer.Get(), applicationName)); - readContainers.append(createSubContainer(localContainer.Get(), organizationString)); - } - - ComPtr roamingContainer; - if (SUCCEEDED(applicationData->get_RoamingSettings(&roamingContainer))) { - if (!applicationName.isEmpty()) - readContainers.append(createSubContainer(roamingContainer.Get(), applicationName)); - readContainers.append(createSubContainer(roamingContainer.Get(), organizationString)); - } - - ComPtr writeRootContainer = (scope == QSettings::UserScope) ? localContainer : roamingContainer; - if (!applicationName.isEmpty()) - writeContainer = createSubContainer(writeRootContainer.Get(), applicationName); - else - writeContainer = createSubContainer(writeRootContainer.Get(), organizationString); - - hr = applicationData->add_DataChanged(Callback(this, &QWinRTSettingsPrivate::onDataChanged).Get(), &dataChangedToken); -} - -IApplicationDataContainer *QWinRTSettingsPrivate::getContainer(IApplicationDataContainer *parent, const QString &group, bool create) const -{ - IApplicationDataContainer *current = parent; - if (group.isEmpty()) - return current; - const QStringList groupPath = group.split(QLatin1Char('/'), Qt::SkipEmptyParts); - - for (const QString &subGroup : groupPath) { - ComPtr sub = subContainer(current, subGroup); - if (!sub && create) - sub = createSubContainer(current, subGroup); - if (!sub) - return 0; // Something seriously went wrong - current = sub.Detach(); - } - return current; -} - -void QWinRTSettingsPrivate::clearContainerMaps() -{ - readContainers.clear(); - writeContainer.Reset(); -} - -bool QWinRTSettingsPrivate::isWritable() const -{ - return true; -} - -QSettingsPrivate *QSettingsPrivate::create(QSettings::Format format, QSettings::Scope scope, - const QString &organization, const QString &application) -{ - if (format == QSettings::NativeFormat) - return new QWinRTSettingsPrivate(scope, organization, application); - else - return new QConfFileSettingsPrivate(format, scope, organization, application); -} - -QSettingsPrivate *QSettingsPrivate::create(const QString &fileName, QSettings::Format format) -{ - if (format == QSettings::NativeFormat) - return new QWinRTSettingsPrivate(fileName); - else - return new QConfFileSettingsPrivate(fileName, format); -} - -QT_END_NAMESPACE diff --git a/src/corelib/io/qstandardpaths_winrt.cpp b/src/corelib/io/qstandardpaths_winrt.cpp deleted file mode 100644 index a7de15472e..0000000000 --- a/src/corelib/io/qstandardpaths_winrt.cpp +++ /dev/null @@ -1,138 +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 "qstandardpaths.h" - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Storage; -using namespace ABI::Windows::ApplicationModel; - -#ifndef QT_NO_STANDARDPATHS - -QT_BEGIN_NAMESPACE - -static QString convertCharArray(const wchar_t *path) -{ - return QDir::fromNativeSeparators(QString::fromWCharArray(path)); -} - -QString QStandardPaths::writableLocation(StandardLocation type) -{ - QString result; - - switch (type) { - case ConfigLocation: // same as AppLocalDataLocation, on Windows - case GenericConfigLocation: // same as GenericDataLocation, on Windows - case AppConfigLocation: - case AppDataLocation: - case AppLocalDataLocation: - case GenericDataLocation: { - ComPtr applicationDataStatics; - if (FAILED(GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Storage_ApplicationData).Get(), &applicationDataStatics))) - break; - ComPtr applicationData; - if (FAILED(applicationDataStatics->get_Current(&applicationData))) - break; - ComPtr settingsFolder; - if (FAILED(applicationData->get_LocalFolder(&settingsFolder))) - break; - ComPtr settingsFolderItem; - if (FAILED(settingsFolder.As(&settingsFolderItem))) - break; - HString path; - if (FAILED(settingsFolderItem->get_Path(path.GetAddressOf()))) - break; - result = convertCharArray(path.GetRawBuffer(nullptr)); - if (isTestModeEnabled()) - result += QLatin1String("/qttest"); - break; - } - case CacheLocation: - return writableLocation(AppLocalDataLocation) + QLatin1String("/cache"); - - case GenericCacheLocation: - return writableLocation(GenericDataLocation) + QLatin1String("/cache"); - - case TempLocation: - result = QDir::tempPath(); - break; - - case ApplicationsLocation: - case DesktopLocation: - case FontsLocation: - case HomeLocation: - case RuntimeLocation: - // these are read-only - break; - - case DocumentsLocation: - case MusicLocation: - case MoviesLocation: - case PicturesLocation: - case DownloadLocation: - default: - Q_UNIMPLEMENTED(); - } - return result; - -} - -QStringList QStandardPaths::standardLocations(StandardLocation type) -{ - const QString writable = writableLocation(type); - return writable.isEmpty() ? QStringList() : QStringList(writable); -} - -QT_END_NAMESPACE - -#endif // QT_NO_STANDARDPATHS diff --git a/src/corelib/io/qstorageinfo_p.h b/src/corelib/io/qstorageinfo_p.h index ec5bb785e3..421e364311 100644 --- a/src/corelib/io/qstorageinfo_p.h +++ b/src/corelib/io/qstorageinfo_p.h @@ -71,7 +71,7 @@ public: static QStorageInfo root(); protected: -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) void retrieveVolumeInfo(); void retrieveDiskFreeSpace(); #elif defined(Q_OS_MAC) diff --git a/src/corelib/io/qstorageinfo_stub.cpp b/src/corelib/io/qstorageinfo_stub.cpp deleted file mode 100644 index a312b9dc89..0000000000 --- a/src/corelib/io/qstorageinfo_stub.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Ivan Komissarov -** 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 "qstorageinfo_p.h" - -QT_BEGIN_NAMESPACE - -void QStorageInfoPrivate::initRootPath() -{ - Q_UNIMPLEMENTED(); - rootPath = QString(); -} - -void QStorageInfoPrivate::doStat() -{ - Q_UNIMPLEMENTED(); -} - -QList QStorageInfoPrivate::mountedVolumes() -{ - Q_UNIMPLEMENTED(); - return QList(); -} - -QStorageInfo QStorageInfoPrivate::root() -{ - Q_UNIMPLEMENTED(); - return QStorageInfo(); -} - -QT_END_NAMESPACE diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index c016a622c7..e6a160c3b2 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -219,17 +219,10 @@ static bool createFileFromTemplate(NativeFileHandle &file, QTemporaryFileName &t const DWORD shareMode = (flags & QTemporaryFileEngine::Win32NonShared) ? 0u : (FILE_SHARE_READ | FILE_SHARE_WRITE); -# ifndef Q_OS_WINRT file = CreateFile((const wchar_t *)path.constData(), GENERIC_READ | GENERIC_WRITE, shareMode, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); -# else // !Q_OS_WINRT - file = CreateFile2((const wchar_t *)path.constData(), - GENERIC_READ | GENERIC_WRITE, - shareMode, CREATE_NEW, - NULL); -# endif // Q_OS_WINRT if (file != INVALID_HANDLE_VALUE) return true; @@ -380,7 +373,7 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) return false; } -#if !defined(Q_OS_WIN) || defined(Q_OS_WINRT) +#if !defined(Q_OS_WIN) d->closeFileHandle = true; #endif diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index 76609894ba..fc48ef430e 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -88,27 +88,15 @@ win32 { kernel/qsystemsemaphore_win.cpp HEADERS += \ kernel/qwineventnotifier.h \ - kernel/qwineventnotifier_p.h + kernel/qwineventnotifier_p.h \ + kernel/qfunctions_winrt_p.h - winrt { - SOURCES += kernel/qeventdispatcher_winrt.cpp - HEADERS += kernel/qeventdispatcher_winrt_p.h - } else { - SOURCES += kernel/qeventdispatcher_win.cpp \ - kernel/qwinregistry.cpp - HEADERS += kernel/qeventdispatcher_win_p.h \ - kernel/qwinregistry_p.h - } + SOURCES += kernel/qeventdispatcher_win.cpp \ + kernel/qwinregistry.cpp + HEADERS += kernel/qeventdispatcher_win_p.h \ + kernel/qwinregistry_p.h - !winrt: LIBS_PRIVATE += -lversion -} - -winrt { - SOURCES += \ - kernel/qfunctions_winrt.cpp - HEADERS += \ - kernel/qfunctions_fake_env_p.h \ - kernel/qfunctions_winrt.h + LIBS_PRIVATE += -lversion } mac { diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 43f641244b..a3414b3edc 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -87,16 +87,7 @@ # include "qeventdispatcher_unix_p.h" #endif #ifdef Q_OS_WIN -# ifdef Q_OS_WINRT -# include "qeventdispatcher_winrt_p.h" -# include "qfunctions_winrt.h" -# include -# include - using namespace ABI::Windows::ApplicationModel::Core; - using namespace Microsoft::WRL; -# else -# include "qeventdispatcher_win_p.h" -# endif +#include "qeventdispatcher_win_p.h" #endif #endif // QT_NO_QOBJECT @@ -397,7 +388,7 @@ Q_GLOBAL_STATIC(QCoreApplicationData, coreappdata) static bool quitLockRefEnabled = true; #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) // Check whether the command line arguments match those passed to main() // by comparing to the global __argv/__argc (MS extension). // Deep comparison is required since argv/argc is rebuilt by WinMain for @@ -423,7 +414,7 @@ static inline bool contains(int argc, char **argv, const char *needle) } return false; } -#endif // Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint flags) : @@ -432,7 +423,7 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint #endif argc(aargc) , argv(aargv) -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) , origArgc(0) , origArgv(nullptr) #endif @@ -451,13 +442,13 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint argc = 0; argv = const_cast(&empty); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) if (!isArgvModified(argc, argv)) { origArgc = argc; origArgv = new char *[argc]; std::copy(argv, argv + argc, QT_MAKE_CHECKED_ARRAY_ITERATOR(origArgv, argc)); } -#endif // Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN #ifndef QT_NO_QOBJECT QCoreApplicationPrivate::is_app_closing = false; @@ -467,10 +458,6 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint qFatal("FATAL: The application binary appears to be running setuid, this is a security hole."); # endif // Q_OS_UNIX -#ifdef Q_OS_WINRT - QThreadData::setMainThread(); -#endif - QThread *cur = QThread::currentThread(); // note: this may end up setting theMainThread! if (cur != theMainThread.loadAcquire()) qWarning("WARNING: QApplication was not created in the main() thread."); @@ -482,7 +469,7 @@ QCoreApplicationPrivate::~QCoreApplicationPrivate() #ifndef QT_NO_QOBJECT cleanupThreadData(); #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) delete [] origArgv; #endif QCoreApplicationPrivate::clearApplicationFilePath(); @@ -570,10 +557,6 @@ void QCoreApplicationPrivate::appendApplicationPathToLibraryPaths() coreappdata()->app_libpaths.reset(app_libpaths = new QStringList); QString app_location = QCoreApplication::applicationFilePath(); app_location.truncate(app_location.lastIndexOf(QLatin1Char('/'))); -#ifdef Q_OS_WINRT - if (app_location.isEmpty()) - app_location.append(QLatin1Char('/')); -#endif app_location = QDir(app_location).canonicalPath(); if (QFile::exists(app_location) && !app_libpaths->contains(app_location)) app_libpaths->append(app_location); @@ -2466,7 +2449,7 @@ QStringList QCoreApplication::arguments() char ** const av = self->d_func()->argv; list.reserve(ac); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) // On Windows, it is possible to pass Unicode arguments on // the command line. To restore those, we split the command line // and filter out arguments that were deleted by derived application @@ -2483,7 +2466,7 @@ QStringList QCoreApplication::arguments() } return list; } // Fall back to rebuilding from argv/argc when a modified argv was passed. -#endif // defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#endif // defined(Q_OS_WIN) for (int a = 0; a < ac; ++a) { list << QString::fromLocal8Bit(av[a]); @@ -2622,9 +2605,6 @@ QString QCoreApplication::applicationName() \row \li Windows (classic desktop) \li PRODUCTVERSION parameter of the VERSIONINFO resource - \row - \li Universal Windows Platform - \li version attribute of the application package manifest \row \li macOS, iOS, tvOS, watchOS \li CFBundleVersion property of the information property list diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index 9d2fde619c..cb3a5a8a4f 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -154,7 +154,7 @@ public: int &argc; char **argv; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) int origArgc; char **origArgv; // store unmodified arguments for QCoreApplication::arguments() #endif diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index 824c0535ed..a0fbf97838 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -53,16 +53,6 @@ #include #include -#ifdef Q_OS_WINRT -#include -#include -#include -#include -using namespace ABI::Windows::ApplicationModel; -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -#endif - QT_BEGIN_NAMESPACE Q_CORE_EXPORT QString qAppFileName() // get application file name @@ -105,33 +95,6 @@ QString QCoreApplicationPrivate::appVersion() const { QString applicationVersion; #ifndef QT_BOOTSTRAPPED -# ifdef Q_OS_WINRT - HRESULT hr; - - ComPtr packageFactory; - hr = RoGetActivationFactory( - HString::MakeReference(RuntimeClass_Windows_ApplicationModel_Package).Get(), - IID_PPV_ARGS(&packageFactory)); - RETURN_IF_FAILED("Failed to create package instance", return QString()); - - ComPtr package; - packageFactory->get_Current(&package); - RETURN_IF_FAILED("Failed to get current application package", return QString()); - - ComPtr packageId; - package->get_Id(&packageId); - RETURN_IF_FAILED("Failed to get current application package ID", return QString()); - - PackageVersion version; - packageId->get_Version(&version); - RETURN_IF_FAILED("Failed to get current application package version", return QString()); - - applicationVersion = QStringLiteral("%1.%2.%3.%4") - .arg(version.Major) - .arg(version.Minor) - .arg(version.Build) - .arg(version.Revision); -# else const QString appFileName = qAppFileName(); QVarLengthArray buffer(appFileName.size() + 1); buffer[appFileName.toWCharArray(buffer.data())] = 0; @@ -154,13 +117,10 @@ QString QCoreApplicationPrivate::appVersion() const } } } -# endif #endif return applicationVersion; } -#ifndef Q_OS_WINRT - #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) Q_CORE_EXPORT HINSTANCE qWinAppInst() // get Windows app handle { @@ -913,8 +873,6 @@ QDebug operator<<(QDebug dbg, const MSG &msg) #endif // QT_NO_QOBJECT -#endif // !defined(Q_OS_WINRT) - #ifndef QT_NO_QOBJECT void QCoreApplicationPrivate::removePostedTimerEvent(QObject *object, int timerId) { diff --git a/src/corelib/kernel/qcorecmdlineargs_p.h b/src/corelib/kernel/qcorecmdlineargs_p.h index 33445a1625..b9f1ef6317 100644 --- a/src/corelib/kernel/qcorecmdlineargs_p.h +++ b/src/corelib/kernel/qcorecmdlineargs_p.h @@ -82,17 +82,7 @@ static inline QStringList qWinCmdArgs(const QString &cmdLine) return result; } -#elif defined(Q_OS_WINRT) // Q_OS_WIN32 - -static inline QStringList qCmdLineArgs(int argc, char *argv[]) -{ - QStringList args; - for (int i = 0; i != argc; ++i) - args += QString::fromLocal8Bit(argv[i]); - return args; -} - -#endif // Q_OS_WINRT +#endif // Q_OS_WIN32 QT_END_NAMESPACE diff --git a/src/corelib/kernel/qeventdispatcher_winrt.cpp b/src/corelib/kernel/qeventdispatcher_winrt.cpp deleted file mode 100644 index f7a1f969a8..0000000000 --- a/src/corelib/kernel/qeventdispatcher_winrt.cpp +++ /dev/null @@ -1,656 +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 "qeventdispatcher_winrt_p.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::System::Threading; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Foundation::Collections; -using namespace ABI::Windows::UI::Core; -using namespace ABI::Windows::ApplicationModel::Core; - -QT_BEGIN_NAMESPACE - -#define INTERRUPT_HANDLE 0 -#define INVALID_TIMER_ID -1 - -struct WinRTTimerInfo : public QAbstractEventDispatcher::TimerInfo { - WinRTTimerInfo(int timerId = INVALID_TIMER_ID, int interval = 0, Qt::TimerType timerType = Qt::CoarseTimer, - QObject *obj = 0, quint64 tt = 0) : - QAbstractEventDispatcher::TimerInfo(timerId, interval, timerType), - inEvent(false), object(obj), targetTime(tt) - { - } - - bool inEvent; - QObject *object; - quint64 targetTime; -}; - -class AgileDispatchedHandler : public RuntimeClass, IDispatchedHandler, IAgileObject> -{ -public: - AgileDispatchedHandler(const std::function &delegate) - : delegate(delegate) - { - } - - HRESULT __stdcall Invoke() - { - return delegate(); - } - -private: - std::function delegate; -}; - -class QWorkHandler : public IWorkItemHandler -{ -public: - QWorkHandler(const std::function &delegate) - : m_delegate(delegate) - { - } - - STDMETHODIMP Invoke(ABI::Windows::Foundation::IAsyncAction *operation) - { - HRESULT res = m_delegate(); - Q_UNUSED(operation); - return res; - } - - STDMETHODIMP QueryInterface(REFIID riid, void FAR* FAR* ppvObj) - { - if (riid == IID_IUnknown || riid == IID_IWorkItemHandler) { - *ppvObj = this; - AddRef(); - return NOERROR; - } - *ppvObj = NULL; - return ResultFromScode(E_NOINTERFACE); - } - - STDMETHODIMP_(ULONG) AddRef(void) - { - return ++m_refs; - } - - STDMETHODIMP_(ULONG) Release(void) - { - if (--m_refs == 0) { - delete this; - return 0; - } - return m_refs; - } - -private: - std::function m_delegate; - ULONG m_refs{0}; -}; - -class QEventDispatcherWinRTPrivate : public QAbstractEventDispatcherPrivate -{ - Q_DECLARE_PUBLIC(QEventDispatcherWinRT) - -public: - QEventDispatcherWinRTPrivate(); - ~QEventDispatcherWinRTPrivate(); - -private: - QHash timerIdToObject; - QVector timerInfos; - mutable QMutex timerInfoLock; - QHash timerHandleToId; - QHash timerIdToHandle; - QHash timerIdToCancelHandle; - - void addTimer(int id, int interval, Qt::TimerType type, QObject *obj, - HANDLE handle, HANDLE cancelHandle) - { - // Zero timer events do not need these handles. - if (interval > 0) { - timerHandleToId.insert(handle, id); - timerIdToHandle.insert(id, handle); - timerIdToCancelHandle.insert(id, cancelHandle); - } - - const quint64 targetTime = qt_msectime() + interval; - const WinRTTimerInfo info(id, interval, type, obj, targetTime); - QMutexLocker locker(&timerInfoLock); - if (id >= timerInfos.size()) - timerInfos.resize(id + 1); - timerInfos[id] = info; - timerIdToObject.insert(id, obj); - } - - bool removeTimer(int id) - { - QMutexLocker locker(&timerInfoLock); - if (id >= timerInfos.size()) - return false; - - WinRTTimerInfo &info = timerInfos[id]; - if (info.timerId == INVALID_TIMER_ID) - return false; - - if (info.interval > 0 && (!timerIdToHandle.contains(id) || !timerIdToCancelHandle.contains(id))) - return false; - - info.timerId = INVALID_TIMER_ID; - - // Remove invalid timerinfos from the vector's end, if the timer with the highest id was removed - int lastTimer = timerInfos.size() - 1; - while (lastTimer >= 0 && timerInfos.at(lastTimer).timerId == INVALID_TIMER_ID) - --lastTimer; - if (lastTimer >= 0 && lastTimer != timerInfos.size() - 1) - timerInfos.resize(lastTimer + 1); - timerIdToObject.remove(id); - // ... remove handle from all lists - if (info.interval > 0) { - HANDLE handle = timerIdToHandle.take(id); - timerHandleToId.remove(handle); - SetEvent(timerIdToCancelHandle.take(id)); - } - return true; - } -}; - -QEventDispatcherWinRT::QEventDispatcherWinRT(QObject *parent) - : QAbstractEventDispatcher(*new QEventDispatcherWinRTPrivate, parent) -{ -} - -QEventDispatcherWinRT::QEventDispatcherWinRT(QEventDispatcherWinRTPrivate &dd, QObject *parent) - : QAbstractEventDispatcher(dd, parent) -{ } - -QEventDispatcherWinRT::~QEventDispatcherWinRT() -{ -} - -HRESULT QEventDispatcherWinRT::runOnXamlThread(const std::function &delegate, bool waitForRun) -{ - static __declspec(thread) ICoreDispatcher *dispatcher = nullptr; - HRESULT hr; - if (!dispatcher) { - ComPtr application; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(), - IID_PPV_ARGS(&application)); - ComPtr view; - hr = application->get_MainView(&view); - if (SUCCEEDED(hr) && view) { - ComPtr window; - hr = view->get_CoreWindow(&window); - Q_ASSERT_SUCCEEDED(hr); - if (!window) { - // In case the application is launched via activation - // there might not be a main view (eg ShareTarget). - // Hence iterate through the available views and try to find - // a dispatcher in there - ComPtr> appViews; - hr = application->get_Views(&appViews); - Q_ASSERT_SUCCEEDED(hr); - quint32 count; - hr = appViews->get_Size(&count); - Q_ASSERT_SUCCEEDED(hr); - for (quint32 i = 0; i < count; ++i) { - hr = appViews->GetAt(i, &view); - Q_ASSERT_SUCCEEDED(hr); - hr = view->get_CoreWindow(&window); - Q_ASSERT_SUCCEEDED(hr); - if (window) { - hr = window->get_Dispatcher(&dispatcher); - Q_ASSERT_SUCCEEDED(hr); - if (dispatcher) - break; - } - } - } else { - hr = window->get_Dispatcher(&dispatcher); - Q_ASSERT_SUCCEEDED(hr); - } - } - } - - if (Q_UNLIKELY(!dispatcher)) { - // In case the application is launched in a way that has no UI and - // also does not allow to create one, e.g. as a background task. - // Features like network operations do still work, others might cause - // errors in that case. - ComPtr tpStatics; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_System_Threading_ThreadPool).Get(), - IID_PPV_ARGS(&tpStatics)); - ComPtr op; - hr = tpStatics.Get()->RunAsync(new QWorkHandler(delegate), &op); - if (FAILED(hr) || !waitForRun) - return hr; - return QWinRTFunctions::await(op); - } - - boolean onXamlThread; - hr = dispatcher->get_HasThreadAccess(&onXamlThread); - Q_ASSERT_SUCCEEDED(hr); - if (onXamlThread) // Already there - return delegate(); - - ComPtr op; - hr = dispatcher->RunAsync(CoreDispatcherPriority_Normal, Make(delegate).Get(), &op); - if (FAILED(hr) || !waitForRun) - return hr; - return QWinRTFunctions::await(op); -} - -HRESULT QEventDispatcherWinRT::runOnMainThread(const std::function &delegate, int timeout) -{ - if (QThread::currentThread() == QCoreApplication::instance()->thread()) - return delegate(); - - struct State { - QSemaphore semaphore; - HRESULT result; - }; - - const auto state = std::make_shared(); - - QMetaObject::invokeMethod(QCoreApplication::instance(), [delegate, state]() { - const QSemaphoreReleaser releaser{state->semaphore}; - state->result = delegate(); - }, nullptr); - - return state->semaphore.tryAcquire(1, timeout) ? state->result : E_FAIL; -} - -bool QEventDispatcherWinRT::processEvents(QEventLoop::ProcessEventsFlags flags) -{ - Q_D(QEventDispatcherWinRT); - - DWORD waitTime = 0; - do { - // Additional user events have to be handled before timer events, but the function may not - // return yet. - const bool userEventsSent = sendPostedEvents(flags); - - const QVector timerHandles = d->timerIdToHandle.values().toVector(); - if (waitTime) - emit aboutToBlock(); - bool timerEventsSent = false; - DWORD waitResult = WaitForMultipleObjectsEx(timerHandles.count(), timerHandles.constData(), FALSE, waitTime, TRUE); - while (waitResult >= WAIT_OBJECT_0 && waitResult < WAIT_OBJECT_0 + timerHandles.count()) { - timerEventsSent = true; - const HANDLE handle = timerHandles.value(waitResult - WAIT_OBJECT_0); - ResetEvent(handle); - const int timerId = d->timerHandleToId.value(handle); - if (timerId == INTERRUPT_HANDLE) - break; - - { - QMutexLocker locker(&d->timerInfoLock); - - WinRTTimerInfo &info = d->timerInfos[timerId]; - Q_ASSERT(info.timerId != INVALID_TIMER_ID); - - QCoreApplication::postEvent(this, new QTimerEvent(timerId)); - - // Update timer's targetTime - const quint64 targetTime = qt_msectime() + info.interval; - info.targetTime = targetTime; - } - waitResult = WaitForMultipleObjectsEx(timerHandles.count(), timerHandles.constData(), FALSE, 0, TRUE); - } - emit awake(); - if (timerEventsSent || userEventsSent) - return true; - - // We cannot wait infinitely like on other platforms, as - // WaitForMultipleObjectsEx might not return. - // For instance win32 uses MsgWaitForMultipleObjects to hook - // into the native event loop, while WinRT handles those - // via callbacks. - waitTime = 1; - } while (flags & QEventLoop::WaitForMoreEvents); - return false; -} - -bool QEventDispatcherWinRT::sendPostedEvents(QEventLoop::ProcessEventsFlags flags) -{ - Q_UNUSED(flags); - if (hasPendingEvents()) { - QCoreApplication::sendPostedEvents(); - return true; - } - return false; -} - -bool QEventDispatcherWinRT::hasPendingEvents() -{ - return qGlobalPostedEventsCount(); -} - -void QEventDispatcherWinRT::registerSocketNotifier(QSocketNotifier *notifier) -{ - Q_UNUSED(notifier); - Q_UNIMPLEMENTED(); -} -void QEventDispatcherWinRT::unregisterSocketNotifier(QSocketNotifier *notifier) -{ - Q_UNUSED(notifier); - Q_UNIMPLEMENTED(); -} - -void QEventDispatcherWinRT::registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object) -{ - Q_UNUSED(timerType); - - if (timerId < 1 || interval < 0 || !object) { -#ifndef QT_NO_DEBUG - qWarning("QEventDispatcherWinRT::registerTimer: invalid arguments"); -#endif - return; - } else if (object->thread() != thread() || thread() != QThread::currentThread()) { -#ifndef QT_NO_DEBUG - qWarning("QEventDispatcherWinRT::registerTimer: timers cannot be started from another thread"); -#endif - return; - } - - Q_D(QEventDispatcherWinRT); - // Don't use timer factory for zero-delay timers - if (interval == 0u) { - d->addTimer(timerId, interval, timerType, object, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE); - QCoreApplication::postEvent(this, new QTimerEvent(timerId)); - return; - } - - TimeSpan period; - // TimeSpan is based on 100-nanosecond units - period.Duration = qMax(qint64(1), qint64(interval) * 10000); - const HANDLE handle = CreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET, SYNCHRONIZE | EVENT_MODIFY_STATE); - const HANDLE cancelHandle = CreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET, SYNCHRONIZE|EVENT_MODIFY_STATE); - HRESULT hr = runOnXamlThread([cancelHandle, handle, period]() { - static ComPtr timerFactory; - HRESULT hr; - if (!timerFactory) { - hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_System_Threading_ThreadPoolTimer).Get(), - &timerFactory); - Q_ASSERT_SUCCEEDED(hr); - } - IThreadPoolTimer *timer; - hr = timerFactory->CreatePeriodicTimerWithCompletion( - Callback([handle, cancelHandle](IThreadPoolTimer *timer) { - DWORD cancelResult = WaitForSingleObjectEx(cancelHandle, 0, TRUE); - if (cancelResult == WAIT_OBJECT_0) { - timer->Cancel(); - return S_OK; - } - if (!SetEvent(handle)) { - Q_ASSERT_X(false, "QEventDispatcherWinRT::registerTimer", - "SetEvent should never fail here"); - return S_OK; - } - return S_OK; - }).Get(), period, - Callback([handle, cancelHandle](IThreadPoolTimer *) { - CloseHandle(handle); - CloseHandle(cancelHandle); - return S_OK; - }).Get(), &timer); - RETURN_HR_IF_FAILED("Failed to create periodic timer"); - return hr; - }, false); - if (FAILED(hr)) { - CloseHandle(handle); - CloseHandle(cancelHandle); - return; - } - d->addTimer(timerId, interval, timerType, object, handle, cancelHandle); -} - -bool QEventDispatcherWinRT::unregisterTimer(int timerId) -{ - if (timerId < 1) { -#ifndef QT_NO_DEBUG - qWarning("QEventDispatcherWinRT::unregisterTimer: invalid argument"); -#endif - return false; - } - if (thread() != QThread::currentThread()) { -#ifndef QT_NO_DEBUG - qWarning("QEventDispatcherWinRT::unregisterTimer: timers cannot be stopped from another thread"); -#endif - return false; - } - - // As we post all timer events internally, they have to pe removed to prevent stray events - QCoreApplicationPrivate::removePostedTimerEvent(this, timerId); - Q_D(QEventDispatcherWinRT); - return d->removeTimer(timerId); -} - -bool QEventDispatcherWinRT::unregisterTimers(QObject *object) -{ - if (!object) { -#ifndef QT_NO_DEBUG - qWarning("QEventDispatcherWinRT::unregisterTimers: invalid argument"); -#endif - return false; - } - QThread *currentThread = QThread::currentThread(); - if (object->thread() != thread() || thread() != currentThread) { -#ifndef QT_NO_DEBUG - qWarning("QEventDispatcherWinRT::unregisterTimers: timers cannot be stopped from another thread"); -#endif - return false; - } - - Q_D(QEventDispatcherWinRT); - const auto timerIds = d->timerIdToObject.keys(); // ### FIXME: iterate over hash directly? But unregisterTimer() modifies the hash! - for (int id : timerIds) { - if (d->timerIdToObject.value(id) == object) - unregisterTimer(id); - } - - return true; -} - -QList QEventDispatcherWinRT::registeredTimers(QObject *object) const -{ - if (!object) { -#ifndef QT_NO_DEBUG - qWarning("QEventDispatcherWinRT:registeredTimers: invalid argument"); -#endif - return QList(); - } - - Q_D(const QEventDispatcherWinRT); - QMutexLocker locker(&d->timerInfoLock); - QList timerInfos; - for (const WinRTTimerInfo &info : d->timerInfos) { - if (info.object == object && info.timerId != INVALID_TIMER_ID) - timerInfos.append(info); - } - return timerInfos; -} - -bool QEventDispatcherWinRT::registerEventNotifier(QWinEventNotifier *notifier) -{ - Q_UNUSED(notifier); - Q_UNIMPLEMENTED(); - return false; -} - -void QEventDispatcherWinRT::unregisterEventNotifier(QWinEventNotifier *notifier) -{ - Q_UNUSED(notifier); - Q_UNIMPLEMENTED(); -} - -int QEventDispatcherWinRT::remainingTime(int timerId) -{ - if (timerId < 1) { -#ifndef QT_NO_DEBUG - qWarning("QEventDispatcherWinRT::remainingTime: invalid argument"); -#endif - return -1; - } - - Q_D(QEventDispatcherWinRT); - QMutexLocker locker(&d->timerInfoLock); - const WinRTTimerInfo timerInfo = d->timerInfos.at(timerId); - if (timerInfo.timerId == INVALID_TIMER_ID) { -#ifndef QT_NO_DEBUG - qWarning("QEventDispatcherWinRT::remainingTime: timer id %d not found", timerId); -#endif - return -1; - } - - const quint64 currentTime = qt_msectime(); - if (currentTime < timerInfo.targetTime) { - // time to wait - return timerInfo.targetTime - currentTime; - } else { - return 0; - } - - return -1; -} - -void QEventDispatcherWinRT::wakeUp() -{ -} - -void QEventDispatcherWinRT::interrupt() -{ - Q_D(QEventDispatcherWinRT); - SetEvent(d->timerIdToHandle.value(INTERRUPT_HANDLE)); -} - -void QEventDispatcherWinRT::flush() -{ -} - -void QEventDispatcherWinRT::startingUp() -{ -} - -void QEventDispatcherWinRT::closingDown() -{ -} - -bool QEventDispatcherWinRT::event(QEvent *e) -{ - Q_D(QEventDispatcherWinRT); - switch (e->type()) { - case QEvent::Timer: { - QTimerEvent *timerEvent = static_cast(e); - const int id = timerEvent->timerId(); - - QMutexLocker locker(&d->timerInfoLock); - - Q_ASSERT(id < d->timerInfos.size()); - WinRTTimerInfo &info = d->timerInfos[id]; - Q_ASSERT(info.timerId != INVALID_TIMER_ID); - - if (info.inEvent) // but don't allow event to recurse - break; - info.inEvent = true; - - QObject *timerObj = d->timerIdToObject.value(id); - locker.unlock(); - - QTimerEvent te(id); - QCoreApplication::sendEvent(timerObj, &te); - - locker.relock(); - - // The timer might have been removed in the meanwhile. If the timer was - // the last one in the list, id is bigger than the list's size. - // Otherwise, the id will just be set to INVALID_TIMER_ID. - if (id >= d->timerInfos.size() || info.timerId == INVALID_TIMER_ID) - break; - - if (info.interval == 0 && info.inEvent) { - // post the next zero timer event as long as the timer was not restarted - QCoreApplication::postEvent(this, new QTimerEvent(id)); - } - info.inEvent = false; - } - default: - break; - } - return QAbstractEventDispatcher::event(e); -} - -QEventDispatcherWinRTPrivate::QEventDispatcherWinRTPrivate() -{ - const bool isGuiThread = QCoreApplication::instance() && - QThread::currentThread() == QCoreApplication::instance()->thread(); - CoInitializeEx(NULL, isGuiThread ? COINIT_APARTMENTTHREADED : COINIT_MULTITHREADED); - HANDLE interruptHandle = CreateEventEx(NULL, NULL, NULL, SYNCHRONIZE|EVENT_MODIFY_STATE); - timerIdToHandle.insert(INTERRUPT_HANDLE, interruptHandle); - timerHandleToId.insert(interruptHandle, INTERRUPT_HANDLE); - timerInfos.reserve(256); -} - -QEventDispatcherWinRTPrivate::~QEventDispatcherWinRTPrivate() -{ - CloseHandle(timerIdToHandle.value(INTERRUPT_HANDLE)); - CoUninitialize(); -} - -QT_END_NAMESPACE diff --git a/src/corelib/kernel/qeventdispatcher_winrt_p.h b/src/corelib/kernel/qeventdispatcher_winrt_p.h deleted file mode 100644 index 2672f11123..0000000000 --- a/src/corelib/kernel/qeventdispatcher_winrt_p.h +++ /dev/null @@ -1,113 +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 QEVENTDISPATCHER_WINRT_P_H -#define QEVENTDISPATCHER_WINRT_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include "QtCore/qabstracteventdispatcher.h" - -#include - -#include - -QT_BEGIN_NAMESPACE - -quint64 qt_msectime(); - -class QEventDispatcherWinRTPrivate; - -class Q_CORE_EXPORT QEventDispatcherWinRT : public QAbstractEventDispatcher -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QEventDispatcherWinRT) - -public: - explicit QEventDispatcherWinRT(QObject *parent = 0); - ~QEventDispatcherWinRT(); - - static HRESULT runOnXamlThread(const std::function &delegate, bool waitForRun = true); - static HRESULT runOnMainThread(const std::function &delegate, int timeout = 100); - - bool processEvents(QEventLoop::ProcessEventsFlags flags); - bool hasPendingEvents(); - - void registerSocketNotifier(QSocketNotifier *notifier); - void unregisterSocketNotifier(QSocketNotifier *notifier); - - void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object); - bool unregisterTimer(int timerId); - bool unregisterTimers(QObject *object); - QList registeredTimers(QObject *object) const; - - int remainingTime(int timerId); - - bool registerEventNotifier(QWinEventNotifier *notifier); - void unregisterEventNotifier(QWinEventNotifier *notifier); - - void wakeUp(); - void interrupt(); - void flush(); - - void startingUp(); - void closingDown(); - -protected: - QEventDispatcherWinRT(QEventDispatcherWinRTPrivate &dd, QObject *parent = 0); - - virtual bool sendPostedEvents(QEventLoop::ProcessEventsFlags flags); - bool event(QEvent *); - int activateTimers(); -}; - -QT_END_NAMESPACE - -#endif // QEVENTDISPATCHER_WINRT_P_H diff --git a/src/corelib/kernel/qfunctions_fake_env_p.h b/src/corelib/kernel/qfunctions_fake_env_p.h deleted file mode 100644 index 68d17ed4a1..0000000000 --- a/src/corelib/kernel/qfunctions_fake_env_p.h +++ /dev/null @@ -1,130 +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_FAKE_ENV_P_H -#define QFUNCTIONS_FAKE_ENV_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qbytearray.h" -#include "qvector.h" - -QT_BEGIN_NAMESPACE - -// Environment ------------------------------------------------------ -struct Variable { - Variable() { } - - Variable(const QByteArray &name, const QByteArray &value) - : name(name), value(value) { } - - QByteArray name; - QByteArray value; -}; - -Q_DECLARE_TYPEINFO(Variable, Q_MOVABLE_TYPE); - -struct NameEquals { - typedef bool result_type; - const char *name; - explicit NameEquals(const char *name) noexcept : name(name) {} - result_type operator()(const Variable &other) const noexcept - { return qstrcmp(other.name, name) == 0; } -}; - -#ifndef Q_CLANG_QDOC -Q_GLOBAL_STATIC(QVector, qt_app_environment) -#endif - -errno_t qt_fake_getenv_s(size_t *sizeNeeded, char *buffer, size_t bufferSize, const char *varName) -{ - if (!sizeNeeded) - return EINVAL; - - QVector::const_iterator end = qt_app_environment->constEnd(); - QVector::const_iterator iterator = std::find_if(qt_app_environment->constBegin(), - end, - NameEquals(varName)); - if (iterator == end) { - if (buffer) - buffer[0] = '\0'; - return ENOENT; - } - - const int size = iterator->value.size() + 1; - if (bufferSize < size_t(size)) { - *sizeNeeded = size; - return ERANGE; - } - - qstrcpy(buffer, iterator->value.constData()); - return 0; -} - -errno_t qt_fake__putenv_s(const char *varName, const char *value) -{ - QVector::iterator end = qt_app_environment->end(); - QVector::iterator iterator = std::find_if(qt_app_environment->begin(), - end, - NameEquals(varName)); - if (!value || !*value) { - if (iterator != end) - qt_app_environment->erase(iterator); - } else { - if (iterator == end) - qt_app_environment->append(Variable(varName, value)); - else - iterator->value = value; - } - - return 0; -} - -QT_END_NAMESPACE - -#endif // QFUNCTIONS_FAKE_ENV_P_H diff --git a/src/corelib/kernel/qfunctions_p.h b/src/corelib/kernel/qfunctions_p.h index 715c553dc5..6744146aa8 100644 --- a/src/corelib/kernel/qfunctions_p.h +++ b/src/corelib/kernel/qfunctions_p.h @@ -57,8 +57,6 @@ # include "QtCore/qfunctions_vxworks.h" #elif defined(Q_OS_NACL) # include "QtCore/qfunctions_nacl.h" -#elif defined(Q_OS_WINRT) -# include "QtCore/qfunctions_winrt.h" #endif #endif diff --git a/src/corelib/kernel/qfunctions_winrt.cpp b/src/corelib/kernel/qfunctions_winrt.cpp deleted file mode 100644 index 6b7e79806f..0000000000 --- a/src/corelib/kernel/qfunctions_winrt.cpp +++ /dev/null @@ -1,58 +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 "qfunctions_winrt.h" - -#ifdef Q_OS_WINRT - -#include "qfunctions_fake_env_p.h" - -QT_BEGIN_NAMESPACE - -void qt_winrt_tzset() -{ -} - -void qt_winrt__tzset() -{ -} - -QT_END_NAMESPACE - -#endif // Q_OS_WINRT diff --git a/src/corelib/kernel/qfunctions_winrt.h b/src/corelib/kernel/qfunctions_winrt_p.h similarity index 60% rename from src/corelib/kernel/qfunctions_winrt.h rename to src/corelib/kernel/qfunctions_winrt_p.h index d0c44be683..aa32747bc8 100644 --- a/src/corelib/kernel/qfunctions_winrt.h +++ b/src/corelib/kernel/qfunctions_winrt_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -37,12 +37,23 @@ ** ****************************************************************************/ -#ifndef QFUNCTIONS_WINRT_H -#define QFUNCTIONS_WINRT_H +#ifndef QFUNCTIONS_WINRT_P_H +#define QFUNCTIONS_WINRT_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// #include -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && defined(Q_CC_MSVC) #include #include @@ -50,6 +61,9 @@ #include #include +#include +#include + // Convenience macros for handling HRESULT values #define RETURN_IF_FAILED(msg, ret) \ if (FAILED(hr)) { \ @@ -75,86 +89,6 @@ #define Q_ASSERT_SUCCEEDED(hr) \ Q_ASSERT_X(SUCCEEDED(hr), Q_FUNC_INFO, qPrintable(qt_error_string(hr))); -#ifdef Q_OS_WINRT - -QT_BEGIN_NAMESPACE - -#ifdef QT_BUILD_CORE_LIB -#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*); -void qt_winrt_tzset(); -void qt_winrt__tzset(); - -QT_END_NAMESPACE - -// As Windows Runtime 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. -// The other declarations available in this file are being used per -// define inside qplatformdefs.h of the corresponding WinRT mkspec. - -#define generate_inline_return_func0(funcname, returntype) \ - inline returntype funcname() \ - { \ - return QT_PREPEND_NAMESPACE(qt_winrt_##funcname)(); \ - } -#define generate_inline_return_func1(funcname, returntype, param1) \ - inline returntype funcname(param1 p1) \ - { \ - return QT_PREPEND_NAMESPACE(qt_winrt_##funcname)(p1); \ - } -#define generate_inline_return_func2(funcname, returntype, prependnamespace, param1, param2) \ - inline returntype funcname(param1 p1, param2 p2) \ - { \ - return QT_PREPEND_NAMESPACE(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_PREPEND_NAMESPACE(qt_winrt_##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 QT_PREPEND_NAMESPACE(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_PREPEND_NAMESPACE(qt_winrt_##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_PREPEND_NAMESPACE(qt_winrt_##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_PREPEND_NAMESPACE(qt_winrt_##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(tzset, void) -generate_inline_return_func0(_tzset, void) - -namespace Microsoft { - namespace WRL { - template class ComPtr; - } -} - QT_BEGIN_NAMESPACE namespace QWinRTFunctions { @@ -170,7 +104,7 @@ enum AwaitStyle template static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr &asyncOp, AwaitStyle awaitStyle, uint timeout) { - Microsoft::WRL::ComPtr asyncInfo; + Microsoft::WRL::ComPtr asyncInfo; HRESULT hr = asyncOp.As(&asyncInfo); if (FAILED(hr)) return hr; @@ -245,8 +179,6 @@ static inline HRESULT await(const Microsoft::WRL::ComPtr &asyncOp, U *results QT_END_NAMESPACE -#endif // Q_OS_WINRT +#endif // Q_OS_WIN && Q_CC_MSVC -#endif // Q_OS_WIN - -#endif // QFUNCTIONS_WINRT_H +#endif // QFUNCTIONS_WINRT_P_H diff --git a/src/corelib/kernel/qsharedmemory_win.cpp b/src/corelib/kernel/qsharedmemory_win.cpp index 02de2339a5..cbf31bcb2f 100644 --- a/src/corelib/kernel/qsharedmemory_win.cpp +++ b/src/corelib/kernel/qsharedmemory_win.cpp @@ -101,12 +101,8 @@ HANDLE QSharedMemoryPrivate::handle() errorString = QSharedMemory::tr("%1: unable to make key").arg(function); return 0; } -#if defined(Q_OS_WINRT) - hand = OpenFileMappingFromApp(FILE_MAP_ALL_ACCESS, FALSE, reinterpret_cast(nativeKey.utf16())); -#else hand = OpenFileMapping(FILE_MAP_ALL_ACCESS, false, reinterpret_cast(nativeKey.utf16())); -#endif if (!hand) { setErrorString(function); return 0; @@ -136,13 +132,8 @@ bool QSharedMemoryPrivate::create(int size) } // Create the file mapping. -#if defined(Q_OS_WINRT) - hand = CreateFileMappingFromApp(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, size, - reinterpret_cast(nativeKey.utf16())); -#else hand = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, size, reinterpret_cast(nativeKey.utf16())); -#endif setErrorString(function); // hand is valid when it already exists unlike unix so explicitly check @@ -153,11 +144,7 @@ bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode mode) { // Grab a pointer to the memory block int permissions = (mode == QSharedMemory::ReadOnly ? FILE_MAP_READ : FILE_MAP_ALL_ACCESS); -#if defined(Q_OS_WINRT) - memory = (void *)MapViewOfFileFromApp(handle(), permissions, 0, 0); -#else memory = (void *)MapViewOfFile(handle(), permissions, 0, 0, 0); -#endif if (0 == memory) { setErrorString(QLatin1String("QSharedMemory::attach")); cleanHandle(); diff --git a/src/corelib/kernel/qsystemerror.cpp b/src/corelib/kernel/qsystemerror.cpp index a735e12925..6a250f5f3a 100644 --- a/src/corelib/kernel/qsystemerror.cpp +++ b/src/corelib/kernel/qsystemerror.cpp @@ -76,7 +76,6 @@ namespace { static QString windowsErrorString(int errorCode) { QString ret; -#ifndef Q_OS_WINRT wchar_t *string = 0; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, NULL, @@ -87,17 +86,6 @@ static QString windowsErrorString(int errorCode) NULL); ret = QString::fromWCharArray(string); LocalFree((HLOCAL)string); -#else - wchar_t errorString[1024]; - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - errorCode, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPWSTR)&errorString, - sizeof(errorString)/sizeof(wchar_t), - NULL); - ret = QString::fromWCharArray(errorString); -#endif // Q_OS_WINRT if (ret.isEmpty() && errorCode == ERROR_MOD_NOT_FOUND) ret = QString::fromLatin1("The specified module could not be found."); diff --git a/src/corelib/kernel/qsystemsemaphore_win.cpp b/src/corelib/kernel/qsystemsemaphore_win.cpp index 2b35803291..d19476db4a 100644 --- a/src/corelib/kernel/qsystemsemaphore_win.cpp +++ b/src/corelib/kernel/qsystemsemaphore_win.cpp @@ -85,14 +85,8 @@ HANDLE QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode) // Create it if it doesn't already exists. if (semaphore == 0) { -#if defined(Q_OS_WINRT) - semaphore = CreateSemaphoreEx(0, initialValue, MAXLONG, - reinterpret_cast(fileName.utf16()), - 0, SEMAPHORE_ALL_ACCESS); -#else semaphore = CreateSemaphore(0, initialValue, MAXLONG, reinterpret_cast(fileName.utf16())); -#endif if (semaphore == NULL) setErrorString(QLatin1String("QSystemSemaphore::handle")); } diff --git a/src/corelib/kernel/qtestsupport_core.cpp b/src/corelib/kernel/qtestsupport_core.cpp index 428ebbd652..928c8021bc 100644 --- a/src/corelib/kernel/qtestsupport_core.cpp +++ b/src/corelib/kernel/qtestsupport_core.cpp @@ -49,9 +49,7 @@ Q_CORE_EXPORT void QTestPrivate::qSleep(int ms) { Q_ASSERT(ms > 0); -#if defined(Q_OS_WINRT) - WaitForSingleObjectEx(GetCurrentThread(), ms, true); -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) Sleep(uint(ms)); #else struct timespec ts = { time_t(ms / 1000), (ms % 1000) * 1000 * 1000 }; diff --git a/src/corelib/kernel/qwineventnotifier.cpp b/src/corelib/kernel/qwineventnotifier.cpp index 0c574e9a4b..b306e3aba1 100644 --- a/src/corelib/kernel/qwineventnotifier.cpp +++ b/src/corelib/kernel/qwineventnotifier.cpp @@ -39,11 +39,7 @@ #include "qwineventnotifier_p.h" -#ifdef Q_OS_WINRT -#include "qeventdispatcher_winrt_p.h" -#else #include "qeventdispatcher_win_p.h" -#endif #include "qcoreapplication.h" #include @@ -235,21 +231,6 @@ bool QWinEventNotifier::event(QEvent * e) return false; } -#if defined(Q_OS_WINRT) - -bool QWinEventNotifierPrivate::registerWaitObject() -{ - Q_UNIMPLEMENTED(); - return false; -} - -void QWinEventNotifierPrivate::unregisterWaitObject() -{ - Q_UNIMPLEMENTED(); -} - -#else // defined(Q_OS_WINRT) - static void CALLBACK wfsoCallback(void *context, BOOLEAN /*ignore*/) { QWinEventNotifierPrivate *nd = reinterpret_cast(context); @@ -287,6 +268,4 @@ void QWinEventNotifierPrivate::unregisterWaitObject() qErrnoWarning("QWinEventNotifier: UnregisterWaitEx failed."); } -#endif // !defined(Q_OS_WINRT) - QT_END_NAMESPACE diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp index ef58724be8..ef1b389adc 100644 --- a/src/corelib/plugin/qlibrary_win.cpp +++ b/src/corelib/plugin/qlibrary_win.cpp @@ -63,10 +63,8 @@ QStringList QLibraryPrivate::prefixes_sys() bool QLibraryPrivate::load_sys() { -#ifndef Q_OS_WINRT //avoid 'Bad Image' message box UINT oldmode = SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); -#endif // We make the following attempts at locating the library: // // Windows @@ -91,22 +89,11 @@ bool QLibraryPrivate::load_sys() attempts.prepend(fileName); else attempts.append(fileName); -#ifdef Q_OS_WINRT - if (fileName.startsWith(QLatin1Char('/'))) - attempts.prepend(QDir::rootPath() + fileName); -#endif locker.unlock(); Handle hnd = nullptr; for (const QString &attempt : qAsConst(attempts)) { -#ifndef Q_OS_WINRT hnd = LoadLibrary(reinterpret_cast(QDir::toNativeSeparators(attempt).utf16())); -#else // Q_OS_WINRT - QString path = QDir::toNativeSeparators(QDir::current().relativeFilePath(attempt)); - hnd = LoadPackagedLibrary(reinterpret_cast(path.utf16()), 0); - if (hnd) - qualifiedFileName = attempt; -#endif // !Q_OS_WINRT // If we have a handle or the last error is something other than "unable // to find the module", then bail out @@ -114,9 +101,7 @@ bool QLibraryPrivate::load_sys() break; } -#ifndef Q_OS_WINRT SetErrorMode(oldmode); -#endif locker.relock(); if (!hnd) { errorString = QLibrary::tr("Cannot load library %1: %2").arg( @@ -125,7 +110,6 @@ bool QLibraryPrivate::load_sys() // Query the actual name of the library that was loaded errorString.clear(); -#ifndef Q_OS_WINRT wchar_t buffer[MAX_PATH]; ::GetModuleFileName(hnd, buffer, MAX_PATH); @@ -147,7 +131,6 @@ bool QLibraryPrivate::load_sys() Q_ASSERT(!ok || hmod == hnd); Q_UNUSED(ok); } -#endif // !Q_OS_WINRT } pHnd.storeRelaxed(hnd); return (pHnd != nullptr); diff --git a/src/corelib/plugin/qsystemlibrary.cpp b/src/corelib/plugin/qsystemlibrary.cpp index 1a88476596..fe6760c8d8 100644 --- a/src/corelib/plugin/qsystemlibrary.cpp +++ b/src/corelib/plugin/qsystemlibrary.cpp @@ -72,14 +72,6 @@ QT_BEGIN_NAMESPACE -#if defined(Q_OS_WINRT) -HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory /* = true */) -{ - Q_UNUSED(onlySystemDirectory); - return ::LoadPackagedLibrary(libraryName, 0); -} -#else - #if !defined(QT_BOOTSTRAPPED) extern QString qAppFileName(); #endif @@ -129,6 +121,4 @@ HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirect } -#endif // Q_OS_WINRT - QT_END_NAMESPACE diff --git a/src/corelib/text/qcollator_p.h b/src/corelib/text/qcollator_p.h index 444ae06a99..304c7135e1 100644 --- a/src/corelib/text/qcollator_p.h +++ b/src/corelib/text/qcollator_p.h @@ -79,9 +79,6 @@ const CollatorType NoCollator = 0; typedef QString CollatorKeyType; typedef int CollatorType; const CollatorType NoCollator = 0; -# ifdef Q_OS_WINRT -# define USE_COMPARESTRINGEX -# endif #else // posix - ignores CollatorType collator, only handles system locale typedef QVector CollatorKeyType; diff --git a/src/corelib/text/qlocale_win.cpp b/src/corelib/text/qlocale_win.cpp index a6582236d5..9af37cb8d0 100644 --- a/src/corelib/text/qlocale_win.cpp +++ b/src/corelib/text/qlocale_win.cpp @@ -51,32 +51,11 @@ # include #endif -#ifdef Q_OS_WINRT -#include - -#include -#include -#include -#include -#endif // Q_OS_WINRT - QT_BEGIN_NAMESPACE -#ifndef Q_OS_WINRT static QByteArray getWinLocaleName(LCID id = LOCALE_USER_DEFAULT); static QString winIso639LangName(LCID id = LOCALE_USER_DEFAULT); static QString winIso3116CtryName(LCID id = LOCALE_USER_DEFAULT); -#else // !Q_OS_WINRT -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::System::UserProfile; - -static QByteArray getWinLocaleName(LPWSTR id = LOCALE_NAME_USER_DEFAULT); -static const char *winLangCodeToIsoName(int code); -static QString winIso639LangName(LPWSTR id = LOCALE_NAME_USER_DEFAULT); -static QString winIso3116CtryName(LPWSTR id = LOCALE_NAME_USER_DEFAULT); -#endif // Q_OS_WINRT #ifndef QT_NO_SYSTEMLOCALE @@ -141,11 +120,7 @@ private: }; // cached values: -#ifndef Q_OS_WINRT LCID lcid; -#else - WCHAR lcName[LOCALE_NAME_MAX_LENGTH]; -#endif SubstitutionType substitutionType; QString zero; // cached value for zeroDigit() @@ -170,47 +145,27 @@ Q_GLOBAL_STATIC(QSystemLocalePrivate, systemLocalePrivate) QSystemLocalePrivate::QSystemLocalePrivate() : substitutionType(SUnknown) { -#ifndef Q_OS_WINRT lcid = GetUserDefaultLCID(); -#else - GetUserDefaultLocaleName(lcName, LOCALE_NAME_MAX_LENGTH); -#endif } inline int QSystemLocalePrivate::getCurrencyFormat(DWORD flags, LPCWSTR value, const CURRENCYFMTW *format, LPWSTR data, int size) { -#ifndef Q_OS_WINRT return GetCurrencyFormat(lcid, flags, value, format, data, size); -#else - return GetCurrencyFormatEx(lcName, flags, value, format, data, size); -#endif } inline int QSystemLocalePrivate::getDateFormat(DWORD flags, const SYSTEMTIME * date, LPCWSTR format, LPWSTR data, int size) { -#ifndef Q_OS_WINRT return GetDateFormat(lcid, flags, date, format, data, size); -#else - return GetDateFormatEx(lcName, flags, date, format, data, size, NULL); -#endif } inline int QSystemLocalePrivate::getTimeFormat(DWORD flags, const SYSTEMTIME *date, LPCWSTR format, LPWSTR data, int size) { -#ifndef Q_OS_WINRT return GetTimeFormat(lcid, flags, date, format, data, size); -#else - return GetTimeFormatEx(lcName, flags, date, format, data, size); -#endif } inline int QSystemLocalePrivate::getLocaleInfo(LCTYPE type, LPWSTR data, int size) { -#ifndef Q_OS_WINRT return GetLocaleInfo(lcid, type, data, size); -#else - return GetLocaleInfoEx(lcName, type, data, size); -#endif } template @@ -646,7 +601,6 @@ QVariant QSystemLocalePrivate::toCurrencyString(const QSystemLocale::CurrencyToS QVariant QSystemLocalePrivate::uiLanguages() { -#ifndef Q_OS_WINRT unsigned long cnt = 0; QVarLengthArray buf(64); # if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE) // Not present in MinGW 4.9/bootstrap builds. @@ -672,35 +626,6 @@ QVariant QSystemLocalePrivate::uiLanguages() str += s.size() + 1; } return result; -#else // !Q_OS_WINRT - QStringList result; - - ComPtr preferences; - HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_System_UserProfile_GlobalizationPreferences).Get(), &preferences); - if (FAILED(hr)) { - qWarning("Could not obtain ApplicationLanguagesStatic"); - return QStringList(); - } - - ComPtr > languageList; - // Languages is a ranked list of "long names" (e.g. en-US) of preferred languages - hr = preferences->get_Languages(&languageList); - Q_ASSERT_SUCCEEDED(hr); - unsigned int size; - hr = languageList->get_Size(&size); - Q_ASSERT_SUCCEEDED(hr); - result.reserve(size); - for (unsigned int i = 0; i < size; ++i) { - HString language; - hr = languageList->GetAt(i, language.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - UINT32 length; - PCWSTR rawString = language.GetRawBuffer(&length); - result << QString::fromWCharArray(rawString, length); - } - - return result; -#endif // Q_OS_WINRT } QVariant QSystemLocalePrivate::nativeLanguageName() @@ -716,11 +641,7 @@ QVariant QSystemLocalePrivate::nativeCountryName() void QSystemLocalePrivate::update() { -#ifndef Q_OS_WINRT lcid = GetUserDefaultLCID(); -#else - GetUserDefaultLocaleName(lcName, LOCALE_NAME_MAX_LENGTH); -#endif substitutionType = SUnknown; zero.resize(0); } @@ -1061,11 +982,7 @@ LCID qt_inIsoNametoLCID(const char *name) } -#ifndef Q_OS_WINRT static QString winIso639LangName(LCID id) -#else -static QString winIso639LangName(LPWSTR id) -#endif { QString result; @@ -1073,11 +990,7 @@ static QString winIso639LangName(LPWSTR id) // the language code QString lang_code; wchar_t out[256]; -#ifndef Q_OS_WINRT if (GetLocaleInfo(id, LOCALE_ILANGUAGE, out, 255)) -#else - if (GetLocaleInfoEx(id, LOCALE_ILANGUAGE, out, 255)) -#endif lang_code = QString::fromWCharArray(out); if (!lang_code.isEmpty()) { @@ -1100,47 +1013,27 @@ static QString winIso639LangName(LPWSTR id) return result; // not one of the problematic languages - do the usual lookup -#ifndef Q_OS_WINRT if (GetLocaleInfo(id, LOCALE_SISO639LANGNAME, out, 255)) -#else - if (GetLocaleInfoEx(id, LOCALE_SISO639LANGNAME, out, 255)) -#endif result = QString::fromWCharArray(out); return result; } -#ifndef Q_OS_WINRT static QString winIso3116CtryName(LCID id) -#else -static QString winIso3116CtryName(LPWSTR id) -#endif { QString result; wchar_t out[256]; -#ifndef Q_OS_WINRT if (GetLocaleInfo(id, LOCALE_SISO3166CTRYNAME, out, 255)) -#else - if (GetLocaleInfoEx(id, LOCALE_SISO3166CTRYNAME, out, 255)) -#endif result = QString::fromWCharArray(out); return result; } -#ifndef Q_OS_WINRT static QByteArray getWinLocaleName(LCID id) -#else -static QByteArray getWinLocaleName(LPWSTR id) -#endif { QByteArray result; -#ifndef Q_OS_WINRT if (id == LOCALE_USER_DEFAULT) { -#else - if (QString::fromWCharArray(id) == QString::fromWCharArray(LOCALE_NAME_USER_DEFAULT)) { -#endif static QByteArray langEnvVar = qgetenv("LANG"); result = langEnvVar; QString lang, script, cntry; @@ -1155,16 +1048,8 @@ static QByteArray getWinLocaleName(LPWSTR id) } } -#ifndef Q_OS_WINRT if (id == LOCALE_USER_DEFAULT) id = GetUserDefaultLCID(); -#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 QString resultusage = winIso639LangName(id); QString country = winIso3116CtryName(id); if (!country.isEmpty()) @@ -1175,13 +1060,7 @@ static QByteArray getWinLocaleName(LPWSTR id) Q_CORE_EXPORT QLocale qt_localeFromLCID(LCID id) { -#ifndef Q_OS_WINRT return QLocale(QString::fromLatin1(getWinLocaleName(id))); -#else // !Q_OS_WINRT - WCHAR name[LOCALE_NAME_MAX_LENGTH]; - LCIDToLocaleName(id, name, LOCALE_NAME_MAX_LENGTH, 0); - return QLocale(QString::fromLatin1(getWinLocaleName(name))); -#endif // Q_OS_WINRT } QT_END_NAMESPACE diff --git a/src/corelib/text/qstringconverter.cpp b/src/corelib/text/qstringconverter.cpp index 43ebde6449..d1b3055bd4 100644 --- a/src/corelib/text/qstringconverter.cpp +++ b/src/corelib/text/qstringconverter.cpp @@ -1115,7 +1115,6 @@ static QString convertToUnicodeCharByChar(const char *chars, qsizetype length, Q state->remainingChars = 0; } const char *mb = mbcs; -#if !defined(Q_OS_WINRT) const char *next = 0; QString s; while ((next = CharNextExA(CP_ACP, mb, 0)) != mb) { @@ -1134,21 +1133,6 @@ static QString convertToUnicodeCharByChar(const char *chars, qsizetype length, Q } mb = next; } -#else - QString s; - size_t size = mbstowcs(NULL, mb, length); - if (size == size_t(-1)) { - Q_ASSERT("Error in CE TextCodec"); - return QString(); - } - wchar_t* ws = new wchar_t[size + 2]; - ws[size +1] = 0; - ws[size] = 0; - size = mbstowcs(ws, mb, length); - for (size_t i = 0; i < size; i++) - s.append(QChar(ws[i])); - delete [] ws; -#endif delete [] mbcs; return s; } diff --git a/src/corelib/thread/qmutex_win.cpp b/src/corelib/thread/qmutex_win.cpp index e221bc89cb..73673cd5fb 100644 --- a/src/corelib/thread/qmutex_win.cpp +++ b/src/corelib/thread/qmutex_win.cpp @@ -46,11 +46,7 @@ QT_BEGIN_NAMESPACE QMutexPrivate::QMutexPrivate() { -#ifndef Q_OS_WINRT event = CreateEvent(0, FALSE, FALSE, 0); -#else - event = CreateEventEx(0, NULL, 0, EVENT_ALL_ACCESS); -#endif if (!event) qWarning("QMutexData::QMutexData: Cannot create event"); diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index d575253408..36e9b2a7a2 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -184,9 +184,7 @@ QThreadPrivate::QThreadPrivate(QThreadData *d) #if defined (Q_OS_WIN) handle = 0; -# ifndef Q_OS_WINRT id = 0; -# endif waiters = 0; terminationEnabled = true; terminatePending = false; diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index b2d1628e6e..9255b05104 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -67,16 +67,6 @@ #include #include -#ifdef Q_OS_WINRT -namespace ABI { - namespace Windows { - namespace Foundation { - struct IAsyncAction; - } - } -} -#endif // Q_OS_WINRT - QT_BEGIN_NAMESPACE class QAbstractEventDispatcher; @@ -246,9 +236,6 @@ public: ~QThreadData(); static Q_AUTOTEST_EXPORT QThreadData *current(bool createIfNecessary = true); -#ifdef Q_OS_WINRT - static void setMainThread(); -#endif static void clearCurrentThreadData(); static QThreadData *get2(QThread *thread) { Q_ASSERT_X(thread != nullptr, "QThread", "internal error"); return thread->d_func()->data; } diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 00d67b3a00..78c4d8d672 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -46,49 +46,19 @@ #include #include -#ifndef Q_OS_WINRT #include -#else -#include -#endif #include -#ifndef Q_OS_WINRT -# ifndef _MT -# define _MT -# endif // _MT -# include -#endif // Q_OS_WINRT +#ifndef _MT +# define _MT +#endif // _MT +#include QT_BEGIN_NAMESPACE #if QT_CONFIG(thread) -#ifdef Q_OS_WINRT -inline DWORD qWinRTTlsAlloc() { - return FlsAlloc(0); -} - -inline bool qWinRTTlsFree(DWORD dwTlsIndex) { - return FlsFree(dwTlsIndex); -} - -inline LPVOID qWinRTTlsGetValue(DWORD dwTlsIndex) { - return FlsGetValue(dwTlsIndex); -} - -inline bool qWinRTTlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue) { - return FlsSetValue(dwTlsIndex, lpTlsValue); -} - -#define TlsAlloc qWinRTTlsAlloc -#define TlsFree qWinRTTlsFree -#define TlsSetValue qWinRTTlsSetValue -#define TlsGetValue qWinRTTlsGetValue - -#endif // Q_OS_WINRT - void qt_watch_adopted_thread(const HANDLE adoptedThreadHandle, QThread *qthread); DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID); @@ -142,15 +112,9 @@ QThreadData *QThreadData::current(bool createIfNecessary) threadData->isAdopted = true; threadData->threadId.storeRelaxed(reinterpret_cast(quintptr(GetCurrentThreadId()))); -#ifndef Q_OS_WINRT if (!QCoreApplicationPrivate::theMainThread) { QCoreApplicationPrivate::theMainThread = threadData->thread.loadRelaxed(); } else { -#else - // for winrt the main thread is set explicitly in QCoreApplication's constructor as the - // native main thread (Xaml thread) is not Qt's main thread. - { -#endif HANDLE realHandle = INVALID_HANDLE_VALUE; DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), @@ -165,33 +129,6 @@ QThreadData *QThreadData::current(bool createIfNecessary) return threadData; } -#ifdef Q_OS_WINRT -void QThreadData::setMainThread() -{ - Q_ASSERT(!QCoreApplicationPrivate::theMainThread); - qt_create_tls(); - QThreadData *threadData = reinterpret_cast(TlsGetValue(qt_current_thread_data_tls_index)); - if (!threadData) { - threadData = new QThreadData; - // This needs to be called prior to new AdoptedThread() to - // avoid recursion. - TlsSetValue(qt_current_thread_data_tls_index, threadData); - QT_TRY { - threadData->thread = new QAdoptedThread(threadData); - } QT_CATCH(...) { - TlsSetValue(qt_current_thread_data_tls_index, 0); - threadData->deref(); - threadData = 0; - QT_RETHROW; - } - threadData->deref(); - threadData->isAdopted = true; - threadData->threadId.storeRelaxed(reinterpret_cast(quintptr(GetCurrentThreadId()))); - } - QCoreApplicationPrivate::theMainThread = threadData->thread.loadRelaxed(); -} -#endif - void QAdoptedThread::init() { d_func()->handle = GetCurrentThread(); @@ -225,11 +162,7 @@ void qt_watch_adopted_thread(const HANDLE adoptedThreadHandle, QThread *qthread) // Start watcher thread if it is not already running. if (qt_adopted_thread_watcher_id == 0) { if (qt_adopted_thread_wakeup == 0) { -#ifndef Q_OS_WINRT qt_adopted_thread_wakeup = CreateEvent(0, false, false, 0); -#else - qt_adopted_thread_wakeup = CreateEventEx(0, NULL, 0, EVENT_ALL_ACCESS); -#endif qt_adopted_thread_handles.prepend(qt_adopted_thread_wakeup); } @@ -268,21 +201,13 @@ DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID) // no need to loop, no timeout offset = 0; count = handlesCopy.count(); -#ifndef Q_OS_WINRT ret = WaitForMultipleObjects(handlesCopy.count(), handlesCopy.constData(), false, INFINITE); -#else - ret = WaitForMultipleObjectsEx(handlesCopy.count(), handlesCopy.constData(), false, INFINITE, false); -#endif } else { int loop = 0; do { offset = loop * MAXIMUM_WAIT_OBJECTS; count = qMin(handlesCopy.count() - offset, MAXIMUM_WAIT_OBJECTS); -#ifndef Q_OS_WINRT ret = WaitForMultipleObjects(count, handlesCopy.constData() + offset, false, 100); -#else - ret = WaitForMultipleObjectsEx(count, handlesCopy.constData() + offset, false, 100, false); -#endif loop = (loop + 1) % loops; } while (ret == WAIT_TIMEOUT); } @@ -323,7 +248,7 @@ DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID) return 0; } -#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINRT) +#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) #ifndef Q_OS_WIN64 # define ULONG_PTR DWORD @@ -354,7 +279,7 @@ void qt_set_thread_name(HANDLE threadId, LPCSTR threadName) { } } -#endif // !QT_NO_DEBUG && Q_CC_MSVC && !Q_OS_WINRT +#endif // !QT_NO_DEBUG && Q_CC_MSVC /************************************************************************** ** QThreadPrivate @@ -365,11 +290,7 @@ void qt_set_thread_name(HANDLE threadId, LPCSTR threadName) QAbstractEventDispatcher *QThreadPrivate::createEventDispatcher(QThreadData *data) { Q_UNUSED(data); -#ifndef Q_OS_WINRT return new QEventDispatcherWin32; -#else - return new QEventDispatcherWinRT; -#endif } #if QT_CONFIG(thread) @@ -392,7 +313,7 @@ unsigned int __stdcall QT_ENSURE_STACK_ALIGNED_FOR_SSE QThreadPrivate::start(voi data->ensureEventDispatcher(); -#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINRT) +#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) // sets the name of the current thread. QByteArray objectName = thr->objectName().toLocal8Bit(); qt_set_thread_name(HANDLE(-1), @@ -457,11 +378,7 @@ Qt::HANDLE QThread::currentThreadIdImpl() noexcept int QThread::idealThreadCount() noexcept { SYSTEM_INFO sysinfo; -#ifndef Q_OS_WINRT GetSystemInfo(&sysinfo); -#else - GetNativeSystemInfo(&sysinfo); -#endif return sysinfo.dwNumberOfProcessors; } @@ -519,16 +436,7 @@ void QThread::start(Priority priority) less than NormalPriority), but the newly created thread preempts its 'parent' and runs at normal priority. */ -#if defined(Q_CC_MSVC) && !defined(_DLL) // && !defined(Q_OS_WINRT) -# ifdef Q_OS_WINRT - // If you wish to accept the memory leaks, uncomment the part above. - // See: - // https://support.microsoft.com/en-us/kb/104641 - // https://msdn.microsoft.com/en-us/library/kdzttdcb.aspx -# error "Microsoft documentation says this combination leaks memory every time a thread is started. " \ - "Please change your build back to -MD/-MDd or, if you understand this issue and want to continue, " \ - "edit this source file." -# endif +#if defined(Q_CC_MSVC) && !defined(_DLL) // MSVC -MT or -MTd build d->handle = (Qt::HANDLE) _beginthreadex(NULL, d->stackSize, QThreadPrivate::start, this, CREATE_SUSPENDED, &(d->id)); @@ -537,7 +445,7 @@ void QThread::start(Priority priority) d->handle = CreateThread(nullptr, d->stackSize, reinterpret_cast(QThreadPrivate::start), this, CREATE_SUSPENDED, reinterpret_cast(&d->id)); -#endif // Q_OS_WINRT +#endif if (!d->handle) { qErrnoWarning("QThread::start: Failed to create thread"); @@ -603,10 +511,7 @@ void QThread::terminate() return; } - // Calling ExitThread() in setTerminationEnabled is all we can do on WinRT -#ifndef Q_OS_WINRT TerminateThread(d->handle, 0); -#endif QThreadPrivate::finish(this, false); } @@ -626,11 +531,7 @@ bool QThread::wait(QDeadlineTimer deadline) locker.mutex()->unlock(); bool ret = false; -#ifndef Q_OS_WINRT switch (WaitForSingleObject(d->handle, deadline.remainingTime())) { -#else - switch (WaitForSingleObjectEx(d->handle, deadline.remainingTime(), false)) { -#endif case WAIT_OBJECT_0: ret = true; break; @@ -671,11 +572,7 @@ void QThread::setTerminationEnabled(bool enabled) if (enabled && d->terminatePending) { QThreadPrivate::finish(thr, false); locker.unlock(); // don't leave the mutex locked! -#ifndef Q_OS_WINRT _endthreadex(0); -#else - ExitThread(0); -#endif } } diff --git a/src/corelib/thread/qwaitcondition_win.cpp b/src/corelib/thread/qwaitcondition_win.cpp index a6ad95b397..ba34129b7f 100644 --- a/src/corelib/thread/qwaitcondition_win.cpp +++ b/src/corelib/thread/qwaitcondition_win.cpp @@ -61,11 +61,7 @@ class QWaitConditionEvent public: inline QWaitConditionEvent() : priority(0), wokenUp(false) { -#ifndef Q_OS_WINRT event = CreateEvent(NULL, TRUE, FALSE, NULL); -#else - event = CreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS); -#endif } inline ~QWaitConditionEvent() { CloseHandle(event); } int priority; @@ -92,9 +88,7 @@ QWaitConditionEvent *QWaitConditionPrivate::pre() mtx.lock(); QWaitConditionEvent *wce = freeQueue.isEmpty() ? new QWaitConditionEvent : freeQueue.takeFirst(); -#ifndef Q_OS_WINRT wce->priority = GetThreadPriority(GetCurrentThread()); -#endif wce->wokenUp = false; // insert 'wce' into the queue (sorted by priority) diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 39fdc491df..78cfa05ec9 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -63,9 +63,6 @@ #include #ifdef Q_OS_WIN # include -# ifdef Q_OS_WINRT -# include "qfunctions_winrt.h" -# endif #endif #if defined(Q_OS_MAC) diff --git a/src/corelib/time/qtimezoneprivate_win.cpp b/src/corelib/time/qtimezoneprivate_win.cpp index 0aaf469ed9..1dc362e45a 100644 --- a/src/corelib/time/qtimezoneprivate_win.cpp +++ b/src/corelib/time/qtimezoneprivate_win.cpp @@ -46,11 +46,7 @@ #include -#ifndef Q_OS_WINRT #include -// The registry-based timezone backend is not available on WinRT, which falls back to equivalent APIs. -#define QT_USE_REGISTRY_TIMEZONE 1 -#endif QT_BEGIN_NAMESPACE @@ -71,10 +67,8 @@ QT_BEGIN_NAMESPACE // Vista introduced support for historic data, see MSDN docs on DYNAMIC_TIME_ZONE_INFORMATION // http://msdn.microsoft.com/en-gb/library/windows/desktop/ms724253%28v=vs.85%29.aspx -#ifdef QT_USE_REGISTRY_TIMEZONE static const wchar_t tzRegPath[] = LR"(SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones)"; static const wchar_t currTzRegPath[] = LR"(SYSTEM\CurrentControlSet\Control\TimeZoneInformation)"; -#endif enum { MIN_YEAR = -292275056, @@ -138,8 +132,6 @@ bool equalTzi(const TIME_ZONE_INFORMATION &tzi1, const TIME_ZONE_INFORMATION &tz && wcscmp(tzi1.DaylightName, tzi2.DaylightName) == 0); } -#ifdef QT_USE_REGISTRY_TIMEZONE - QWinTimeZonePrivate::QWinTransitionRule readRegistryRule(const HKEY &key, const wchar_t *value, bool *ok) { @@ -189,73 +181,6 @@ TIME_ZONE_INFORMATION getRegistryTzi(const QByteArray &windowsId, bool *ok) return tzi; } -#else // QT_USE_REGISTRY_TIMEZONE -struct QWinDynamicTimeZone -{ - QString standardName; - QString daylightName; - QString timezoneName; - qint32 bias; - bool daylightTime; -}; - -typedef QHash QWinRTTimeZoneHash; - -Q_GLOBAL_STATIC(QWinRTTimeZoneHash, gTimeZones) - -void enumerateTimeZones() -{ - DYNAMIC_TIME_ZONE_INFORMATION dtzInfo; - quint32 index = 0; - QString prevTimeZoneKeyName; - while (SUCCEEDED(EnumDynamicTimeZoneInformation(index++, &dtzInfo))) { - QWinDynamicTimeZone item; - item.timezoneName = QString::fromWCharArray(dtzInfo.TimeZoneKeyName); - // As soon as key name repeats, break. Some systems continue to always - // return the last item independent of index being out of range - if (item.timezoneName == prevTimeZoneKeyName) - break; - item.standardName = QString::fromWCharArray(dtzInfo.StandardName); - item.daylightName = QString::fromWCharArray(dtzInfo.DaylightName); - item.daylightTime = !dtzInfo.DynamicDaylightTimeDisabled; - item.bias = dtzInfo.Bias; - gTimeZones->insert(item.timezoneName.toUtf8(), item); - prevTimeZoneKeyName = item.timezoneName; - } -} - -DYNAMIC_TIME_ZONE_INFORMATION dynamicInfoForId(const QByteArray &windowsId) -{ - DYNAMIC_TIME_ZONE_INFORMATION dtzInfo; - quint32 index = 0; - QString prevTimeZoneKeyName; - while (SUCCEEDED(EnumDynamicTimeZoneInformation(index++, &dtzInfo))) { - const QString timeZoneName = QString::fromWCharArray(dtzInfo.TimeZoneKeyName); - if (timeZoneName == QLatin1String(windowsId)) - break; - if (timeZoneName == prevTimeZoneKeyName) - break; - prevTimeZoneKeyName = timeZoneName; - } - return dtzInfo; -} - -QWinTimeZonePrivate::QWinTransitionRule -readDynamicRule(DYNAMIC_TIME_ZONE_INFORMATION &dtzi, int year, bool *ok) -{ - TIME_ZONE_INFORMATION tzi; - QWinTimeZonePrivate::QWinTransitionRule rule; - *ok = GetTimeZoneInformationForYear(year, &dtzi, &tzi); - if (*ok) { - rule.startYear = 0; - rule.standardTimeBias = tzi.Bias + tzi.StandardBias; - rule.daylightTimeBias = tzi.Bias + tzi.DaylightBias - rule.standardTimeBias; - rule.standardTimeRule = tzi.StandardDate; - rule.daylightTimeRule = tzi.DaylightDate; - } - return rule; -} -#endif // QT_USE_REGISTRY_TIMEZONE bool isSameRule(const QWinTimeZonePrivate::QWinTransitionRule &last, const QWinTimeZonePrivate::QWinTransitionRule &rule) @@ -273,7 +198,6 @@ bool isSameRule(const QWinTimeZonePrivate::QWinTransitionRule &last, QList availableWindowsIds() { -#ifdef QT_USE_REGISTRY_TIMEZONE // TODO Consider caching results in a global static, very unlikely to change. QList list; QWinRegistryKey key(HKEY_LOCAL_MACHINE, tzRegPath); @@ -290,16 +214,10 @@ QList availableWindowsIds() } } return list; -#else // QT_USE_REGISTRY_TIMEZONE - if (gTimeZones->isEmpty()) - enumerateTimeZones(); - return gTimeZones->keys(); -#endif // QT_USE_REGISTRY_TIMEZONE } QByteArray windowsSystemZoneId() { -#ifdef QT_USE_REGISTRY_TIMEZONE // On Vista and later is held in the value TimeZoneKeyName in key currTzRegPath const QString id = QWinRegistryKey(HKEY_LOCAL_MACHINE, currTzRegPath) .stringValue(L"TimeZoneKeyName"); @@ -316,11 +234,6 @@ QByteArray windowsSystemZoneId() if (equalTzi(getRegistryTzi(winId, &ok), sysTzi)) return winId; } -#else // QT_USE_REGISTRY_TIMEZONE - DYNAMIC_TIME_ZONE_INFORMATION dtzi; - if (SUCCEEDED(GetDynamicTimeZoneInformation(&dtzi))) - return QString::fromWCharArray(dtzi.TimeZoneKeyName).toLocal8Bit(); -#endif // QT_USE_REGISTRY_TIMEZONE // If we can't determine the current ID use UTC return QTimeZonePrivate::utcQByteArray(); @@ -544,7 +457,6 @@ void QWinTimeZonePrivate::init(const QByteArray &ianaId) bool badMonth = false; // Only warn once per zone, if at all. if (!m_windowsId.isEmpty()) { -#ifdef QT_USE_REGISTRY_TIMEZONE // Open the base TZI for the time zone const QString baseKeyPath = QString::fromWCharArray(tzRegPath) + QLatin1Char('\\') + QString::fromUtf8(m_windowsId); @@ -591,50 +503,6 @@ void QWinTimeZonePrivate::init(const QByteArray &ianaId) m_tranRules.append(rule); } } -#else // QT_USE_REGISTRY_TIMEZONE - if (gTimeZones->isEmpty()) - enumerateTimeZones(); - QWinRTTimeZoneHash::const_iterator it = gTimeZones->find(m_windowsId); - if (it != gTimeZones->constEnd()) { - m_displayName = it->timezoneName; - m_standardName = it->standardName; - m_daylightName = it->daylightName; - DWORD firstYear = 0; - DWORD lastYear = 0; - DYNAMIC_TIME_ZONE_INFORMATION dtzi = dynamicInfoForId(m_windowsId); - if (GetDynamicTimeZoneInformationEffectiveYears(&dtzi, &firstYear, &lastYear) - == ERROR_SUCCESS && firstYear < lastYear) { - for (DWORD year = firstYear; year <= lastYear; ++year) { - bool ok = false; - QWinTransitionRule rule = readDynamicRule(dtzi, year, &ok); - if (ok - // Don't repeat a recurrent rule - && (m_tranRules.isEmpty() - || !isSameRule(m_tranRules.last(), rule))) { - if (!badMonth - && (rule.standardTimeRule.wMonth == 0) - != (rule.daylightTimeRule.wMonth == 0)) { - badMonth = true; - qWarning("MS dynamic TZ API violated its wMonth constraint;" - "this may cause mistakes for %s from %d", - ianaId.constData(), year); - } - rule.startYear = m_tranRules.isEmpty() ? MIN_YEAR : year; - m_tranRules.append(rule); - } - } - } else { - // At least try to get the non-dynamic data: - dtzi.DynamicDaylightTimeDisabled = false; - bool ok = false; - QWinTransitionRule rule = readDynamicRule(dtzi, 1970, &ok); - if (ok) { - rule.startYear = MIN_YEAR; - m_tranRules.append(rule); - } - } - } -#endif // QT_USE_REGISTRY_TIMEZONE } // If there are no rules then we failed to find a windowsId or any tzi info diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp index a3d2a2f7c0..ed4171fe4d 100644 --- a/src/corelib/tools/qcommandlineparser.cpp +++ b/src/corelib/tools/qcommandlineparser.cpp @@ -45,7 +45,7 @@ #include #include #include -#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) # include #endif #include @@ -542,7 +542,7 @@ QString QCommandLineParser::errorText() const enum MessageType { UsageMessage, ErrorMessage }; -#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) // 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() @@ -554,17 +554,11 @@ static inline bool displayMessageBox() GetStartupInfo(&startupInfo); return !(startupInfo.dwFlags & STARTF_USESTDHANDLES); } -#endif // Q_OS_WIN && !QT_BOOTSTRAPPED && !Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN && !QT_BOOTSTRAPPED static void showParserMessage(const QString &message, MessageType type) { -#if defined(Q_OS_WINRT) - if (type == UsageMessage) - qInfo("%ls", qUtf16Printable(message)); - else - qCritical("%ls", qUtf16Printable(message)); - return; -#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) +#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) if (displayMessageBox()) { const UINT flags = MB_OK | MB_TOPMOST | MB_SETFOREGROUND | (type == UsageMessage ? MB_ICONINFORMATION : MB_ICONERROR); diff --git a/src/gui/.prev_CMakeLists.txt b/src/gui/.prev_CMakeLists.txt index b9b2076af5..6670408378 100644 --- a/src/gui/.prev_CMakeLists.txt +++ b/src/gui/.prev_CMakeLists.txt @@ -300,6 +300,7 @@ qt_extend_target(Gui CONDITION QT_FEATURE_animation qt_extend_target(Gui CONDITION WIN32 SOURCES + image/qpixmap_win.cpp kernel/qwindowdefs_win.h rhi/qrhid3d11.cpp rhi/qrhid3d11_p.h rhi/qrhid3d11_p_p.h @@ -364,7 +365,7 @@ qt_extend_target(Gui CONDITION APPLE AND QT_FEATURE_accessibility ${FWFoundation} ) -qt_extend_target(Gui CONDITION QT_FEATURE_accessibility AND WIN32 AND NOT WINRT +qt_extend_target(Gui CONDITION QT_FEATURE_accessibility AND WIN32 SOURCES accessible/windows/apisupport/qwindowsuiawrapper.cpp accessible/windows/apisupport/qwindowsuiawrapper_p.h accessible/windows/apisupport/uiaattributeids_p.h @@ -406,11 +407,6 @@ qt_extend_target(Gui CONDITION QT_FEATURE_movie image/qmovie.cpp image/qmovie.h ) -qt_extend_target(Gui CONDITION WIN32 AND NOT WINRT - SOURCES - image/qpixmap_win.cpp -) - qt_extend_target(Gui CONDITION QT_FEATURE_png SOURCES image/qpnghandler.cpp image/qpnghandler_p.h diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index af144a2e24..3c844c7f51 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -13,9 +13,7 @@ qt_find_package(WrapPNG PROVIDED_TARGETS WrapPNG::WrapPNG) qt_find_package(WrapFreetype PROVIDED_TARGETS WrapFreetype::WrapFreetype) if (QT_FEATURE_gui) - if (WINRT) - set(_default_platform "winrt") - elseif(WIN32) + if(WIN32) set(_default_platform "windows") elseif(ANDROID) set(_default_platform "android") @@ -392,6 +390,7 @@ qt_extend_target(Gui CONDITION QT_FEATURE_animation qt_extend_target(Gui CONDITION WIN32 SOURCES + image/qpixmap_win.cpp kernel/qwindowdefs_win.h rhi/qrhid3d11.cpp rhi/qrhid3d11_p.h rhi/qrhid3d11_p_p.h @@ -457,7 +456,7 @@ qt_extend_target(Gui CONDITION APPLE AND QT_FEATURE_accessibility ${FWFoundation} ) -qt_extend_target(Gui CONDITION QT_FEATURE_accessibility AND WIN32 AND NOT WINRT +qt_extend_target(Gui CONDITION QT_FEATURE_accessibility AND WIN32 SOURCES accessible/windows/apisupport/qwindowsuiawrapper.cpp accessible/windows/apisupport/qwindowsuiawrapper_p.h accessible/windows/apisupport/uiaattributeids_p.h @@ -499,11 +498,6 @@ qt_extend_target(Gui CONDITION QT_FEATURE_movie image/qmovie.cpp image/qmovie.h ) -qt_extend_target(Gui CONDITION WIN32 AND NOT WINRT - SOURCES - image/qpixmap_win.cpp -) - qt_extend_target(Gui CONDITION QT_FEATURE_png SOURCES image/qpnghandler.cpp image/qpnghandler_p.h diff --git a/src/gui/accessible/accessible.pri b/src/gui/accessible/accessible.pri index 7a376d98a2..471e2fbaea 100644 --- a/src/gui/accessible/accessible.pri +++ b/src/gui/accessible/accessible.pri @@ -24,5 +24,5 @@ qtConfig(accessibility) { LIBS_PRIVATE += -framework Foundation } - win32:!winrt: include(windows/windows.pri) + win32: include(windows/windows.pri) } diff --git a/src/gui/configure.cmake b/src/gui/configure.cmake index e844a603ac..9ee5089f49 100644 --- a/src/gui/configure.cmake +++ b/src/gui/configure.cmake @@ -569,7 +569,7 @@ qt_feature("directwrite2" PRIVATE ) qt_feature("direct2d" PRIVATE LABEL "Direct 2D" - CONDITION WIN32 AND NOT WINRT AND libs.d2d1 OR FIXME + CONDITION WIN32 AND libs.d2d1 OR FIXME ) qt_feature("direct2d1_1" PRIVATE LABEL "Direct 2D 1.1" @@ -692,13 +692,13 @@ qt_feature("opengles32" PUBLIC qt_feature("opengl-desktop" LABEL "Desktop OpenGL" AUTODETECT NOT WIN32 - CONDITION ( WIN32 AND NOT WINRT AND ( MSVC OR OpenGL_FOUND ) ) OR ( NOT WATCHOS AND NOT WIN32 AND NOT WASM AND OpenGL_FOUND ) + CONDITION ( WIN32 AND ( MSVC OR OpenGL_FOUND ) ) OR ( NOT WATCHOS AND NOT WIN32 AND NOT WASM AND OpenGL_FOUND ) ENABLE INPUT_opengl STREQUAL 'desktop' DISABLE INPUT_opengl STREQUAL 'es2' OR INPUT_opengl STREQUAL 'dynamic' OR INPUT_opengl STREQUAL 'no' ) qt_feature("opengl-dynamic" LABEL "Dynamic OpenGL" - CONDITION WIN32 AND NOT WINRT + CONDITION WIN32 DISABLE INPUT_opengl STREQUAL 'no' OR INPUT_opengl STREQUAL 'desktop' ) qt_feature("dynamicgl" PUBLIC diff --git a/src/gui/configure.json b/src/gui/configure.json index f770ee7729..377865679d 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -1069,7 +1069,7 @@ }, "direct2d": { "label": "Direct 2D", - "condition": "config.win32 && !config.winrt && libs.d2d1", + "condition": "config.win32 && libs.d2d1", "output": [ "privateFeature" ] }, "direct2d1_1": { @@ -1224,12 +1224,12 @@ "autoDetect": "!config.win32", "enable": "input.opengl == 'desktop'", "disable": "input.opengl == 'es2' || input.opengl == 'dynamic' || input.opengl == 'no'", - "condition": "(config.win32 && !config.winrt && (config.msvc || libs.opengl)) || (!config.watchos && !config.win32 && !config.wasm && libs.opengl)" + "condition": "(config.win32 && (config.msvc || libs.opengl)) || (!config.watchos && !config.win32 && !config.wasm && libs.opengl)" }, "opengl-dynamic": { "label": "Dynamic OpenGL", "disable": "input.opengl == 'no' || input.opengl == 'desktop'", - "condition": "config.win32 && !config.winrt", + "condition": "config.win32", "output": [ { "type": "publicFeature", "name": "dynamicgl" }, { "type": "define", "name": "QT_OPENGL_DYNAMIC" } diff --git a/src/gui/configure.pri b/src/gui/configure.pri index 490ef0df28..667ccf53e2 100644 --- a/src/gui/configure.pri +++ b/src/gui/configure.pri @@ -60,7 +60,6 @@ defineTest(qtConfTest_qpaDefaultPlatform) { name = !isEmpty(config.input.qpa_default_platform): name = $$config.input.qpa_default_platform else: !isEmpty(QT_QPA_DEFAULT_PLATFORM): name = $$QT_QPA_DEFAULT_PLATFORM - else: winrt: name = winrt else: win32: name = windows else: android: name = android else: macos: name = cocoa diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index c1cd798490..bf0aa519a8 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -55,7 +55,7 @@ qtConfig(movie) { SOURCES += image/qmovie.cpp } -win32:!winrt: SOURCES += image/qpixmap_win.cpp +win32: SOURCES += image/qpixmap_win.cpp darwin: OBJECTIVE_SOURCES += image/qimage_darwin.mm diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp index 3b42e78624..79a2caea69 100644 --- a/src/gui/kernel/qclipboard.cpp +++ b/src/gui/kernel/qclipboard.cpp @@ -137,17 +137,6 @@ QT_BEGIN_NAMESPACE \endlist - \section1 Notes for Universal Windows Platform Users - - \list - - \li The Universal Windows Platform only allows to query the - clipboard in case the application is active and an application - window has focus. Accessing the clipboard data when in background - will fail due to access denial. - - \endlist - \sa QGuiApplication */ diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index c6facb8ceb..cde21dc8dd 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1256,12 +1256,12 @@ static void init_platform(const QString &pluginNamesWithArguments, const QString if (!availablePlugins.isEmpty()) fatalMessage += QStringLiteral("\nAvailable platform plugins are: %1.\n").arg(availablePlugins.join(QLatin1String(", "))); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) // 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_WINRT +#endif // Q_OS_WIN qFatal("%s", qPrintable(fatalMessage)); return; diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 24e0289c53..65315ed7cb 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -158,9 +158,6 @@ static const qreal aliasedCoordinateDelta = 0.5 - 0.015625; static inline bool winClearTypeFontsEnabled() { -#ifdef Q_OS_WINRT - return false; -#else // Q_OS_WINRT UINT result = 0; #if !defined(SPI_GETFONTSMOOTHINGTYPE) // MinGW # define SPI_GETFONTSMOOTHINGTYPE 0x200A @@ -168,7 +165,6 @@ static inline bool winClearTypeFontsEnabled() #endif SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &result, 0); return result == FE_FONTSMOOTHINGCLEARTYPE; -#endif // !Q_OS_WINRT } /*! diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp index 5b7ad10a2f..c284e17f46 100644 --- a/src/gui/rhi/qrhid3d11.cpp +++ b/src/gui/rhi/qrhid3d11.cpp @@ -147,11 +147,7 @@ QRhiD3D11::QRhiD3D11(QRhiD3D11InitParams *params, QRhiD3D11NativeHandles *import static QString comErrorMessage(HRESULT hr) { -#ifndef Q_OS_WINRT const _com_error comError(hr); -#else - const _com_error comError(hr, nullptr); -#endif QString result = QLatin1String("Error 0x") + QString::number(ulong(hr), 16); if (const wchar_t *msg = comError.ErrorMessage()) result += QLatin1String(": ") + QString::fromWCharArray(msg); diff --git a/src/network/.prev_CMakeLists.txt b/src/network/.prev_CMakeLists.txt index 1af21c806b..bc088516a3 100644 --- a/src/network/.prev_CMakeLists.txt +++ b/src/network/.prev_CMakeLists.txt @@ -35,6 +35,7 @@ qt_add_module(Network kernel/qtnetworkglobal.h kernel/qtnetworkglobal_p.h socket/qabstractsocket.cpp socket/qabstractsocket.h socket/qabstractsocket_p.h socket/qabstractsocketengine.cpp socket/qabstractsocketengine_p.h + socket/qnativesocketengine.cpp socket/qnativesocketengine_p.h socket/qtcpserver.cpp socket/qtcpserver.h socket/qtcpserver_p.h socket/qtcpsocket.cpp socket/qtcpsocket.h socket/qtcpsocket_p.h socket/qudpsocket.cpp socket/qudpsocket.h @@ -59,7 +60,6 @@ qt_add_module(Network ) #### Keys ignored in scope 1:.:.:network.pro:: -# MODULE_WINRT_CAPABILITIES = "internetClient" "internetClientServer" "privateNetworkClientServer" # QMAKE_LIBS = "$$QMAKE_LIBS_NETWORK" ## Scopes: @@ -178,10 +178,6 @@ qt_extend_target(Network CONDITION ANDROID AND QT_FEATURE_dnslookup qt_extend_target(Network CONDITION WIN32 SOURCES kernel/qhostinfo_win.cpp -) - -qt_extend_target(Network CONDITION WIN32 AND NOT WINRT - SOURCES kernel/qnetworkinterface_win.cpp kernel/qnetworkproxy_win.cpp socket/qnativesocketengine_win.cpp @@ -191,22 +187,11 @@ qt_extend_target(Network CONDITION WIN32 AND NOT WINRT iphlpapi ) -qt_extend_target(Network CONDITION QT_FEATURE_dnslookup AND WIN32 AND NOT WINRT +qt_extend_target(Network CONDITION QT_FEATURE_dnslookup AND WIN32 SOURCES kernel/qdnslookup_win.cpp ) -qt_extend_target(Network CONDITION WINRT - SOURCES - kernel/qnetworkinterface_winrt.cpp - socket/qnativesocketengine_winrt.cpp socket/qnativesocketengine_winrt_p.h -) - -qt_extend_target(Network CONDITION QT_FEATURE_dnslookup AND WINRT - SOURCES - kernel/qdnslookup_winrt.cpp -) - qt_extend_target(Network CONDITION APPLE AND NOT UIKIT LIBRARIES ${FWCoreServices} @@ -245,7 +230,7 @@ qt_extend_target(Network CONDITION MACOS kernel/qnetworkproxy_mac.cpp ) -qt_extend_target(Network CONDITION QT_FEATURE_libproxy AND NOT MACOS AND (UNIX OR WINRT) +qt_extend_target(Network CONDITION QT_FEATURE_libproxy AND UNIX AND NOT MACOS SOURCES kernel/qnetworkproxy_libproxy.cpp LIBRARIES @@ -253,7 +238,7 @@ qt_extend_target(Network CONDITION QT_FEATURE_libproxy AND NOT MACOS AND (UNIX O PkgConfig::Libproxy ) -qt_extend_target(Network CONDITION NOT MACOS AND NOT QT_FEATURE_libproxy AND (UNIX OR WINRT) +qt_extend_target(Network CONDITION UNIX AND NOT MACOS AND NOT QT_FEATURE_libproxy SOURCES kernel/qnetworkproxy_generic.cpp ) @@ -269,11 +254,6 @@ qt_extend_target(Network CONDITION QT_FEATURE_sctp socket/qsctpsocket.cpp socket/qsctpsocket.h socket/qsctpsocket_p.h ) -qt_extend_target(Network CONDITION NOT WINRT - SOURCES - socket/qnativesocketengine.cpp socket/qnativesocketengine_p.h -) - qt_extend_target(Network CONDITION MSVC MOC_OPTIONS "-D_WINSOCK_DEPRECATED_NO_WARNINGS" @@ -285,7 +265,7 @@ qt_extend_target(Network CONDITION QT_FEATURE_localserver socket/qlocalsocket.cpp socket/qlocalsocket.h socket/qlocalsocket_p.h ) -qt_extend_target(Network CONDITION QT_FEATURE_localserver AND (INTEGRITY OR WINRT) +qt_extend_target(Network CONDITION INTEGRITY AND QT_FEATURE_localserver SOURCES socket/qlocalserver_tcp.cpp socket/qlocalsocket_tcp.cpp @@ -293,13 +273,13 @@ qt_extend_target(Network CONDITION QT_FEATURE_localserver AND (INTEGRITY OR WINR QT_LOCALSOCKET_TCP ) -qt_extend_target(Network CONDITION QT_FEATURE_localserver AND UNIX AND NOT INTEGRITY AND NOT WINRT +qt_extend_target(Network CONDITION QT_FEATURE_localserver AND UNIX AND NOT INTEGRITY SOURCES socket/qlocalserver_unix.cpp socket/qlocalsocket_unix.cpp ) -qt_extend_target(Network CONDITION QT_FEATURE_localserver AND WIN32 AND NOT WINRT +qt_extend_target(Network CONDITION QT_FEATURE_localserver AND WIN32 SOURCES socket/qlocalserver_win.cpp socket/qlocalsocket_win.cpp @@ -328,16 +308,6 @@ qt_extend_target(Network CONDITION QT_FEATURE_ssl ssl/qsslsocket.cpp ssl/qsslsocket.h ssl/qsslsocket_p.h ) -qt_extend_target(Network CONDITION QT_FEATURE_ssl AND WINRT - SOURCES - ssl/qsslcertificate_winrt.cpp - ssl/qssldiffiehellmanparameters_dummy.cpp - ssl/qsslellipticcurve_dummy.cpp - ssl/qsslkey_qt.cpp - ssl/qsslkey_winrt.cpp - ssl/qsslsocket_winrt.cpp ssl/qsslsocket_winrt_p.h -) - qt_extend_target(Network CONDITION QT_FEATURE_schannel AND QT_FEATURE_ssl SOURCES ssl/qsslcertificate_schannel.cpp diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt index 6ff806fef9..0aff359750 100644 --- a/src/network/CMakeLists.txt +++ b/src/network/CMakeLists.txt @@ -35,6 +35,7 @@ qt_add_module(Network kernel/qtnetworkglobal.h kernel/qtnetworkglobal_p.h socket/qabstractsocket.cpp socket/qabstractsocket.h socket/qabstractsocket_p.h socket/qabstractsocketengine.cpp socket/qabstractsocketengine_p.h + socket/qnativesocketengine.cpp socket/qnativesocketengine_p.h socket/qtcpserver.cpp socket/qtcpserver.h socket/qtcpserver_p.h socket/qtcpsocket.cpp socket/qtcpsocket.h socket/qtcpsocket_p.h socket/qudpsocket.cpp socket/qudpsocket.h @@ -59,7 +60,6 @@ qt_add_module(Network ) #### Keys ignored in scope 1:.:.:network.pro:: -# MODULE_WINRT_CAPABILITIES = "internetClient" "internetClientServer" "privateNetworkClientServer" # QMAKE_LIBS = "$$QMAKE_LIBS_NETWORK" ## Scopes: @@ -178,10 +178,6 @@ qt_extend_target(Network CONDITION ANDROID AND QT_FEATURE_dnslookup qt_extend_target(Network CONDITION WIN32 SOURCES kernel/qhostinfo_win.cpp -) - -qt_extend_target(Network CONDITION WIN32 AND NOT WINRT - SOURCES kernel/qnetworkinterface_win.cpp kernel/qnetworkproxy_win.cpp socket/qnativesocketengine_win.cpp @@ -191,22 +187,11 @@ qt_extend_target(Network CONDITION WIN32 AND NOT WINRT iphlpapi ) -qt_extend_target(Network CONDITION QT_FEATURE_dnslookup AND WIN32 AND NOT WINRT +qt_extend_target(Network CONDITION QT_FEATURE_dnslookup AND WIN32 SOURCES kernel/qdnslookup_win.cpp ) -qt_extend_target(Network CONDITION WINRT - SOURCES - kernel/qnetworkinterface_winrt.cpp - socket/qnativesocketengine_winrt.cpp socket/qnativesocketengine_winrt_p.h -) - -qt_extend_target(Network CONDITION QT_FEATURE_dnslookup AND WINRT - SOURCES - kernel/qdnslookup_winrt.cpp -) - qt_extend_target(Network CONDITION APPLE AND NOT UIKIT LIBRARIES ${FWCoreServices} @@ -245,7 +230,7 @@ qt_extend_target(Network CONDITION MACOS kernel/qnetworkproxy_mac.cpp ) -qt_extend_target(Network CONDITION QT_FEATURE_libproxy AND NOT MACOS AND (UNIX OR WINRT) +qt_extend_target(Network CONDITION QT_FEATURE_libproxy AND UNIX AND NOT MACOS SOURCES kernel/qnetworkproxy_libproxy.cpp LIBRARIES @@ -253,7 +238,7 @@ qt_extend_target(Network CONDITION QT_FEATURE_libproxy AND NOT MACOS AND (UNIX O PkgConfig::Libproxy ) -qt_extend_target(Network CONDITION NOT MACOS AND NOT QT_FEATURE_libproxy AND (UNIX OR WINRT) +qt_extend_target(Network CONDITION UNIX AND NOT MACOS AND NOT QT_FEATURE_libproxy SOURCES kernel/qnetworkproxy_generic.cpp ) @@ -269,11 +254,6 @@ qt_extend_target(Network CONDITION QT_FEATURE_sctp socket/qsctpsocket.cpp socket/qsctpsocket.h socket/qsctpsocket_p.h ) -qt_extend_target(Network CONDITION NOT WINRT - SOURCES - socket/qnativesocketengine.cpp socket/qnativesocketengine_p.h -) - qt_extend_target(Network CONDITION MSVC MOC_OPTIONS "-D_WINSOCK_DEPRECATED_NO_WARNINGS" @@ -285,7 +265,7 @@ qt_extend_target(Network CONDITION QT_FEATURE_localserver socket/qlocalsocket.cpp socket/qlocalsocket.h socket/qlocalsocket_p.h ) -qt_extend_target(Network CONDITION QT_FEATURE_localserver AND (INTEGRITY OR WINRT) +qt_extend_target(Network CONDITION INTEGRITY AND QT_FEATURE_localserver SOURCES socket/qlocalserver_tcp.cpp socket/qlocalsocket_tcp.cpp @@ -293,13 +273,13 @@ qt_extend_target(Network CONDITION QT_FEATURE_localserver AND (INTEGRITY OR WINR QT_LOCALSOCKET_TCP ) -qt_extend_target(Network CONDITION QT_FEATURE_localserver AND UNIX AND NOT INTEGRITY AND NOT WINRT +qt_extend_target(Network CONDITION QT_FEATURE_localserver AND UNIX AND NOT INTEGRITY SOURCES socket/qlocalserver_unix.cpp socket/qlocalsocket_unix.cpp ) -qt_extend_target(Network CONDITION QT_FEATURE_localserver AND WIN32 AND NOT WINRT +qt_extend_target(Network CONDITION QT_FEATURE_localserver AND WIN32 SOURCES socket/qlocalserver_win.cpp socket/qlocalsocket_win.cpp @@ -328,16 +308,6 @@ qt_extend_target(Network CONDITION QT_FEATURE_ssl ssl/qsslsocket.cpp ssl/qsslsocket.h ssl/qsslsocket_p.h ) -qt_extend_target(Network CONDITION QT_FEATURE_ssl AND WINRT - SOURCES - ssl/qsslcertificate_winrt.cpp - ssl/qssldiffiehellmanparameters_dummy.cpp - ssl/qsslellipticcurve_dummy.cpp - ssl/qsslkey_qt.cpp - ssl/qsslkey_winrt.cpp - ssl/qsslsocket_winrt.cpp ssl/qsslsocket_winrt_p.h -) - qt_extend_target(Network CONDITION QT_FEATURE_schannel AND QT_FEATURE_ssl SOURCES ssl/qsslcertificate_schannel.cpp diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index f916ee2981..468a530e7b 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -640,7 +640,6 @@ QHttpNetworkReply* QHttpNetworkConnectionPrivate::queueRequest(const QHttpNetwor channels[0].h2RequestsToSend.insert(request.priority(), pair); } -#ifndef Q_OS_WINRT // For Happy Eyeballs the networkLayerState is set to Unknown // until we have started the first connection attempt. So no // request will be started until we know if IPv4 or IPv6 @@ -648,13 +647,6 @@ QHttpNetworkReply* QHttpNetworkConnectionPrivate::queueRequest(const QHttpNetwor if (networkLayerState == Unknown || networkLayerState == HostLookupPending) { startHostInfoLookup(); } else if ( networkLayerState == IPv4 || networkLayerState == IPv6 ) { -#else // !Q_OS_WINRT - { - // Skip the host lookup part for winrt. Host lookup and proxy handling are done by Windows - // internally and networkLayerPreference is ignored on this platform. Instead of refactoring - // the whole approach we just pretend that everything important is known here. - networkLayerState = IPv4; -#endif // this used to be called via invokeMethod and a QueuedConnection // It is the only place _q_startNextRequest is called directly without going // through the event loop using a QueuedConnection. diff --git a/src/network/configure.cmake b/src/network/configure.cmake index 1dccd67f78..1bfa978612 100644 --- a/src/network/configure.cmake +++ b/src/network/configure.cmake @@ -264,7 +264,7 @@ qt_feature("openssl" PRIVATE qt_feature_definition("openssl" "QT_NO_OPENSSL" NEGATE) qt_feature_config("openssl" QMAKE_PUBLIC_QT_CONFIG) qt_feature("openssl-runtime" - AUTODETECT NOT WINRT AND NOT WASM + AUTODETECT NOT WASM CONDITION NOT QT_FEATURE_securetransport AND NOT QT_FEATURE_schannel AND TEST_openssl_headers ENABLE INPUT_openssl STREQUAL 'yes' OR INPUT_openssl STREQUAL 'runtime' DISABLE INPUT_openssl STREQUAL 'no' OR INPUT_openssl STREQUAL 'linked' OR INPUT_ssl STREQUAL 'no' @@ -284,13 +284,13 @@ qt_feature("securetransport" PUBLIC qt_feature_definition("securetransport" "QT_SECURETRANSPORT") qt_feature("schannel" PUBLIC LABEL "Schannel" - CONDITION INPUT_schannel STREQUAL 'yes' AND WIN32 AND NOT WINRT AND ( INPUT_openssl STREQUAL '' OR INPUT_openssl STREQUAL 'no' ) + CONDITION INPUT_schannel STREQUAL 'yes' AND WIN32 AND ( INPUT_openssl STREQUAL '' OR INPUT_openssl STREQUAL 'no' ) DISABLE INPUT_schannel STREQUAL 'no' OR INPUT_ssl STREQUAL 'no' ) qt_feature_definition("schannel" "QT_SCHANNEL") qt_feature("ssl" PUBLIC LABEL "SSL" - CONDITION WINRT OR QT_FEATURE_securetransport OR QT_FEATURE_openssl OR QT_FEATURE_schannel + CONDITION QT_FEATURE_securetransport OR QT_FEATURE_openssl OR QT_FEATURE_schannel ) qt_feature_definition("ssl" "QT_NO_SSL" NEGATE VALUE "1") qt_feature("dtls" PUBLIC @@ -389,7 +389,7 @@ qt_feature("sspi" PUBLIC SECTION "Networking" LABEL "SSPI" PURPOSE "Enable NTLM/SPNEGO authentication through SSPI" - CONDITION WIN32 AND NOT WINRT + CONDITION WIN32 ) qt_feature_definition("sspi" "QT_NO_SSPI" NEGATE VALUE "1") qt_feature("netlistmgr" PRIVATE @@ -421,7 +421,7 @@ qt_configure_add_summary_entry( ) qt_configure_add_summary_entry( ARGS "schannel" - CONDITION WIN32 AND NOT WINRT + CONDITION WIN32 ) qt_configure_add_summary_entry(ARGS "openssl") qt_configure_add_summary_entry(ARGS "openssl-linked") diff --git a/src/network/configure.json b/src/network/configure.json index 254a36d725..5f26f83c54 100644 --- a/src/network/configure.json +++ b/src/network/configure.json @@ -272,7 +272,7 @@ ] }, "openssl-runtime": { - "autoDetect": "!config.winrt && !config.wasm", + "autoDetect": "!config.wasm", "enable": "input.openssl == 'yes' || input.openssl == 'runtime'", "disable": "input.openssl == 'no' || input.openssl == 'linked' || input.ssl == 'no'", "condition": "!features.securetransport && !features.schannel && libs.openssl_headers" @@ -299,7 +299,7 @@ "schannel": { "label": "Schannel", "disable": "input.schannel == 'no' || input.ssl == 'no'", - "condition": "input.schannel == 'yes' && config.win32 && !config.winrt && (input.openssl == '' || input.openssl == 'no')", + "condition": "input.schannel == 'yes' && config.win32 && (input.openssl == '' || input.openssl == 'no')", "output": [ "publicFeature", { "type": "define", "name": "QT_SCHANNEL" } @@ -307,7 +307,7 @@ }, "ssl": { "label": "SSL", - "condition": "config.winrt || features.securetransport || features.openssl || features.schannel", + "condition": "features.securetransport || features.openssl || features.schannel", "output": [ "publicFeature", "feature" ] }, "dtls": { @@ -411,7 +411,7 @@ "label": "SSPI", "purpose": "Enable NTLM/SPNEGO authentication through SSPI", "section": "Networking", - "condition": "config.win32 && !config.winrt", + "condition": "config.win32", "output": [ "publicFeature", "feature" ] }, "netlistmgr": { @@ -469,7 +469,7 @@ For example: { "type": "feature", "args": "schannel", - "condition": "config.win32 && !config.winrt" + "condition": "config.win32" }, "openssl", "openssl-linked", diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri index 7dd5b1d97e..d7d0dd522c 100644 --- a/src/network/kernel/kernel.pri +++ b/src/network/kernel/kernel.pri @@ -62,16 +62,10 @@ android:qtConfig(dnslookup) { } win32: { - SOURCES += kernel/qhostinfo_win.cpp - - !winrt { - SOURCES += kernel/qnetworkinterface_win.cpp - qtConfig(dnslookup): SOURCES += kernel/qdnslookup_win.cpp - LIBS_PRIVATE += -ldnsapi -liphlpapi - } else { - SOURCES += kernel/qnetworkinterface_winrt.cpp - qtConfig(dnslookup): SOURCES += kernel/qdnslookup_winrt.cpp - } + SOURCES += kernel/qhostinfo_win.cpp \ + kernel/qnetworkinterface_win.cpp + qtConfig(dnslookup): SOURCES += kernel/qdnslookup_win.cpp + LIBS_PRIVATE += -ldnsapi -liphlpapi } mac { @@ -94,7 +88,7 @@ qtConfig(gssapi): QMAKE_USE_PRIVATE += gssapi uikit:HEADERS += kernel/qnetworkinterface_uikit_p.h osx:SOURCES += kernel/qnetworkproxy_mac.cpp -else:win32:!winrt: SOURCES += kernel/qnetworkproxy_win.cpp +else:win32: SOURCES += kernel/qnetworkproxy_win.cpp else: qtConfig(libproxy) { SOURCES += kernel/qnetworkproxy_libproxy.cpp QMAKE_USE_PRIVATE += libproxy libdl diff --git a/src/network/kernel/qdnslookup_winrt.cpp b/src/network/kernel/qdnslookup_winrt.cpp deleted file mode 100644 index 30510d89fc..0000000000 --- a/src/network/kernel/qdnslookup_winrt.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtNetwork 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 "qdnslookup_p.h" - -#include -#include -#include - -#include -#include -#include -#include -#include - -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Foundation::Collections; -using namespace ABI::Windows::Networking; -using namespace ABI::Windows::Networking::Connectivity; -using namespace ABI::Windows::Networking::Sockets; - -#define E_NO_SUCH_HOST 0x80072af9 - -QT_BEGIN_NAMESPACE - -void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestName, const QHostAddress &nameserver, QDnsLookupReply *reply) -{ - // TODO: Add nameserver support for winRT - if (!nameserver.isNull()) - qWarning("Ignoring nameserver as its currently not supported on WinRT"); - - // TODO: is there any way to do "proper" dns lookup? - if (requestType != QDnsLookup::A && requestType != QDnsLookup::AAAA - && requestType != QDnsLookup::ANY) { - reply->error = QDnsLookup::InvalidRequestError; - reply->errorString = QLatin1String("WinRT only supports IPv4 and IPv6 requests"); - return; - } - - QString aceHostname = QUrl::fromAce(requestName); - if (aceHostname.isEmpty()) { - reply->error = QDnsLookup::InvalidRequestError; - reply->errorString = requestName.isEmpty() ? tr("No hostname given") : tr("Invalid hostname"); - return; - } - - ComPtr hostnameFactory; - HRESULT hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(), - IID_PPV_ARGS(&hostnameFactory)); - if (FAILED(hr)) { - reply->error = QDnsLookup::ResolverError; - reply->errorString = QLatin1String("Could not obtain hostname factory"); - return; - } - ComPtr host; - HStringReference hostNameRef((const wchar_t*)aceHostname.utf16()); - hr = hostnameFactory->CreateHostName(hostNameRef.Get(), &host); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr datagramSocketStatics; - hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_DatagramSocket).Get(), &datagramSocketStatics); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr *>> op; - hr = datagramSocketStatics->GetEndpointPairsAsync(host.Get(), - HString::MakeReference(L"0").Get(), - &op); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr> endpointPairs; - hr = QWinRTFunctions::await(op, endpointPairs.GetAddressOf(), QWinRTFunctions::YieldThread, 60 * 1000); - if (hr == E_NO_SUCH_HOST || !endpointPairs) { - reply->error = QDnsLookup::NotFoundError; - reply->errorString = tr("Host %1 could not be found.").arg(aceHostname); - return; - } - if (FAILED(hr)) { - reply->error = QDnsLookup::ServerFailureError; - reply->errorString = tr("Unknown error"); - return; - } - - unsigned int size; - hr = endpointPairs->get_Size(&size); - Q_ASSERT_SUCCEEDED(hr); - // endpoint pairs might contain duplicates so we temporarily store addresses in a QSet - QSet addresses; - for (unsigned int i = 0; i < size; ++i) { - ComPtr endpointpair; - hr = endpointPairs->GetAt(i, &endpointpair); - Q_ASSERT_SUCCEEDED(hr); - ComPtr remoteHost; - hr = endpointpair->get_RemoteHostName(&remoteHost); - Q_ASSERT_SUCCEEDED(hr); - HostNameType type; - hr = remoteHost->get_Type(&type); - Q_ASSERT_SUCCEEDED(hr); - if (type == HostNameType_Bluetooth || type == HostNameType_DomainName - || (requestType != QDnsLookup::ANY - && ((type == HostNameType_Ipv4 && requestType == QDnsLookup::AAAA) - || (type == HostNameType_Ipv6 && requestType == QDnsLookup::A)))) - continue; - - HString name; - hr = remoteHost->get_CanonicalName(name.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - UINT32 length; - PCWSTR rawString = name.GetRawBuffer(&length); - addresses.insert(QHostAddress(QString::fromWCharArray(rawString, length))); - } - for (const QHostAddress &address : qAsConst(addresses)) { - QDnsHostAddressRecord record; - record.d->name = aceHostname; - record.d->value = address; - reply->hostAddressRecords.append(record); - } -} - -QT_END_NAMESPACE diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index b9fc129685..0783c0751f 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -479,14 +479,10 @@ QHostAddress::QHostAddress(const QString &address) QHostAddress::QHostAddress(const struct sockaddr *sockaddr) : d(new QHostAddressPrivate) { -#ifndef Q_OS_WINRT if (sockaddr->sa_family == AF_INET) setAddress(htonl(((const sockaddr_in *)sockaddr)->sin_addr.s_addr)); else if (sockaddr->sa_family == AF_INET6) setAddress(((const sockaddr_in6 *)sockaddr)->sin6_addr.s6_addr); -#else - Q_UNUSED(sockaddr) -#endif } /*! @@ -659,15 +655,11 @@ bool QHostAddress::setAddress(const QString &address) void QHostAddress::setAddress(const struct sockaddr *sockaddr) { d.detach(); -#ifndef Q_OS_WINRT clear(); if (sockaddr->sa_family == AF_INET) setAddress(htonl(((const sockaddr_in *)sockaddr)->sin_addr.s_addr)); else if (sockaddr->sa_family == AF_INET6) setAddress(((const sockaddr_in6 *)sockaddr)->sin6_addr.s6_addr); -#else - Q_UNUSED(sockaddr) -#endif } /*! diff --git a/src/network/kernel/qnetworkinterface_winrt.cpp b/src/network/kernel/qnetworkinterface_winrt.cpp deleted file mode 100644 index 24ac3df52f..0000000000 --- a/src/network/kernel/qnetworkinterface_winrt.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtNetwork 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 "qnetworkinterface.h" -#include "qnetworkinterface_p.h" - -#ifndef QT_NO_NETWORKINTERFACE - -#include - -#include -#include -#include -#include -#include - -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Foundation::Collections; -using namespace ABI::Windows::Networking; -using namespace ABI::Windows::Networking::Connectivity; - -#include - -QT_BEGIN_NAMESPACE - -struct HostNameInfo { - GUID adapterId; - unsigned char prefixLength; - QString address; -}; - -uint QNetworkInterfaceManager::interfaceIndexFromName(const QString &name) -{ - // TBD - may not be possible - Q_UNUSED(name); - return 0; -} - -QString QNetworkInterfaceManager::interfaceNameFromIndex(uint index) -{ - // TBD - may not be possible - return QString::number(index); -} - -static QNetworkInterfacePrivate *interfaceFromProfile(IConnectionProfile *profile, QList *hostList) -{ - if (!profile) - return 0; - - QNetworkInterfacePrivate *iface = new QNetworkInterfacePrivate; - - NetworkConnectivityLevel connectivityLevel; - HRESULT hr = profile->GetNetworkConnectivityLevel(&connectivityLevel); - Q_ASSERT_SUCCEEDED(hr); - if (connectivityLevel != NetworkConnectivityLevel_None) - iface->flags = QNetworkInterface::IsUp | QNetworkInterface::IsRunning; - iface->flags |= QNetworkInterface::CanBroadcast; - - ComPtr adapter; - hr = profile->get_NetworkAdapter(&adapter); - // Indicates that no internet connection is available/the device is in airplane mode - if (hr == E_INVALIDARG) - return 0; - Q_ASSERT_SUCCEEDED(hr); - UINT32 type; - hr = adapter->get_IanaInterfaceType(&type); - Q_ASSERT_SUCCEEDED(hr); - if (type == 23) - iface->flags |= QNetworkInterface::IsPointToPoint; - GUID id; - hr = adapter->get_NetworkAdapterId(&id); - Q_ASSERT_SUCCEEDED(hr); - OLECHAR adapterName[39]={0}; - StringFromGUID2(id, adapterName, 39); - iface->name = QString::fromWCharArray(adapterName); - - // According to http://stackoverflow.com/questions/12936193/how-unique-is-the-ethernet-network-adapter-id-in-winrt-it-is-derived-from-the-m - // obtaining the MAC address using WinRT API is impossible - // iface->hardwareAddress = ? - - for (int i = 0; i < hostList->length(); ++i) { - const HostNameInfo hostInfo = hostList->at(i); - if (id != hostInfo.adapterId) - continue; - - QNetworkAddressEntry entry; - entry.setIp(QHostAddress(hostInfo.address)); - entry.setPrefixLength(hostInfo.prefixLength); - iface->addressEntries << entry; - - hostList->takeAt(i); - --i; - } - return iface; -} - -static QList interfaceListing() -{ - QList interfaces; - - QList hostList; - - ComPtr hostNameStatics; - HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_Connectivity_NetworkInformation).Get(), &hostNameStatics); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr> hostNames; - hr = hostNameStatics->GetHostNames(&hostNames); - Q_ASSERT_SUCCEEDED(hr); - if (!hostNames) - return interfaces; - - unsigned int hostNameCount; - hr = hostNames->get_Size(&hostNameCount); - Q_ASSERT_SUCCEEDED(hr); - for (unsigned i = 0; i < hostNameCount; ++i) { - HostNameInfo hostInfo; - ComPtr hostName; - hr = hostNames->GetAt(i, &hostName); - Q_ASSERT_SUCCEEDED(hr); - - HostNameType type; - hr = hostName->get_Type(&type); - Q_ASSERT_SUCCEEDED(hr); - if (type == HostNameType_DomainName) - continue; - - ComPtr ipInformation; - hr = hostName->get_IPInformation(&ipInformation); - Q_ASSERT_SUCCEEDED(hr); - ComPtr currentAdapter; - hr = ipInformation->get_NetworkAdapter(¤tAdapter); - Q_ASSERT_SUCCEEDED(hr); - - hr = currentAdapter->get_NetworkAdapterId(&hostInfo.adapterId); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr> prefixLengthReference; - hr = ipInformation->get_PrefixLength(&prefixLengthReference); - Q_ASSERT_SUCCEEDED(hr); - - hr = prefixLengthReference->get_Value(&hostInfo.prefixLength); - Q_ASSERT_SUCCEEDED(hr); - - // invalid prefixes - if ((type == HostNameType_Ipv4 && hostInfo.prefixLength > 32) - || (type == HostNameType_Ipv6 && hostInfo.prefixLength > 128)) - continue; - - HString name; - hr = hostName->get_CanonicalName(name.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - UINT32 length; - PCWSTR rawString = name.GetRawBuffer(&length); - hostInfo.address = QString::fromWCharArray(rawString, length); - - hostList << hostInfo; - } - - INetworkInformationStatics *networkInfoStatics; - hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_Connectivity_NetworkInformation).Get(), &networkInfoStatics); - Q_ASSERT_SUCCEEDED(hr); - ComPtr connectionProfile; - hr = networkInfoStatics->GetInternetConnectionProfile(&connectionProfile); - Q_ASSERT_SUCCEEDED(hr); - QNetworkInterfacePrivate *iface = interfaceFromProfile(connectionProfile.Get(), &hostList); - if (iface) { - iface->index = 0; - interfaces << iface; - } - - ComPtr> connectionProfiles; - hr = networkInfoStatics->GetConnectionProfiles(&connectionProfiles); - Q_ASSERT_SUCCEEDED(hr); - if (!connectionProfiles) - return interfaces; - - unsigned int size; - hr = connectionProfiles->get_Size(&size); - Q_ASSERT_SUCCEEDED(hr); - for (unsigned int i = 0; i < size; ++i) { - ComPtr profile; - hr = connectionProfiles->GetAt(i, &profile); - Q_ASSERT_SUCCEEDED(hr); - - iface = interfaceFromProfile(profile.Get(), &hostList); - if (iface) { - iface->index = i + 1; - interfaces << iface; - } - } - return interfaces; -} - -QList QNetworkInterfaceManager::scan() -{ - return interfaceListing(); -} - -QString QHostInfo::localDomainName() -{ - return QString(); -} - -QT_END_NAMESPACE - -#endif // QT_NO_NETWORKINTERFACE diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp index 9dfe32d5f7..c4dc33f66f 100644 --- a/src/network/kernel/qnetworkproxy_win.cpp +++ b/src/network/kernel/qnetworkproxy_win.cpp @@ -367,7 +367,6 @@ static QList parseServerList(const QNetworkProxyQuery &query, con return removeDuplicateProxies(result); } -#if !defined(Q_OS_WINRT) namespace { class QRegistryWatcher { Q_DISABLE_COPY_MOVE(QRegistryWatcher) @@ -421,7 +420,6 @@ private: QVector m_registryHandles; }; } // namespace -#endif // !defined(Q_OS_WINRT) class QWindowsSystemProxy { @@ -441,9 +439,7 @@ public: QStringList proxyServerList; QStringList proxyBypass; QList defaultResult; -#if !defined(Q_OS_WINRT) QRegistryWatcher proxySettingsWatcher; -#endif bool initialized; bool functional; bool isAutoConfig; @@ -477,9 +473,7 @@ void QWindowsSystemProxy::reset() void QWindowsSystemProxy::init() { bool proxySettingsChanged = false; -#if !defined(Q_OS_WINRT) proxySettingsChanged = proxySettingsWatcher.hasChanged(); -#endif if (initialized && !proxySettingsChanged) return; @@ -487,12 +481,10 @@ void QWindowsSystemProxy::init() reset(); -#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")); proxySettingsWatcher.addLocation(HKEY_LOCAL_MACHINE, QStringLiteral("Software\\Policies\\Microsoft\\Windows\\CurrentVersion\\Internet Settings")); -#endif // load the winhttp.dll library QSystemLibrary lib(L"winhttp"); diff --git a/src/network/network.pro b/src/network/network.pro index 7bd54fd12e..b1bfc51f90 100644 --- a/src/network/network.pro +++ b/src/network/network.pro @@ -21,9 +21,4 @@ include(ssl/ssl.pri) QMAKE_LIBS += $$QMAKE_LIBS_NETWORK -MODULE_WINRT_CAPABILITIES = \ - internetClient \ - internetClientServer \ - privateNetworkClientServer - load(qt_module) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 03d69d6204..0f9e22d131 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -948,7 +948,7 @@ void QAbstractSocketPrivate::resolveProxy(const QString &hostname, quint16 port) } #endif // !QT_NO_NETWORKPROXY -#if !defined(QT_NO_NETWORKPROXY) || defined(Q_OS_WINRT) +#if !defined(QT_NO_NETWORKPROXY) /*! \internal @@ -990,7 +990,7 @@ void QAbstractSocketPrivate::startConnectingByName(const QString &host) emit q->stateChanged(state); } -#endif // !QT_NO_NETWORKPROXY || Q_OS_WINRT +#endif // !QT_NO_NETWORKPROXY /*! \internal @@ -1713,7 +1713,6 @@ void QAbstractSocket::connectToHost(const QString &hostName, quint16 port, QIODevice::open(openMode); d->readChannelCount = d->writeChannelCount = 0; -#ifndef Q_OS_WINRT d->state = HostLookupState; emit stateChanged(d->state); @@ -1751,10 +1750,6 @@ void QAbstractSocket::connectToHost(const QString &hostName, quint16 port, (d->state == ConnectingState || d->state == HostLookupState) ? " (connection in progress)" : ""); #endif -#else // !Q_OS_WINRT - // On WinRT we should always connect by name. Lookup and proxy handling are done by the API. - d->startConnectingByName(hostName); -#endif } /*! \overload diff --git a/src/network/socket/qabstractsocketengine.cpp b/src/network/socket/qabstractsocketengine.cpp index 44139ff81d..50462fb11f 100644 --- a/src/network/socket/qabstractsocketengine.cpp +++ b/src/network/socket/qabstractsocketengine.cpp @@ -39,11 +39,7 @@ #include "qabstractsocketengine_p.h" -#ifndef Q_OS_WINRT #include "qnativesocketengine_p.h" -#else -#include "qnativesocketengine_winrt_p.h" -#endif #include "qmutex.h" #include "qnetworkproxy.h" diff --git a/src/network/socket/qlocalserver.cpp b/src/network/socket/qlocalserver.cpp index 5ca2db70b9..251b785dfd 100644 --- a/src/network/socket/qlocalserver.cpp +++ b/src/network/socket/qlocalserver.cpp @@ -195,7 +195,7 @@ QLocalServer::SocketOptions QLocalServer::socketOptions() const \l{https://msdn.microsoft.com/en-us/library/windows/desktop/ms740522(v=vs.85).aspx} {Winsock 2 Socket Handle}. - \li With WinRT and on INTEGRITY, the returned value is the + \li On INTEGRITY, the returned value is the QTcpServer socket descriptor and the type is defined by \l{QTcpServer::socketDescriptor}{socketDescriptor}. diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp index 60e753e2e2..ab3fcecf66 100644 --- a/src/network/socket/qlocalsocket.cpp +++ b/src/network/socket/qlocalsocket.cpp @@ -135,7 +135,7 @@ QT_BEGIN_NAMESPACE \l{https://msdn.microsoft.com/en-us/library/windows/desktop/ms740522(v=vs.85).aspx} {Winsock 2 Socket Handle}. - \li With WinRT and on INTEGRITY, the returned value is the + \li On INTEGRITY, the returned value is the QTcpSocket socket descriptor and the type is defined by \l{QTcpSocket::socketDescriptor}{socketDescriptor}. diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index ad625b758e..6667a6b097 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -195,7 +195,7 @@ QNativeSocketEnginePrivate::QNativeSocketEnginePrivate() : writeNotifier(nullptr), exceptNotifier(nullptr) { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) QSysInfo::machineHostName(); // this initializes ws2_32.dll #endif } diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp deleted file mode 100644 index 2eb2141fee..0000000000 --- a/src/network/socket/qnativesocketengine_winrt.cpp +++ /dev/null @@ -1,1815 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtNetwork 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 - -#include "qnativesocketengine_winrt_p.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#ifndef QT_NO_SSL -#include -#endif - -#include -#include -#include -#include -#include -#include -#include - -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Foundation::Collections; -using namespace ABI::Windows::Storage::Streams; -using namespace ABI::Windows::Networking; -using namespace ABI::Windows::Networking::Connectivity; -using namespace ABI::Windows::Networking::Sockets; -#if _MSC_VER >= 1900 -using namespace ABI::Windows::Security::EnterpriseData; -#endif - -typedef ITypedEventHandler ClientConnectedHandler; -typedef ITypedEventHandler DatagramReceivedHandler; -typedef IAsyncOperationWithProgressCompletedHandler SocketReadCompletedHandler; -typedef IAsyncOperationWithProgressCompletedHandler SocketWriteCompletedHandler; -typedef IAsyncOperationWithProgress IAsyncBufferOperation; - -QT_BEGIN_NAMESPACE - -Q_LOGGING_CATEGORY(lcNetworkSocket, "qt.network.socket"); -Q_LOGGING_CATEGORY(lcNetworkSocketVerbose, "qt.network.socket.verbose"); - -#if _MSC_VER >= 1900 -static HRESULT qt_winrt_try_create_thread_network_context(QString host, ComPtr &context) -{ - HRESULT hr; - ComPtr protectionPolicyManager; - - hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Security_EnterpriseData_ProtectionPolicyManager).Get(), - &protectionPolicyManager); - RETURN_HR_IF_FAILED("Could not access ProtectionPolicyManager statics."); - - ComPtr hostNameFactory; - hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(), - &hostNameFactory); - RETURN_HR_IF_FAILED("Could not access HostName factory."); - - ComPtr hostName; - HStringReference hostRef(reinterpret_cast(host.utf16()), host.length()); - hr = hostNameFactory->CreateHostName(hostRef.Get(), &hostName); - RETURN_HR_IF_FAILED("Could not create hostname."); - - ComPtr> op; - hr = protectionPolicyManager->GetPrimaryManagedIdentityForNetworkEndpointAsync(hostName.Get(), &op); - RETURN_HR_IF_FAILED("Could not get identity operation."); - - HSTRING hIdentity; - hr = QWinRTFunctions::await(op, &hIdentity); - RETURN_HR_IF_FAILED("Could not wait for identity operation."); - - // Implies there is no need for a network context for this address - if (hIdentity == nullptr) - return S_OK; - - hr = protectionPolicyManager->CreateCurrentThreadNetworkContext(hIdentity, &context); - RETURN_HR_IF_FAILED("Could not create thread network context"); - - return S_OK; -} -#endif // _MSC_VER >= 1900 - -typedef QHash TcpSocketHash; - -struct SocketHandler -{ - SocketHandler() : socketCount(0) {} - qintptr socketCount; - TcpSocketHash pendingTcpSockets; -}; - -Q_GLOBAL_STATIC(SocketHandler, gSocketHandler) - -struct SocketGlobal -{ - SocketGlobal() - { - HRESULT hr; - hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Storage_Streams_Buffer).Get(), - &bufferFactory); - Q_ASSERT_SUCCEEDED(hr); - } - - ComPtr bufferFactory; -}; -Q_GLOBAL_STATIC(SocketGlobal, g) - -#define READ_BUFFER_SIZE 65536 - -static inline QString qt_QStringFromHString(const HString &string) -{ - UINT32 length; - PCWSTR rawString = string.GetRawBuffer(&length); - return QString::fromWCharArray(rawString, length); -} - -class SocketEngineWorker : public QObject -{ - Q_OBJECT -public: - SocketEngineWorker(QNativeSocketEnginePrivate *engine) - : enginePrivate(engine) - { - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << engine; - } - - ~SocketEngineWorker() - { - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO; - if (Q_UNLIKELY(initialReadOp)) { - qCDebug(lcNetworkSocket) << Q_FUNC_INFO << "Closing initial read operation"; - ComPtr info; - HRESULT hr = initialReadOp.As(&info); - Q_ASSERT_SUCCEEDED(hr); - if (info) { - hr = info->Cancel(); - Q_ASSERT_SUCCEEDED(hr); - hr = info->Close(); - Q_ASSERT_SUCCEEDED(hr); - } - } - - if (readOp) { - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << "Closing read operation"; - ComPtr info; - HRESULT hr = readOp.As(&info); - Q_ASSERT_SUCCEEDED(hr); - if (info) { - hr = info->Cancel(); - Q_ASSERT_SUCCEEDED(hr); - hr = info->Close(); - Q_ASSERT_SUCCEEDED(hr); - } - } - - if (connectOp) { - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << "Closing connect operation"; - ComPtr info; - HRESULT hr = connectOp.As(&info); - Q_ASSERT_SUCCEEDED(hr); - if (info) { - hr = info->Cancel(); - Q_ASSERT_SUCCEEDED(hr); - hr = info->Close(); - Q_ASSERT_SUCCEEDED(hr); - } - } - } - -signals: - void connectOpFinished(bool success, QAbstractSocket::SocketError error, WinRTSocketEngine::ErrorString errorString); - void newDataReceived(); - void socketErrorOccured(QAbstractSocket::SocketError error); - -public: - void startReading() - { - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO; - ComPtr buffer; - HRESULT hr = g->bufferFactory->Create(READ_BUFFER_SIZE, &buffer); - Q_ASSERT_SUCCEEDED(hr); - ComPtr stream; - hr = tcpSocket->get_InputStream(&stream); - Q_ASSERT_SUCCEEDED(hr); - hr = stream->ReadAsync(buffer.Get(), READ_BUFFER_SIZE, InputStreamOptions_Partial, initialReadOp.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - enginePrivate->socketState = QAbstractSocket::ConnectedState; - hr = initialReadOp->put_Completed(Callback(this, &SocketEngineWorker::onReadyRead).Get()); - Q_ASSERT_SUCCEEDED(hr); - } - - HRESULT onConnectOpFinished(IAsyncAction *action, AsyncStatus) - { - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO; - HRESULT hr = action->GetResults(); - if (FAILED(hr)) { - if (hr == HRESULT_FROM_WIN32(WSAETIMEDOUT)) { - emit connectOpFinished(false, QAbstractSocket::NetworkError, WinRTSocketEngine::ConnectionTimeOutErrorString); - return S_OK; - } else if (hr == HRESULT_FROM_WIN32(WSAEHOSTUNREACH)) { - emit connectOpFinished(false, QAbstractSocket::HostNotFoundError, WinRTSocketEngine::HostUnreachableErrorString); - return S_OK; - } else if (hr == HRESULT_FROM_WIN32(WSAECONNREFUSED)) { - emit connectOpFinished(false, QAbstractSocket::ConnectionRefusedError, WinRTSocketEngine::ConnectionRefusedErrorString); - return S_OK; - } else { - emit connectOpFinished(false, QAbstractSocket::UnknownSocketError, WinRTSocketEngine::UnknownSocketErrorString); - return S_OK; - } - } - - // The callback might be triggered several times if we do not cancel/reset it here - if (connectOp) { - ComPtr info; - hr = connectOp.As(&info); - Q_ASSERT_SUCCEEDED(hr); - if (info) { - hr = info->Cancel(); - Q_ASSERT_SUCCEEDED(hr); - hr = info->Close(); - Q_ASSERT_SUCCEEDED(hr); - } - hr = connectOp.Reset(); - Q_ASSERT_SUCCEEDED(hr); - } - - emit connectOpFinished(true, QAbstractSocket::UnknownSocketError, WinRTSocketEngine::UnknownSocketErrorString); - return S_OK; - } - - HRESULT OnNewDatagramReceived(IDatagramSocket *, IDatagramSocketMessageReceivedEventArgs *args) - { - qCDebug(lcNetworkSocketVerbose) << this << Q_FUNC_INFO; - WinRtDatagram datagram; - QHostAddress returnAddress; - ComPtr remoteHost; - HRESULT hr = args->get_RemoteAddress(&remoteHost); - RETURN_OK_IF_FAILED("Could not obtain remote host"); - HString remoteHostString; - hr = remoteHost->get_CanonicalName(remoteHostString.GetAddressOf()); - RETURN_OK_IF_FAILED("Could not obtain remote host's canonical name"); - returnAddress.setAddress(qt_QStringFromHString(remoteHostString)); - datagram.header.senderAddress = returnAddress; - HString remotePort; - hr = args->get_RemotePort(remotePort.GetAddressOf()); - RETURN_OK_IF_FAILED("Could not obtain remote port"); - datagram.header.senderPort = qt_QStringFromHString(remotePort).toInt(); - - ComPtr reader; - hr = args->GetDataReader(&reader); - RETURN_OK_IF_FAILED("Could not obtain data reader"); - quint32 length; - hr = reader->get_UnconsumedBufferLength(&length); - RETURN_OK_IF_FAILED("Could not obtain unconsumed buffer length"); - datagram.data.resize(length); - hr = reader->ReadBytes(length, reinterpret_cast(datagram.data.data())); - RETURN_OK_IF_FAILED("Could not read datagram"); - - QMutexLocker locker(&mutex); - // Notify the engine about new datagrams being present at the next event loop iteration - if (emitDataReceived) - emit newDataReceived(); - pendingDatagrams << datagram; - - return S_OK; - } - - HRESULT onReadyRead(IAsyncBufferOperation *asyncInfo, AsyncStatus status) - { - qCDebug(lcNetworkSocketVerbose) << this << Q_FUNC_INFO; - if (asyncInfo == initialReadOp.Get()) { - initialReadOp.Reset(); - } else if (asyncInfo == readOp.Get()) { - readOp.Reset(); - } else { - Q_ASSERT(false); - } - - // A read in UnconnectedState will close the socket and return -1 and thus tell the caller, - // that the connection was closed. The socket cannot be closed here, as the subsequent read - // might fail then. - if (status == Error || status == Canceled) { - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << "Remote host closed"; - emit socketErrorOccured(QAbstractSocket::RemoteHostClosedError); - return S_OK; - } - - ComPtr buffer; - HRESULT hr = asyncInfo->GetResults(&buffer); - if (FAILED(hr)) { - qErrnoWarning(hr, "Failed to get read results buffer"); - emit socketErrorOccured(QAbstractSocket::UnknownSocketError); - return S_OK; - } - - UINT32 bufferLength; - hr = buffer->get_Length(&bufferLength); - if (FAILED(hr)) { - qErrnoWarning(hr, "Failed to get buffer length"); - emit socketErrorOccured(QAbstractSocket::UnknownSocketError); - return S_OK; - } - // A zero sized buffer length signals, that the remote host closed the connection. The socket - // cannot be closed though, as the following read might have socket descriptor -1 and thus and - // the closing of the socket won't be communicated to the caller. So only the error is set. The - // actual socket close happens inside of read. - if (!bufferLength) { - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << "Remote host closed"; - emit socketErrorOccured(QAbstractSocket::RemoteHostClosedError); - return S_OK; - } - - ComPtr byteArrayAccess; - hr = buffer.As(&byteArrayAccess); - if (FAILED(hr)) { - qErrnoWarning(hr, "Failed to get cast buffer"); - emit socketErrorOccured(QAbstractSocket::UnknownSocketError); - return S_OK; - } - byte *data; - hr = byteArrayAccess->Buffer(&data); - if (FAILED(hr)) { - qErrnoWarning(hr, "Failed to access buffer data"); - emit socketErrorOccured(QAbstractSocket::UnknownSocketError); - return S_OK; - } - - QByteArray newData(reinterpret_cast(data), qint64(bufferLength)); - - QMutexLocker readLocker(&mutex); - emit newDataReceived(); - pendingData.append(newData); - readLocker.unlock(); - - hr = QEventDispatcherWinRT::runOnXamlThread([buffer, this]() { - UINT32 readBufferLength; - ComPtr stream; - HRESULT hr = tcpSocket->get_InputStream(&stream); - if (FAILED(hr)) { - qErrnoWarning(hr, "Failed to obtain input stream"); - emit socketErrorOccured(QAbstractSocket::UnknownSocketError); - return S_OK; - } - - // Reuse the stream buffer - hr = buffer->get_Capacity(&readBufferLength); - if (FAILED(hr)) { - qErrnoWarning(hr, "Failed to get buffer capacity"); - emit socketErrorOccured(QAbstractSocket::UnknownSocketError); - return S_OK; - } - hr = buffer->put_Length(0); - if (FAILED(hr)) { - qErrnoWarning(hr, "Failed to set buffer length"); - emit socketErrorOccured(QAbstractSocket::UnknownSocketError); - return S_OK; - } - - hr = stream->ReadAsync(buffer.Get(), readBufferLength, InputStreamOptions_Partial, &readOp); - if (FAILED(hr)) { - qErrnoWarning(hr, "onReadyRead(): Could not read into socket stream buffer."); - emit socketErrorOccured(QAbstractSocket::UnknownSocketError); - return S_OK; - } - hr = readOp->put_Completed(Callback(this, &SocketEngineWorker::onReadyRead).Get()); - if (FAILED(hr)) { - qErrnoWarning(hr, "onReadyRead(): Failed to set socket read callback."); - emit socketErrorOccured(QAbstractSocket::UnknownSocketError); - return S_OK; - } - return S_OK; - }); - Q_ASSERT_SUCCEEDED(hr); - return S_OK; - } - - void setTcpSocket(ComPtr socket) { tcpSocket = socket; } - -private: - friend class QNativeSocketEngine; - ComPtr tcpSocket; - - QList pendingDatagrams; - bool emitDataReceived = true; - QByteArray pendingData; - - // Protects pendingData/pendingDatagrams which are accessed from native callbacks - QMutex mutex; - - ComPtr connectOp; - ComPtr> initialReadOp; - ComPtr> readOp; - - QNativeSocketEnginePrivate *enginePrivate; -}; - -static QByteArray socketDescription(const QAbstractSocketEngine *s) -{ - QByteArray result; - if (const QObject *o = s->parent()) { - const QString name = o->objectName(); - if (!name.isEmpty()) { - result += '"'; - result += name.toLocal8Bit(); - result += "\"/"; - } - result += o->metaObject()->className(); - } - return result; -} - -// Common constructs -#define Q_CHECK_VALID_SOCKETLAYER(function, returnValue) do { \ - if (!isValid()) { \ - qWarning(""#function" was called on an uninitialized socket device"); \ - return returnValue; \ - } } while (0) -#define Q_CHECK_INVALID_SOCKETLAYER(function, returnValue) do { \ - if (isValid()) { \ - qWarning(""#function" was called on an already initialized socket device"); \ - return returnValue; \ - } } while (0) -#define Q_CHECK_STATE(function, checkState, returnValue) do { \ - if (d->socketState != (checkState)) { \ - qWarning(""#function" was not called in "#checkState); \ - return (returnValue); \ - } } while (0) -#define Q_CHECK_NOT_STATE(function, checkState, returnValue) do { \ - if (d->socketState == (checkState)) { \ - qWarning(""#function" was called in "#checkState); \ - return (returnValue); \ - } } while (0) -#define Q_CHECK_STATES(function, state1, state2, returnValue) do { \ - if (d->socketState != (state1) && d->socketState != (state2)) { \ - qWarning(""#function" was called" \ - " not in "#state1" or "#state2); \ - return (returnValue); \ - } } while (0) -#define Q_CHECK_STATES3(function, state1, state2, state3, returnValue) do { \ - if (d->socketState != (state1) && d->socketState != (state2) && d->socketState != (state3)) { \ - qWarning(""#function" was called" \ - " not in "#state1", "#state2" or "#state3); \ - return (returnValue); \ - } } while (0) -#define Q_CHECK_TYPE(function, type, returnValue) do { \ - if (d->socketType != (type)) { \ - qWarning(#function" was called by a" \ - " socket other than "#type""); \ - return (returnValue); \ - } } while (0) -#define Q_TR(a) QT_TRANSLATE_NOOP(QNativeSocketEngine, a) - -template -static AsyncStatus opStatus(const ComPtr &op) -{ - ComPtr info; - HRESULT hr = op.As(&info); - Q_ASSERT_SUCCEEDED(hr); - AsyncStatus status; - hr = info->get_Status(&status); - Q_ASSERT_SUCCEEDED(hr); - return status; -} - -static qint64 writeIOStream(ComPtr stream, const char *data, qint64 len) -{ - qCDebug(lcNetworkSocket) << Q_FUNC_INFO << data << len; - ComPtr buffer; - HRESULT hr = g->bufferFactory->Create(len, &buffer); - Q_ASSERT_SUCCEEDED(hr); - hr = buffer->put_Length(len); - Q_ASSERT_SUCCEEDED(hr); - ComPtr byteArrayAccess; - hr = buffer.As(&byteArrayAccess); - Q_ASSERT_SUCCEEDED(hr); - byte *bytes; - hr = byteArrayAccess->Buffer(&bytes); - Q_ASSERT_SUCCEEDED(hr); - memcpy(bytes, data, len); - ComPtr> op; - hr = stream->WriteAsync(buffer.Get(), &op); - RETURN_IF_FAILED("Failed to write to stream", return -1); - UINT32 bytesWritten; - hr = QWinRTFunctions::await(op, &bytesWritten); - RETURN_IF_FAILED("Failed to write to stream", return -1); - return bytesWritten; -} - -QNativeSocketEngine::QNativeSocketEngine(QObject *parent) - : QAbstractSocketEngine(*new QNativeSocketEnginePrivate(), parent) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << parent; - qRegisterMetaType(); - qRegisterMetaType(); - Q_D(QNativeSocketEngine); -#ifndef QT_NO_SSL - if (parent) - d->sslSocket = qobject_cast(parent->parent()); -#endif - - connect(this, &QNativeSocketEngine::connectionReady, - this, &QNativeSocketEngine::connectionNotification, Qt::QueuedConnection); - connect(this, &QNativeSocketEngine::readReady, - this, &QNativeSocketEngine::processReadReady, Qt::QueuedConnection); - connect(this, &QNativeSocketEngine::writeReady, - this, &QNativeSocketEngine::writeNotification, Qt::QueuedConnection); - connect(d->worker, &SocketEngineWorker::connectOpFinished, - this, &QNativeSocketEngine::handleConnectOpFinished, Qt::QueuedConnection); - connect(d->worker, &SocketEngineWorker::newDataReceived, this, &QNativeSocketEngine::handleNewData, Qt::QueuedConnection); - connect(d->worker, &SocketEngineWorker::socketErrorOccured, - this, &QNativeSocketEngine::handleTcpError, Qt::QueuedConnection); -} - -QNativeSocketEngine::~QNativeSocketEngine() -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO; - close(); -} - -bool QNativeSocketEngine::initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << type << protocol; - Q_D(QNativeSocketEngine); - if (isValid()) - close(); - - // Create the socket - if (!d->createNewSocket(type, protocol)) - return false; - - if (type == QAbstractSocket::UdpSocket) { - // Set the broadcasting flag if it's a UDP socket. - if (!setOption(BroadcastSocketOption, 1)) { - d->setError(QAbstractSocket::UnsupportedSocketOperationError, - WinRTSocketEngine::BroadcastingInitFailedErrorString); - close(); - return false; - } - - // Set some extra flags that are interesting to us, but accept failure - setOption(ReceivePacketInformation, 1); - setOption(ReceiveHopLimit, 1); - } - - - // Make sure we receive out-of-band data - if (type == QAbstractSocket::TcpSocket - && !setOption(ReceiveOutOfBandData, 1)) { - qWarning("QNativeSocketEngine::initialize unable to inline out-of-band data"); - } - - - d->socketType = type; - d->socketProtocol = protocol; - return true; -} - -bool QNativeSocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << socketDescriptor << socketState; - Q_D(QNativeSocketEngine); - - if (isValid()) - close(); - - // Currently, only TCP sockets are initialized this way. - IStreamSocket *socket = gSocketHandler->pendingTcpSockets.take(socketDescriptor); - d->socketDescriptor = qintptr(socket); - d->socketType = QAbstractSocket::TcpSocket; - - if (!d->socketDescriptor || !d->fetchConnectionParameters()) { - d->setError(QAbstractSocket::UnsupportedSocketOperationError, - WinRTSocketEngine::InvalidSocketErrorString); - d->socketDescriptor = -1; - return false; - } - - // Start processing incoming data - if (d->socketType == QAbstractSocket::TcpSocket) { - HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d, socket, this]() { - d->worker->setTcpSocket(socket); - d->worker->startReading(); - return S_OK; - }); - if (FAILED(hr)) - return false; - } else { - d->socketState = socketState; - } - - return true; -} - -qintptr QNativeSocketEngine::socketDescriptor() const -{ - Q_D(const QNativeSocketEngine); - return d->socketDescriptor; -} - -bool QNativeSocketEngine::isValid() const -{ - Q_D(const QNativeSocketEngine); - return d->socketDescriptor != -1; -} - -bool QNativeSocketEngine::connectToHost(const QHostAddress &address, quint16 port) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << address << port; - Q_D(QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::connectToHost(), false); - Q_CHECK_STATES3(QNativeSocketEngine::connectToHost(), QAbstractSocket::BoundState, - QAbstractSocket::UnconnectedState, QAbstractSocket::ConnectingState, false); - const QString addressString = address.toString(); - return connectToHostByName(addressString, port); -} - -bool QNativeSocketEngine::connectToHostByName(const QString &name, quint16 port) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << name << port; - Q_D(QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::connectToHostByName(), false); - Q_CHECK_STATES3(QNativeSocketEngine::connectToHostByName(), QAbstractSocket::BoundState, - QAbstractSocket::UnconnectedState, QAbstractSocket::ConnectingState, false); - HRESULT hr; - -#if _MSC_VER >= 1900 - ComPtr networkContext; - if (!qEnvironmentVariableIsEmpty("QT_WINRT_USE_THREAD_NETWORK_CONTEXT")) { - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << "Creating network context"; - hr = qt_winrt_try_create_thread_network_context(name, networkContext); - if (FAILED(hr)) { - setError(QAbstractSocket::ConnectionRefusedError, QLatin1String("Could not create thread network context.")); - d->socketState = QAbstractSocket::ConnectedState; - return true; - } - } -#endif // _MSC_VER >= 1900 - - HStringReference hostNameRef(reinterpret_cast(name.utf16())); - ComPtr hostNameFactory; - hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(), - &hostNameFactory); - Q_ASSERT_SUCCEEDED(hr); - ComPtr remoteHost; - hr = hostNameFactory->CreateHostName(hostNameRef.Get(), &remoteHost); - RETURN_FALSE_IF_FAILED("QNativeSocketEngine::connectToHostByName: Could not create hostname."); - - const QString portString = QString::number(port); - HStringReference portReference(reinterpret_cast(portString.utf16())); - if (d->socketType == QAbstractSocket::TcpSocket) - hr = d->tcpSocket()->ConnectAsync(remoteHost.Get(), portReference.Get(), &d->worker->connectOp); - else if (d->socketType == QAbstractSocket::UdpSocket) - hr = d->udpSocket()->ConnectAsync(remoteHost.Get(), portReference.Get(), &d->worker->connectOp); - if (hr == E_ACCESSDENIED) { - qErrnoWarning(hr, "QNativeSocketEngine::connectToHostByName: Unable to connect to host (%s:%hu/%s). " - "Please check your manifest capabilities.", - qPrintable(name), port, socketDescription(this).constData()); - return false; - } - Q_ASSERT_SUCCEEDED(hr); - -#if _MSC_VER >= 1900 - if (networkContext != nullptr) { - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << "Closing network context"; - ComPtr networkContextCloser; - hr = networkContext.As(&networkContextCloser); - Q_ASSERT_SUCCEEDED(hr); - hr = networkContextCloser->Close(); - Q_ASSERT_SUCCEEDED(hr); - } -#endif // _MSC_VER >= 1900 - - d->socketState = QAbstractSocket::ConnectingState; - QEventDispatcherWinRT::runOnXamlThread([d, &hr]() { - hr = d->worker->connectOp->put_Completed(Callback( - d->worker, &SocketEngineWorker::onConnectOpFinished).Get()); - RETURN_OK_IF_FAILED("connectToHostByName: Could not register \"connectOp\" callback"); - return S_OK; - }); - if (FAILED(hr)) - return false; - - return d->socketState == QAbstractSocket::ConnectedState; -} - -bool QNativeSocketEngine::bind(const QHostAddress &address, quint16 port) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << address << port; - Q_D(QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::bind(), false); - Q_CHECK_STATE(QNativeSocketEngine::bind(), QAbstractSocket::UnconnectedState, false); - - HRESULT hr; - // runOnXamlThread may only return S_OK (will assert otherwise) so no need to check its result. - // hr is set inside the lambda though. If an error occurred hr will point that out. - bool specificErrorSet = false; - QEventDispatcherWinRT::runOnXamlThread([address, d, &hr, port, &specificErrorSet, this]() { - ComPtr hostAddress; - - if (address != QHostAddress::Any && address != QHostAddress::AnyIPv4 && address != QHostAddress::AnyIPv6) { - ComPtr hostNameFactory; - hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(), - &hostNameFactory); - RETURN_OK_IF_FAILED("QNativeSocketEngine::bind: Could not obtain hostname factory"); - const QString addressString = address.toString(); - HStringReference addressRef(reinterpret_cast(addressString.utf16())); - hr = hostNameFactory->CreateHostName(addressRef.Get(), &hostAddress); - RETURN_OK_IF_FAILED("QNativeSocketEngine::bind: Could not create hostname."); - } - - QString portQString = port ? QString::number(port) : QString(); - HStringReference portString(reinterpret_cast(portQString.utf16())); - - ComPtr op; - if (d->socketType == QAbstractSocket::TcpSocket) { - if (!d->tcpListener) { - hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_StreamSocketListener).Get(), - &d->tcpListener); - RETURN_OK_IF_FAILED("QNativeSocketEngine::bind: Could not create tcp listener"); - } - - hr = d->tcpListener->add_ConnectionReceived( - Callback(d, &QNativeSocketEnginePrivate::handleClientConnection).Get(), - &d->connectionToken); - RETURN_OK_IF_FAILED("QNativeSocketEngine::bind: Could not register client connection callback"); - hr = d->tcpListener->BindEndpointAsync(hostAddress.Get(), portString.Get(), &op); - } else if (d->socketType == QAbstractSocket::UdpSocket) { - hr = d->udpSocket()->BindEndpointAsync(hostAddress.Get(), portString.Get(), &op); - } - if (hr == E_ACCESSDENIED) { - qErrnoWarning(hr, "Unable to bind socket (%s:%hu/%s). Please check your manifest capabilities.", - qPrintable(address.toString()), port, socketDescription(this).constData()); - d->setError(QAbstractSocket::SocketAccessError, - WinRTSocketEngine::AccessErrorString); - d->socketState = QAbstractSocket::UnconnectedState; - specificErrorSet = true; - return S_OK; - } - RETURN_OK_IF_FAILED("QNativeSocketEngine::bind: Unable to bind socket"); - - hr = QWinRTFunctions::await(op); - if (hr == 0x80072741) { // The requested address is not valid in its context - d->setError(QAbstractSocket::SocketAddressNotAvailableError, - WinRTSocketEngine::AddressNotAvailableErrorString); - d->socketState = QAbstractSocket::UnconnectedState; - specificErrorSet = true; - return S_OK; - // Only one usage of each socket address (protocol/network address/port) is normally permitted - } else if (hr == 0x80072740) { - d->setError(QAbstractSocket::AddressInUseError, - WinRTSocketEngine::AddressInuseErrorString); - d->socketState = QAbstractSocket::UnconnectedState; - specificErrorSet = true; - return S_OK; - } - RETURN_OK_IF_FAILED("QNativeSocketEngine::bind: Could not wait for bind to finish"); - return S_OK; - }); - if (FAILED(hr)) { - if (!specificErrorSet) { - d->setError(QAbstractSocket::UnknownSocketError, - WinRTSocketEngine::UnknownSocketErrorString); - d->socketState = QAbstractSocket::UnconnectedState; - } - return false; - } - - d->socketState = QAbstractSocket::BoundState; - return d->fetchConnectionParameters(); -} - -bool QNativeSocketEngine::listen() -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO; - Q_D(QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::listen(), false); - Q_CHECK_STATE(QNativeSocketEngine::listen(), QAbstractSocket::BoundState, false); -#if QT_CONFIG(sctp) - Q_CHECK_TYPES(QNativeSocketEngine::listen(), QAbstractSocket::TcpSocket, - QAbstractSocket::SctpSocket, false); -#else - Q_CHECK_TYPE(QNativeSocketEngine::listen(), QAbstractSocket::TcpSocket, false); -#endif - - if (d->tcpListener && d->socketDescriptor != -1) { - d->socketState = QAbstractSocket::ListeningState; - return true; - } - return false; -} - -int QNativeSocketEngine::accept() -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO; - Q_D(QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::accept(), -1); - Q_CHECK_STATE(QNativeSocketEngine::accept(), QAbstractSocket::ListeningState, -1); -#if QT_CONFIG(sctp) - Q_CHECK_TYPES(QNativeSocketEngine::accept(), QAbstractSocket::TcpSocket, - QAbstractSocket::SctpSocket, -1); -#else - Q_CHECK_TYPE(QNativeSocketEngine::accept(), QAbstractSocket::TcpSocket, -1); -#endif - - if (d->socketDescriptor == -1 || d->pendingConnections.isEmpty()) { - d->setError(QAbstractSocket::TemporaryError, WinRTSocketEngine::TemporaryErrorString); - return -1; - } - - if (d->socketType == QAbstractSocket::TcpSocket) { - IStreamSocket *socket = d->pendingConnections.takeFirst(); - - SocketHandler *handler = gSocketHandler(); - handler->pendingTcpSockets.insert(++handler->socketCount, socket); - return handler->socketCount; - } - - return -1; -} - -void QNativeSocketEngine::close() -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO; - Q_D(QNativeSocketEngine); - - if (d->closingDown) - return; - - if (d->pendingReadNotification) { - // We use QPointer here to see if this QNativeSocketEngine was deleted as a result of - // finishing and cleaning up a network request when calling "processReadReady". - QPointer alive(this); - processReadReady(); - if (alive.isNull()) - return; - } - - d->closingDown = true; - - d->notifyOnRead = false; - d->notifyOnWrite = false; - d->notifyOnException = false; - d->emitReadReady = false; - - HRESULT hr; - if (d->socketType == QAbstractSocket::TcpSocket) { - hr = QEventDispatcherWinRT::runOnXamlThread([d]() { - HRESULT hr; - // To close the connection properly (not with a hard reset) all pending read operation have to - // be finished or cancelled. The API isn't available on Windows 8.1 though. - ComPtr socket3; - hr = d->tcpSocket()->QueryInterface(IID_PPV_ARGS(&socket3)); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr action; - hr = socket3->CancelIOAsync(&action); - Q_ASSERT_SUCCEEDED(hr); - hr = QWinRTFunctions::await(action, QWinRTFunctions::YieldThread, 5000); - // If there is no pending IO (no read established before) the function will fail with - // "function was called at an unexpected time" which is fine. - // Timeout is fine as well. The result will be the socket being hard reset instead of - // being closed gracefully - if (hr != E_ILLEGAL_METHOD_CALL && hr != ERROR_TIMEOUT) - Q_ASSERT_SUCCEEDED(hr); - return S_OK; - }); - Q_ASSERT_SUCCEEDED(hr); - } - - if (d->socketDescriptor != -1) { - ComPtr socket; - if (d->socketType == QAbstractSocket::TcpSocket) { - hr = d->tcpSocket()->QueryInterface(IID_PPV_ARGS(&socket)); - Q_ASSERT_SUCCEEDED(hr); - hr = d->tcpSocket()->Release(); - Q_ASSERT_SUCCEEDED(hr); - } else if (d->socketType == QAbstractSocket::UdpSocket) { - hr = d->udpSocket()->QueryInterface(IID_PPV_ARGS(&socket)); - Q_ASSERT_SUCCEEDED(hr); - hr = d->udpSocket()->Release(); - Q_ASSERT_SUCCEEDED(hr); - } - - if (socket) { - hr = socket->Close(); - Q_ASSERT_SUCCEEDED(hr); - } - d->socketDescriptor = -1; - } - d->socketState = QAbstractSocket::UnconnectedState; - d->hasSetSocketError = false; - d->localPort = 0; - d->localAddress.clear(); - d->peerPort = 0; - d->peerAddress.clear(); - d->inboundStreamCount = d->outboundStreamCount = 0; -} - -bool QNativeSocketEngine::joinMulticastGroup(const QHostAddress &groupAddress, const QNetworkInterface &iface) -{ - Q_D(QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::joinMulticastGroup(), false); - Q_CHECK_STATE(QNativeSocketEngine::joinMulticastGroup(), QAbstractSocket::BoundState, false); - Q_CHECK_TYPE(QNativeSocketEngine::joinMulticastGroup(), QAbstractSocket::UdpSocket, false); - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << groupAddress << iface; - Q_UNIMPLEMENTED(); - return false; -} - -bool QNativeSocketEngine::leaveMulticastGroup(const QHostAddress &groupAddress, const QNetworkInterface &iface) -{ - Q_D(QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::leaveMulticastGroup(), false); - Q_CHECK_STATE(QNativeSocketEngine::leaveMulticastGroup(), QAbstractSocket::BoundState, false); - Q_CHECK_TYPE(QNativeSocketEngine::leaveMulticastGroup(), QAbstractSocket::UdpSocket, false); - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << groupAddress << iface; - Q_UNIMPLEMENTED(); - return false; -} - -QNetworkInterface QNativeSocketEngine::multicastInterface() const -{ - Q_D(const QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::multicastInterface(), QNetworkInterface()); - Q_CHECK_TYPE(QNativeSocketEngine::multicastInterface(), QAbstractSocket::UdpSocket, QNetworkInterface()); - Q_UNIMPLEMENTED(); - return QNetworkInterface(); -} - -bool QNativeSocketEngine::setMulticastInterface(const QNetworkInterface &iface) -{ - Q_D(QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::setMulticastInterface(), false); - Q_CHECK_TYPE(QNativeSocketEngine::setMulticastInterface(), QAbstractSocket::UdpSocket, false); - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << iface; - Q_UNIMPLEMENTED(); - return false; -} - -qint64 QNativeSocketEngine::bytesAvailable() const -{ - Q_D(const QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::bytesAvailable(), -1); - Q_CHECK_NOT_STATE(QNativeSocketEngine::bytesAvailable(), QAbstractSocket::UnconnectedState, -1); - if (d->socketType != QAbstractSocket::TcpSocket) - return -1; - - QMutexLocker locker(&d->worker->mutex); - const qint64 bytesAvailable = d->worker->pendingData.length(); - - qCDebug(lcNetworkSocketVerbose) << this << Q_FUNC_INFO << bytesAvailable; - return bytesAvailable; -} - -qint64 QNativeSocketEngine::read(char *data, qint64 maxlen) -{ - qCDebug(lcNetworkSocketVerbose) << this << Q_FUNC_INFO << maxlen; - Q_D(QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::read(), -1); - Q_CHECK_STATES(QNativeSocketEngine::read(), QAbstractSocket::ConnectedState, QAbstractSocket::BoundState, -1); - if (d->socketType != QAbstractSocket::TcpSocket) - return -1; - - // There will be a read notification when the socket was closed by the remote host. If that - // happens and there isn't anything left in the buffer, we have to return -1 in order to signal - // the closing of the socket. - QMutexLocker mutexLocker(&d->worker->mutex); - if (d->worker->pendingData.isEmpty() && d->socketState != QAbstractSocket::ConnectedState) { - close(); - return -1; - } - - QByteArray readData; - const int copyLength = qMin(maxlen, qint64(d->worker->pendingData.length())); - if (maxlen >= d->worker->pendingData.length()) { - qCDebug(lcNetworkSocketVerbose) << this << Q_FUNC_INFO << "Reading full buffer"; - readData = d->worker->pendingData; - d->worker->pendingData.clear(); - d->emitReadReady = true; - } else { - qCDebug(lcNetworkSocketVerbose) << this << Q_FUNC_INFO << "Reading part of the buffer (" - << copyLength << "of" << d->worker->pendingData.length() << "bytes"; - readData = d->worker->pendingData.left(maxlen); - d->worker->pendingData.remove(0, maxlen); - if (d->notifyOnRead) { - d->pendingReadNotification = true; - emit readReady(); - } - } - mutexLocker.unlock(); - - memcpy(data, readData, copyLength); - qCDebug(lcNetworkSocketVerbose) << this << Q_FUNC_INFO << "Read" << copyLength << "bytes"; - return copyLength; -} - -qint64 QNativeSocketEngine::write(const char *data, qint64 len) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << data << len; - Q_D(QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::write(), -1); - Q_CHECK_STATE(QNativeSocketEngine::write(), QAbstractSocket::ConnectedState, -1); - - HRESULT hr = E_FAIL; - ComPtr stream; - if (d->socketType == QAbstractSocket::TcpSocket) - hr = d->tcpSocket()->get_OutputStream(&stream); - else if (d->socketType == QAbstractSocket::UdpSocket) - hr = d->udpSocket()->get_OutputStream(&stream); - Q_ASSERT_SUCCEEDED(hr); - - qint64 bytesWritten = writeIOStream(stream, data, len); - if (bytesWritten < 0) - d->setError(QAbstractSocket::SocketAccessError, WinRTSocketEngine::AccessErrorString); - else if (bytesWritten > 0 && d->notifyOnWrite) - emit writeReady(); - - return bytesWritten; -} - -qint64 QNativeSocketEngine::readDatagram(char *data, qint64 maxlen, QIpPacketHeader *header, - PacketHeaderOptions) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << maxlen; -#ifndef QT_NO_UDPSOCKET - Q_D(QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::readDatagram(), -1); - Q_CHECK_STATES(QNativeSocketEngine::readDatagram(), QAbstractSocket::BoundState, - QAbstractSocket::ConnectedState, -1); - - QMutexLocker locker(&d->worker->mutex); - if (d->socketType != QAbstractSocket::UdpSocket || d->worker->pendingDatagrams.isEmpty()) { - if (header) - header->clear(); - return -1; - } - - WinRtDatagram datagram = d->worker->pendingDatagrams.takeFirst(); - if (header) - *header = datagram.header; - - QByteArray readOrigin; - if (maxlen < datagram.data.length()) - readOrigin = datagram.data.left(maxlen); - else - readOrigin = datagram.data; - if (d->worker->pendingDatagrams.isEmpty()) { - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << "That's all folks"; - d->worker->emitDataReceived = true; - d->emitReadReady = true; - } - - locker.unlock(); - memcpy(data, readOrigin, qMin(maxlen, qint64(datagram.data.length()))); - return readOrigin.length(); -#else - Q_UNUSED(data) - Q_UNUSED(maxlen) - Q_UNUSED(header) - return -1; -#endif // QT_NO_UDPSOCKET -} - -qint64 QNativeSocketEngine::writeDatagram(const char *data, qint64 len, const QIpPacketHeader &header) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << data << len; -#ifndef QT_NO_UDPSOCKET - Q_D(QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::writeDatagram(), -1); - Q_CHECK_STATES(QNativeSocketEngine::writeDatagram(), QAbstractSocket::BoundState, - QAbstractSocket::ConnectedState, -1); - - if (d->socketType != QAbstractSocket::UdpSocket) - return -1; - - ComPtr remoteHost; - ComPtr hostNameFactory; - - HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(), - &hostNameFactory); - Q_ASSERT_SUCCEEDED(hr); - const QString addressString = header.destinationAddress.toString(); - HStringReference hostNameRef(reinterpret_cast(addressString.utf16())); - hr = hostNameFactory->CreateHostName(hostNameRef.Get(), &remoteHost); - RETURN_IF_FAILED("QNativeSocketEngine::writeDatagram: Could not create hostname.", return -1); - - ComPtr> streamOperation; - ComPtr stream; - const QString portString = QString::number(header.destinationPort); - HStringReference portRef(reinterpret_cast(portString.utf16())); - hr = d->udpSocket()->GetOutputStreamAsync(remoteHost.Get(), portRef.Get(), &streamOperation); - Q_ASSERT_SUCCEEDED(hr); - - hr = QWinRTFunctions::await(streamOperation, stream.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - - return writeIOStream(stream, data, len); -#else - Q_UNUSED(data) - Q_UNUSED(len) - Q_UNUSED(header) - return -1; -#endif // QT_NO_UDPSOCKET -} - -bool QNativeSocketEngine::hasPendingDatagrams() const -{ - Q_D(const QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::hasPendingDatagrams(), false); - Q_CHECK_NOT_STATE(QNativeSocketEngine::hasPendingDatagrams(), QAbstractSocket::UnconnectedState, false); - Q_CHECK_TYPE(QNativeSocketEngine::hasPendingDatagrams(), QAbstractSocket::UdpSocket, false); - - QMutexLocker locker(&d->worker->mutex); - return d->worker->pendingDatagrams.length() > 0; -} - -qint64 QNativeSocketEngine::pendingDatagramSize() const -{ - Q_D(const QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::pendingDatagramSize(), -1); - Q_CHECK_TYPE(QNativeSocketEngine::pendingDatagramSize(), QAbstractSocket::UdpSocket, -1); - - QMutexLocker locker(&d->worker->mutex); - if (d->worker->pendingDatagrams.isEmpty()) - return -1; - - return d->worker->pendingDatagrams.at(0).data.length(); -} - -qint64 QNativeSocketEngine::bytesToWrite() const -{ - return 0; -} - -qint64 QNativeSocketEngine::receiveBufferSize() const -{ - Q_D(const QNativeSocketEngine); - return d->option(QAbstractSocketEngine::ReceiveBufferSocketOption); -} - -void QNativeSocketEngine::setReceiveBufferSize(qint64 bufferSize) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << bufferSize; - Q_D(QNativeSocketEngine); - d->setOption(QAbstractSocketEngine::ReceiveBufferSocketOption, bufferSize); -} - -qint64 QNativeSocketEngine::sendBufferSize() const -{ - Q_D(const QNativeSocketEngine); - return d->option(QAbstractSocketEngine::SendBufferSocketOption); -} - -void QNativeSocketEngine::setSendBufferSize(qint64 bufferSize) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << bufferSize; - Q_D(QNativeSocketEngine); - d->setOption(QAbstractSocketEngine::SendBufferSocketOption, bufferSize); -} - -int QNativeSocketEngine::option(QAbstractSocketEngine::SocketOption option) const -{ - Q_D(const QNativeSocketEngine); - return d->option(option); -} - -bool QNativeSocketEngine::setOption(QAbstractSocketEngine::SocketOption option, int value) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << option << value; - Q_D(QNativeSocketEngine); - return d->setOption(option, value); -} - -bool QNativeSocketEngine::waitForRead(int msecs, bool *timedOut) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << msecs; - Q_D(QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::waitForRead(), false); - Q_CHECK_NOT_STATE(QNativeSocketEngine::waitForRead(), - QAbstractSocket::UnconnectedState, false); - - if (timedOut) - *timedOut = false; - - QElapsedTimer timer; - timer.start(); - while (msecs > timer.elapsed()) { - // Servers with active connections are ready for reading - if (!d->currentConnections.isEmpty()) - return true; - - // If we are a client, we are ready to read if our buffer has data - QMutexLocker locker(&d->worker->mutex); - if (!d->worker->pendingData.isEmpty()) - return true; - - // Nothing to do, wait for more events - d->eventLoop.processEvents(); - } - - d->setError(QAbstractSocket::SocketTimeoutError, - WinRTSocketEngine::TimeOutErrorString); - - if (timedOut) - *timedOut = true; - return false; -} - -bool QNativeSocketEngine::waitForWrite(int msecs, bool *timedOut) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << msecs; - Q_UNUSED(timedOut); - Q_D(QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::waitForWrite(), false); - Q_CHECK_NOT_STATE(QNativeSocketEngine::waitForWrite(), - QAbstractSocket::UnconnectedState, false); - - if (d->socketState == QAbstractSocket::ConnectingState) { - HRESULT hr = QWinRTFunctions::await(d->worker->connectOp, QWinRTFunctions::ProcessMainThreadEvents); - if (SUCCEEDED(hr)) { - handleConnectOpFinished(true, QAbstractSocket::UnknownSocketError, WinRTSocketEngine::UnknownSocketErrorString); - return true; - } - } - return false; -} - -bool QNativeSocketEngine::waitForReadOrWrite(bool *readyToRead, bool *readyToWrite, bool checkRead, bool checkWrite, int msecs, bool *timedOut) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << checkRead << checkWrite << msecs; - Q_D(QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::waitForReadOrWrite(), false); - Q_CHECK_NOT_STATE(QNativeSocketEngine::waitForReadOrWrite(), - QAbstractSocket::UnconnectedState, false); - - Q_UNUSED(readyToRead); - Q_UNUSED(readyToWrite); - Q_UNUSED(timedOut); - return false; -} - -bool QNativeSocketEngine::isReadNotificationEnabled() const -{ - Q_D(const QNativeSocketEngine); - return d->notifyOnRead; -} - -void QNativeSocketEngine::setReadNotificationEnabled(bool enable) -{ - qCDebug(lcNetworkSocketVerbose) << this << Q_FUNC_INFO << enable; - Q_D(QNativeSocketEngine); - d->notifyOnRead = enable; -} - -bool QNativeSocketEngine::isWriteNotificationEnabled() const -{ - Q_D(const QNativeSocketEngine); - return d->notifyOnWrite; -} - -void QNativeSocketEngine::setWriteNotificationEnabled(bool enable) -{ - qCDebug(lcNetworkSocketVerbose) << this << Q_FUNC_INFO << enable; - Q_D(QNativeSocketEngine); - d->notifyOnWrite = enable; - if (enable && d->socketState == QAbstractSocket::ConnectedState) { - if (bytesToWrite()) - return; // will be emitted as a result of bytes written - writeNotification(); - } -} - -bool QNativeSocketEngine::isExceptionNotificationEnabled() const -{ - Q_D(const QNativeSocketEngine); - return d->notifyOnException; -} - -void QNativeSocketEngine::setExceptionNotificationEnabled(bool enable) -{ - qCDebug(lcNetworkSocketVerbose) << this << Q_FUNC_INFO << enable; - Q_D(QNativeSocketEngine); - d->notifyOnException = enable; -} - -void QNativeSocketEngine::establishRead() -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO; - Q_D(QNativeSocketEngine); - - HRESULT hr; - hr = QEventDispatcherWinRT::runOnXamlThread([d]() { - d->worker->setTcpSocket(d->tcpSocket()); - d->worker->startReading(); - return S_OK; - }); - Q_ASSERT_SUCCEEDED(hr); -} - -void QNativeSocketEngine::handleConnectOpFinished(bool success, QAbstractSocket::SocketError error, WinRTSocketEngine::ErrorString errorString) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << success << error << errorString; - Q_D(QNativeSocketEngine); - disconnect(d->worker, &SocketEngineWorker::connectOpFinished, - this, &QNativeSocketEngine::handleConnectOpFinished); - if (!success) { - d->setError(error, errorString); - d->socketState = QAbstractSocket::UnconnectedState; - close(); - return; - } - - d->socketState = QAbstractSocket::ConnectedState; - d->fetchConnectionParameters(); - emit connectionReady(); - - if (d->socketType != QAbstractSocket::TcpSocket) - return; - -#ifndef QT_NO_SSL - // Delay the reader so that the SSL socket can upgrade - if (d->sslSocket) - QObject::connect(qobject_cast(d->sslSocket), &QSslSocket::encrypted, this, &QNativeSocketEngine::establishRead); - else -#endif - establishRead(); -} - -void QNativeSocketEngine::handleNewData() -{ - qCDebug(lcNetworkSocketVerbose) << this << Q_FUNC_INFO; - Q_D(QNativeSocketEngine); - - if (d->notifyOnRead && d->emitReadReady) { - if (d->socketType == QAbstractSocket::UdpSocket && !d->worker->emitDataReceived) - return; - qCDebug(lcNetworkSocketVerbose) << this << Q_FUNC_INFO << "Emitting readReady"; - d->pendingReadNotification = true; - emit readReady(); - d->worker->emitDataReceived = false; - d->emitReadReady = false; - } -} - -void QNativeSocketEngine::handleTcpError(QAbstractSocket::SocketError error) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << error; - Q_D(QNativeSocketEngine); - WinRTSocketEngine::ErrorString errorString; - switch (error) { - case QAbstractSocket::RemoteHostClosedError: - errorString = WinRTSocketEngine::RemoteHostClosedErrorString; - break; - default: - errorString = WinRTSocketEngine::UnknownSocketErrorString; - } - - d->setError(error, errorString); - close(); -} - -void QNativeSocketEngine::processReadReady() -{ - Q_D(QNativeSocketEngine); - if (d->closingDown) - return; - - d->pendingReadNotification = false; - readNotification(); -} - -bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType socketType, QAbstractSocket::NetworkLayerProtocol &socketProtocol) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << socketType << socketProtocol; - Q_UNUSED(socketProtocol); - HRESULT hr; - - switch (socketType) { - case QAbstractSocket::TcpSocket: { - ComPtr socket; - hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_StreamSocket).Get(), &socket); - RETURN_FALSE_IF_FAILED("createNewSocket: Could not create socket instance"); - socketDescriptor = qintptr(socket.Detach()); - break; - } - case QAbstractSocket::UdpSocket: { - ComPtr socket; - hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_DatagramSocket).Get(), &socket); - RETURN_FALSE_IF_FAILED("createNewSocket: Could not create socket instance"); - socketDescriptor = qintptr(socket.Detach()); - QEventDispatcherWinRT::runOnXamlThread([&hr, this]() { - hr = udpSocket()->add_MessageReceived(Callback(worker, &SocketEngineWorker::OnNewDatagramReceived).Get(), &connectionToken); - if (FAILED(hr)) { - qErrnoWarning(hr, "createNewSocket: Could not add \"message received\" callback"); - return hr; - } - return S_OK; - }); - if (FAILED(hr)) - return false; - break; - } - default: - qWarning("Invalid socket type"); - return false; - } - - this->socketType = socketType; - - // Make the socket nonblocking. - if (!setOption(QAbstractSocketEngine::NonBlockingSocketOption, 1)) { - setError(QAbstractSocket::UnsupportedSocketOperationError, WinRTSocketEngine::NonBlockingInitFailedErrorString); - q_func()->close(); - return false; - } - - return true; -} - -QNativeSocketEnginePrivate::QNativeSocketEnginePrivate() - : QAbstractSocketEnginePrivate() - , notifyOnRead(true) - , notifyOnWrite(true) - , notifyOnException(false) - , closingDown(false) - , socketDescriptor(-1) - , worker(new SocketEngineWorker(this)) - , sslSocket(nullptr) - , connectionToken( { -1 } ) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO; -} - -QNativeSocketEnginePrivate::~QNativeSocketEnginePrivate() -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO; - if (socketDescriptor == -1 || connectionToken.value == -1) - return; - - HRESULT hr; - if (socketType == QAbstractSocket::UdpSocket) - hr = udpSocket()->remove_MessageReceived(connectionToken); - else if (socketType == QAbstractSocket::TcpSocket) - hr = tcpListener->remove_ConnectionReceived(connectionToken); - Q_ASSERT_SUCCEEDED(hr); - - worker->deleteLater(); -} - -void QNativeSocketEnginePrivate::setError(QAbstractSocket::SocketError error, WinRTSocketEngine::ErrorString errorString) const -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << error << errorString; - if (hasSetSocketError) { - // Only set socket errors once for one engine; expect the - // socket to recreate its engine after an error. Note: There's - // one exception: SocketError(11) bypasses this as it's purely - // a temporary internal error condition. - // Another exception is the way the waitFor*() functions set - // an error when a timeout occurs. After the call to setError() - // they reset the hasSetSocketError to false - return; - } - if (error != QAbstractSocket::SocketError(11)) - hasSetSocketError = true; - - socketError = error; - - switch (errorString) { - case WinRTSocketEngine::NonBlockingInitFailedErrorString: - socketErrorString = QNativeSocketEngine::tr("Unable to initialize non-blocking socket"); - break; - case WinRTSocketEngine::BroadcastingInitFailedErrorString: - socketErrorString = QNativeSocketEngine::tr("Unable to initialize broadcast socket"); - break; - // should not happen anymore - case WinRTSocketEngine::NoIpV6ErrorString: - socketErrorString = QNativeSocketEngine::tr("Attempt to use IPv6 socket on a platform with no IPv6 support"); - break; - case WinRTSocketEngine::RemoteHostClosedErrorString: - socketErrorString = QNativeSocketEngine::tr("The remote host closed the connection"); - break; - case WinRTSocketEngine::TimeOutErrorString: - socketErrorString = QNativeSocketEngine::tr("Network operation timed out"); - break; - case WinRTSocketEngine::ResourceErrorString: - socketErrorString = QNativeSocketEngine::tr("Out of resources"); - break; - case WinRTSocketEngine::OperationUnsupportedErrorString: - socketErrorString = QNativeSocketEngine::tr("Unsupported socket operation"); - break; - case WinRTSocketEngine::ProtocolUnsupportedErrorString: - socketErrorString = QNativeSocketEngine::tr("Protocol type not supported"); - break; - case WinRTSocketEngine::InvalidSocketErrorString: - socketErrorString = QNativeSocketEngine::tr("Invalid socket descriptor"); - break; - case WinRTSocketEngine::HostUnreachableErrorString: - socketErrorString = QNativeSocketEngine::tr("Host unreachable"); - break; - case WinRTSocketEngine::NetworkUnreachableErrorString: - socketErrorString = QNativeSocketEngine::tr("Network unreachable"); - break; - case WinRTSocketEngine::AccessErrorString: - socketErrorString = QNativeSocketEngine::tr("Permission denied"); - break; - case WinRTSocketEngine::ConnectionTimeOutErrorString: - socketErrorString = QNativeSocketEngine::tr("Connection timed out"); - break; - case WinRTSocketEngine::ConnectionRefusedErrorString: - socketErrorString = QNativeSocketEngine::tr("Connection refused"); - break; - case WinRTSocketEngine::AddressInuseErrorString: - socketErrorString = QNativeSocketEngine::tr("The bound address is already in use"); - break; - case WinRTSocketEngine::AddressNotAvailableErrorString: - socketErrorString = QNativeSocketEngine::tr("The address is not available"); - break; - case WinRTSocketEngine::AddressProtectedErrorString: - socketErrorString = QNativeSocketEngine::tr("The address is protected"); - break; - case WinRTSocketEngine::DatagramTooLargeErrorString: - socketErrorString = QNativeSocketEngine::tr("Datagram was too large to send"); - break; - case WinRTSocketEngine::SendDatagramErrorString: - socketErrorString = QNativeSocketEngine::tr("Unable to send a message"); - break; - case WinRTSocketEngine::ReceiveDatagramErrorString: - socketErrorString = QNativeSocketEngine::tr("Unable to receive a message"); - break; - case WinRTSocketEngine::WriteErrorString: - socketErrorString = QNativeSocketEngine::tr("Unable to write"); - break; - case WinRTSocketEngine::ReadErrorString: - socketErrorString = QNativeSocketEngine::tr("Network error"); - break; - case WinRTSocketEngine::PortInuseErrorString: - socketErrorString = QNativeSocketEngine::tr("Another socket is already listening on the same port"); - break; - case WinRTSocketEngine::NotSocketErrorString: - socketErrorString = QNativeSocketEngine::tr("Operation on non-socket"); - break; - case WinRTSocketEngine::InvalidProxyTypeString: - socketErrorString = QNativeSocketEngine::tr("The proxy type is invalid for this operation"); - break; - case WinRTSocketEngine::TemporaryErrorString: - socketErrorString = QNativeSocketEngine::tr("Temporary error"); - break; - case WinRTSocketEngine::UnknownSocketErrorString: - socketErrorString = QNativeSocketEngine::tr("Unknown error"); - break; - } -} - -int QNativeSocketEnginePrivate::option(QAbstractSocketEngine::SocketOption opt) const -{ - ComPtr control; - if (socketType == QAbstractSocket::TcpSocket) { - if (FAILED(tcpSocket()->get_Control(&control))) { - qWarning("QNativeSocketEnginePrivate::option: Could not obtain socket control"); - return -1; - } - } - switch (opt) { - case QAbstractSocketEngine::NonBlockingSocketOption: - case QAbstractSocketEngine::BroadcastSocketOption: - case QAbstractSocketEngine::ReceiveOutOfBandData: - return 1; - case QAbstractSocketEngine::SendBufferSocketOption: - if (socketType == QAbstractSocket::UdpSocket) - return -1; - - UINT32 bufferSize; - if (FAILED(control->get_OutboundBufferSizeInBytes(&bufferSize))) { - qWarning("Could not obtain OutboundBufferSizeInBytes information vom socket control"); - return -1; - } - return bufferSize; - case QAbstractSocketEngine::LowDelayOption: - if (socketType == QAbstractSocket::UdpSocket) - return -1; - - boolean noDelay; - if (FAILED(control->get_NoDelay(&noDelay))) { - qWarning("Could not obtain NoDelay information from socket control"); - return -1; - } - return noDelay; - case QAbstractSocketEngine::KeepAliveOption: - if (socketType == QAbstractSocket::UdpSocket) - return -1; - - boolean keepAlive; - if (FAILED(control->get_KeepAlive(&keepAlive))) { - qWarning("Could not obtain KeepAlive information from socket control"); - return -1; - } - return keepAlive; - case QAbstractSocketEngine::ReceiveBufferSocketOption: - case QAbstractSocketEngine::AddressReusable: - case QAbstractSocketEngine::BindExclusively: - case QAbstractSocketEngine::MulticastTtlOption: - case QAbstractSocketEngine::MulticastLoopbackOption: - case QAbstractSocketEngine::TypeOfServiceOption: - case QAbstractSocketEngine::MaxStreamsSocketOption: - case QAbstractSocketEngine::PathMtuInformation: - default: - return -1; - } - return -1; -} - -bool QNativeSocketEnginePrivate::setOption(QAbstractSocketEngine::SocketOption opt, int v) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO << opt << v; - ComPtr control; - if (socketType == QAbstractSocket::TcpSocket) { - if (FAILED(tcpSocket()->get_Control(&control))) { - qWarning("QNativeSocketEnginePrivate::setOption: Could not obtain socket control"); - return false; - } - } - switch (opt) { - case QAbstractSocketEngine::NonBlockingSocketOption: - case QAbstractSocketEngine::BroadcastSocketOption: - case QAbstractSocketEngine::ReceiveOutOfBandData: - return v != 0; - case QAbstractSocketEngine::SendBufferSocketOption: - if (socketType == QAbstractSocket::UdpSocket) - return false; - - if (FAILED(control->put_OutboundBufferSizeInBytes(v))) { - qWarning("Could not set OutboundBufferSizeInBytes"); - return false; - } - return true; - case QAbstractSocketEngine::LowDelayOption: { - if (socketType == QAbstractSocket::UdpSocket) - return false; - - boolean noDelay = v; - if (FAILED(control->put_NoDelay(noDelay))) { - qWarning("Could not obtain NoDelay information from socket control"); - return false; - } - return true; - } - case QAbstractSocketEngine::KeepAliveOption: { - if (socketType == QAbstractSocket::UdpSocket - || socketState != QAbstractSocket::UnconnectedState) - return false; - - boolean keepAlive = v; - if (FAILED(control->put_KeepAlive(keepAlive))) { - qWarning("Could not set KeepAlive value"); - return false; - } - return true; - } - case QAbstractSocketEngine::ReceiveBufferSocketOption: - case QAbstractSocketEngine::AddressReusable: - case QAbstractSocketEngine::BindExclusively: - case QAbstractSocketEngine::MulticastTtlOption: - case QAbstractSocketEngine::MulticastLoopbackOption: - case QAbstractSocketEngine::TypeOfServiceOption: - case QAbstractSocketEngine::MaxStreamsSocketOption: - case QAbstractSocketEngine::PathMtuInformation: - default: - return false; - } - return false; -} - -bool QNativeSocketEnginePrivate::fetchConnectionParameters() -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO; - localPort = 0; - localAddress.clear(); - peerPort = 0; - peerAddress.clear(); - inboundStreamCount = outboundStreamCount = 0; - - HRESULT hr; - if (socketType == QAbstractSocket::TcpSocket) { - ComPtr hostName; - HString tmpHString; - ComPtr info; - hr = tcpSocket()->get_Information(&info); - Q_ASSERT_SUCCEEDED(hr); - hr = info->get_LocalAddress(&hostName); - Q_ASSERT_SUCCEEDED(hr); - if (hostName) { - hr = hostName->get_CanonicalName(tmpHString.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - localAddress.setAddress(qt_QStringFromHString(tmpHString)); - hr = info->get_LocalPort(tmpHString.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - localPort = qt_QStringFromHString(tmpHString).toInt(); - } - if (!localPort && tcpListener) { - ComPtr listenerInfo = 0; - hr = tcpListener->get_Information(&listenerInfo); - Q_ASSERT_SUCCEEDED(hr); - hr = listenerInfo->get_LocalPort(tmpHString.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - localPort = qt_QStringFromHString(tmpHString).toInt(); - localAddress = QHostAddress::Any; - } - info->get_RemoteAddress(&hostName); - if (hostName) { - hr = hostName->get_CanonicalName(tmpHString.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - peerAddress.setAddress(qt_QStringFromHString(tmpHString)); - hr = info->get_RemotePort(tmpHString.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - peerPort = qt_QStringFromHString(tmpHString).toInt(); - inboundStreamCount = outboundStreamCount = 1; - } - } else if (socketType == QAbstractSocket::UdpSocket) { - ComPtr hostName; - HString tmpHString; - ComPtr info; - hr = udpSocket()->get_Information(&info); - Q_ASSERT_SUCCEEDED(hr); - hr = info->get_LocalAddress(&hostName); - Q_ASSERT_SUCCEEDED(hr); - if (hostName) { - hr = hostName->get_CanonicalName(tmpHString.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - localAddress.setAddress(qt_QStringFromHString(tmpHString)); - hr = info->get_LocalPort(tmpHString.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - localPort = qt_QStringFromHString(tmpHString).toInt(); - } - - hr = info->get_RemoteAddress(&hostName); - Q_ASSERT_SUCCEEDED(hr); - if (hostName) { - hr = hostName->get_CanonicalName(tmpHString.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - peerAddress.setAddress(qt_QStringFromHString(tmpHString)); - hr = info->get_RemotePort(tmpHString.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - peerPort = qt_QStringFromHString(tmpHString).toInt(); - inboundStreamCount = outboundStreamCount = 1; - } - } - return true; -} - -HRESULT QNativeSocketEnginePrivate::handleClientConnection(IStreamSocketListener *listener, IStreamSocketListenerConnectionReceivedEventArgs *args) -{ - qCDebug(lcNetworkSocket) << this << Q_FUNC_INFO; - Q_Q(QNativeSocketEngine); - Q_UNUSED(listener) - IStreamSocket *socket; - args->get_Socket(&socket); - pendingConnections.append(socket); - emit q->connectionReady(); - if (notifyOnRead) - emit q->readReady(); - return S_OK; -} - -QT_END_NAMESPACE - -#include "qnativesocketengine_winrt.moc" diff --git a/src/network/socket/qnativesocketengine_winrt_p.h b/src/network/socket/qnativesocketengine_winrt_p.h deleted file mode 100644 index e1fe58bb97..0000000000 --- a/src/network/socket/qnativesocketengine_winrt_p.h +++ /dev/null @@ -1,243 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtNetwork 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 QNATIVESOCKETENGINE_WINRT_P_H -#define QNATIVESOCKETENGINE_WINRT_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of the QLibrary class. This header file may change from -// version to version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include -#include -#include -#include -#include "QtNetwork/qhostaddress.h" -#include "private/qabstractsocketengine_p.h" -#include -#include - -QT_BEGIN_NAMESPACE - -Q_DECLARE_LOGGING_CATEGORY(lcNetworkSocket) -Q_DECLARE_LOGGING_CATEGORY(lcNetworkSocketVerbose) - -namespace WinRTSocketEngine { - enum ErrorString { - NonBlockingInitFailedErrorString, - BroadcastingInitFailedErrorString, - NoIpV6ErrorString, - RemoteHostClosedErrorString, - TimeOutErrorString, - ResourceErrorString, - OperationUnsupportedErrorString, - ProtocolUnsupportedErrorString, - InvalidSocketErrorString, - HostUnreachableErrorString, - NetworkUnreachableErrorString, - AccessErrorString, - ConnectionTimeOutErrorString, - ConnectionRefusedErrorString, - AddressInuseErrorString, - AddressNotAvailableErrorString, - AddressProtectedErrorString, - DatagramTooLargeErrorString, - SendDatagramErrorString, - ReceiveDatagramErrorString, - WriteErrorString, - ReadErrorString, - PortInuseErrorString, - NotSocketErrorString, - InvalidProxyTypeString, - TemporaryErrorString, - - UnknownSocketErrorString = -1 - }; -} - -class QNativeSocketEnginePrivate; -class SocketEngineWorker; - -struct WinRtDatagram { - QByteArray data; - QIpPacketHeader header; -}; - -class Q_AUTOTEST_EXPORT QNativeSocketEngine : public QAbstractSocketEngine -{ - Q_OBJECT -public: - QNativeSocketEngine(QObject *parent = 0); - ~QNativeSocketEngine(); - - bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol); - bool initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState); - - qintptr socketDescriptor() const; - - bool isValid() const; - - bool connectToHost(const QHostAddress &address, quint16 port); - bool connectToHostByName(const QString &name, quint16 port); - bool bind(const QHostAddress &address, quint16 port); - bool listen(); - int accept(); - void close(); - -#ifndef QT_NO_NETWORKINTERFACE - bool joinMulticastGroup(const QHostAddress &groupAddress, - const QNetworkInterface &iface); - bool leaveMulticastGroup(const QHostAddress &groupAddress, - const QNetworkInterface &iface); - QNetworkInterface multicastInterface() const; - bool setMulticastInterface(const QNetworkInterface &iface); -#endif - - qint64 bytesAvailable() const; - - qint64 read(char *data, qint64 maxlen); - qint64 write(const char *data, qint64 len); - - qint64 readDatagram(char *data, qint64 maxlen, QIpPacketHeader * = 0, PacketHeaderOptions = WantNone); - qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &header); - bool hasPendingDatagrams() const; - qint64 pendingDatagramSize() const; - - qint64 bytesToWrite() const; - - qint64 receiveBufferSize() const; - void setReceiveBufferSize(qint64 bufferSize); - - qint64 sendBufferSize() const; - void setSendBufferSize(qint64 bufferSize); - - int option(SocketOption option) const; - bool setOption(SocketOption option, int value); - - bool waitForRead(int msecs = 30000, bool *timedOut = 0); - bool waitForWrite(int msecs = 30000, bool *timedOut = 0); - bool waitForReadOrWrite(bool *readyToRead, bool *readyToWrite, - bool checkRead, bool checkWrite, - int msecs = 30000, bool *timedOut = 0); - - bool isReadNotificationEnabled() const; - void setReadNotificationEnabled(bool enable); - bool isWriteNotificationEnabled() const; - void setWriteNotificationEnabled(bool enable); - bool isExceptionNotificationEnabled() const; - void setExceptionNotificationEnabled(bool enable); - -signals: - void connectionReady(); - void readReady(); - void writeReady(); - void newDatagramReceived(const WinRtDatagram &datagram); - -private slots: - void establishRead(); - void handleConnectOpFinished(bool success, QAbstractSocket::SocketError error, - WinRTSocketEngine::ErrorString errorString); - void handleNewData(); - void handleTcpError(QAbstractSocket::SocketError error); - void processReadReady(); - -private: - Q_DECLARE_PRIVATE(QNativeSocketEngine) - Q_DISABLE_COPY_MOVE(QNativeSocketEngine) -}; - -class QNativeSocketEnginePrivate : public QAbstractSocketEnginePrivate -{ - Q_DECLARE_PUBLIC(QNativeSocketEngine) -public: - QNativeSocketEnginePrivate(); - ~QNativeSocketEnginePrivate(); - - qintptr socketDescriptor; - SocketEngineWorker *worker; - - bool notifyOnRead, notifyOnWrite, notifyOnException; - QAtomicInt closingDown; - - void setError(QAbstractSocket::SocketError error, WinRTSocketEngine::ErrorString errorString) const; - - // native functions - int option(QNativeSocketEngine::SocketOption option) const; - bool setOption(QNativeSocketEngine::SocketOption option, int value); - - bool createNewSocket(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol &protocol); - - bool checkProxy(const QHostAddress &address); - bool fetchConnectionParameters(); - -private: - inline ABI::Windows::Networking::Sockets::IStreamSocket *tcpSocket() const - { return reinterpret_cast(socketDescriptor); } - inline ABI::Windows::Networking::Sockets::IDatagramSocket *udpSocket() const - { return reinterpret_cast(socketDescriptor); } - Microsoft::WRL::ComPtr tcpListener; - - QList pendingConnections; - QList currentConnections; - QEventLoop eventLoop; - QAbstractSocket *sslSocket; - EventRegistrationToken connectionToken; - - bool emitReadReady = true; - bool pendingReadNotification = false; - - HRESULT handleClientConnection(ABI::Windows::Networking::Sockets::IStreamSocketListener *tcpListener, - ABI::Windows::Networking::Sockets::IStreamSocketListenerConnectionReceivedEventArgs *args); -}; - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(WinRtDatagram) -Q_DECLARE_METATYPE(WinRTSocketEngine::ErrorString) - -#endif // QNATIVESOCKETENGINE_WINRT_P_H diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri index c3a98ea31a..67325ac70f 100644 --- a/src/network/socket/socket.pri +++ b/src/network/socket/socket.pri @@ -43,10 +43,8 @@ qtConfig(sctp) { socket/qsctpsocket.cpp } -!winrt { - SOURCES += socket/qnativesocketengine.cpp - HEADERS += socket/qnativesocketengine_p.h -} +SOURCES += socket/qnativesocketengine.cpp +HEADERS += socket/qnativesocketengine_p.h unix { SOURCES += socket/qnativesocketengine_unix.cpp @@ -57,13 +55,8 @@ unix { # invalid C/C++ code otherwise. msvc: QMAKE_MOC_OPTIONS += -D_WINSOCK_DEPRECATED_NO_WARNINGS -win32:!winrt:SOURCES += socket/qnativesocketengine_win.cpp -win32:!winrt: QMAKE_USE_PRIVATE += advapi32 - -winrt { - SOURCES += socket/qnativesocketengine_winrt.cpp - HEADERS += socket/qnativesocketengine_winrt_p.h -} +win32: SOURCES += socket/qnativesocketengine_win.cpp +win32: QMAKE_USE_PRIVATE += advapi32 qtConfig(localserver) { HEADERS += socket/qlocalserver.h \ @@ -73,7 +66,7 @@ qtConfig(localserver) { SOURCES += socket/qlocalsocket.cpp \ socket/qlocalserver.cpp - integrity|winrt { + integrity { SOURCES += socket/qlocalsocket_tcp.cpp \ socket/qlocalserver_tcp.cpp DEFINES += QT_LOCALSOCKET_TCP diff --git a/src/network/ssl/qssl.cpp b/src/network/ssl/qssl.cpp index 87b9a1b038..4482e8862b 100644 --- a/src/network/ssl/qssl.cpp +++ b/src/network/ssl/qssl.cpp @@ -111,11 +111,11 @@ Q_LOGGING_CATEGORY(lcSsl, "qt.network.ssl"); Describes the protocol of the cipher. \value TlsV1_0 TLSv1.0 - \value TlsV1_0OrLater TLSv1.0 and later versions. This option is not available when using the WinRT backend due to platform limitations. - \value TlsV1_1 TLSv1.1. When using the WinRT backend this option will also enable TLSv1.0. - \value TlsV1_1OrLater TLSv1.1 and later versions. This option is not available when using the WinRT backend due to platform limitations. - \value TlsV1_2 TLSv1.2. When using the WinRT backend this option will also enable TLSv1.0 and TLSv1.1. - \value TlsV1_2OrLater TLSv1.2 and later versions. This option is not available when using the WinRT backend due to platform limitations. + \value TlsV1_0OrLater TLSv1.0 and later versions. + \value TlsV1_1 TLSv1.1. + \value TlsV1_1OrLater TLSv1.1 and later versions. + \value TlsV1_2 TLSv1.2. + \value TlsV1_2OrLater TLSv1.2 and later versions. \value DtlsV1_0 DTLSv1.0 \value DtlsV1_0OrLater DTLSv1.0 and later versions. \value DtlsV1_2 DTLSv1.2 diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 7539c26ecb..6daf5c362e 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -115,9 +115,6 @@ #ifndef QT_NO_OPENSSL #include "qsslsocket_openssl_symbols_p.h" #endif -#ifdef Q_OS_WINRT -#include "qsslsocket_winrt_p.h" -#endif #ifdef QT_SECURETRANSPORT #include "qsslsocket_mac_p.h" #endif diff --git a/src/network/ssl/qsslcertificate_p.h b/src/network/ssl/qsslcertificate_p.h index 234cd45ceb..4588aa7d6f 100644 --- a/src/network/ssl/qsslcertificate_p.h +++ b/src/network/ssl/qsslcertificate_p.h @@ -70,11 +70,6 @@ struct X509_EXTENSION; struct ASN1_OBJECT; #endif -#ifdef Q_OS_WINRT -#include -#include -#endif - #if QT_CONFIG(schannel) #include #endif @@ -146,12 +141,6 @@ public: QAtomicInt ref; -#ifdef Q_OS_WINRT - Microsoft::WRL::ComPtr certificate; - - static QSslCertificate QSslCertificate_from_Certificate(ABI::Windows::Security::Cryptography::Certificates::ICertificate *iCertificate); -#endif - #if QT_CONFIG(schannel) const CERT_CONTEXT *certificateContext = nullptr; diff --git a/src/network/ssl/qsslcertificate_qt.cpp b/src/network/ssl/qsslcertificate_qt.cpp index 7cf96a4a88..d75e620ff7 100644 --- a/src/network/ssl/qsslcertificate_qt.cpp +++ b/src/network/ssl/qsslcertificate_qt.cpp @@ -141,7 +141,7 @@ QDateTime QSslCertificate::expiryDate() const return d->notValidAfter; } -#if !defined(Q_OS_WINRT) && !QT_CONFIG(schannel) // implemented in qsslcertificate_{winrt,schannel}.cpp +#if !QT_CONFIG(schannel) // implemented in qsslcertificate_schannel.cpp Qt::HANDLE QSslCertificate::handle() const { Q_UNIMPLEMENTED(); diff --git a/src/network/ssl/qsslcertificate_winrt.cpp b/src/network/ssl/qsslcertificate_winrt.cpp deleted file mode 100644 index e601307c17..0000000000 --- a/src/network/ssl/qsslcertificate_winrt.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtNetwork 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 "qsslcertificate_p.h" - -#include - -#include -#include -#include -#include - -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Security::Cryptography; -using namespace ABI::Windows::Security::Cryptography::Certificates; -using namespace ABI::Windows::Storage::Streams; - -QT_USE_NAMESPACE - -struct SslCertificateGlobal -{ - SslCertificateGlobal() { - HRESULT hr; - hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Security_Cryptography_Certificates_Certificate).Get(), - &certificateFactory); - Q_ASSERT_SUCCEEDED(hr); - hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Security_Cryptography_CryptographicBuffer).Get(), - &bufferFactory); - Q_ASSERT_SUCCEEDED(hr); - } - - ComPtr certificateFactory; - ComPtr bufferFactory; -}; -Q_GLOBAL_STATIC(SslCertificateGlobal, g) - -QSslCertificate QSslCertificatePrivate::QSslCertificate_from_Certificate(ICertificate *iCertificate) -{ - Q_ASSERT(iCertificate); - ComPtr buffer; - HRESULT hr = iCertificate->GetCertificateBlob(&buffer); - RETURN_IF_FAILED("Could not obtain certification blob", return QSslCertificate()); - ComPtr byteAccess; - hr = buffer.As(&byteAccess); - RETURN_IF_FAILED("Could not obtain byte access to buffer", return QSslCertificate()); - char *data; - hr = byteAccess->Buffer(reinterpret_cast(&data)); - RETURN_IF_FAILED("Could not obtain buffer data", return QSslCertificate()); - UINT32 size; - hr = buffer->get_Length(&size); - RETURN_IF_FAILED("Could not obtain buffer length ", return QSslCertificate()); - QByteArray der(data, size); - - QSslCertificate certificate; - certificate.d->null = false; - certificate.d->certificate = iCertificate; - - return certificatesFromDer(der, 1).at(0); -} - -Qt::HANDLE QSslCertificate::handle() const -{ - if (!d->certificate) { - HRESULT hr; - ComPtr buffer; - hr = g->bufferFactory->CreateFromByteArray(d->derData.length(), (BYTE *)d->derData.data(), &buffer); - RETURN_IF_FAILED("Failed to create the certificate data buffer", return nullptr); - - hr = g->certificateFactory->CreateCertificate(buffer.Get(), &d->certificate); - RETURN_IF_FAILED("Failed to create the certificate handle from the data buffer", - return nullptr); - } - - return d->certificate.Get(); -} diff --git a/src/network/ssl/qsslkey_qt.cpp b/src/network/ssl/qsslkey_qt.cpp index 43969c3d28..f3bd75dfa6 100644 --- a/src/network/ssl/qsslkey_qt.cpp +++ b/src/network/ssl/qsslkey_qt.cpp @@ -715,11 +715,6 @@ static EncryptionData readPbes1(const QVector &element, const QByt key.truncate(8); // first 8 bytes are used for the key QSslKeyPrivate::Cipher cipher = oidCipherMap[encryptionScheme]; -#ifdef Q_OS_WINRT - // @todo: document this instead? find some other solution? - if (cipher == QSslKeyPrivate::Cipher::Rc2Cbc) - qWarning("PBES1 with RC2_CBC doesn't work properly on WinRT."); -#endif // Steps 4-6 are done after returning return {cipher, key, iv}; } diff --git a/src/network/ssl/qsslkey_winrt.cpp b/src/network/ssl/qsslkey_winrt.cpp deleted file mode 100644 index 69eaaa387f..0000000000 --- a/src/network/ssl/qsslkey_winrt.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtNetwork 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 "qssl_p.h" -#include "qsslkey.h" -#include "qsslkey_p.h" -#include "qsslcertificate_p.h" - -#include - -#include -#include -#include -#include -#include -#include - -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Security::Cryptography; -using namespace ABI::Windows::Security::Cryptography::Certificates; -using namespace ABI::Windows::Security::Cryptography::Core; -using namespace ABI::Windows::Storage::Streams; - -QT_USE_NAMESPACE - -struct SslKeyGlobal -{ - SslKeyGlobal() - { - HRESULT hr; - hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Security_Cryptography_Core_CryptographicEngine).Get(), - &engine); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr keyProviderFactory; - hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Security_Cryptography_Core_SymmetricKeyAlgorithmProvider).Get(), - &keyProviderFactory); - Q_ASSERT_SUCCEEDED(hr); - hr = keyProviderFactory->OpenAlgorithm(HString::MakeReference(L"DES_CBC").Get(), - &keyProviders[QSslKeyPrivate::DesCbc]); - Q_ASSERT_SUCCEEDED(hr); - hr = keyProviderFactory->OpenAlgorithm(HString::MakeReference(L"3DES_CBC").Get(), - &keyProviders[QSslKeyPrivate::DesEde3Cbc]); - Q_ASSERT_SUCCEEDED(hr); - hr = keyProviderFactory->OpenAlgorithm(HString::MakeReference(L"RC2_CBC").Get(), - &keyProviders[QSslKeyPrivate::Rc2Cbc]); - Q_ASSERT_SUCCEEDED(hr); - hr = keyProviderFactory->OpenAlgorithm(HString::MakeReference(L"AES_CBC").Get(), - &keyProviders[QSslKeyPrivate::Aes128Cbc]); - Q_ASSERT_SUCCEEDED(hr); - hr = keyProviderFactory->OpenAlgorithm(HString::MakeReference(L"AES_CBC").Get(), - &keyProviders[QSslKeyPrivate::Aes192Cbc]); - Q_ASSERT_SUCCEEDED(hr); - hr = keyProviderFactory->OpenAlgorithm(HString::MakeReference(L"AES_CBC").Get(), - &keyProviders[QSslKeyPrivate::Aes256Cbc]); - Q_ASSERT_SUCCEEDED(hr); - - hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Security_Cryptography_CryptographicBuffer).Get(), - &bufferFactory); - Q_ASSERT_SUCCEEDED(hr); - } - - ComPtr engine; - QHash> keyProviders; - ComPtr bufferFactory; -}; -Q_GLOBAL_STATIC(SslKeyGlobal, g) - -static QByteArray doCrypt(QSslKeyPrivate::Cipher cipher, QByteArray data, const QByteArray &key, const QByteArray &iv, bool encrypt) -{ - HRESULT hr; - - ISymmetricKeyAlgorithmProvider *keyProvider = g->keyProviders[cipher].Get(); - Q_ASSERT(keyProvider); - - ComPtr keyBuffer; - hr = g->bufferFactory->CreateFromByteArray(key.length(), (BYTE *)key.data(), &keyBuffer); - Q_ASSERT_SUCCEEDED(hr); - ComPtr cryptographicKey; - hr = keyProvider->CreateSymmetricKey(keyBuffer.Get(), &cryptographicKey); - Q_ASSERT_SUCCEEDED(hr); - - UINT32 blockLength; - hr = keyProvider->get_BlockLength(&blockLength); - Q_ASSERT_SUCCEEDED(hr); - if (encrypt) { // Add padding - const char padding = blockLength - data.length() % blockLength; - data += QByteArray(padding, padding); - } - - ComPtr dataBuffer; - hr = g->bufferFactory->CreateFromByteArray(data.length(), (BYTE *)data.data(), &dataBuffer); - Q_ASSERT_SUCCEEDED(hr); - ComPtr ivBuffer; - hr = g->bufferFactory->CreateFromByteArray(iv.length(), (BYTE *)iv.data(), &ivBuffer); - Q_ASSERT_SUCCEEDED(hr); - ComPtr resultBuffer; - hr = encrypt ? g->engine->Encrypt(cryptographicKey.Get(), dataBuffer.Get(), ivBuffer.Get(), &resultBuffer) - : g->engine->Decrypt(cryptographicKey.Get(), dataBuffer.Get(), ivBuffer.Get(), &resultBuffer); - Q_ASSERT_SUCCEEDED(hr); - - UINT32 resultLength; - hr = resultBuffer->get_Length(&resultLength); - Q_ASSERT_SUCCEEDED(hr); - ComPtr bufferAccess; - hr = resultBuffer.As(&bufferAccess); - Q_ASSERT_SUCCEEDED(hr); - byte *resultData; - hr = bufferAccess->Buffer(&resultData); - Q_ASSERT_SUCCEEDED(hr); - - if (!encrypt) { // Remove padding - const uchar padding = resultData[resultLength - 1]; - if (padding > 0 && padding <= blockLength) - resultLength -= padding; - else - qCWarning(lcSsl, "Invalid padding length of %u; decryption likely failed.", padding); - } - - return QByteArray(reinterpret_cast(resultData), resultLength); -} - -QByteArray QSslKeyPrivate::decrypt(Cipher cipher, const QByteArray &data, const QByteArray &key, const QByteArray &iv) -{ - return doCrypt(cipher, data, key, iv, false); -} - -QByteArray QSslKeyPrivate::encrypt(Cipher cipher, const QByteArray &data, const QByteArray &key, const QByteArray &iv) -{ - return doCrypt(cipher, data, key, iv, true); -} diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 47dc7a9f71..64e556ac3c 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -456,9 +456,6 @@ #ifndef QT_NO_OPENSSL #include "qsslsocket_openssl_p.h" #endif -#ifdef Q_OS_WINRT -#include "qsslsocket_winrt_p.h" -#endif #ifdef QT_SECURETRANSPORT #include "qsslsocket_mac_p.h" #endif diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h index d21e8900d8..e7e24ef246 100644 --- a/src/network/ssl/qsslsocket.h +++ b/src/network/ssl/qsslsocket.h @@ -279,7 +279,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_flushWriteBuffer()) Q_PRIVATE_SLOT(d_func(), void _q_flushReadBuffer()) Q_PRIVATE_SLOT(d_func(), void _q_resumeImplementation()) -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !QT_CONFIG(schannel) +#if defined(Q_OS_WIN) && !QT_CONFIG(schannel) Q_PRIVATE_SLOT(d_func(), void _q_caRootLoaded(QSslCertificate,QSslCertificate)) #endif friend class QSslSocketBackendPrivate; diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index 971650a71c..c5e604cf5e 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -75,9 +75,7 @@ class QSslContext; #elif defined(Q_OS_WIN) #include #include -#ifndef Q_OS_WINRT #include -#endif // !Q_OS_WINRT #ifndef HCRYPTPROV_LEGACY #define HCRYPTPROV_LEGACY HCRYPTPROV #endif // !HCRYPTPROV_LEGACY @@ -184,7 +182,7 @@ public: void _q_flushWriteBuffer(); void _q_flushReadBuffer(); void _q_resumeImplementation(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !QT_CONFIG(schannel) +#if defined(Q_OS_WIN) && !QT_CONFIG(schannel) virtual void _q_caRootLoaded(QSslCertificate,QSslCertificate) = 0; #endif diff --git a/src/network/ssl/qsslsocket_winrt.cpp b/src/network/ssl/qsslsocket_winrt.cpp deleted file mode 100644 index 5f5201fc82..0000000000 --- a/src/network/ssl/qsslsocket_winrt.cpp +++ /dev/null @@ -1,682 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtNetwork 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 "qssl_p.h" -#include "qsslsocket_winrt_p.h" -#include "qsslsocket.h" -#include "qsslcertificate_p.h" -#include "qsslcipher_p.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Foundation::Collections; -using namespace ABI::Windows::Networking; -using namespace ABI::Windows::Networking::Sockets; -using namespace ABI::Windows::Security::Cryptography::Certificates; -using namespace ABI::Windows::Storage::Streams; - -QT_BEGIN_NAMESPACE - -bool QSslSocketPrivate::s_libraryLoaded = true; -bool QSslSocketPrivate::s_loadRootCertsOnDemand = true; -bool QSslSocketPrivate::s_loadedCiphersAndCerts = false; - -struct SslSocketGlobal -{ - SslSocketGlobal() - { - HRESULT hr; - hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(), - &hostNameFactory); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr certificateStores; - hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Security_Cryptography_Certificates_CertificateStores).Get(), - &certificateStores); - Q_ASSERT_SUCCEEDED(hr); - - hr = certificateStores->get_TrustedRootCertificationAuthorities(&rootStore); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr *>> op; - hr = certificateStores->FindAllAsync(&op); - Q_ASSERT_SUCCEEDED(hr); - ComPtr> certificates; - hr = QWinRTFunctions::await(op, certificates.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - quint32 size; - hr = certificates->get_Size(&size); - Q_ASSERT_SUCCEEDED(hr); - for (quint32 i = 0; i < size; ++i) { - ComPtr certificate; - hr = certificates->GetAt(i, &certificate); - Q_ASSERT_SUCCEEDED(hr); - systemCaCertificates.append(QSslCertificatePrivate::QSslCertificate_from_Certificate(certificate.Get())); - } - } - - void syncCaCertificates(const QSet &add, const QSet &remove) - { - QMutexLocker locker(&certificateMutex); - for (const QSslCertificate &certificate : add) { - QHash::iterator it = additionalCertificates.find(certificate); - if (it != additionalCertificates.end()) { - it.value().ref(); // Add a reference - } else { - // install certificate - HRESULT hr; - hr = rootStore->Add(static_cast(certificate.handle())); - Q_ASSERT_SUCCEEDED(hr); - additionalCertificates.insert(certificate, 1); - } - } - for (const QSslCertificate &certificate : remove) { - QHash::iterator it = additionalCertificates.find(certificate); - if (it != additionalCertificates.end() && !it.value().deref()) { - // no more references, remove certificate - HRESULT hr; - hr = rootStore->Delete(static_cast(certificate.handle())); - Q_ASSERT_SUCCEEDED(hr); - additionalCertificates.erase(it); - } - } - } - - ComPtr hostNameFactory; - QList systemCaCertificates; - -private: - QMutex certificateMutex; - ComPtr rootStore; - QHash additionalCertificates; -}; -Q_GLOBAL_STATIC(SslSocketGlobal, g) - -// Called on the socket's thread to avoid cross-thread deletion -void QSslSocketConnectionHelper::disconnectSocketFromHost() -{ - if (d->plainSocket) - d->plainSocket->disconnectFromHost(); -} - -QSslSocketBackendPrivate::QSslSocketBackendPrivate() - : connectionHelper(new QSslSocketConnectionHelper(this)) -{ -} - -QSslSocketBackendPrivate::~QSslSocketBackendPrivate() -{ - g->syncCaCertificates(QSet(), previousCaCertificates); -} - -bool QSslSocketPrivate::supportsSsl() -{ - return true; -} - -void QSslSocketPrivate::ensureInitialized() -{ - if (s_loadedCiphersAndCerts) - return; - s_loadedCiphersAndCerts = true; - resetDefaultCiphers(); -} - -long QSslSocketPrivate::sslLibraryVersionNumber() -{ - // ### Qt 6: Find a proper replacement for the deprecated method below. - return QSysInfo::windowsVersion(); -} - -QString QSslSocketPrivate::sslLibraryVersionString() -{ - return QStringLiteral("Windows Runtime, ") + QSysInfo::prettyProductName(); -} - -long QSslSocketPrivate::sslLibraryBuildVersionNumber() -{ - Q_UNIMPLEMENTED(); - return 0; -} - -QString QSslSocketPrivate::sslLibraryBuildVersionString() -{ - Q_UNIMPLEMENTED(); - return QString::number(sslLibraryBuildVersionNumber()); -} - -void QSslSocketPrivate::resetDefaultCiphers() -{ - setDefaultSupportedCiphers(QSslSocketBackendPrivate::defaultCiphers()); - setDefaultCiphers(QSslSocketBackendPrivate::defaultCiphers()); -} - - -QList QSslSocketBackendPrivate::defaultCiphers() -{ - QList ciphers; - const QString protocolStrings[] = { QStringLiteral("TLSv1"), - QStringLiteral("TLSv1.1"), QStringLiteral("TLSv1.2") }; - const QSsl::SslProtocol protocols[] = { QSsl::TlsV1_0, QSsl::TlsV1_1, QSsl::TlsV1_2 }; - const int size = static_cast(ARRAYSIZE(protocols)); - ciphers.reserve(size); - for (int i = 0; i < size; ++i) { - QSslCipher cipher; - cipher.d->isNull = false; - cipher.d->name = QStringLiteral("WINRT"); - cipher.d->protocol = protocols[i]; - cipher.d->protocolString = protocolStrings[i]; - ciphers.append(cipher); - } - return ciphers; -} - -QList QSslSocketPrivate::systemCaCertificates() -{ - return g->systemCaCertificates; -} - -void QSslSocketBackendPrivate::startClientEncryption() -{ - Q_Q(QSslSocket); - - QSsl::SslProtocol protocol = q->protocol(); - switch (q->protocol()) { - case QSsl::AnyProtocol: - protectionLevel = SocketProtectionLevel_Tls10; - break; - case QSsl::TlsV1_0: - protectionLevel = SocketProtectionLevel_Tls10; - break; - case QSsl::TlsV1_1: - protectionLevel = SocketProtectionLevel_Tls11; - break; - case QSsl::TlsV1_2: - protectionLevel = SocketProtectionLevel_Tls12; - break; - case QSsl::TlsV1_0OrLater: - case QSsl::TlsV1_1OrLater: - case QSsl::TlsV1_2OrLater: - case QSsl::TlsV1_3: - case QSsl::TlsV1_3OrLater: - // TlsV1_0OrLater, TlsV1_1OrLater and TlsV1_2OrLater are disabled on WinRT - // because there is no good way to map them to the native API. - setErrorAndEmit(QAbstractSocket::SslInvalidUserDataError, - QStringLiteral("unsupported protocol")); - return; - case QSsl::SecureProtocols: - // SocketProtectionLevel_Tls12 actually means "use TLS1.0, 1.1 or 1.2" - // https://docs.microsoft.com/en-us/uwp/api/windows.networking.sockets.socketprotectionlevel - protectionLevel = SocketProtectionLevel_Tls12; - break; - default: - protectionLevel = SocketProtectionLevel_Tls12; // default to highest - protocol = QSsl::TlsV1_2; - break; - } - - // Sync custom certificates - const QSet caCertificates(configuration.caCertificates.constBegin(), configuration.caCertificates.constEnd()); - const QSet newCertificates = caCertificates - previousCaCertificates; - const QSet oldCertificates = previousCaCertificates - caCertificates; - g->syncCaCertificates(newCertificates, oldCertificates); - previousCaCertificates = caCertificates; - - continueHandshake(); -} - -void QSslSocketBackendPrivate::startServerEncryption() -{ - Q_UNIMPLEMENTED(); -} - -void QSslSocketBackendPrivate::transmit() -{ - Q_Q(QSslSocket); - - if (connectionEncrypted && !writeBuffer.isEmpty()) { - qint64 totalBytesWritten = 0; - int nextDataBlockSize; - while ((nextDataBlockSize = writeBuffer.nextDataBlockSize()) > 0) { - int writtenBytes = plainSocket->write(writeBuffer.readPointer(), nextDataBlockSize); - writtenBytes = nextDataBlockSize; - - writeBuffer.free(writtenBytes); - totalBytesWritten += writtenBytes; - - if (writtenBytes < nextDataBlockSize) - break; - } - - if (totalBytesWritten > 0) { - // Don't emit bytesWritten() recursively. - if (!emittedBytesWritten) { - emittedBytesWritten = true; - emit q->bytesWritten(totalBytesWritten); - emittedBytesWritten = false; - } - emit q->channelBytesWritten(0, totalBytesWritten); - } - } - - // Check if we've got any data to be read from the socket. - int pendingBytes; - bool bytesRead = false; - while ((pendingBytes = plainSocket->bytesAvailable()) > 0) { - char *ptr = buffer.reserve(pendingBytes); - int readBytes = plainSocket->read(ptr, pendingBytes); - buffer.chop(pendingBytes - readBytes); - bytesRead = true; - } - - if (bytesRead) { - if (readyReadEmittedPointer) - *readyReadEmittedPointer = true; - emit q->readyRead(); - emit q->channelReadyRead(0); - } - - if (pendingClose) { - pendingClose = false; - q->disconnectFromHost(); - } -} - -void QSslSocketBackendPrivate::disconnectFromHost() -{ - QMetaObject::invokeMethod(connectionHelper.data(), "disconnectSocketFromHost", Qt::QueuedConnection); -} - -void QSslSocketBackendPrivate::disconnected() -{ -} - -QSslCipher QSslSocketBackendPrivate::sessionCipher() const -{ - return configuration.sessionCipher; -} - -QSsl::SslProtocol QSslSocketBackendPrivate::sessionProtocol() const -{ - return configuration.sessionCipher.protocol(); -} - -void QSslSocketBackendPrivate::continueHandshake() -{ - IStreamSocket *socket = reinterpret_cast(plainSocket->socketDescriptor()); - if (qintptr(socket) == -1) { - setErrorAndEmit(QAbstractSocket::SslInternalError, - QStringLiteral("At attempt was made to continue the handshake on an invalid socket.")); - return; - } - - HRESULT hr; - ComPtr hostName; - const QString host = verificationPeerName.isEmpty() ? plainSocket->peerName() - : verificationPeerName; - if (host.isEmpty()) { - ComPtr info; - hr = socket->get_Information(&info); - Q_ASSERT_SUCCEEDED(hr); - hr = info->get_RemoteAddress(&hostName); - } else { - HStringReference hostRef(reinterpret_cast(host.utf16()), host.length()); - hr = g->hostNameFactory->CreateHostName(hostRef.Get(), &hostName); - Q_ASSERT_SUCCEEDED(hr); - } - if (FAILED(hr)) { - setErrorAndEmit(QAbstractSocket::SslInvalidUserDataError, qt_error_string(hr)); - return; - } - - ComPtr control; - hr = socket->get_Control(&control); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr control2; - hr = control.As(&control2); - ComPtr> ignoreList; - hr = control2->get_IgnorableServerCertificateErrors(&ignoreList); - Q_ASSERT_SUCCEEDED(hr); - - QSet ignoreErrors(ignoreErrorsList.constBegin(), ignoreErrorsList.constEnd()); - for (int i = ChainValidationResult_Untrusted; i < ChainValidationResult_OtherErrors + 1; ++i) { - // Populate the native ignore list - break to add, continue to skip - switch (i) { - case ChainValidationResult_Revoked: - case ChainValidationResult_InvalidSignature: - case ChainValidationResult_BasicConstraintsError: - case ChainValidationResult_InvalidCertificateAuthorityPolicy: - case ChainValidationResult_UnknownCriticalExtension: - case ChainValidationResult_OtherErrors: - continue; // The above errors can't be ignored in the handshake - case ChainValidationResult_Untrusted: - if (ignoreAllSslErrors || ignoreErrors.contains(QSslError::CertificateUntrusted)) - break; - continue; - case ChainValidationResult_Expired: - if (ignoreAllSslErrors || ignoreErrors.contains(QSslError::CertificateExpired)) - break; - continue; - case ChainValidationResult_IncompleteChain: - if (ignoreAllSslErrors - || ignoreErrors.contains(QSslError::InvalidCaCertificate) - || ignoreErrors.contains(QSslError::UnableToVerifyFirstCertificate) - || ignoreErrors.contains(QSslError::UnableToGetIssuerCertificate)) { - break; - } - continue; - case ChainValidationResult_WrongUsage: - if (ignoreAllSslErrors || ignoreErrors.contains(QSslError::InvalidPurpose)) - break; - continue; - case ChainValidationResult_InvalidName: - if (ignoreAllSslErrors - || ignoreErrors.contains(QSslError::HostNameMismatch) - || ignoreErrors.contains(QSslError::SubjectIssuerMismatch)) { - break; - } - continue; - case ChainValidationResult_RevocationInformationMissing: - case ChainValidationResult_RevocationFailure: - default: - if (ignoreAllSslErrors) - break; - continue; - } - hr = ignoreList->Append(static_cast(i)); - Q_ASSERT_SUCCEEDED(hr); - } - - ComPtr op; - hr = socket->UpgradeToSslAsync(protectionLevel, hostName.Get(), &op); - if (FAILED(hr)) { - setErrorAndEmit(QAbstractSocket::SslInternalError, - QSslSocket::tr("Error creating SSL session: %1").arg(qt_error_string(hr))); - return; - } - - hr = QEventDispatcherWinRT::runOnXamlThread([this, op]() { - HRESULT hr = op->put_Completed(Callback( - this, &QSslSocketBackendPrivate::onSslUpgrade).Get()); - return hr; - }); - Q_ASSERT_SUCCEEDED(hr); -} - -HRESULT QSslSocketBackendPrivate::onSslUpgrade(IAsyncAction *action, AsyncStatus) -{ - Q_Q(QSslSocket); - - if (wasDeleted) { - qCWarning(lcSsl, - "SSL upgrade callback received after the delegate was deleted. " - "This may be indicative of an internal bug in the WinRT SSL implementation."); - return S_OK; - } - - HRESULT hr = action->GetResults(); - QSet errors; - switch (hr) { - case SEC_E_INVALID_TOKEN: // Occurs when the server doesn't support the requested protocol - setErrorAndEmit(QAbstractSocket::SslHandshakeFailedError, qt_error_string(hr)); - q->disconnectFromHost(); - return S_OK; - default: - if (FAILED(hr)) - qErrnoWarning(hr, "error"); // Unhandled error; let sslErrors take care of it - break; - } - - IStreamSocket *socket = reinterpret_cast(plainSocket->socketDescriptor()); - if (qintptr(socket) == -1) { - qCWarning(lcSsl, - "The underlying TCP socket used by the SSL socket is invalid. " - "This may be indicative of an internal bug in the WinRT SSL implementation."); - return S_OK; - } - - ComPtr info; - hr = socket->get_Information(&info); - Q_ASSERT_SUCCEEDED(hr); - ComPtr info2; - hr = info.As(&info2); - Q_ASSERT_SUCCEEDED(hr); - - // Cipher - QSsl::SslProtocol protocol; - SocketProtectionLevel protectionLevel; - hr = info->get_ProtectionLevel(&protectionLevel); - switch (protectionLevel) { - default: - protocol = QSsl::UnknownProtocol; - break; - case SocketProtectionLevel_Ssl: - protocol = QSsl::SslV3; - break; - case SocketProtectionLevel_Tls10: - protocol = QSsl::TlsV1_0; - break; - case SocketProtectionLevel_Tls11: - protocol = QSsl::TlsV1_1; - break; - case SocketProtectionLevel_Tls12: - protocol = QSsl::TlsV1_2; - break; - } - configuration.sessionCipher = QSslCipher(QStringLiteral("WINRT"), protocol); // The actual cipher name is not accessible - - // Certificate & chain - ComPtr certificate; - hr = info2->get_ServerCertificate(&certificate); - Q_ASSERT_SUCCEEDED(hr); - - QList peerCertificateChain; - if (certificate) { - ComPtr> op; - hr = certificate->BuildChainAsync(nullptr, &op); - Q_ASSERT_SUCCEEDED(hr); - ComPtr certificateChain; - hr = QWinRTFunctions::await(op, certificateChain.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr> certificates; - hr = certificateChain->GetCertificates(true, &certificates); - Q_ASSERT_SUCCEEDED(hr); - quint32 certificatesLength; - hr = certificates->get_Size(&certificatesLength); - Q_ASSERT_SUCCEEDED(hr); - for (quint32 i = 0; i < certificatesLength; ++i) { - ComPtr chainCertificate; - hr = certificates->GetAt(i, &chainCertificate); - Q_ASSERT_SUCCEEDED(hr); - peerCertificateChain.append(QSslCertificatePrivate::QSslCertificate_from_Certificate(chainCertificate.Get())); - } - } - - configuration.peerCertificate = certificate ? QSslCertificatePrivate::QSslCertificate_from_Certificate(certificate.Get()) - : QSslCertificate(); - configuration.peerCertificateChain = peerCertificateChain; - - // Errors - ComPtr> chainValidationResults; - hr = info2->get_ServerCertificateErrors(&chainValidationResults); - Q_ASSERT_SUCCEEDED(hr); - quint32 size; - hr = chainValidationResults->get_Size(&size); - Q_ASSERT_SUCCEEDED(hr); - for (quint32 i = 0; i < size; ++i) { - ChainValidationResult result; - hr = chainValidationResults->GetAt(i, &result); - Q_ASSERT_SUCCEEDED(hr); - switch (result) { - case ChainValidationResult_Success: - break; - case ChainValidationResult_Untrusted: - errors.insert(QSslError::CertificateUntrusted); - break; - case ChainValidationResult_Revoked: - errors.insert(QSslError::CertificateRevoked); - break; - case ChainValidationResult_Expired: - errors.insert(QSslError::CertificateExpired); - break; - case ChainValidationResult_IncompleteChain: - errors.insert(QSslError::UnableToGetIssuerCertificate); - break; - case ChainValidationResult_InvalidSignature: - errors.insert(QSslError::CertificateSignatureFailed); - break; - case ChainValidationResult_WrongUsage: - errors.insert(QSslError::InvalidPurpose); - break; - case ChainValidationResult_InvalidName: - errors.insert(QSslError::HostNameMismatch); - break; - case ChainValidationResult_InvalidCertificateAuthorityPolicy: - errors.insert(QSslError::InvalidCaCertificate); - break; - default: - errors.insert(QSslError::UnspecifiedError); - break; - } - } - - sslErrors = QList(errors.constBegin(), errors.constEnd()); - - // Peer validation - if (!configuration.peerCertificate.isNull()) { - const QString peerName = verificationPeerName.isEmpty() ? q->peerName() : verificationPeerName; - if (!isMatchingHostname(configuration.peerCertificate, peerName)) { - // No matches in common names or alternate names. - const QSslError error(QSslError::HostNameMismatch, configuration.peerCertificate); - const int index = sslErrors.indexOf(QSslError::HostNameMismatch); - if (index >= 0) // Replace the existing error - sslErrors[index] = error; - else - sslErrors.append(error); - emit q->peerVerifyError(error); - } - - // Peer validation required, but no certificate is present - } else if (configuration.peerVerifyMode == QSslSocket::VerifyPeer - || configuration.peerVerifyMode == QSslSocket::AutoVerifyPeer) { - QSslError error(QSslError::NoPeerCertificate); - sslErrors.append(error); - emit q->peerVerifyError(error); - } - - // Peer chain validation - for (const QSslCertificate &certificate : qAsConst(peerCertificateChain)) { - if (!QSslCertificatePrivate::isBlacklisted(certificate)) - continue; - - QSslError error(QSslError::CertificateBlacklisted, certificate); - sslErrors.append(error); - emit q->peerVerifyError(error); - } - - if (!sslErrors.isEmpty()) { - emit q->sslErrors(sslErrors); - setErrorAndEmit(QAbstractSocket::SslHandshakeFailedError, sslErrors.constFirst().errorString()); - - // Disconnect if there are any non-ignorable errors - for (const QSslError &error : qAsConst(sslErrors)) { - if (ignoreErrorsList.contains(error)) - continue; - q->disconnectFromHost(); - return S_OK; - } - } - - if (readBufferMaxSize) - plainSocket->setReadBufferSize(readBufferMaxSize); - - connectionEncrypted = true; - emit q->encrypted(); - - // The write buffer may already have data written to it, so we need to call transmit. - // This has to be done in 'q's thread, and not in the current thread (the XAML thread). - QMetaObject::invokeMethod(q, [this](){ transmit(); }); - - if (pendingClose) { - pendingClose = false; - q->disconnectFromHost(); - } - - return S_OK; -} - -QList QSslSocketBackendPrivate::verify(const QList &certificateChain, const QString &hostName) -{ - Q_UNIMPLEMENTED(); - Q_UNUSED(certificateChain) - Q_UNUSED(hostName) - QList errors; - - return errors; -} - -bool QSslSocketBackendPrivate::importPkcs12(QIODevice *device, - QSslKey *key, QSslCertificate *cert, - QList *caCertificates, - const QByteArray &passPhrase) -{ - Q_UNIMPLEMENTED(); - Q_UNUSED(device) - Q_UNUSED(key) - Q_UNUSED(cert) - Q_UNUSED(caCertificates) - Q_UNUSED(passPhrase) - return false; -} - -QT_END_NAMESPACE diff --git a/src/network/ssl/qsslsocket_winrt_p.h b/src/network/ssl/qsslsocket_winrt_p.h deleted file mode 100644 index 030db6d4fa..0000000000 --- a/src/network/ssl/qsslsocket_winrt_p.h +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtNetwork 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 QSSLSOCKET_WINRT_P_H -#define QSSLSOCKET_WINRT_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of the QtNetwork library. This header file may change from -// version to version without notice, or even be removed. -// -// We mean it. -// - -#include -#include "qsslsocket_p.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -class QSslSocketConnectionHelper : public QObject -{ - Q_OBJECT -public: - QSslSocketConnectionHelper(QSslSocketBackendPrivate *d) - : d(d) { } - - Q_INVOKABLE void disconnectSocketFromHost(); - -private: - QSslSocketBackendPrivate *d; -}; - -class QSslSocketBackendPrivate : public QSslSocketPrivate -{ - Q_DECLARE_PUBLIC(QSslSocket) -public: - QSslSocketBackendPrivate(); - ~QSslSocketBackendPrivate(); - - // Platform specific functions - void startClientEncryption() override; - void startServerEncryption() override; - void transmit() override; - void disconnectFromHost() override; - void disconnected() override; - QSslCipher sessionCipher() const override; - QSsl::SslProtocol sessionProtocol() const override; - void continueHandshake() override; - - static QList defaultCiphers(); - static QList verify(const QList &certificateChain, const QString &hostName); - static bool importPkcs12(QIODevice *device, - QSslKey *key, QSslCertificate *cert, - QList *caCertificates, - const QByteArray &passPhrase); - -private: - HRESULT onSslUpgrade(ABI::Windows::Foundation::IAsyncAction *, - ABI::Windows::Foundation::AsyncStatus); - - QScopedPointer connectionHelper; - ABI::Windows::Networking::Sockets::SocketProtectionLevel protectionLevel; - QSet previousCaCertificates; -}; - -QT_END_NAMESPACE - -#endif // QSSLSOCKET_WINRT_P_H diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri index dfbf539303..1310435eb9 100644 --- a/src/network/ssl/ssl.pri +++ b/src/network/ssl/ssl.pri @@ -42,16 +42,6 @@ qtConfig(ssl) { ssl/qsslpresharedkeyauthenticator.cpp \ ssl/qocspresponse.cpp - winrt { - HEADERS += ssl/qsslsocket_winrt_p.h - SOURCES += ssl/qsslcertificate_winrt.cpp \ - ssl/qssldiffiehellmanparameters_dummy.cpp \ - ssl/qsslkey_qt.cpp \ - ssl/qsslkey_winrt.cpp \ - ssl/qsslsocket_winrt.cpp \ - ssl/qsslellipticcurve_dummy.cpp - } - qtConfig(schannel) { HEADERS += ssl/qsslsocket_schannel_p.h SOURCES += ssl/qsslsocket_schannel.cpp \ diff --git a/src/platformsupport/fontdatabases/.prev_CMakeLists.txt b/src/platformsupport/fontdatabases/.prev_CMakeLists.txt index 5ac6c097a0..be84811a9e 100644 --- a/src/platformsupport/fontdatabases/.prev_CMakeLists.txt +++ b/src/platformsupport/fontdatabases/.prev_CMakeLists.txt @@ -35,7 +35,7 @@ qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_fontconfig Fontconfig::Fontconfig ) -qt_extend_target(FontDatabaseSupport CONDITION WIN32 AND NOT WINRT +qt_extend_target(FontDatabaseSupport CONDITION WIN32 SOURCES windows/qwindowsfontdatabase.cpp windows/qwindowsfontdatabase_p.h windows/qwindowsfontdatabasebase.cpp windows/qwindowsfontdatabasebase_p.h @@ -50,21 +50,21 @@ qt_extend_target(FontDatabaseSupport CONDITION WIN32 AND NOT WINRT Qt::GuiPrivate ) -qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_freetype AND WIN32 AND NOT WINRT +qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_freetype AND WIN32 SOURCES windows/qwindowsfontdatabase_ft.cpp windows/qwindowsfontdatabase_ft_p.h LIBRARIES WrapFreetype::WrapFreetype ) -qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32 AND NOT WINRT +qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32 SOURCES windows/qwindowsfontenginedirectwrite.cpp windows/qwindowsfontenginedirectwrite_p.h LIBRARIES d2d1 ) -qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite3 AND WIN32 AND NOT WINRT +qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite3 AND WIN32 SOURCES windows/qwindowsdirectwritefontdatabase.cpp windows/qwindowsdirectwritefontdatabase_p.h DEFINES @@ -74,36 +74,24 @@ qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATUR dwrite_3 ) -qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite2 AND WIN32 AND NOT QT_FEATURE_directwrite3 AND NOT WINRT +qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite2 AND WIN32 AND NOT QT_FEATURE_directwrite3 DEFINES QT_USE_DIRECTWRITE2 LIBRARIES dwrite_2 ) -qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32 AND NOT QT_FEATURE_directwrite2 AND NOT QT_FEATURE_directwrite3 AND NOT WINRT +qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32 AND NOT QT_FEATURE_directwrite2 AND NOT QT_FEATURE_directwrite3 LIBRARIES dwrite ) -qt_extend_target(FontDatabaseSupport CONDITION WIN32 AND NOT WINRT AND (NOT QT_FEATURE_direct2d OR NOT QT_FEATURE_directwrite) +qt_extend_target(FontDatabaseSupport CONDITION WIN32 AND (NOT QT_FEATURE_direct2d OR NOT QT_FEATURE_directwrite) DEFINES QT_NO_DIRECTWRITE ) -qt_extend_target(FontDatabaseSupport CONDITION MINGW AND WIN32 AND NOT WINRT +qt_extend_target(FontDatabaseSupport CONDITION MINGW AND WIN32 LIBRARIES uuid ) - -qt_extend_target(FontDatabaseSupport CONDITION WINRT - SOURCES - winrt/qwinrtfontdatabase.cpp winrt/qwinrtfontdatabase_p.h - DEFINES - __WRL_NO_DEFAULT_LIB__ - LIBRARIES - dwrite_1 - ws2_32 - PUBLIC_LIBRARIES - Qt::GuiPrivate -) diff --git a/src/platformsupport/fontdatabases/CMakeLists.txt b/src/platformsupport/fontdatabases/CMakeLists.txt index 32efd33a5f..8b37257ded 100644 --- a/src/platformsupport/fontdatabases/CMakeLists.txt +++ b/src/platformsupport/fontdatabases/CMakeLists.txt @@ -47,7 +47,7 @@ if(TARGET WrapFreetype::WrapFreetype) endif() # special case end -qt_extend_target(FontDatabaseSupport CONDITION WIN32 AND NOT WINRT +qt_extend_target(FontDatabaseSupport CONDITION WIN32 SOURCES windows/qwindowsfontdatabase.cpp windows/qwindowsfontdatabase_p.h windows/qwindowsfontdatabasebase.cpp windows/qwindowsfontdatabasebase_p.h @@ -62,21 +62,21 @@ qt_extend_target(FontDatabaseSupport CONDITION WIN32 AND NOT WINRT Qt::GuiPrivate ) -qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_freetype AND WIN32 AND NOT WINRT +qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_freetype AND WIN32 SOURCES windows/qwindowsfontdatabase_ft.cpp windows/qwindowsfontdatabase_ft_p.h LIBRARIES WrapFreetype::WrapFreetype ) -qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32 AND NOT WINRT +qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32 SOURCES windows/qwindowsfontenginedirectwrite.cpp windows/qwindowsfontenginedirectwrite_p.h LIBRARIES d2d1 ) -qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite3 AND WIN32 AND NOT WINRT +qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite3 AND WIN32 SOURCES windows/qwindowsdirectwritefontdatabase.cpp windows/qwindowsdirectwritefontdatabase_p.h DEFINES @@ -86,36 +86,24 @@ qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATUR dwrite_3 ) -qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite2 AND WIN32 AND NOT QT_FEATURE_directwrite3 AND NOT WINRT +qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite2 AND WIN32 AND NOT QT_FEATURE_directwrite3 DEFINES QT_USE_DIRECTWRITE2 LIBRARIES dwrite_2 ) -qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32 AND NOT QT_FEATURE_directwrite2 AND NOT QT_FEATURE_directwrite3 AND NOT WINRT +qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32 AND NOT QT_FEATURE_directwrite2 AND NOT QT_FEATURE_directwrite3 LIBRARIES dwrite ) -qt_extend_target(FontDatabaseSupport CONDITION WIN32 AND NOT WINRT AND (NOT QT_FEATURE_direct2d OR NOT QT_FEATURE_directwrite) +qt_extend_target(FontDatabaseSupport CONDITION WIN32 AND (NOT QT_FEATURE_direct2d OR NOT QT_FEATURE_directwrite) DEFINES QT_NO_DIRECTWRITE ) -qt_extend_target(FontDatabaseSupport CONDITION MINGW AND WIN32 AND NOT WINRT +qt_extend_target(FontDatabaseSupport CONDITION MINGW AND WIN32 LIBRARIES uuid ) - -qt_extend_target(FontDatabaseSupport CONDITION WINRT - SOURCES - winrt/qwinrtfontdatabase.cpp winrt/qwinrtfontdatabase_p.h - DEFINES - __WRL_NO_DEFAULT_LIB__ - LIBRARIES - dwrite_1 - ws2_32 - PUBLIC_LIBRARIES - Qt::GuiPrivate -) diff --git a/src/platformsupport/fontdatabases/fontdatabases.pro b/src/platformsupport/fontdatabases/fontdatabases.pro index d90ec31685..d597a0d6c2 100644 --- a/src/platformsupport/fontdatabases/fontdatabases.pro +++ b/src/platformsupport/fontdatabases/fontdatabases.pro @@ -15,12 +15,8 @@ qtConfig(fontconfig) { include($$PWD/fontconfig/fontconfig.pri) } -win32:!winrt { +win32 { include($$PWD/windows/windows.pri) } -winrt { - include($$PWD/winrt/winrt.pri) -} - load(qt_module) diff --git a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp deleted file mode 100644 index bc1a4c7d6f..0000000000 --- a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp +++ /dev/null @@ -1,507 +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$ -** -****************************************************************************/ - -#include "qwinrtfontdatabase_p.h" - -#include - -#include -#include - -#include -#include -#include -using namespace Microsoft::WRL; - -QT_BEGIN_NAMESPACE - -Q_LOGGING_CATEGORY(lcQpaFonts, "qt.qpa.fonts") - -QDebug operator<<(QDebug d, const QFontDef &def) -{ - QDebugStateSaver saver(d); - d.nospace(); - d << "Family=" << def.family << " Stylename=" << def.styleName - << " pointsize=" << def.pointSize << " pixelsize=" << def.pixelSize - << " styleHint=" << def.styleHint << " weight=" << def.weight - << " stretch=" << def.stretch << " hintingPreference=" - << def.hintingPreference; - return d; -} - -// Based on unicode range tables at http://www.microsoft.com/typography/otspec/os2.htm#ur -static QFontDatabase::WritingSystem writingSystemFromUnicodeRange(const DWRITE_UNICODE_RANGE &range) -{ - if (range.first >= 0x0000 && range.last <= 0x007F) - return QFontDatabase::Latin; - if (range.first >= 0x0370 && range.last <= 0x03FF) - return QFontDatabase::Greek; - if (range.first >= 0x0400 && range.last <= 0x04FF) - return QFontDatabase::Cyrillic; - if (range.first >= 0x0530 && range.last <= 0x058F) - return QFontDatabase::Armenian; - if (range.first >= 0x0590 && range.last <= 0x05FF) - return QFontDatabase::Hebrew; - if (range.first >= 0x0600 && range.last <= 0x06FF) - return QFontDatabase::Arabic; - if (range.first >= 0x0700 && range.last <= 0x074F) - return QFontDatabase::Syriac; - if (range.first >= 0x0780 && range.last <= 0x07BF) - return QFontDatabase::Thaana; - if (range.first >= 0x0900 && range.last <= 0x097F) - return QFontDatabase::Devanagari; - if (range.first >= 0x0980 && range.last <= 0x09FF) - return QFontDatabase::Bengali; - if (range.first >= 0x0A00 && range.last <= 0x0A7F) - return QFontDatabase::Gurmukhi; - if (range.first >= 0x0A80 && range.last <= 0x0AFF) - return QFontDatabase::Gujarati; - if (range.first >= 0x0B00 && range.last <= 0x0B7F) - return QFontDatabase::Oriya; - if (range.first >= 0x0B80 && range.last <= 0x0BFF) - return QFontDatabase::Tamil; - if (range.first >= 0x0C00 && range.last <= 0x0C7F) - return QFontDatabase::Telugu; - if (range.first >= 0x0C80 && range.last <= 0x0CFF) - return QFontDatabase::Kannada; - if (range.first >= 0x0D00 && range.last <= 0x0D7F) - return QFontDatabase::Malayalam; - if (range.first >= 0x0D80 && range.last <= 0x0DFF) - return QFontDatabase::Sinhala; - if (range.first >= 0x0E00 && range.last <= 0x0E7F) - return QFontDatabase::Thai; - if (range.first >= 0x0E80 && range.last <= 0x0EFF) - return QFontDatabase::Lao; - if (range.first >= 0x0F00 && range.last <= 0x0FFF) - return QFontDatabase::Tibetan; - if (range.first >= 0x1000 && range.last <= 0x109F) - return QFontDatabase::Myanmar; - if (range.first >= 0x10A0 && range.last <= 0x10FF) - return QFontDatabase::Georgian; - if (range.first >= 0x1780 && range.last <= 0x17FF) - return QFontDatabase::Khmer; - if (range.first >= 0x4E00 && range.last <= 0x9FFF) - return QFontDatabase::SimplifiedChinese; - if (range.first >= 0xAC00 && range.last <= 0xD7AF) - return QFontDatabase::Korean; - if (range.first >= 0x1680 && range.last <= 0x169F) - return QFontDatabase::Ogham; - if (range.first >= 0x16A0 && range.last <= 0x16FF) - return QFontDatabase::Runic; - if (range.first >= 0x07C0 && range.last <= 0x07FF) - return QFontDatabase::Nko; - - return QFontDatabase::Other; -} - -QWinRTFontDatabase::~QWinRTFontDatabase() -{ - qCDebug(lcQpaFonts) << __FUNCTION__; - - foreach (IDWriteFontFile *fontFile, m_fonts.keys()) - fontFile->Release(); - - foreach (IDWriteFontFamily *fontFamily, m_fontFamilies) - fontFamily->Release(); -} - -QString QWinRTFontDatabase::fontDir() const -{ - qCDebug(lcQpaFonts) << __FUNCTION__; - QString fontDirectory = QFreeTypeFontDatabase::fontDir(); - if (!QFile::exists(fontDirectory)) { - // Fall back to app directory + fonts, and just app directory after that - const QString applicationDirPath = QCoreApplication::applicationDirPath(); - fontDirectory = applicationDirPath + QLatin1String("/fonts"); - if (!QFile::exists(fontDirectory)) { - if (m_fontFamilies.isEmpty()) - qWarning("No fonts directory found in application package."); - fontDirectory = applicationDirPath; - } - } - return fontDirectory; -} - -QFont QWinRTFontDatabase::defaultFont() const -{ - return QFont(QStringLiteral("Segoe UI")); -} - -bool QWinRTFontDatabase::fontsAlwaysScalable() const -{ - return true; -} - -void QWinRTFontDatabase::populateFontDatabase() -{ - qCDebug(lcQpaFonts) << __FUNCTION__; - - ComPtr factory; - HRESULT hr = DWriteCreateFactory(DWRITE_FACTORY_TYPE_ISOLATED, __uuidof(IDWriteFactory1), &factory); - if (FAILED(hr)) { - qWarning("Failed to create DirectWrite factory: %s", qPrintable(qt_error_string(hr))); - QFreeTypeFontDatabase::populateFontDatabase(); - return; - } - - ComPtr fontCollection; - hr = factory->GetSystemFontCollection(&fontCollection); - if (FAILED(hr)) { - qWarning("Failed to open system font collection: %s", qPrintable(qt_error_string(hr))); - QFreeTypeFontDatabase::populateFontDatabase(); - return; - } - - int fontFamilyCount = fontCollection->GetFontFamilyCount(); - for (int i = 0; i < fontFamilyCount; ++i) { - ComPtr fontFamily; - hr = fontCollection->GetFontFamily(i, &fontFamily); - if (FAILED(hr)) { - qWarning("Unable to get font family: %s", qPrintable(qt_error_string(hr))); - continue; - } - - ComPtr names; - hr = fontFamily->GetFamilyNames(&names); - if (FAILED(hr)) { - qWarning("Unable to get font family names: %s", qPrintable(qt_error_string(hr))); - continue; - } - quint32 familyNameLength; - hr = names->GetStringLength(0, &familyNameLength); - if (FAILED(hr)) { - qWarning("Unable to get family name length: %s", qPrintable(qt_error_string(hr))); - continue; - } - QVector familyBuffer(familyNameLength + 1); - hr = names->GetString(0, familyBuffer.data(), familyBuffer.size()); - if (FAILED(hr)) { - qWarning("Unable to create font family name: %s", qPrintable(qt_error_string(hr))); - continue; - } - QString familyName = QString::fromWCharArray(familyBuffer.data(), familyNameLength); - - m_fontFamilies.insert(familyName, fontFamily.Detach()); - - registerFontFamily(familyName); - } - - QFreeTypeFontDatabase::populateFontDatabase(); -} - -void QWinRTFontDatabase::populateFamily(const QString &familyName) -{ - qCDebug(lcQpaFonts) << __FUNCTION__ << familyName; - - IDWriteFontFamily *fontFamily = m_fontFamilies.value(familyName); - if (!fontFamily) { - qWarning("The font family %s was not found.", qPrintable(familyName)); - return; - } - - bool fontRegistered = false; - const int fontCount = fontFamily->GetFontCount(); - for (int j = 0; j < fontCount; ++j) { - ComPtr font; - HRESULT hr = fontFamily->GetFont(j, &font); - if (FAILED(hr)) { - qWarning("Unable to get font: %s", qPrintable(qt_error_string(hr))); - continue; - } - - // Skip simulated faces - if (font->GetSimulations() != DWRITE_FONT_SIMULATIONS_NONE) - continue; - - ComPtr baseFontFace; - hr = font->CreateFontFace(&baseFontFace); - if (FAILED(hr)) { - qWarning("Unable to create base font face: %s", qPrintable(qt_error_string(hr))); - continue; - } - ComPtr fontFace; - hr = baseFontFace.As(&fontFace); - if (FAILED(hr)) { - qWarning("Unable to create font face: %s", qPrintable(qt_error_string(hr))); - continue; - } - - // We can't deal with multi-file fonts - quint32 fileCount; - hr = fontFace->GetFiles(&fileCount, NULL); - if (FAILED(hr)) { - qWarning("Unable to get font file count: %s", qPrintable(qt_error_string(hr))); - continue; - } - if (fileCount != 1) - continue; - - ComPtr informationalStrings; - BOOL exists; - hr = font->GetInformationalStrings(DWRITE_INFORMATIONAL_STRING_MANUFACTURER, - &informationalStrings, &exists); - if (FAILED(hr)) { - qWarning("Unable to get font foundry: %s", qPrintable(qt_error_string(hr))); - continue; - } - QString foundryName; - if (exists) { - quint32 length; - hr = informationalStrings->GetStringLength(0, &length); - if (FAILED(hr)) - qWarning("Unable to get foundry name length: %s", qPrintable(qt_error_string(hr))); - if (SUCCEEDED(hr)) { - QVector buffer(length + 1); - hr = informationalStrings->GetString(0, buffer.data(), buffer.size()); - if (FAILED(hr)) - qWarning("Unable to get foundry name: %s", qPrintable(qt_error_string(hr))); - if (SUCCEEDED(hr)) - foundryName = QString::fromWCharArray(buffer.data(), length); - } - } - - QFont::Weight weight = QPlatformFontDatabase::weightFromInteger(font->GetWeight()); - - QFont::Style style; - switch (font->GetStyle()) { - default: - case DWRITE_FONT_STYLE_NORMAL: - style = QFont::StyleNormal; - break; - case DWRITE_FONT_STYLE_OBLIQUE: - style = QFont::StyleOblique; - break; - case DWRITE_FONT_STYLE_ITALIC: - style = QFont::StyleItalic; - break; - } - - QFont::Stretch stretch; - switch (font->GetStretch()) { - default: - case DWRITE_FONT_STRETCH_UNDEFINED: - case DWRITE_FONT_STRETCH_NORMAL: - stretch = QFont::Unstretched; - break; - case DWRITE_FONT_STRETCH_ULTRA_CONDENSED: - stretch = QFont::UltraCondensed; - break; - case DWRITE_FONT_STRETCH_EXTRA_CONDENSED: - stretch = QFont::ExtraCondensed; - break; - case DWRITE_FONT_STRETCH_CONDENSED: - stretch = QFont::Condensed; - break; - case DWRITE_FONT_STRETCH_SEMI_CONDENSED: - stretch = QFont::SemiCondensed; - break; - case DWRITE_FONT_STRETCH_SEMI_EXPANDED: - stretch = QFont::SemiExpanded; - break; - case DWRITE_FONT_STRETCH_EXPANDED: - stretch = QFont::Expanded; - break; - case DWRITE_FONT_STRETCH_EXTRA_EXPANDED: - stretch = QFont::ExtraExpanded; - break; - case DWRITE_FONT_STRETCH_ULTRA_EXPANDED: - stretch = QFont::UltraExpanded; - break; - } - - const bool fixedPitch = fontFace->IsMonospacedFont(); - - // Get writing systems from unicode ranges - quint32 actualRangeCount; - hr = fontFace->GetUnicodeRanges(0, nullptr, &actualRangeCount); - Q_ASSERT(hr == E_NOT_SUFFICIENT_BUFFER); - QVector unicodeRanges(actualRangeCount); - hr = fontFace->GetUnicodeRanges(actualRangeCount, unicodeRanges.data(), &actualRangeCount); - if (FAILED(hr)) { - qWarning("Unable to get font unicode range: %s", qPrintable(qt_error_string(hr))); - continue; - } - QSupportedWritingSystems writingSystems; - for (quint32 i = 0; i < actualRangeCount; ++i) { - const QFontDatabase::WritingSystem writingSystem = writingSystemFromUnicodeRange(unicodeRanges.at(i)); - writingSystems.setSupported(writingSystem); - } - if (writingSystems.supported(QFontDatabase::SimplifiedChinese)) { - writingSystems.setSupported(QFontDatabase::TraditionalChinese); - writingSystems.setSupported(QFontDatabase::Japanese); - } - if (writingSystems.supported(QFontDatabase::Latin)) - writingSystems.setSupported(QFontDatabase::Vietnamese); - - IDWriteFontFile *fontFile; - hr = fontFace->GetFiles(&fileCount, &fontFile); - if (FAILED(hr)) { - qWarning("Unable to get font file: %s", qPrintable(qt_error_string(hr))); - continue; - } - - FontDescription description = { fontFace->GetIndex(), QUuid::createUuid().toByteArray() }; - m_fonts.insert(fontFile, description); - registerFont(familyName, QString(), foundryName, weight, style, stretch, - true, true, 0, fixedPitch, writingSystems, fontFile); - fontRegistered = true; - } - - // Always populate something to avoid an assert - if (!fontRegistered) { - registerFont(familyName, QString(), QString(), QFont::Normal, QFont::StyleNormal, - QFont::Unstretched, false, false, 0, false, QSupportedWritingSystems(), 0); - } -} - -QFontEngine *QWinRTFontDatabase::fontEngine(const QFontDef &fontDef, void *handle) -{ - qCDebug(lcQpaFonts) << __FUNCTION__ << "FONTDEF" << fontDef << handle; - - if (!handle) // Happens if a font family population failed - return 0; - - IDWriteFontFile *fontFile = reinterpret_cast(handle); - if (!m_fonts.contains(fontFile)) - return QFreeTypeFontDatabase::fontEngine(fontDef, handle); - - const void *referenceKey; - quint32 referenceKeySize; - HRESULT hr = fontFile->GetReferenceKey(&referenceKey, &referenceKeySize); - if (FAILED(hr)) { - qWarning("Unable to get font file reference key: %s", qPrintable(qt_error_string(hr))); - return 0; - } - - ComPtr loader; - hr = fontFile->GetLoader(&loader); - if (FAILED(hr)) { - qWarning("Unable to get font file loader: %s", qPrintable(qt_error_string(hr))); - return 0; - } - - ComPtr stream; - hr =loader->CreateStreamFromKey(referenceKey, referenceKeySize, &stream); - if (FAILED(hr)) { - qWarning("Unable to get font file stream: %s", qPrintable(qt_error_string(hr))); - return 0; - } - - quint64 fileSize; - hr = stream->GetFileSize(&fileSize); - if (FAILED(hr)) { - qWarning("Unable to get font file size: %s", qPrintable(qt_error_string(hr))); - return 0; - } - - const void *data; - void *context; - hr = stream->ReadFileFragment(&data, 0, fileSize, &context); - if (FAILED(hr)) { - qWarning("Unable to get font file data: %s", qPrintable(qt_error_string(hr))); - return 0; - } - const QByteArray fontData((const char *)data, fileSize); - stream->ReleaseFileFragment(context); - - QFontEngine::FaceId faceId; - const FontDescription description = m_fonts.value(fontFile); - faceId.uuid = description.uuid; - faceId.index = description.index; - - return QFontEngineFT::create(fontDef, faceId, fontData); -} - -QString QWinRTFontDatabase::familyForStyleHint(QFont::StyleHint styleHint) -{ - switch (styleHint) { - case QFont::Times: - return QStringLiteral("Times New Roman"); - case QFont::Courier: - return QStringLiteral("Courier New"); - case QFont::Monospace: - return QStringLiteral("Courier New"); - case QFont::Cursive: - return QStringLiteral("Comic Sans MS"); - case QFont::Fantasy: - return QStringLiteral("Impact"); - case QFont::Decorative: - return QStringLiteral("Old English"); - case QFont::Helvetica: - return QStringLiteral("Segoe UI"); - case QFont::System: - default: - break; - } - return QStringLiteral("Segoe UI"); -} - -QStringList QWinRTFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, - QFont::StyleHint styleHint, - QChar::Script script) const -{ - Q_UNUSED(style) - Q_UNUSED(script) - - qCDebug(lcQpaFonts) << __FUNCTION__ << family; - - QStringList result; - result.append(QWinRTFontDatabase::familyForStyleHint(styleHint)); - result.append(QFreeTypeFontDatabase::fallbacksForFamily(family, style, styleHint, script)); - return result; -} - -void QWinRTFontDatabase::releaseHandle(void *handle) -{ - qCDebug(lcQpaFonts) << __FUNCTION__ << handle; - - if (!handle) - return; - - IDWriteFontFile *fontFile = reinterpret_cast(handle); - if (m_fonts.contains(fontFile)) { - m_fonts.remove(fontFile); - fontFile->Release(); - return; - } - - QFreeTypeFontDatabase::releaseHandle(handle); -} - -QT_END_NAMESPACE diff --git a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h deleted file mode 100644 index 615b4eeb12..0000000000 --- a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h +++ /dev/null @@ -1,92 +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 QWINRTFONTDATABASE_H -#define QWINRTFONTDATABASE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -struct IDWriteFontFile; -struct IDWriteFontFamily; - -QT_BEGIN_NAMESPACE - -Q_DECLARE_LOGGING_CATEGORY(lcQpaFonts) - -struct FontDescription -{ - quint32 index; - QByteArray uuid; -}; - -class QWinRTFontDatabase : public QFreeTypeFontDatabase -{ -public: - ~QWinRTFontDatabase(); - QString fontDir() const override; - QFont defaultFont() const override; - bool fontsAlwaysScalable() const override; - void populateFontDatabase() override; - void populateFamily(const QString &familyName) override; - QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override; - QStringList fallbacksForFamily(const QString &family, QFont::Style style, - QFont::StyleHint styleHint, QChar::Script script) const override; - void releaseHandle(void *handle) override; - - static QString familyForStyleHint(QFont::StyleHint styleHint); -private: - QHash m_fonts; - QHash m_fontFamilies; -}; - -QT_END_NAMESPACE - -#endif // QWINRTFONTDATABASE_H diff --git a/src/platformsupport/fontdatabases/winrt/winrt.pri b/src/platformsupport/fontdatabases/winrt/winrt.pri deleted file mode 100644 index 1cd417c1fd..0000000000 --- a/src/platformsupport/fontdatabases/winrt/winrt.pri +++ /dev/null @@ -1,11 +0,0 @@ -QT *= gui-private - -SOURCES += \ - $$PWD/qwinrtfontdatabase.cpp - -HEADERS += \ - $$PWD/qwinrtfontdatabase_p.h - -DEFINES += __WRL_NO_DEFAULT_LIB__ - -QMAKE_USE_PRIVATE += dwrite_1 ws2_32 diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 8d6516b0b5..9a6a8f1e39 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -17,6 +17,6 @@ endif() if(TARGET Qt::Widgets) add_subdirectory(styles) endif() -if(TARGET Qt::PrintSupport AND NOT WINRT) +if(TARGET Qt::PrintSupport) add_subdirectory(printsupport) endif() diff --git a/src/plugins/imageformats/jpeg/.prev_CMakeLists.txt b/src/plugins/imageformats/jpeg/.prev_CMakeLists.txt index bf9b12e703..b7e0c7cab7 100644 --- a/src/plugins/imageformats/jpeg/.prev_CMakeLists.txt +++ b/src/plugins/imageformats/jpeg/.prev_CMakeLists.txt @@ -85,10 +85,5 @@ qt_extend_target(QJpegPlugin CONDITION NOT QT_FEATURE_system_jpeg ../../../3rdparty/libjpeg/src ) -qt_extend_target(QJpegPlugin CONDITION WINRT AND NOT QT_FEATURE_system_jpeg - DEFINES - NO_GETENV -) - -#### Keys ignored in scope 6:.:../../../3rdparty:../../../3rdparty/libjpeg.pri:GCC: +#### Keys ignored in scope 5:.:../../../3rdparty:../../../3rdparty/libjpeg.pri:GCC: # QMAKE_CFLAGS_WARN_ON = "-Wno-unused-parameter" "-Wno-main" diff --git a/src/plugins/imageformats/jpeg/CMakeLists.txt b/src/plugins/imageformats/jpeg/CMakeLists.txt index 2542a86eed..2c45da7bbd 100644 --- a/src/plugins/imageformats/jpeg/CMakeLists.txt +++ b/src/plugins/imageformats/jpeg/CMakeLists.txt @@ -87,10 +87,5 @@ qt_extend_target(QJpegPlugin CONDITION NOT QT_FEATURE_system_jpeg ../../../3rdparty/libjpeg/src ) -qt_extend_target(QJpegPlugin CONDITION WINRT AND NOT QT_FEATURE_system_jpeg - DEFINES - NO_GETENV -) - -#### Keys ignored in scope 6:.:../../../3rdparty:../../../3rdparty/libjpeg.pri:GCC: +#### Keys ignored in scope 5:.:../../../3rdparty:../../../3rdparty/libjpeg.pri:GCC: # QMAKE_CFLAGS_WARN_ON = "-Wno-unused-parameter" "-Wno-main" diff --git a/src/plugins/platforms/.prev_CMakeLists.txt b/src/plugins/platforms/.prev_CMakeLists.txt index 947efaaf63..baded9525c 100644 --- a/src/plugins/platforms/.prev_CMakeLists.txt +++ b/src/plugins/platforms/.prev_CMakeLists.txt @@ -18,12 +18,9 @@ endif() if(MACOS) add_subdirectory(cocoa) endif() -if(WIN32 AND NOT WINRT) +if(WIN32) add_subdirectory(windows) endif() -if(WINRT) - add_subdirectory(winrt) -endif() if(QT_FEATURE_direct2d1_1 AND QT_FEATURE_directwrite1) add_subdirectory(direct2d) endif() diff --git a/src/plugins/platforms/CMakeLists.txt b/src/plugins/platforms/CMakeLists.txt index 83f3e2975b..a509cdfdc4 100644 --- a/src/plugins/platforms/CMakeLists.txt +++ b/src/plugins/platforms/CMakeLists.txt @@ -18,12 +18,9 @@ endif() if(MACOS) add_subdirectory(cocoa) endif() -if(WIN32 AND NOT WINRT) +if(WIN32) add_subdirectory(windows) endif() -if(WINRT) - # add_subdirectory(winrt) # special case TODO -endif() if(QT_FEATURE_direct2d1_1 AND QT_FEATURE_directwrite1) # add_subdirectory(direct2d) # special case TODO endif() diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp index bfdcda1a84..a11012a81a 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.cpp +++ b/src/plugins/platforms/minimal/qminimalintegration.cpp @@ -46,9 +46,7 @@ #include #include -#if defined(Q_OS_WINRT) -# include -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) # include # if QT_CONFIG(freetype) # include @@ -68,8 +66,6 @@ #if !defined(Q_OS_WIN) #include -#elif defined(Q_OS_WINRT) -#include #else #include #endif @@ -139,9 +135,7 @@ public: QPlatformFontDatabase *QMinimalIntegration::fontDatabase() const { if (!m_fontDatabase && (m_options & EnableFonts)) { -#if defined(Q_OS_WINRT) - m_fontDatabase = new QWinRTFontDatabase; -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) if (m_options & FreeTypeFontDatabase) { # if QT_CONFIG(freetype) m_fontDatabase = new QWindowsFontDatabaseFT; @@ -190,11 +184,7 @@ QPlatformBackingStore *QMinimalIntegration::createPlatformBackingStore(QWindow * QAbstractEventDispatcher *QMinimalIntegration::createEventDispatcher() const { #ifdef Q_OS_WIN -#ifndef Q_OS_WINRT return new QEventDispatcherWin32; -#else // !Q_OS_WINRT - return new QEventDispatcherWinRT; -#endif // Q_OS_WINRT #else return createUnixEventDispatcher(); #endif diff --git a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp index a0d35a80cd..10321cec83 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp +++ b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp @@ -47,9 +47,6 @@ #if defined(Q_OS_UNIX) # include -#elif defined(Q_OS_WINRT) -# include -# include #elif defined(Q_OS_WIN) # include #endif @@ -65,29 +62,6 @@ QT_BEGIN_NAMESPACE -#ifdef Q_OS_WINRT -namespace { -class QWinRTEventDispatcher : public QEventDispatcherWinRT { -public: - QWinRTEventDispatcher() {} - -protected: - bool hasPendingEvents() override - { - return QEventDispatcherWinRT::hasPendingEvents() || QWindowSystemInterface::windowSystemEventsQueued(); - } - - bool sendPostedEvents(QEventLoop::ProcessEventsFlags flags) - { - bool didProcess = QEventDispatcherWinRT::sendPostedEvents(flags); - if (!(flags & QEventLoop::ExcludeUserInputEvents)) - didProcess |= QWindowSystemInterface::sendWindowSystemEvents(flags); - return didProcess; - } -}; -} // anonymous namespace -#endif // Q_OS_WINRT - QMinimalEglIntegration::QMinimalEglIntegration() : mFontDb(new QGenericUnixFontDatabase()), mScreen(new QMinimalEglScreen(EGL_DEFAULT_DISPLAY)) { @@ -153,8 +127,6 @@ QAbstractEventDispatcher *QMinimalEglIntegration::createEventDispatcher() const { #if defined(Q_OS_UNIX) return createUnixEventDispatcher(); -#elif defined(Q_OS_WINRT) - return new QWinRTEventDispatcher; #elif defined(Q_OS_WIN) return new QWindowsGuiEventDispatcher; #else diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp index 1d9a6ee2f7..849faeccb1 100644 --- a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp +++ b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp @@ -51,11 +51,7 @@ #endif #elif defined(Q_OS_WIN) #include -#ifndef Q_OS_WINRT #include -#else -#include -#endif #endif #include @@ -166,11 +162,7 @@ QAbstractEventDispatcher *QOffscreenIntegration::createEventDispatcher() const #if defined(Q_OS_UNIX) return createUnixEventDispatcher(); #elif defined(Q_OS_WIN) -#ifndef Q_OS_WINRT return new QOffscreenEventDispatcher(); -#else // !Q_OS_WINRT - return new QOffscreenEventDispatcher(); -#endif // Q_OS_WINRT #else return 0; #endif diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro index 39665fa8ca..ab7ee395d7 100644 --- a/src/plugins/platforms/platforms.pro +++ b/src/plugins/platforms/platforms.pro @@ -14,8 +14,7 @@ qtConfig(xcb) { uikit:!watchos: SUBDIRS += ios osx: SUBDIRS += cocoa -win32:!winrt: SUBDIRS += windows -winrt: SUBDIRS += winrt +win32: SUBDIRS += windows qtConfig(direct2d1_1):qtConfig(directwrite1) { SUBDIRS += direct2d diff --git a/src/plugins/platforms/winrt/main.cpp b/src/plugins/platforms/winrt/main.cpp deleted file mode 100644 index a37bd1e3d8..0000000000 --- a/src/plugins/platforms/winrt/main.cpp +++ /dev/null @@ -1,66 +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$ -** -****************************************************************************/ - -#include "qwinrtintegration.h" - -#include - -QT_BEGIN_NAMESPACE - -class QWinRTIntegrationPlugin : public QPlatformIntegrationPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "winrt.json") - -public: - QPlatformIntegration *create(const QString&, const QStringList&) override; -}; - -QPlatformIntegration *QWinRTIntegrationPlugin::create(const QString& system, const QStringList& paramList) -{ - Q_UNUSED(paramList); - if (!system.compare(QLatin1String("winrt"), Qt::CaseInsensitive)) - return QWinRTIntegration::create(); - - return nullptr; -} - -QT_END_NAMESPACE - -#include "main.moc" diff --git a/src/plugins/platforms/winrt/qwinrtbackingstore.cpp b/src/plugins/platforms/winrt/qwinrtbackingstore.cpp deleted file mode 100644 index fbf611d7f7..0000000000 --- a/src/plugins/platforms/winrt/qwinrtbackingstore.cpp +++ /dev/null @@ -1,194 +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$ -** -****************************************************************************/ - -#include "qwinrtbackingstore.h" - -#include "qwinrtscreen.h" -#include "qwinrtwindow.h" -#include "qwinrteglcontext.h" -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -class QWinRTBackingStorePrivate -{ -public: - bool initialized; - QSize size; - QScopedPointer context; - QScopedPointer fbo; - QWinRTScreen *screen; - QImage paintDevice; -}; - -QWinRTBackingStore::QWinRTBackingStore(QWindow *window) - : QPlatformBackingStore(window), d_ptr(new QWinRTBackingStorePrivate) -{ - Q_D(QWinRTBackingStore); - qCInfo(lcQpaBackingStore) << __FUNCTION__ << this << window; - - d->initialized = false; - d->screen = static_cast(window->screen()->handle()); - - if (window->surfaceType() == QSurface::RasterSurface) - window->setSurfaceType(QSurface::OpenGLSurface); -} - -bool QWinRTBackingStore::initialize() -{ - Q_D(QWinRTBackingStore); - qCDebug(lcQpaBackingStore) << __FUNCTION__ << d->initialized; - - if (d->initialized) - return true; - - d->context.reset(new QOpenGLContext); - QSurfaceFormat format = window()->format(); - d->context->setFormat(format); - d->context->setScreen(window()->screen()); - if (!d->context->create()) - return false; - - if (!d->context->makeCurrent(window())) - return false; - - d->context->doneCurrent(); - d->initialized = true; - return true; -} - -QWinRTBackingStore::~QWinRTBackingStore() -{ - qCInfo(lcQpaBackingStore) << __FUNCTION__ << this; -} - -QPaintDevice *QWinRTBackingStore::paintDevice() -{ - Q_D(QWinRTBackingStore); - return &d->paintDevice; -} - -void QWinRTBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) -{ - Q_D(QWinRTBackingStore); - Q_UNUSED(offset) - - qCDebug(lcQpaBackingStore) << __FUNCTION__ << this << window << region; - - if (d->size.isEmpty()) - return; - - const QRect bounds = region.boundingRect() & d->paintDevice.rect(); - if (bounds.isEmpty()) - return; - - const bool ok = d->context->makeCurrent(window); - if (!ok) - qWarning("unable to flush"); - - glBindTexture(GL_TEXTURE_2D, d->fbo->texture()); - // TODO: when ANGLE GLES3 support is finished, use the glPixelStorei functions to minimize upload - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, bounds.y(), d->size.width(), bounds.height(), - GL_RGBA, GL_UNSIGNED_BYTE, d->paintDevice.constScanLine(bounds.y())); - glBindTexture(GL_TEXTURE_2D, 0); - - glBindFramebuffer(GL_READ_FRAMEBUFFER_ANGLE, d->fbo->handle()); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER_ANGLE, 0); - const int y1 = bounds.y(); - const int y2 = y1 + bounds.height(); - const int x1 = bounds.x(); - const int x2 = x1 + bounds.width(); - glBlitFramebuffer(x1, y1, x2, y2, - x1, d->size.height() - y1, x2, d->size.height() - y2, - GL_COLOR_BUFFER_BIT, GL_NEAREST); - - d->context->swapBuffers(window); - d->context->doneCurrent(); -} - -void QWinRTBackingStore::resize(const QSize &size, const QRegion &staticContents) -{ - Q_D(QWinRTBackingStore); - Q_UNUSED(staticContents) - - qCDebug(lcQpaBackingStore) << __FUNCTION__ << this << size; - - if (!initialize()) - return; - - if (d->size == size) - return; - - d->size = size; - if (d->size.isEmpty()) - return; - - d->paintDevice = QImage(d->size, QImage::Format_RGBA8888_Premultiplied); - - const bool ok = d->context->makeCurrent(window()); - if (!ok) - qWarning("unable to resize"); - - d->fbo.reset(new QOpenGLFramebufferObject(d->size)); - - d->context->doneCurrent(); -} - -QImage QWinRTBackingStore::toImage() const -{ - Q_D(const QWinRTBackingStore); - return d->paintDevice; -} - -void QWinRTBackingStore::beginPaint(const QRegion ®ion) -{ - qCDebug(lcQpaBackingStore) << __FUNCTION__ << this << region; - - resize(window()->size(), region); -} - -void QWinRTBackingStore::endPaint() -{ - qCDebug(lcQpaBackingStore) << __FUNCTION__ << this; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/winrt/qwinrtbackingstore.h b/src/plugins/platforms/winrt/qwinrtbackingstore.h deleted file mode 100644 index b62d340b82..0000000000 --- a/src/plugins/platforms/winrt/qwinrtbackingstore.h +++ /dev/null @@ -1,74 +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 QWINRTBACKINGSTORE_H -#define QWINRTBACKINGSTORE_H - -#define GL_GLEXT_PROTOTYPES -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QWinRTScreen; - -class QWinRTBackingStorePrivate; -class QWinRTBackingStore : public QPlatformBackingStore -{ -public: - explicit QWinRTBackingStore(QWindow *window); - ~QWinRTBackingStore() override; - QPaintDevice *paintDevice() override; - void beginPaint(const QRegion &) override; - void endPaint() override; - void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) override; - void resize(const QSize &size, const QRegion &staticContents) override; - QImage toImage() const override; - -private: - bool initialize(); - - QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QWinRTBackingStore) -}; - -QT_END_NAMESPACE - -#endif // QWINRTBACKINGSTORE_H diff --git a/src/plugins/platforms/winrt/qwinrtcanvas.cpp b/src/plugins/platforms/winrt/qwinrtcanvas.cpp deleted file mode 100644 index dd6b52d9cd..0000000000 --- a/src/plugins/platforms/winrt/qwinrtcanvas.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include "qwinrtcanvas.h" -#include "uiautomation/qwinrtuiaaccessibility.h" -#include "uiautomation/qwinrtuiamainprovider.h" -#include "uiautomation/qwinrtuiametadatacache.h" -#include "uiautomation/qwinrtuiautils.h" - -#include -#include - -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::System; -using namespace ABI::Windows::UI; -using namespace ABI::Windows::UI::Core; -using namespace ABI::Windows::UI::Xaml; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Foundation::Collections; - -QT_BEGIN_NAMESPACE - -QWinRTCanvas::QWinRTCanvas(const std::function &delegateWindow) -{ - ComPtr factory; - HRESULT hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_Xaml_Controls_Canvas).Get(), IID_PPV_ARGS(&factory)); - Q_ASSERT_SUCCEEDED(hr); - - hr = factory->CreateInstance(this, &m_base, &m_core); - Q_ASSERT_SUCCEEDED(hr); - - delegate = delegateWindow; -} - -HRESULT STDMETHODCALLTYPE QWinRTCanvas::QueryInterface(REFIID iid, LPVOID *iface) -{ - if (!iface) - return E_POINTER; - *iface = nullptr; - - if (iid == IID_IUnknown) { - *iface = static_cast(this); - AddRef(); - return S_OK; - } else if (iid == Xaml::IID_IUIElementOverrides) { - *iface = static_cast(this); - AddRef(); - return S_OK; - } else { - return m_base.CopyTo(iid, iface); - } -} - -HRESULT STDMETHODCALLTYPE QWinRTCanvas::GetIids(ULONG *iidCount, IID **iids) -{ - *iidCount = 0; - *iids = nullptr; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTCanvas::GetRuntimeClassName(HSTRING *className) -{ - const wchar_t *name = L"QWinRTCanvas"; - return ::WindowsCreateString(name, static_cast(::wcslen(name)), className); -} - -HRESULT STDMETHODCALLTYPE QWinRTCanvas::GetTrustLevel(TrustLevel *trustLevel) -{ - *trustLevel = TrustLevel::BaseTrust; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTCanvas::OnCreateAutomationPeer(Xaml::Automation::Peers::IAutomationPeer **returnValue) -{ - if (!returnValue) - return E_INVALIDARG; - *returnValue = nullptr; - - if (delegate) { - if (QWindow *window = delegate()) { - QWinRTUiaAccessibility::activate(); - if (QAccessibleInterface *accessible = window->accessibleRoot()) { - QAccessible::Id accid = QWinRTUiAutomation::idForAccessible(accessible); - QWinRTUiaMetadataCache::instance()->load(accid); - if (ComPtr provider = QWinRTUiaMainProvider::providerForAccessibleId(accid)) - return provider.CopyTo(returnValue); - } - } - } - return m_base->OnCreateAutomationPeer(returnValue); -} - -HRESULT STDMETHODCALLTYPE QWinRTCanvas::OnDisconnectVisualChildren() -{ - return m_base->OnDisconnectVisualChildren(); -} - -HRESULT STDMETHODCALLTYPE QWinRTCanvas::FindSubElementsForTouchTargeting(Point point, Rect boundingRect, IIterable*> **returnValue) -{ - return m_base->FindSubElementsForTouchTargeting(point, boundingRect, returnValue); -} - -QT_END_NAMESPACE - diff --git a/src/plugins/platforms/winrt/qwinrtcanvas.h b/src/plugins/platforms/winrt/qwinrtcanvas.h deleted file mode 100644 index bc3b708ac2..0000000000 --- a/src/plugins/platforms/winrt/qwinrtcanvas.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTCANVAS_H -#define QWINRTCANVAS_H - -#include -#include - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QWinRTCanvas: - public Microsoft::WRL::RuntimeClass -{ -public: - QWinRTCanvas(const std::function &delegateWindow); - ~QWinRTCanvas() override = default; - - HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *iface) override; - HRESULT STDMETHODCALLTYPE GetIids(ULONG *iidCount, IID **iids) override; - HRESULT STDMETHODCALLTYPE GetRuntimeClassName(HSTRING *className) override; - HRESULT STDMETHODCALLTYPE GetTrustLevel(TrustLevel *trustLevel) override; - HRESULT STDMETHODCALLTYPE OnCreateAutomationPeer(ABI::Windows::UI::Xaml::Automation::Peers::IAutomationPeer **returnValue) override; - HRESULT STDMETHODCALLTYPE OnDisconnectVisualChildren() override; - HRESULT STDMETHODCALLTYPE FindSubElementsForTouchTargeting(ABI::Windows::Foundation::Point point, ABI::Windows::Foundation::Rect boundingRect, ABI::Windows::Foundation::Collections::IIterable*> **returnValue) override; - -private: - Microsoft::WRL::ComPtr m_base; - Microsoft::WRL::ComPtr m_core; - std::function delegate; -}; - -QT_END_NAMESPACE - -#endif // QWINRTCANVAS_H diff --git a/src/plugins/platforms/winrt/qwinrtclipboard.cpp b/src/plugins/platforms/winrt/qwinrtclipboard.cpp deleted file mode 100644 index fd0ed8aed2..0000000000 --- a/src/plugins/platforms/winrt/qwinrtclipboard.cpp +++ /dev/null @@ -1,188 +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$ -** -****************************************************************************/ - -#include "qwinrtclipboard.h" - -#include -#include -#include - -#include - -#include - -using namespace ABI::Windows::ApplicationModel::DataTransfer; -using namespace ABI::Windows::Foundation; -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; - -typedef IEventHandler ContentChangedHandler; - -#define RETURN_NULLPTR_IF_FAILED(msg) RETURN_IF_FAILED(msg, return nullptr) - -QT_BEGIN_NAMESPACE - -QWinRTClipboard::QWinRTClipboard() - : m_mimeData(nullptr) -{ - QEventDispatcherWinRT::runOnXamlThread([this]() { - HRESULT hr; - hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_ApplicationModel_DataTransfer_Clipboard).Get(), - &m_nativeClipBoard); - Q_ASSERT_SUCCEEDED(hr); - - EventRegistrationToken tok; - hr = m_nativeClipBoard->add_ContentChanged(Callback(this, &QWinRTClipboard::onContentChanged).Get(), &tok); - Q_ASSERT_SUCCEEDED(hr); - - return hr; - }); -} - -QMimeData *QWinRTClipboard::mimeData(QClipboard::Mode mode) -{ - if (!supportsMode(mode)) - return nullptr; - - ComPtr view; - HRESULT hr; - hr = m_nativeClipBoard->GetContent(&view); - RETURN_NULLPTR_IF_FAILED("Could not get clipboard content."); - - ComPtr> op; - HString result; - // This throws a security exception (WinRT originate error / 0x40080201. - // Unfortunately there seems to be no way to avoid this, neither - // running on the XAML thread, nor some other way. Stack Overflow - // confirms this problem since Windows (Phone) 8.0. - hr = view->GetTextAsync(&op); - RETURN_NULLPTR_IF_FAILED("Could not get clipboard text."); - - hr = QWinRTFunctions::await(op, result.GetAddressOf()); - RETURN_NULLPTR_IF_FAILED("Could not get clipboard text content"); - - quint32 size; - const wchar_t *textStr = result.GetRawBuffer(&size); - QString text = QString::fromWCharArray(textStr, int(size)); - text.replace(QLatin1String("\r\n"), QLatin1String("\n")); - - if (m_mimeData) { - if (m_mimeData->text() == text) - return m_mimeData; - delete m_mimeData; - } - m_mimeData = new QMimeData(); - m_mimeData->setText(text); - - return m_mimeData; -} - -// Inspired by QWindowsMimeText::convertFromMime -inline QString convertToWindowsLineEnding(const QString &text) -{ - const QChar *u = text.unicode(); - QString res; - const int s = text.length(); - int maxsize = s + s / 40 + 3; - res.resize(maxsize); - int ri = 0; - bool cr = false; - for (int i = 0; i < s; ++i) { - if (*u == QLatin1Char('\r')) - cr = true; - else { - if (*u == QLatin1Char('\n') && !cr) - res[ri++] = QLatin1Char('\r'); - cr = false; - } - res[ri++] = *u; - if (ri+3 >= maxsize) { - maxsize += maxsize / 4; - res.resize(maxsize); - } - ++u; - } - res.truncate(ri); - return res; -} - -void QWinRTClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) -{ - if (!supportsMode(mode)) - return; - - const bool newData = !m_mimeData || m_mimeData != data; - if (newData) { - if (m_mimeData) - delete m_mimeData; - m_mimeData = data; - } - const QString text = data ? data->text() : QString(); - HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([this, text]() { - HRESULT hr; - ComPtr package; - hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_ApplicationModel_DataTransfer_DataPackage).Get(), - &package); - - const QString nativeString = convertToWindowsLineEnding(text); - HStringReference textRef(reinterpret_cast(nativeString.utf16()), - uint(nativeString.length())); - - hr = package->SetText(textRef.Get()); - RETURN_HR_IF_FAILED("Could not set text to clipboard data package."); - - hr = m_nativeClipBoard->SetContent(package.Get()); - RETURN_HR_IF_FAILED("Could not set clipboard content."); - return S_OK; - }); - RETURN_VOID_IF_FAILED("Could not set clipboard text."); -} - -bool QWinRTClipboard::supportsMode(QClipboard::Mode mode) const -{ - return mode == QClipboard::Clipboard; -} - -HRESULT QWinRTClipboard::onContentChanged(IInspectable *, IInspectable *) -{ - emitChanged(QClipboard::Clipboard); - return S_OK; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/winrt/qwinrtclipboard.h b/src/plugins/platforms/winrt/qwinrtclipboard.h deleted file mode 100644 index 899fcbe730..0000000000 --- a/src/plugins/platforms/winrt/qwinrtclipboard.h +++ /dev/null @@ -1,77 +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 QWINRTPLATFORMCLIPBOARD_H -#define QWINRTPLATFORMCLIPBOARD_H - -#include -#include - -#include - -namespace ABI { - namespace Windows { - namespace ApplicationModel { - namespace DataTransfer { - struct IClipboardStatics; - } - } - } -} - -QT_BEGIN_NAMESPACE - -class QWinRTClipboard: public QPlatformClipboard -{ -public: - QWinRTClipboard(); - - QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) override; - void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard) override; - bool supportsMode(QClipboard::Mode mode) const override; - - HRESULT onContentChanged(IInspectable *, IInspectable *); -private: - Microsoft::WRL::ComPtr m_nativeClipBoard; - QMimeData *m_mimeData; -}; - -QT_END_NAMESPACE - -#endif // QWINRTPLATFORMCLIPBOARD_H diff --git a/src/plugins/platforms/winrt/qwinrtcursor.cpp b/src/plugins/platforms/winrt/qwinrtcursor.cpp deleted file mode 100644 index 180905945b..0000000000 --- a/src/plugins/platforms/winrt/qwinrtcursor.cpp +++ /dev/null @@ -1,230 +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$ -** -****************************************************************************/ - -#include "qwinrtcursor.h" -#include "qwinrtscreen.h" -#include - -#include -#include -#include - -#include -#include -#include -#include -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::UI::Core; -using namespace ABI::Windows::Foundation; - -QT_BEGIN_NAMESPACE - -static inline bool qIsPointInRect(const Point &p, const Rect &r) -{ - return (p.X >= r.X && p.Y >= r.Y && p.X < r.X + r.Width && p.Y < r.Y + r.Height); -} - -class QWinRTCursorPrivate -{ -public: - ComPtr cursorFactory; -}; - -QWinRTCursor::QWinRTCursor() - : d_ptr(new QWinRTCursorPrivate) -{ - Q_D(QWinRTCursor); - - HRESULT hr; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_Core_CoreCursor).Get(), - IID_PPV_ARGS(&d->cursorFactory)); - Q_ASSERT_SUCCEEDED(hr); -} - -#ifndef QT_NO_CURSOR -void QWinRTCursor::changeCursor(QCursor *windowCursor, QWindow *window) -{ - Q_D(QWinRTCursor); - - HRESULT hr; - ICoreWindow *coreWindow = static_cast(window->screen()->handle())->coreWindow(); - - CoreCursorType type; - switch (windowCursor ? windowCursor->shape() : Qt::ArrowCursor) { - case Qt::BlankCursor: - hr = QEventDispatcherWinRT::runOnXamlThread([coreWindow]() { - coreWindow->put_PointerCursor(nullptr); - return S_OK; - }); - RETURN_VOID_IF_FAILED("Failed to set blank native cursor"); - return; - default: - case Qt::OpenHandCursor: - case Qt::ClosedHandCursor: - case Qt::DragCopyCursor: - case Qt::DragMoveCursor: - case Qt::DragLinkCursor: - // (unavailable) - case Qt::ArrowCursor: - type = CoreCursorType_Arrow; - break; - case Qt::UpArrowCursor: - type = CoreCursorType_UpArrow; - break; - case Qt::CrossCursor: - type = CoreCursorType_Cross; - break; - case Qt::WaitCursor: - case Qt::BusyCursor: - type = CoreCursorType_Wait; - break; - case Qt::IBeamCursor: - type = CoreCursorType_IBeam; - break; - case Qt::SizeVerCursor: - case Qt::SplitVCursor: - type = CoreCursorType_SizeNorthSouth; - break; - case Qt::SizeHorCursor: - case Qt::SplitHCursor: - type = CoreCursorType_SizeWestEast; - break; - case Qt::SizeBDiagCursor: - type = CoreCursorType_SizeNortheastSouthwest; - break; - case Qt::SizeFDiagCursor: - type = CoreCursorType_SizeNorthwestSoutheast; - break; - case Qt::SizeAllCursor: - type = CoreCursorType_SizeAll; - break; - case Qt::PointingHandCursor: - type = CoreCursorType_Hand; - break; - case Qt::ForbiddenCursor: - type = CoreCursorType_UniversalNo; - break; - case Qt::WhatsThisCursor: - type = CoreCursorType_Help; - break; - case Qt::BitmapCursor: - case Qt::CustomCursor: - // TODO: figure out if arbitrary bitmaps can be made into resource IDs - // For now, we don't get enough info from QCursor to set a custom cursor - type = CoreCursorType_Custom; - break; - } - - ComPtr cursor; - hr = d->cursorFactory->CreateCursor(type, 0, &cursor); - RETURN_VOID_IF_FAILED("Failed to create native cursor."); - - hr = QEventDispatcherWinRT::runOnXamlThread([coreWindow, &cursor]() { - return coreWindow->put_PointerCursor(cursor.Get()); - }); - RETURN_VOID_IF_FAILED("Failed to set native cursor"); -} -#endif // QT_NO_CURSOR - -QPoint QWinRTCursor::pos() const -{ - const QWinRTScreen *screen = static_cast(QGuiApplication::primaryScreen()->handle()); - Q_ASSERT(screen); - ICoreWindow *coreWindow = screen->coreWindow(); - Q_ASSERT(coreWindow); - Point point; - Rect bounds; - HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([coreWindow, &point, &bounds]() { - HRESULT hr = coreWindow->get_PointerPosition(&point); - RETURN_HR_IF_FAILED("Failed to obtain pointer position."); - hr = coreWindow->get_Bounds(&bounds); - RETURN_HR_IF_FAILED("Failed to obtain window bounds."); - return hr; - }); - Q_ASSERT_SUCCEEDED(hr); - QPointF position(qreal(point.X), qreal(point.Y)); - // If no cursor get_PointerPosition returns SHRT_MIN for x and y - if ((int(position.x()) == SHRT_MIN && int(position.y()) == SHRT_MIN) - || FAILED(hr)) - return QPointF(Q_INFINITY, Q_INFINITY).toPoint(); - position.rx() -= qreal(bounds.X); - position.ry() -= qreal(bounds.Y); - position *= screen->scaleFactor(); - return position.toPoint(); -} - -void QWinRTCursor::setPos(const QPoint &pos) -{ - QWinRTScreen *screen = static_cast(QGuiApplication::primaryScreen()->handle()); - Q_ASSERT(screen); - ComPtr coreWindow = screen->coreWindow(); - Q_ASSERT(coreWindow); - const QPointF scaledPos = QPointF(pos) / screen->scaleFactor(); - QWinRTScreen::MousePositionTransition t; - HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([coreWindow, scaledPos, &t]() { - ComPtr coreWindow2; - HRESULT hr = coreWindow.As(&coreWindow2); - RETURN_HR_IF_FAILED("Failed to cast core window."); - Rect bounds; - hr = coreWindow->get_Bounds(&bounds); - RETURN_HR_IF_FAILED("Failed to obtain window bounds."); - Point mousePos; - hr = coreWindow->get_PointerPosition(&mousePos); - RETURN_HR_IF_FAILED("Failed to obtain mouse position."); - const Point p = { FLOAT(scaledPos.x()) + bounds.X, - FLOAT(scaledPos.y()) + bounds.Y }; - const bool wasInWindow = qIsPointInRect(mousePos, bounds); - const bool willBeInWindow = qIsPointInRect(p, bounds); - if (wasInWindow && willBeInWindow) - t = QWinRTScreen::MousePositionTransition::StayedIn; - else if (wasInWindow && !willBeInWindow) - t = QWinRTScreen::MousePositionTransition::MovedOut; - else if (!wasInWindow && willBeInWindow) - t = QWinRTScreen::MousePositionTransition::MovedIn; - else - t = QWinRTScreen::MousePositionTransition::StayedOut; - return coreWindow2->put_PointerPosition(p); - }); - RETURN_VOID_IF_FAILED("Failed to set cursor position"); - screen->emulateMouseMove(scaledPos, t); -} - -QT_END_NAMESPACE - diff --git a/src/plugins/platforms/winrt/qwinrtcursor.h b/src/plugins/platforms/winrt/qwinrtcursor.h deleted file mode 100644 index eca3d8c7ca..0000000000 --- a/src/plugins/platforms/winrt/qwinrtcursor.h +++ /dev/null @@ -1,66 +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 QWINRTCURSOR_H -#define QWINRTCURSOR_H - -#include - -QT_BEGIN_NAMESPACE - -class QWinRTCursorPrivate; -class QWinRTCursor : public QPlatformCursor -{ -public: - explicit QWinRTCursor(); - ~QWinRTCursor() override = default; -#ifndef QT_NO_CURSOR - void changeCursor(QCursor * windowCursor, QWindow *window) override; -#endif - QPoint pos() const override; - void setPos(const QPoint &pos) override; - -private: - QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QWinRTCursor) -}; - -QT_END_NAMESPACE - -#endif // QWINRTCURSOR_H diff --git a/src/plugins/platforms/winrt/qwinrtdrag.cpp b/src/plugins/platforms/winrt/qwinrtdrag.cpp deleted file mode 100644 index 3ed4cd692d..0000000000 --- a/src/plugins/platforms/winrt/qwinrtdrag.cpp +++ /dev/null @@ -1,889 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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$ -** -****************************************************************************/ -#include "qwinrtdrag.h" - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -using namespace ABI::Windows::ApplicationModel::DataTransfer; -using namespace ABI::Windows::ApplicationModel::DataTransfer::DragDrop; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Foundation::Collections; -using namespace ABI::Windows::Graphics::Imaging; -using namespace ABI::Windows::Storage; -using namespace ABI::Windows::Storage::Streams; -using namespace ABI::Windows::UI::Xaml; -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; - -QT_BEGIN_NAMESPACE - -Q_LOGGING_CATEGORY(lcQpaMime, "qt.qpa.mime") - -ComPtr createIBufferFromData(const char *data, qint32 size) -{ - static ComPtr bufferFactory; - HRESULT hr; - if (!bufferFactory) { - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Storage_Streams_Buffer).Get(), - IID_PPV_ARGS(&bufferFactory)); - Q_ASSERT_SUCCEEDED(hr); - } - - ComPtr buffer; - const UINT32 length = UINT32(size); - hr = bufferFactory->Create(length, &buffer); - Q_ASSERT_SUCCEEDED(hr); - hr = buffer->put_Length(length); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr byteArrayAccess; - hr = buffer.As(&byteArrayAccess); - Q_ASSERT_SUCCEEDED(hr); - - byte *bytes; - hr = byteArrayAccess->Buffer(&bytes); - Q_ASSERT_SUCCEEDED(hr); - memcpy(bytes, data, length); - return buffer; -} - -class DragThreadTransferData : public QObject -{ - Q_OBJECT -public slots: - void handleDrag(); -public: - explicit DragThreadTransferData(QObject *parent = nullptr); - QWindow *window; - QWinRTInternalMimeData *mime; - QPoint point; - Qt::DropActions actions; - bool dropAction; - ComPtr nativeArgs; - ComPtr deferral; -}; - -inline QString hStringToQString(const HString &hString) -{ - quint32 l; - const wchar_t *raw = hString.GetRawBuffer(&l); - return (QString::fromWCharArray(raw, int(l))); -} - -inline HString qStringToHString(const QString &qString) -{ - HString h; - h.Set(reinterpret_cast(qString.utf16()), uint(qString.size())); - return h; -} - -namespace NativeFormatStrings { - static ComPtr dataStatics; - static HSTRING text; // text/plain - static HSTRING html; // text/html - static HSTRING storage; // text/uri-list -} - -static inline DataPackageOperation translateFromQDragDropActions(const Qt::DropAction action) -{ - switch (action) { - case Qt::CopyAction: - return DataPackageOperation_Copy; - case Qt::MoveAction: - return DataPackageOperation_Move; - case Qt::LinkAction: - return DataPackageOperation_Link; - case Qt::IgnoreAction: - default: - return DataPackageOperation_None; - } -} - -static inline Qt::DropActions translateToQDragDropActions(const DataPackageOperation op) -{ - Qt::DropActions actions = Qt::IgnoreAction; - // None needs to be interpreted as the sender being able to handle - // anything and let the receiver decide - if (op == DataPackageOperation_None) - actions = Qt::LinkAction | Qt::CopyAction | Qt::MoveAction; - if (op & DataPackageOperation_Link) - actions |= Qt::LinkAction; - if (op & DataPackageOperation_Copy) - actions |= Qt::CopyAction; - if (op & DataPackageOperation_Move) - actions |= Qt::MoveAction; - return actions; -} - -QWinRTInternalMimeData::QWinRTInternalMimeData() - : QInternalMimeData() -{ - qCDebug(lcQpaMime) << __FUNCTION__; - if (!NativeFormatStrings::dataStatics) { - HRESULT hr; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_ApplicationModel_DataTransfer_StandardDataFormats).Get(), - IID_PPV_ARGS(&NativeFormatStrings::dataStatics)); - Q_ASSERT_SUCCEEDED(hr); - hr = NativeFormatStrings::dataStatics->get_Text(&NativeFormatStrings::text); - Q_ASSERT_SUCCEEDED(hr); - hr = NativeFormatStrings::dataStatics->get_Html(&NativeFormatStrings::html); - Q_ASSERT_SUCCEEDED(hr); - hr = NativeFormatStrings::dataStatics->get_StorageItems(&NativeFormatStrings::storage); - Q_ASSERT_SUCCEEDED(hr); - } -} - -bool QWinRTInternalMimeData::hasFormat_sys(const QString &mimetype) const -{ - qCDebug(lcQpaMime) << __FUNCTION__ << mimetype; - - if (!dataView) - return false; - - return formats_sys().contains(mimetype); -} - -QStringList QWinRTInternalMimeData::formats_sys() const -{ - qCDebug(lcQpaMime) << __FUNCTION__; - - if (!dataView) - return QStringList(); - - if (!formats.isEmpty()) - return formats; - - HRESULT hr; - hr = QEventDispatcherWinRT::runOnXamlThread([this]() { - boolean contains; - HRESULT hr; - hr = dataView->Contains(NativeFormatStrings::text, &contains); - if (SUCCEEDED(hr) && contains) - formats.append(QLatin1String("text/plain")); - - hr = dataView->Contains(NativeFormatStrings::html, &contains); - if (SUCCEEDED(hr) && contains) - formats.append(QLatin1String("text/html")); - - hr = dataView->Contains(NativeFormatStrings::storage, &contains); - if (SUCCEEDED(hr) && contains) - formats.append(QLatin1String("text/uri-list")); - - // We need to add any additional format as well, for legacy windows - // reasons, but also in case someone adds custom formats. - ComPtr> availableFormats; - hr = dataView->get_AvailableFormats(&availableFormats); - RETURN_OK_IF_FAILED("Could not query available formats."); - - quint32 size; - hr = availableFormats->get_Size(&size); - RETURN_OK_IF_FAILED("Could not query format vector size."); - for (quint32 i = 0; i < size; ++i) { - HString str; - hr = availableFormats->GetAt(i, str.GetAddressOf()); - if (FAILED(hr)) - continue; - formats.append(hStringToQString(str)); - } - return S_OK; - }); - Q_ASSERT_SUCCEEDED(hr); - - return formats; -} - -QVariant QWinRTInternalMimeData::retrieveData_sys(const QString &mimetype, QVariant::Type preferredType) const -{ - qCDebug(lcQpaMime) << __FUNCTION__ << mimetype << preferredType; - - if (!dataView || !formats.contains(mimetype)) - return QVariant(); - - QVariant result; - HRESULT hr; - if (mimetype == QLatin1String("text/plain")) { - hr = QEventDispatcherWinRT::runOnXamlThread([this, &result]() { - HRESULT hr; - ComPtr> op; - HString res; - hr = dataView->GetTextAsync(&op); - Q_ASSERT_SUCCEEDED(hr); - hr = QWinRTFunctions::await(op, res.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - result.setValue(hStringToQString(res)); - return S_OK; - }); - } else if (mimetype == QLatin1String("text/uri-list")) { - hr = QEventDispatcherWinRT::runOnXamlThread([this, &result]() { - HRESULT hr; - ComPtr*>> op; - hr = dataView->GetStorageItemsAsync(&op); - Q_ASSERT_SUCCEEDED(hr); - ComPtr> nativeItems; - hr = QWinRTFunctions::await(op, nativeItems.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - QList items; - quint32 count; - hr = nativeItems->get_Size(&count); - for (quint32 i = 0; i < count; ++i) { - ComPtr item; - hr = nativeItems->GetAt(i, &item); - Q_ASSERT_SUCCEEDED(hr); - HString path; - hr = item->get_Path(path.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - items.append(QUrl::fromLocalFile(hStringToQString(path))); - } - result.setValue(items); - return S_OK; - }); - } else if (mimetype == QLatin1String("text/html")) { - hr = QEventDispatcherWinRT::runOnXamlThread([this, &result]() { - HRESULT hr; - ComPtr> op; - HString res; - hr = dataView->GetHtmlFormatAsync(&op); - Q_ASSERT_SUCCEEDED(hr); - hr = QWinRTFunctions::await(op, res.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - result.setValue(hStringToQString(res)); - return S_OK; - }); - } else { - // Asking for custom data - hr = QEventDispatcherWinRT::runOnXamlThread([this, &result, mimetype]() { - HRESULT hr; - ComPtr> op; - ComPtr res; - HString type; - type.Set(reinterpret_cast(mimetype.utf16()), uint(mimetype.size())); - hr = dataView->GetDataAsync(type.Get(), &op); - RETURN_OK_IF_FAILED("Could not query custom drag data."); - hr = QWinRTFunctions::await(op, res.GetAddressOf()); - if (FAILED(hr) || !res) { - qCDebug(lcQpaMime) << "Custom drop data operation returned no results or failed."; - return S_OK; - } - - // Test for properties - ComPtr propertyValue; - hr = res.As(&propertyValue); - if (SUCCEEDED(hr)) { - // We need to check which type of custom data we are receiving - PropertyType propertyType; - propertyValue->get_Type(&propertyType); - switch (propertyType) { - case PropertyType_UInt8: { - quint8 v; - hr = propertyValue->GetUInt8(&v); - Q_ASSERT_SUCCEEDED(hr); - result.setValue(v); - return S_OK; - } - case PropertyType_Int16: { - qint16 v; - hr = propertyValue->GetInt16(&v); - Q_ASSERT_SUCCEEDED(hr); - result.setValue(v); - return S_OK; - } - case PropertyType_UInt16: { - quint16 v; - hr = propertyValue->GetUInt16(&v); - Q_ASSERT_SUCCEEDED(hr); - result.setValue(v); - return S_OK; - } - case PropertyType_Int32: { - qint32 v; - hr = propertyValue->GetInt32(&v); - Q_ASSERT_SUCCEEDED(hr); - result.setValue(v); - return S_OK; - } - case PropertyType_UInt32: { - quint32 v; - hr = propertyValue->GetUInt32(&v); - Q_ASSERT_SUCCEEDED(hr); - result.setValue(v); - return S_OK; - } - case PropertyType_Int64: { - qint64 v; - hr = propertyValue->GetInt64(&v); - Q_ASSERT_SUCCEEDED(hr); - result.setValue(v); - return S_OK; - } - case PropertyType_UInt64: { - quint64 v; - hr = propertyValue->GetUInt64(&v); - Q_ASSERT_SUCCEEDED(hr); - result.setValue(v); - return S_OK; - } - case PropertyType_Single: { - float v; - hr = propertyValue->GetSingle(&v); - Q_ASSERT_SUCCEEDED(hr); - result.setValue(v); - return S_OK; - } - case PropertyType_Double: { - double v; - hr = propertyValue->GetDouble(&v); - Q_ASSERT_SUCCEEDED(hr); - result.setValue(v); - return S_OK; - } - case PropertyType_Char16: { - wchar_t v; - hr = propertyValue->GetChar16(&v); - Q_ASSERT_SUCCEEDED(hr); - result.setValue(QString::fromWCharArray(&v, 1)); - return S_OK; - } - case PropertyType_Boolean: { - boolean v; - hr = propertyValue->GetBoolean(&v); - Q_ASSERT_SUCCEEDED(hr); - result.setValue(v); - return S_OK; - } - case PropertyType_String: { - HString stringProperty; - hr = propertyValue->GetString(stringProperty.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - result.setValue(hStringToQString(stringProperty)); - return S_OK; - } - default: - qCDebug(lcQpaMime) << "Unknown property type dropped:" << propertyType; - } - return S_OK; - } - - // Custom data can be read via input streams - ComPtr randomAccessStream; - hr = res.As(&randomAccessStream); - if (SUCCEEDED(hr)) { - UINT64 size; - hr = randomAccessStream->get_Size(&size); - Q_ASSERT_SUCCEEDED(hr); - ComPtr stream; - hr = randomAccessStream.As(&stream); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr bufferFactory; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Storage_Streams_Buffer).Get(), - IID_PPV_ARGS(&bufferFactory)); - Q_ASSERT_SUCCEEDED(hr); - - UINT32 length = UINT32(qBound(quint64(0), quint64(size), quint64(UINT_MAX))); - ComPtr buffer; - hr = bufferFactory->Create(length, &buffer); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr> readOp; - hr = stream->ReadAsync(buffer.Get(), length, InputStreamOptions_None, &readOp); - - ComPtr effectiveBuffer; - hr = QWinRTFunctions::await(readOp, effectiveBuffer.GetAddressOf()); - - hr = effectiveBuffer->get_Length(&length); - - ComPtr byteArrayAccess; - hr = effectiveBuffer.As(&byteArrayAccess); - - byte *bytes; - hr = byteArrayAccess->Buffer(&bytes); - QByteArray array((char *)bytes, int(length)); - result.setValue(array); - return S_OK; - } - - HSTRING runtimeClass; - hr = res->GetRuntimeClassName(&runtimeClass); - Q_ASSERT_SUCCEEDED(hr); - HString converted; - converted.Set(runtimeClass); - qCDebug(lcQpaMime) << "Unknown drop data type received (" << hStringToQString(converted) - << "). Ignoring..."; - return S_OK; - }); - } - return result; -} - -void QWinRTInternalMimeData::setDataView(const Microsoft::WRL::ComPtr &d) -{ - dataView = d; - formats.clear(); -} - -static HRESULT qt_drag_enter(IInspectable *sender, ABI::Windows::UI::Xaml::IDragEventArgs *e) -{ - QWinRTDrag::instance()->handleNativeDragEvent(sender, e); - return S_OK; -} - -static HRESULT qt_drag_over(IInspectable *sender, ABI::Windows::UI::Xaml::IDragEventArgs *e) -{ - QWinRTDrag::instance()->handleNativeDragEvent(sender, e); - return S_OK; -} - -static HRESULT qt_drag_leave(IInspectable *sender, ABI::Windows::UI::Xaml::IDragEventArgs *e) -{ - // Qt internally checks for new drags and auto sends leave events - // Also there is no QPA function for handling leave - Q_UNUSED(sender); - Q_UNUSED(e); - return S_OK; -} - -static HRESULT qt_drop(IInspectable *sender, ABI::Windows::UI::Xaml::IDragEventArgs *e) -{ - QWinRTDrag::instance()->handleNativeDragEvent(sender, e, true); - return S_OK; -} - -#define Q_DECLARE_DRAGHANDLER(name,func) \ -class QtDragEventHandler##name : public IDragEventHandler \ -{ \ -public: \ - virtual ~QtDragEventHandler##name() {\ - }\ - STDMETHODIMP Invoke(IInspectable *sender, \ - ABI::Windows::UI::Xaml::IDragEventArgs *e) \ - { \ - return qt_##func(sender, e);\ - } \ - \ - STDMETHODIMP \ - QueryInterface(REFIID riid, void FAR* FAR* ppvObj) \ - { \ - if (riid == IID_IUnknown || riid == IID_IDragEventHandler) { \ - *ppvObj = this; \ - AddRef(); \ - return NOERROR; \ - } \ - *ppvObj = NULL; \ - return ResultFromScode(E_NOINTERFACE); \ - } \ - \ - STDMETHODIMP_(ULONG) \ - AddRef(void) \ - { \ - return ++m_refs; \ - } \ - \ - STDMETHODIMP_(ULONG) \ - Release(void) \ - { \ - if (--m_refs == 0) { \ - delete this; \ - return 0; \ - } \ - return m_refs; \ - } \ -private: \ -ULONG m_refs{0}; \ -}; - -Q_DECLARE_DRAGHANDLER(Enter, drag_enter) -Q_DECLARE_DRAGHANDLER(Over, drag_over) -Q_DECLARE_DRAGHANDLER(Leave, drag_leave) -Q_DECLARE_DRAGHANDLER(Drop, drop) - -#define Q_INST_DRAGHANDLER(name) QtDragEventHandler##name() - -Q_GLOBAL_STATIC(QWinRTDrag, gDrag); - -extern ComPtr qt_winrt_lastPointerPoint; // qwinrtscreen.cpp - -QWinRTDrag::QWinRTDrag() - : QPlatformDrag() - , m_dragTarget(nullptr) -{ - qCDebug(lcQpaMime) << __FUNCTION__; - m_enter = new Q_INST_DRAGHANDLER(Enter); - m_over = new Q_INST_DRAGHANDLER(Over); - m_leave = new Q_INST_DRAGHANDLER(Leave); - m_drop = new Q_INST_DRAGHANDLER(Drop); - m_mimeData = new QWinRTInternalMimeData; -} - -QWinRTDrag::~QWinRTDrag() -{ - qCDebug(lcQpaMime) << __FUNCTION__; - delete m_enter; - delete m_over; - delete m_leave; - delete m_drop; - delete m_mimeData; -} - -QWinRTDrag *QWinRTDrag::instance() -{ - return gDrag; -} - -inline HRESULT resetUiElementDrag(ComPtr &elem3, EventRegistrationToken startingToken) -{ - return QEventDispatcherWinRT::runOnXamlThread([elem3, startingToken]() { - HRESULT hr; - hr = elem3->put_CanDrag(false); - Q_ASSERT_SUCCEEDED(hr); - hr = elem3->remove_DragStarting(startingToken); - Q_ASSERT_SUCCEEDED(hr); - return S_OK; - }); -} - -Qt::DropAction QWinRTDrag::drag(QDrag *drag) -{ - qCDebug(lcQpaMime) << __FUNCTION__ << drag; - - if (!qt_winrt_lastPointerPoint) { - Q_ASSERT_X(qt_winrt_lastPointerPoint, Q_FUNC_INFO, "No pointerpoint known"); - return Qt::IgnoreAction; - } - - ComPtr elem3; - HRESULT hr = m_ui.As(&elem3); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr> op; - EventRegistrationToken startingToken; - - hr = QEventDispatcherWinRT::runOnXamlThread([drag, &op, &hr, elem3, &startingToken]() { - - hr = elem3->put_CanDrag(true); - Q_ASSERT_SUCCEEDED(hr); - - auto startingCallback = Callback> ([drag](IInspectable *, IDragStartingEventArgs *args) { - qCDebug(lcQpaMime) << "Drag starting" << args; - - ComPtr dataPackage; - HRESULT hr; - hr = args->get_Data(dataPackage.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - Qt::DropAction action = drag->defaultAction(); - hr = dataPackage->put_RequestedOperation(translateFromQDragDropActions(action)); - Q_ASSERT_SUCCEEDED(hr); - -#ifndef QT_WINRT_LIMITED_DRAGANDDROP - ComPtr args2; - hr = args->QueryInterface(IID_PPV_ARGS(&args2)); - Q_ASSERT_SUCCEEDED(hr); - - Qt::DropActions actions = drag->supportedActions(); - DataPackageOperation allowedOperations = DataPackageOperation_None; - if (actions & Qt::CopyAction) - allowedOperations |= DataPackageOperation_Copy; - if (actions & Qt::MoveAction) - allowedOperations |= DataPackageOperation_Move; - if (actions & Qt::LinkAction) - allowedOperations |= DataPackageOperation_Link; - hr = args2->put_AllowedOperations(allowedOperations); - Q_ASSERT_SUCCEEDED(hr); -#endif // QT_WINRT_LIMITED_DRAGANDDROP - QMimeData *mimeData = drag->mimeData(); - if (mimeData->hasText()) { - hr = dataPackage->SetText(qStringToHString(mimeData->text()).Get()); - Q_ASSERT_SUCCEEDED(hr); - } - if (mimeData->hasHtml()) { - hr = dataPackage->SetHtmlFormat(qStringToHString(mimeData->html()).Get()); - Q_ASSERT_SUCCEEDED(hr); - } - // ### TODO: Missing: weblink, image - - if (!drag->pixmap().isNull()) { - const QImage image2 = drag->pixmap().toImage(); - const QImage image = image2.convertToFormat(QImage::Format_ARGB32); - if (!image.isNull()) { - // Create IBuffer containing image - ComPtr imageBuffer - = createIBufferFromData(reinterpret_cast(image.bits()), int(image.sizeInBytes())); - - ComPtr bitmapFactory; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Graphics_Imaging_SoftwareBitmap).Get(), - IID_PPV_ARGS(&bitmapFactory)); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr bitmap; - hr = bitmapFactory->Create(BitmapPixelFormat_Rgba8, image.width(), image.height(), &bitmap); - Q_ASSERT_SUCCEEDED(hr); - - hr = bitmap->CopyFromBuffer(imageBuffer.Get()); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr dragUi; - hr = args->get_DragUI(dragUi.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - - hr = dragUi->SetContentFromSoftwareBitmap(bitmap.Get()); - Q_ASSERT_SUCCEEDED(hr); - } - } - - const QStringList formats = mimeData->formats(); - for (auto item : formats) { - QByteArray data = mimeData->data(item); - - ComPtr buffer = createIBufferFromData(data.constData(), data.size()); - - // We cannot push the buffer to the data package as the result on - // recipient side is different from native events. It still sends a - // buffer, but that potentially cannot be parsed. Hence we need to create - // a IRandomAccessStream which gets forwarded as is to the drop side. - ComPtr ras; - hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Storage_Streams_InMemoryRandomAccessStream).Get(), &ras); - Q_ASSERT_SUCCEEDED(hr); - - hr = ras->put_Size(UINT64(data.size())); - ComPtr outputStream; - hr = ras->GetOutputStreamAt(0, &outputStream); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr> writeOp; - hr = outputStream->WriteAsync(buffer.Get(), &writeOp); - Q_ASSERT_SUCCEEDED(hr); - - UINT32 result; - hr = QWinRTFunctions::await(writeOp, &result); - Q_ASSERT_SUCCEEDED(hr); - - unsigned char flushResult; - ComPtr> flushOp; - hr = outputStream->FlushAsync(&flushOp); - Q_ASSERT_SUCCEEDED(hr); - - hr = QWinRTFunctions::await(flushOp, &flushResult); - Q_ASSERT_SUCCEEDED(hr); - - hr = dataPackage->SetData(qStringToHString(item).Get(), ras.Get()); - Q_ASSERT_SUCCEEDED(hr); - } - return S_OK; - }); - - hr = elem3->add_DragStarting(startingCallback.Get(), &startingToken); - Q_ASSERT_SUCCEEDED(hr); - - hr = elem3->StartDragAsync(qt_winrt_lastPointerPoint.Get(), &op); - Q_ASSERT_SUCCEEDED(hr); - - return hr; - }); - if (!op || FAILED(hr)) { - qCDebug(lcQpaMime) << "Drag failed:" << hr; - hr = resetUiElementDrag(elem3, startingToken); - Q_ASSERT_SUCCEEDED(hr); - return Qt::IgnoreAction; - } - - DataPackageOperation nativeOperationType; - // Do not yield, as that can cause deadlocks when dropping inside the same app - hr = QWinRTFunctions::await(op, &nativeOperationType, QWinRTFunctions::ProcessThreadEvents); - Q_ASSERT_SUCCEEDED(hr); - - hr = resetUiElementDrag(elem3, startingToken); - Q_ASSERT_SUCCEEDED(hr); - - Qt::DropAction resultAction; - switch (nativeOperationType) { - case DataPackageOperation_Link: - resultAction = Qt::LinkAction; - break; - case DataPackageOperation_Copy: - resultAction = Qt::CopyAction; - break; - case DataPackageOperation_Move: - resultAction = Qt::MoveAction; - break; - case DataPackageOperation_None: - default: - resultAction = Qt::IgnoreAction; - break; - } - - return resultAction; -} - -void QWinRTDrag::setDropTarget(QWindow *target) -{ - qCDebug(lcQpaMime) << __FUNCTION__ << target; - m_dragTarget = target; -} - -void QWinRTDrag::setUiElement(ComPtr &element) -{ - qCDebug(lcQpaMime) << __FUNCTION__; - m_ui = element; - // We set the element to always accept drops and then evaluate during - // runtime - HRESULT hr = element->put_AllowDrop(TRUE); - EventRegistrationToken tok; - hr = element->add_DragEnter(m_enter, &tok); - RETURN_VOID_IF_FAILED("Failed to add DragEnter handler."); - hr = element->add_DragOver(m_over, &tok); - RETURN_VOID_IF_FAILED("Failed to add DragOver handler."); - hr = element->add_DragLeave(m_leave, &tok); - RETURN_VOID_IF_FAILED("Failed to add DragLeave handler."); - hr = element->add_Drop(m_drop, &tok); - RETURN_VOID_IF_FAILED("Failed to add Drop handler."); -} - -void QWinRTDrag::handleNativeDragEvent(IInspectable *sender, ABI::Windows::UI::Xaml::IDragEventArgs *e, bool drop) -{ - Q_UNUSED(sender); - - if (!m_dragTarget) - return; - - HRESULT hr; - Point relativePoint; - hr = e->GetPosition(m_ui.Get(), &relativePoint); - RETURN_VOID_IF_FAILED("Could not query drag position."); - const QPoint p(int(relativePoint.X), int(relativePoint.Y)); - - ComPtr e2; - hr = e->QueryInterface(IID_PPV_ARGS(&e2)); - RETURN_VOID_IF_FAILED("Could not convert drag event args"); - - DragDropModifiers modifiers; - hr = e2->get_Modifiers(&modifiers); - -#ifndef QT_WINRT_LIMITED_DRAGANDDROP - ComPtr e3; - hr = e->QueryInterface(IID_PPV_ARGS(&e3)); - Q_ASSERT_SUCCEEDED(hr); - - DataPackageOperation dataOp; - hr = e3->get_AllowedOperations(&dataOp); - if (FAILED(hr)) - qCDebug(lcQpaMime) << __FUNCTION__ << "Could not query drag operations"; - - const Qt::DropActions actions = translateToQDragDropActions(dataOp); -#else // !QT_WINRT_LIMITED_DRAGANDDROP - const Qt::DropActions actions = Qt::LinkAction | Qt::CopyAction | Qt::MoveAction;; -#endif // !QT_WINRT_LIMITED_DRAGANDDROP - - ComPtr dataView; - hr = e2->get_DataView(&dataView); - Q_ASSERT_SUCCEEDED(hr); - - m_mimeData->setDataView(dataView); - - // We use deferral as we need to jump to the Qt thread to handle - // the drag event - ComPtr deferral; - hr = e2->GetDeferral(&deferral); - Q_ASSERT_SUCCEEDED(hr); - - DragThreadTransferData *transferData = new DragThreadTransferData; - transferData->moveToThread(qGuiApp->thread()); - transferData->window = m_dragTarget; - transferData->point = p; - transferData->mime = m_mimeData; - transferData->actions = actions; - transferData->dropAction = drop; - transferData->nativeArgs = e; - transferData->deferral = deferral; - QMetaObject::invokeMethod(transferData, "handleDrag", Qt::QueuedConnection); -} - -DragThreadTransferData::DragThreadTransferData(QObject *parent) - : QObject(parent) - , dropAction(false) -{ -} - -void DragThreadTransferData::handleDrag() -{ - bool accepted = false; - Qt::DropAction acceptedAction; - if (dropAction) { - QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(window, mime, point, actions); - accepted = response.isAccepted(); - acceptedAction = response.acceptedAction(); - } else { - QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(window, mime, point, actions); - accepted = response.isAccepted(); - acceptedAction = response.acceptedAction(); - } - - HRESULT hr; - hr = QEventDispatcherWinRT::runOnXamlThread([accepted, acceptedAction, this]() { - HRESULT hr; - hr = nativeArgs->put_Handled(accepted); - if (acceptedAction != Qt::IgnoreAction) { - ComPtr e2; - hr = nativeArgs.As(&e2); - if (SUCCEEDED(hr)) - hr = e2->put_AcceptedOperation(translateFromQDragDropActions(acceptedAction)); - } - deferral->Complete(); - return S_OK; - }); - Q_ASSERT_SUCCEEDED(hr); - deleteLater(); -} - -QT_END_NAMESPACE - -#include "qwinrtdrag.moc" diff --git a/src/plugins/platforms/winrt/qwinrtdrag.h b/src/plugins/platforms/winrt/qwinrtdrag.h deleted file mode 100644 index ab57999bba..0000000000 --- a/src/plugins/platforms/winrt/qwinrtdrag.h +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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$ -** -****************************************************************************/ - -#include - -#include -#include -#include -#include - -#include - -namespace ABI { - namespace Windows { - namespace ApplicationModel { - namespace DataTransfer { - struct IDataPackageView; - } - } - namespace UI { - namespace Xaml { - struct IUIElement; - struct IDragEventArgs; - struct IDragOperationDeferral; - //struct IDataPackageView; - } - } - } -} - -QT_BEGIN_NAMESPACE - -Q_DECLARE_LOGGING_CATEGORY(lcQpaMime) - -class QtDragEventHandlerEnter; -class QtDragEventHandlerOver; -class QtDragEventHandlerLeave; -class QtDragEventHandlerDrop; -class QWinRTInternalMimeData; - -class QWinRTInternalMimeData : public QInternalMimeData { -public: - QWinRTInternalMimeData(); - ~QWinRTInternalMimeData() override = default; - - bool hasFormat_sys(const QString &mimetype) const override; - QStringList formats_sys() const override; - QVariant retrieveData_sys(const QString &mimetype, QVariant::Type preferredType) const override; - - void setDataView(const Microsoft::WRL::ComPtr &d); -private: - Microsoft::WRL::ComPtr dataView; - mutable QStringList formats; -}; - -class QWinRTDrag : public QPlatformDrag { -public: - QWinRTDrag(); - ~QWinRTDrag() override; - static QWinRTDrag *instance(); - - Qt::DropAction drag(QDrag *) override; - - void setDropTarget(QWindow *target); - - // Native integration and registration - void setUiElement(Microsoft::WRL::ComPtr &element); - - void handleNativeDragEvent(IInspectable *sender, ABI::Windows::UI::Xaml::IDragEventArgs *e, bool drop = false); -private: - Microsoft::WRL::ComPtr m_ui; - QWindow *m_dragTarget; - QtDragEventHandlerEnter *m_enter; - QtDragEventHandlerOver *m_over; - QtDragEventHandlerLeave *m_leave; - QtDragEventHandlerDrop *m_drop; - QWinRTInternalMimeData *m_mimeData; -}; - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/winrt/qwinrteglcontext.cpp b/src/plugins/platforms/winrt/qwinrteglcontext.cpp deleted file mode 100644 index aa64ac1f99..0000000000 --- a/src/plugins/platforms/winrt/qwinrteglcontext.cpp +++ /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$ -** -****************************************************************************/ - -#include "qwinrteglcontext.h" -#include "qwinrtwindow.h" -#include - -#include - -#include - -#include -#define EGL_EGLEXT_PROTOTYPES -#include - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -struct WinRTEGLDisplay -{ - WinRTEGLDisplay() { - } - ~WinRTEGLDisplay() { - eglTerminate(eglDisplay); - } - - EGLDisplay eglDisplay; -}; - -Q_GLOBAL_STATIC(WinRTEGLDisplay, g) - -class QWinRTEGLContextPrivate -{ -public: - QWinRTEGLContextPrivate() : eglContext(EGL_NO_CONTEXT), eglShareContext(EGL_NO_CONTEXT) { } - QSurfaceFormat format; - EGLConfig eglConfig; - EGLContext eglContext; - EGLContext eglShareContext; -}; - -QWinRTEGLContext::QWinRTEGLContext(QOpenGLContext *context) - : d_ptr(new QWinRTEGLContextPrivate) -{ - Q_D(QWinRTEGLContext); - d->format = context->format(); - d->format.setRenderableType(QSurfaceFormat::OpenGLES); - if (QPlatformOpenGLContext *shareHandle = context->shareHandle()) - d->eglShareContext = static_cast(shareHandle)->d_ptr->eglContext; -} - -QWinRTEGLContext::~QWinRTEGLContext() -{ - Q_D(QWinRTEGLContext); - if (d->eglContext != EGL_NO_CONTEXT) - eglDestroyContext(g->eglDisplay, d->eglContext); -} - -void QWinRTEGLContext::initialize() -{ - Q_D(QWinRTEGLContext); - - // Test if the hardware supports at least level 9_3 - D3D_FEATURE_LEVEL featureLevels[] = { D3D_FEATURE_LEVEL_9_3 }; // minimum feature level - HRESULT hr = D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, featureLevels, 1, - D3D11_SDK_VERSION, nullptr, nullptr, nullptr); - EGLint deviceType = SUCCEEDED(hr) ? EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE - : EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE; - - eglBindAPI(EGL_OPENGL_ES_API); - - const EGLint displayAttributes[] = { - EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, - EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, deviceType, - EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, true, - EGL_NONE, - }; - g->eglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, displayAttributes); - if (Q_UNLIKELY(g->eglDisplay == EGL_NO_DISPLAY)) - qCritical("Failed to initialize EGL display: 0x%x", eglGetError()); - - // eglInitialize checks for EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE - // which adds a suspending handler. This needs to be added from the Xaml - // thread itself, otherwise it will not be invoked. add_Suspending does - // not return an error unfortunately, so it silently fails and causes - // applications to not quit when the system wants to terminate the app - // after suspend. - hr = QEventDispatcherWinRT::runOnXamlThread([]() { - if (!eglInitialize(g->eglDisplay, nullptr, nullptr)) - qCritical("Failed to initialize EGL: 0x%x", eglGetError()); - return S_OK; - }); - d->eglConfig = q_configFromGLFormat(g->eglDisplay, d->format); - - const EGLint flags = d->format.testOption(QSurfaceFormat::DebugContext) - ? EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR : 0; - const int major = d->format.majorVersion(); - const int minor = d->format.minorVersion(); - if (major > 3 || (major == 3 && minor > 0)) - qWarning("QWinRTEGLContext: ANGLE only partially supports OpenGL ES > 3.0"); - const EGLint attributes[] = { - EGL_CONTEXT_CLIENT_VERSION, d->format.majorVersion(), - EGL_CONTEXT_MINOR_VERSION_KHR, d->format.minorVersion(), - EGL_CONTEXT_FLAGS_KHR, flags, - EGL_NONE - }; - d->eglContext = eglCreateContext(g->eglDisplay, d->eglConfig, d->eglShareContext, attributes); - if (d->eglContext == EGL_NO_CONTEXT) { - qWarning("QEGLPlatformContext: Failed to create context: %x", eglGetError()); - return; - } -} - -bool QWinRTEGLContext::makeCurrent(QPlatformSurface *windowSurface) -{ - Q_D(QWinRTEGLContext); - Q_ASSERT(windowSurface->surface()->supportsOpenGL()); - - EGLSurface surface; - if (windowSurface->surface()->surfaceClass() == QSurface::Window) { - QWinRTWindow *window = static_cast(windowSurface); - if (window->eglSurface() == EGL_NO_SURFACE) - window->createEglSurface(g->eglDisplay, d->eglConfig); - - surface = window->eglSurface(); - } else { // Offscreen - surface = static_cast(windowSurface)->pbuffer(); - } - - if (surface == EGL_NO_SURFACE) - return false; - - const bool ok = eglMakeCurrent(g->eglDisplay, surface, surface, d->eglContext); - if (!ok) { - qWarning("QEGLPlatformContext: eglMakeCurrent failed: %x", eglGetError()); - return false; - } - - eglSwapInterval(g->eglDisplay, d->format.swapInterval()); - return true; -} - -void QWinRTEGLContext::doneCurrent() -{ - const bool ok = eglMakeCurrent(g->eglDisplay, EGL_NO_SURFACE, - EGL_NO_SURFACE, EGL_NO_CONTEXT); - if (!ok) - qWarning("QEGLPlatformContext: eglMakeCurrent failed: %x", eglGetError()); -} - -void QWinRTEGLContext::swapBuffers(QPlatformSurface *windowSurface) -{ - Q_ASSERT(windowSurface->surface()->supportsOpenGL()); - - const QWinRTWindow *window = static_cast(windowSurface); - eglSwapBuffers(g->eglDisplay, window->eglSurface()); -} - -QSurfaceFormat QWinRTEGLContext::format() const -{ - Q_D(const QWinRTEGLContext); - return d->format; -} - -QFunctionPointer QWinRTEGLContext::getProcAddress(const char *procName) -{ - static QHash standardFuncs; - if (standardFuncs.isEmpty()) { - standardFuncs.insert(QByteArrayLiteral("glBindTexture"), (QFunctionPointer)&glBindTexture); - standardFuncs.insert(QByteArrayLiteral("glBlendFunc"), (QFunctionPointer)&glBlendFunc); - standardFuncs.insert(QByteArrayLiteral("glClear"), (QFunctionPointer)&glClear); - standardFuncs.insert(QByteArrayLiteral("glClearColor"), (QFunctionPointer)&glClearColor); - standardFuncs.insert(QByteArrayLiteral("glClearStencil"), (QFunctionPointer)&glClearStencil); - standardFuncs.insert(QByteArrayLiteral("glColorMask"), (QFunctionPointer)&glColorMask); - standardFuncs.insert(QByteArrayLiteral("glCopyTexImage2D"), (QFunctionPointer)&glCopyTexImage2D); - standardFuncs.insert(QByteArrayLiteral("glCopyTexSubImage2D"), (QFunctionPointer)&glCopyTexSubImage2D); - standardFuncs.insert(QByteArrayLiteral("glCullFace"), (QFunctionPointer)&glCullFace); - standardFuncs.insert(QByteArrayLiteral("glDeleteTextures"), (QFunctionPointer)&glDeleteTextures); - standardFuncs.insert(QByteArrayLiteral("glDepthFunc"), (QFunctionPointer)&glDepthFunc); - standardFuncs.insert(QByteArrayLiteral("glDepthMask"), (QFunctionPointer)&glDepthMask); - standardFuncs.insert(QByteArrayLiteral("glDisable"), (QFunctionPointer)&glDisable); - standardFuncs.insert(QByteArrayLiteral("glDrawArrays"), (QFunctionPointer)&glDrawArrays); - standardFuncs.insert(QByteArrayLiteral("glDrawElements"), (QFunctionPointer)&glDrawElements); - standardFuncs.insert(QByteArrayLiteral("glEnable"), (QFunctionPointer)&glEnable); - standardFuncs.insert(QByteArrayLiteral("glFinish"), (QFunctionPointer)&glFinish); - standardFuncs.insert(QByteArrayLiteral("glFlush"), (QFunctionPointer)&glFlush); - standardFuncs.insert(QByteArrayLiteral("glFrontFace"), (QFunctionPointer)&glFrontFace); - standardFuncs.insert(QByteArrayLiteral("glGenTextures"), (QFunctionPointer)&glGenTextures); - standardFuncs.insert(QByteArrayLiteral("glGetBooleanv"), (QFunctionPointer)&glGetBooleanv); - standardFuncs.insert(QByteArrayLiteral("glGetError"), (QFunctionPointer)&glGetError); - standardFuncs.insert(QByteArrayLiteral("glGetFloatv"), (QFunctionPointer)&glGetFloatv); - standardFuncs.insert(QByteArrayLiteral("glGetIntegerv"), (QFunctionPointer)&glGetIntegerv); - standardFuncs.insert(QByteArrayLiteral("glGetString"), (QFunctionPointer)&glGetString); - standardFuncs.insert(QByteArrayLiteral("glGetTexParameterfv"), (QFunctionPointer)&glGetTexParameterfv); - standardFuncs.insert(QByteArrayLiteral("glGetTexParameteriv"), (QFunctionPointer)&glGetTexParameteriv); - standardFuncs.insert(QByteArrayLiteral("glHint"), (QFunctionPointer)&glHint); - standardFuncs.insert(QByteArrayLiteral("glIsEnabled"), (QFunctionPointer)&glIsEnabled); - standardFuncs.insert(QByteArrayLiteral("glIsTexture"), (QFunctionPointer)&glIsTexture); - standardFuncs.insert(QByteArrayLiteral("glLineWidth"), (QFunctionPointer)&glLineWidth); - standardFuncs.insert(QByteArrayLiteral("glPixelStorei"), (QFunctionPointer)&glPixelStorei); - standardFuncs.insert(QByteArrayLiteral("glPolygonOffset"), (QFunctionPointer)&glPolygonOffset); - standardFuncs.insert(QByteArrayLiteral("glReadPixels"), (QFunctionPointer)&glReadPixels); - standardFuncs.insert(QByteArrayLiteral("glScissor"), (QFunctionPointer)&glScissor); - standardFuncs.insert(QByteArrayLiteral("glStencilFunc"), (QFunctionPointer)&glStencilFunc); - standardFuncs.insert(QByteArrayLiteral("glStencilMask"), (QFunctionPointer)&glStencilMask); - standardFuncs.insert(QByteArrayLiteral("glStencilOp"), (QFunctionPointer)&glStencilOp); - standardFuncs.insert(QByteArrayLiteral("glTexImage2D"), (QFunctionPointer)&glTexImage2D); - standardFuncs.insert(QByteArrayLiteral("glTexParameterf"), (QFunctionPointer)&glTexParameterf); - standardFuncs.insert(QByteArrayLiteral("glTexParameterfv"), (QFunctionPointer)&glTexParameterfv); - standardFuncs.insert(QByteArrayLiteral("glTexParameteri"), (QFunctionPointer)&glTexParameteri); - standardFuncs.insert(QByteArrayLiteral("glTexParameteriv"), (QFunctionPointer)&glTexParameteriv); - standardFuncs.insert(QByteArrayLiteral("glTexSubImage2D"), (QFunctionPointer)&glTexSubImage2D); - standardFuncs.insert(QByteArrayLiteral("glViewport"), (QFunctionPointer)&glViewport); - standardFuncs.insert(QByteArrayLiteral("glActiveTexture"), (QFunctionPointer)&glActiveTexture); - standardFuncs.insert(QByteArrayLiteral("glAttachShader"), (QFunctionPointer)&glAttachShader); - standardFuncs.insert(QByteArrayLiteral("glBindAttribLocation"), (QFunctionPointer)&glBindAttribLocation); - standardFuncs.insert(QByteArrayLiteral("glBindBuffer"), (QFunctionPointer)&glBindBuffer); - standardFuncs.insert(QByteArrayLiteral("glBindFramebuffer"), (QFunctionPointer)&glBindFramebuffer); - standardFuncs.insert(QByteArrayLiteral("glBindRenderbuffer"), (QFunctionPointer)&glBindRenderbuffer); - standardFuncs.insert(QByteArrayLiteral("glBlendColor"), (QFunctionPointer)&glBlendColor); - standardFuncs.insert(QByteArrayLiteral("glBlendEquation"), (QFunctionPointer)&glBlendEquation); - standardFuncs.insert(QByteArrayLiteral("glBlendEquationSeparate"), (QFunctionPointer)&glBlendEquationSeparate); - standardFuncs.insert(QByteArrayLiteral("glBlendFuncSeparate"), (QFunctionPointer)&glBlendFuncSeparate); - standardFuncs.insert(QByteArrayLiteral("glBufferData"), (QFunctionPointer)&glBufferData); - standardFuncs.insert(QByteArrayLiteral("glBufferSubData"), (QFunctionPointer)&glBufferSubData); - standardFuncs.insert(QByteArrayLiteral("glCheckFramebufferStatus"), (QFunctionPointer)&glCheckFramebufferStatus); - standardFuncs.insert(QByteArrayLiteral("glCompileShader"), (QFunctionPointer)&glCompileShader); - standardFuncs.insert(QByteArrayLiteral("glCompressedTexImage2D"), (QFunctionPointer)&glCompressedTexImage2D); - standardFuncs.insert(QByteArrayLiteral("glCompressedTexSubImage2D"), (QFunctionPointer)&glCompressedTexSubImage2D); - standardFuncs.insert(QByteArrayLiteral("glCreateProgram"), (QFunctionPointer)&glCreateProgram); - standardFuncs.insert(QByteArrayLiteral("glCreateShader"), (QFunctionPointer)&glCreateShader); - standardFuncs.insert(QByteArrayLiteral("glDeleteBuffers"), (QFunctionPointer)&glDeleteBuffers); - standardFuncs.insert(QByteArrayLiteral("glDeleteFramebuffers"), (QFunctionPointer)&glDeleteFramebuffers); - standardFuncs.insert(QByteArrayLiteral("glDeleteProgram"), (QFunctionPointer)&glDeleteProgram); - standardFuncs.insert(QByteArrayLiteral("glDeleteRenderbuffers"), (QFunctionPointer)&glDeleteRenderbuffers); - standardFuncs.insert(QByteArrayLiteral("glDeleteShader"), (QFunctionPointer)&glDeleteShader); - standardFuncs.insert(QByteArrayLiteral("glDetachShader"), (QFunctionPointer)&glDetachShader); - standardFuncs.insert(QByteArrayLiteral("glDisableVertexAttribArray"), (QFunctionPointer)&glDisableVertexAttribArray); - standardFuncs.insert(QByteArrayLiteral("glEnableVertexAttribArray"), (QFunctionPointer)&glEnableVertexAttribArray); - standardFuncs.insert(QByteArrayLiteral("glFramebufferRenderbuffer"), (QFunctionPointer)&glFramebufferRenderbuffer); - standardFuncs.insert(QByteArrayLiteral("glFramebufferTexture2D"), (QFunctionPointer)&glFramebufferTexture2D); - standardFuncs.insert(QByteArrayLiteral("glGenBuffers"), (QFunctionPointer)&glGenBuffers); - standardFuncs.insert(QByteArrayLiteral("glGenerateMipmap"), (QFunctionPointer)&glGenerateMipmap); - standardFuncs.insert(QByteArrayLiteral("glGenFramebuffers"), (QFunctionPointer)&glGenFramebuffers); - standardFuncs.insert(QByteArrayLiteral("glGenRenderbuffers"), (QFunctionPointer)&glGenRenderbuffers); - standardFuncs.insert(QByteArrayLiteral("glGetActiveAttrib"), (QFunctionPointer)&glGetActiveAttrib); - standardFuncs.insert(QByteArrayLiteral("glGetActiveUniform"), (QFunctionPointer)&glGetActiveUniform); - standardFuncs.insert(QByteArrayLiteral("glGetAttachedShaders"), (QFunctionPointer)&glGetAttachedShaders); - standardFuncs.insert(QByteArrayLiteral("glGetAttribLocation"), (QFunctionPointer)&glGetAttribLocation); - standardFuncs.insert(QByteArrayLiteral("glGetBufferParameteriv"), (QFunctionPointer)&glGetBufferParameteriv); - standardFuncs.insert(QByteArrayLiteral("glGetFramebufferAttachmentParameteriv"), (QFunctionPointer)&glGetFramebufferAttachmentParameteriv); - standardFuncs.insert(QByteArrayLiteral("glGetProgramiv"), (QFunctionPointer)&glGetProgramiv); - standardFuncs.insert(QByteArrayLiteral("glGetProgramInfoLog"), (QFunctionPointer)&glGetProgramInfoLog); - standardFuncs.insert(QByteArrayLiteral("glGetRenderbufferParameteriv"), (QFunctionPointer)&glGetRenderbufferParameteriv); - standardFuncs.insert(QByteArrayLiteral("glGetShaderiv"), (QFunctionPointer)&glGetShaderiv); - standardFuncs.insert(QByteArrayLiteral("glGetShaderInfoLog"), (QFunctionPointer)&glGetShaderInfoLog); - standardFuncs.insert(QByteArrayLiteral("glGetShaderPrecisionFormat"), (QFunctionPointer)&glGetShaderPrecisionFormat); - standardFuncs.insert(QByteArrayLiteral("glGetShaderSource"), (QFunctionPointer)&glGetShaderSource); - standardFuncs.insert(QByteArrayLiteral("glGetUniformfv"), (QFunctionPointer)&glGetUniformfv); - standardFuncs.insert(QByteArrayLiteral("glGetUniformiv"), (QFunctionPointer)&glGetUniformiv); - standardFuncs.insert(QByteArrayLiteral("glGetUniformLocation"), (QFunctionPointer)&glGetUniformLocation); - standardFuncs.insert(QByteArrayLiteral("glGetVertexAttribfv"), (QFunctionPointer)&glGetVertexAttribfv); - standardFuncs.insert(QByteArrayLiteral("glGetVertexAttribiv"), (QFunctionPointer)&glGetVertexAttribiv); - standardFuncs.insert(QByteArrayLiteral("glGetVertexAttribPointerv"), (QFunctionPointer)&glGetVertexAttribPointerv); - standardFuncs.insert(QByteArrayLiteral("glIsBuffer"), (QFunctionPointer)&glIsBuffer); - standardFuncs.insert(QByteArrayLiteral("glIsFramebuffer"), (QFunctionPointer)&glIsFramebuffer); - standardFuncs.insert(QByteArrayLiteral("glIsProgram"), (QFunctionPointer)&glIsProgram); - standardFuncs.insert(QByteArrayLiteral("glIsRenderbuffer"), (QFunctionPointer)&glIsRenderbuffer); - standardFuncs.insert(QByteArrayLiteral("glIsShader"), (QFunctionPointer)&glIsShader); - standardFuncs.insert(QByteArrayLiteral("glLinkProgram"), (QFunctionPointer)&glLinkProgram); - standardFuncs.insert(QByteArrayLiteral("glReleaseShaderCompiler"), (QFunctionPointer)&glReleaseShaderCompiler); - standardFuncs.insert(QByteArrayLiteral("glRenderbufferStorage"), (QFunctionPointer)&glRenderbufferStorage); - standardFuncs.insert(QByteArrayLiteral("glSampleCoverage"), (QFunctionPointer)&glSampleCoverage); - standardFuncs.insert(QByteArrayLiteral("glShaderBinary"), (QFunctionPointer)&glShaderBinary); - standardFuncs.insert(QByteArrayLiteral("glShaderSource"), (QFunctionPointer)&glShaderSource); - standardFuncs.insert(QByteArrayLiteral("glStencilFuncSeparate"), (QFunctionPointer)&glStencilFuncSeparate); - standardFuncs.insert(QByteArrayLiteral("glStencilMaskSeparate"), (QFunctionPointer)&glStencilMaskSeparate); - standardFuncs.insert(QByteArrayLiteral("glStencilOpSeparate"), (QFunctionPointer)&glStencilOpSeparate); - standardFuncs.insert(QByteArrayLiteral("glUniform1f"), (QFunctionPointer)&glUniform1f); - standardFuncs.insert(QByteArrayLiteral("glUniform1fv"), (QFunctionPointer)&glUniform1fv); - standardFuncs.insert(QByteArrayLiteral("glUniform1i"), (QFunctionPointer)&glUniform1i); - standardFuncs.insert(QByteArrayLiteral("glUniform1iv"), (QFunctionPointer)&glUniform1iv); - standardFuncs.insert(QByteArrayLiteral("glUniform2f"), (QFunctionPointer)&glUniform2f); - standardFuncs.insert(QByteArrayLiteral("glUniform2fv"), (QFunctionPointer)&glUniform2fv); - standardFuncs.insert(QByteArrayLiteral("glUniform2i"), (QFunctionPointer)&glUniform2i); - standardFuncs.insert(QByteArrayLiteral("glUniform2iv"), (QFunctionPointer)&glUniform2iv); - standardFuncs.insert(QByteArrayLiteral("glUniform3f"), (QFunctionPointer)&glUniform3f); - standardFuncs.insert(QByteArrayLiteral("glUniform3fv"), (QFunctionPointer)&glUniform3fv); - standardFuncs.insert(QByteArrayLiteral("glUniform3i"), (QFunctionPointer)&glUniform3i); - standardFuncs.insert(QByteArrayLiteral("glUniform3iv"), (QFunctionPointer)&glUniform3iv); - standardFuncs.insert(QByteArrayLiteral("glUniform4f"), (QFunctionPointer)&glUniform4f); - standardFuncs.insert(QByteArrayLiteral("glUniform4fv"), (QFunctionPointer)&glUniform4fv); - standardFuncs.insert(QByteArrayLiteral("glUniform4i"), (QFunctionPointer)&glUniform4i); - standardFuncs.insert(QByteArrayLiteral("glUniform4iv"), (QFunctionPointer)&glUniform4iv); - standardFuncs.insert(QByteArrayLiteral("glUniformMatrix2fv"), (QFunctionPointer)&glUniformMatrix2fv); - standardFuncs.insert(QByteArrayLiteral("glUniformMatrix3fv"), (QFunctionPointer)&glUniformMatrix3fv); - standardFuncs.insert(QByteArrayLiteral("glUniformMatrix4fv"), (QFunctionPointer)&glUniformMatrix4fv); - standardFuncs.insert(QByteArrayLiteral("glUseProgram"), (QFunctionPointer)&glUseProgram); - standardFuncs.insert(QByteArrayLiteral("glValidateProgram"), (QFunctionPointer)&glValidateProgram); - standardFuncs.insert(QByteArrayLiteral("glVertexAttrib1f"), (QFunctionPointer)&glVertexAttrib1f); - standardFuncs.insert(QByteArrayLiteral("glVertexAttrib1fv"), (QFunctionPointer)&glVertexAttrib1fv); - standardFuncs.insert(QByteArrayLiteral("glVertexAttrib2f"), (QFunctionPointer)&glVertexAttrib2f); - standardFuncs.insert(QByteArrayLiteral("glVertexAttrib2fv"), (QFunctionPointer)&glVertexAttrib2fv); - standardFuncs.insert(QByteArrayLiteral("glVertexAttrib3f"), (QFunctionPointer)&glVertexAttrib3f); - standardFuncs.insert(QByteArrayLiteral("glVertexAttrib3fv"), (QFunctionPointer)&glVertexAttrib3fv); - standardFuncs.insert(QByteArrayLiteral("glVertexAttrib4f"), (QFunctionPointer)&glVertexAttrib4f); - standardFuncs.insert(QByteArrayLiteral("glVertexAttrib4fv"), (QFunctionPointer)&glVertexAttrib4fv); - standardFuncs.insert(QByteArrayLiteral("glVertexAttribPointer"), (QFunctionPointer)&glVertexAttribPointer); - standardFuncs.insert(QByteArrayLiteral("glClearDepthf"), (QFunctionPointer)&glClearDepthf); - standardFuncs.insert(QByteArrayLiteral("glDepthRangef"), (QFunctionPointer)&glDepthRangef); - }; - - QHash::const_iterator i = standardFuncs.find(procName); - if (i != standardFuncs.end()) - return i.value(); - - return eglGetProcAddress(procName); -} - -bool QWinRTEGLContext::isValid() const -{ - Q_D(const QWinRTEGLContext); - return d->eglContext != EGL_NO_CONTEXT; -} - -EGLDisplay QWinRTEGLContext::display() -{ - return g->eglDisplay; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/winrt/qwinrteglcontext.h b/src/plugins/platforms/winrt/qwinrteglcontext.h deleted file mode 100644 index 8dbd0fc7d0..0000000000 --- a/src/plugins/platforms/winrt/qwinrteglcontext.h +++ /dev/null @@ -1,73 +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 QWINDOWSEGLCONTEXT_H -#define QWINDOWSEGLCONTEXT_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class QWinRTEGLContextPrivate; -class QWinRTEGLContext : public QPlatformOpenGLContext -{ -public: - explicit QWinRTEGLContext(QOpenGLContext *context); - ~QWinRTEGLContext() override; - - void initialize() override; - - bool makeCurrent(QPlatformSurface *windowSurface) override; - void doneCurrent() override; - void swapBuffers(QPlatformSurface *windowSurface) override; - - QSurfaceFormat format() const override; - QFunctionPointer getProcAddress(const char *procName) override; - bool isValid() const override; - - static EGLDisplay display(); -private: - QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QWinRTEGLContext) -}; - -QT_END_NAMESPACE - -#endif // QWINDOWSEGLCONTEXT_H diff --git a/src/plugins/platforms/winrt/qwinrteventdispatcher.cpp b/src/plugins/platforms/winrt/qwinrteventdispatcher.cpp deleted file mode 100644 index eb59c22033..0000000000 --- a/src/plugins/platforms/winrt/qwinrteventdispatcher.cpp +++ /dev/null @@ -1,66 +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$ -** -****************************************************************************/ - -#include "qwinrteventdispatcher.h" -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QWinRTEventDispatcher::QWinRTEventDispatcher(QObject *parent) - : QEventDispatcherWinRT(parent) -{ -} - -bool QWinRTEventDispatcher::hasPendingEvents() -{ - return QEventDispatcherWinRT::hasPendingEvents() || QWindowSystemInterface::windowSystemEventsQueued(); -} - -bool QWinRTEventDispatcher::sendPostedEvents(QEventLoop::ProcessEventsFlags flags) -{ - bool didProcess = QEventDispatcherWinRT::sendPostedEvents(flags); - if (!(flags & QEventLoop::ExcludeUserInputEvents)) - didProcess |= QWindowSystemInterface::sendWindowSystemEvents(flags); - return didProcess; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/winrt/qwinrteventdispatcher.h b/src/plugins/platforms/winrt/qwinrteventdispatcher.h deleted file mode 100644 index 61c824f0a9..0000000000 --- a/src/plugins/platforms/winrt/qwinrteventdispatcher.h +++ /dev/null @@ -1,60 +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 QWINRTEVENTDISPATCHER_H -#define QWINRTEVENTDISPATCHER_H - -#include - -QT_BEGIN_NAMESPACE - -class QWinRTEventDispatcher : public QEventDispatcherWinRT -{ - Q_OBJECT -public: - explicit QWinRTEventDispatcher(QObject *parent = nullptr); - -protected: - bool hasPendingEvents() override; - bool sendPostedEvents(QEventLoop::ProcessEventsFlags flags) override; -}; - -QT_END_NAMESPACE - -#endif // QWINRTEVENTDISPATCHER_H diff --git a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp deleted file mode 100644 index fee8063f13..0000000000 --- a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp +++ /dev/null @@ -1,596 +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$ -** -****************************************************************************/ - -#include "qwinrtfiledialoghelper.h" -#include "qwinrtfileengine.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::ApplicationModel::Activation; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Foundation::Collections; -using namespace ABI::Windows::Storage; -using namespace ABI::Windows::Storage::Pickers; - -typedef IAsyncOperationCompletedHandler SingleFileHandler; -typedef IAsyncOperationCompletedHandler *> MultipleFileHandler; -typedef IAsyncOperationCompletedHandler SingleFolderHandler; - -QT_BEGIN_NAMESPACE - -// Required for save file picker -class WindowsStringVector : public RuntimeClass> -{ -public: - HRESULT __stdcall GetAt(quint32 index, HSTRING *item) - { - *item = impl.at(int(index)); - return S_OK; - } - HRESULT __stdcall get_Size(quint32 *size) - { - *size = quint32(impl.size()); - return S_OK; - } - HRESULT __stdcall GetView(IVectorView **view) - { - *view = nullptr; - return E_NOTIMPL; - } - HRESULT __stdcall IndexOf(HSTRING value, quint32 *index, boolean *found) - { - *found = false; - for (int i = 0; i < impl.size(); ++i) { - qint32 result; - HRESULT hr = WindowsCompareStringOrdinal(impl.at(i), value, &result); - if (FAILED(hr)) - return hr; - if (result == 0) { - *index = quint32(i); - *found = true; - break; - } - } - return S_OK; - } - HRESULT __stdcall SetAt(quint32 index, HSTRING item) - { - HSTRING newItem; - HRESULT hr = WindowsDuplicateString(item, &newItem); - if (FAILED(hr)) - return hr; - impl[int(index)] = newItem; - return S_OK; - } - HRESULT __stdcall InsertAt(quint32 index, HSTRING item) - { - HSTRING newItem; - HRESULT hr = WindowsDuplicateString(item, &newItem); - if (FAILED(hr)) - return hr; - impl.insert(int(index), newItem); - return S_OK; - } - HRESULT __stdcall RemoveAt(quint32 index) - { - WindowsDeleteString(impl.takeAt(int(index))); - return S_OK; - } - HRESULT __stdcall Append(HSTRING item) - { - HSTRING newItem; - HRESULT hr = WindowsDuplicateString(item, &newItem); - if (FAILED(hr)) - return hr; - impl.append(newItem); - return S_OK; - } - HRESULT __stdcall RemoveAtEnd() - { - WindowsDeleteString(impl.takeLast()); - return S_OK; - } - HRESULT __stdcall Clear() - { - foreach (const HSTRING &item, impl) - WindowsDeleteString(item); - impl.clear(); - return S_OK; - } -private: - QVector impl; -}; - -template -static bool initializePicker(HSTRING runtimeId, T **picker, const QSharedPointer &options) -{ - HRESULT hr; - - ComPtr basePicker; - hr = RoActivateInstance(runtimeId, &basePicker); - RETURN_FALSE_IF_FAILED("Failed to instantiate file picker"); - hr = basePicker.Get()->QueryInterface(IID_PPV_ARGS(picker)); - RETURN_FALSE_IF_FAILED("Failed to cast file picker"); - - if (options->isLabelExplicitlySet(QFileDialogOptions::Accept)) { - const QString labelText = options->labelText(QFileDialogOptions::Accept); - HStringReference labelTextRef(reinterpret_cast(labelText.utf16()), - uint(labelText.length())); - hr = (*picker)->put_CommitButtonText(labelTextRef.Get()); - RETURN_FALSE_IF_FAILED("Failed to set commit button text"); - } - - return true; -} - -template -static bool initializeOpenPickerOptions(T *picker, const QSharedPointer &options) -{ - HRESULT hr; - hr = picker->put_ViewMode(options->viewMode() == QFileDialogOptions::Detail - ? PickerViewMode_Thumbnail : PickerViewMode_List); - RETURN_FALSE_IF_FAILED("Failed to set picker view mode"); - - ComPtr> filters; - hr = picker->get_FileTypeFilter(&filters); - RETURN_FALSE_IF_FAILED("Failed to get file type filters list"); - for (const QString &namedFilter : options->nameFilters()) { - for (const QString &filter : QPlatformFileDialogHelper::cleanFilterList(namedFilter)) { - // Remove leading star - const int offset = (filter.length() > 1 && filter.startsWith(QLatin1Char('*'))) ? 1 : 0; - HStringReference filterRef(reinterpret_cast(filter.utf16() + offset), - uint(filter.length() - offset)); - hr = filters->Append(filterRef.Get()); - if (FAILED(hr)) { - qWarning("Failed to add named file filter \"%s\": %s", - qPrintable(filter), qPrintable(qt_error_string(hr))); - } - } - } - // The file dialog won't open with an empty list - add a default wildcard - quint32 size; - hr = filters->get_Size(&size); - RETURN_FALSE_IF_FAILED("Failed to get file type filters list size"); - if (!size) { - hr = filters->Append(HString::MakeReference(L"*").Get()); - RETURN_FALSE_IF_FAILED("Failed to add default wildcard to file type filters list"); - } - - return true; -} - -static bool pickFiles(IFileOpenPicker *picker, QWinRTFileDialogHelper *helper, bool singleFile) -{ - Q_ASSERT(picker); - Q_ASSERT(helper); - HRESULT hr; - hr = QEventDispatcherWinRT::runOnXamlThread([picker, helper, singleFile]() { - HRESULT hr; - if (singleFile) { - ComPtr> op; - hr = picker->PickSingleFileAsync(&op); - RETURN_HR_IF_FAILED("Failed to open single file picker"); - hr = op->put_Completed(Callback(helper, &QWinRTFileDialogHelper::onSingleFilePicked).Get()); - RETURN_HR_IF_FAILED("Failed to attach file picker callback"); - } else { - ComPtr *>> op; - hr = picker->PickMultipleFilesAsync(&op); - RETURN_HR_IF_FAILED("Failed to open multi file picker"); - hr = op->put_Completed(Callback(helper, &QWinRTFileDialogHelper::onMultipleFilesPicked).Get()); - RETURN_HR_IF_FAILED("Failed to attach multi file callback"); - } - return S_OK; - }); - return SUCCEEDED(hr); -} - -static bool pickFolder(IFolderPicker *picker, QWinRTFileDialogHelper *helper) -{ - Q_ASSERT(picker); - Q_ASSERT(helper); - HRESULT hr; - hr = QEventDispatcherWinRT::runOnXamlThread([picker, helper]() { - HRESULT hr; - ComPtr> op; - hr = picker->PickSingleFolderAsync(&op); - RETURN_HR_IF_FAILED("Failed to open folder picker"); - hr = op->put_Completed(Callback(helper, &QWinRTFileDialogHelper::onSingleFolderPicked).Get()); - RETURN_HR_IF_FAILED("Failed to attach folder picker callback"); - return S_OK; - }); - return SUCCEEDED(hr); -} - -static bool pickSaveFile(IFileSavePicker *picker, QWinRTFileDialogHelper *helper) -{ - Q_ASSERT(picker); - Q_ASSERT(helper); - HRESULT hr; - hr = QEventDispatcherWinRT::runOnXamlThread([picker, helper]() { - HRESULT hr; - ComPtr> op; - hr = picker->PickSaveFileAsync(&op); - RETURN_HR_IF_FAILED("Failed to open save file picker"); - hr = op->put_Completed(Callback(helper, &QWinRTFileDialogHelper::onSingleFilePicked).Get()); - RETURN_HR_IF_FAILED("Failed to attach save file picker callback"); - return S_OK; - }); - return SUCCEEDED(hr); -} - -class QWinRTFileDialogHelperPrivate -{ -public: - bool shown; - QEventLoop loop; - - // Input - QUrl directory; - QUrl saveFileName; - QString selectedNameFilter; - - // Output - QList selectedFiles; -}; - -QWinRTFileDialogHelper::QWinRTFileDialogHelper() - : QPlatformFileDialogHelper(), d_ptr(new QWinRTFileDialogHelperPrivate) -{ - Q_D(QWinRTFileDialogHelper); - - d->shown = false; -} - -void QWinRTFileDialogHelper::exec() -{ - Q_D(QWinRTFileDialogHelper); - - if (!d->shown) - show(Qt::Dialog, Qt::ApplicationModal, nullptr); - d->loop.exec(); -} - -bool QWinRTFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) -{ - Q_UNUSED(windowFlags) - Q_UNUSED(windowModality) - Q_UNUSED(parent) - Q_D(QWinRTFileDialogHelper); - - HRESULT hr; - const QSharedPointer dialogOptions = options(); - switch (dialogOptions->acceptMode()) { - default: - case QFileDialogOptions::AcceptOpen: { - switch (dialogOptions->fileMode()) { - case QFileDialogOptions::AnyFile: - case QFileDialogOptions::ExistingFile: - case QFileDialogOptions::ExistingFiles: { - ComPtr picker; - if (!initializePicker(HString::MakeReference(RuntimeClass_Windows_Storage_Pickers_FileOpenPicker).Get(), - picker.GetAddressOf(), dialogOptions)) { - return false; - } - if (!initializeOpenPickerOptions(picker.Get(), dialogOptions)) - return false; - - if (!pickFiles(picker.Get(), this, dialogOptions->fileMode() == QFileDialogOptions::ExistingFile)) - return false; - - break; - } - case QFileDialogOptions::Directory: - case QFileDialogOptions::DirectoryOnly: { - ComPtr picker; - if (!initializePicker(HString::MakeReference(RuntimeClass_Windows_Storage_Pickers_FolderPicker).Get(), - picker.GetAddressOf(), dialogOptions)) { - return false; - } - if (!initializeOpenPickerOptions(picker.Get(), dialogOptions)) - return false; - - if (!pickFolder(picker.Get(), this)) - return false; - - break; - } - } - break; - } - case QFileDialogOptions::AcceptSave: { - ComPtr picker; - if (!initializePicker(HString::MakeReference(RuntimeClass_Windows_Storage_Pickers_FileSavePicker).Get(), - picker.GetAddressOf(), dialogOptions)) { - return false; - } - - if (!dialogOptions->nameFilters().isEmpty()) { - ComPtr *>> choices; - hr = picker->get_FileTypeChoices(&choices); - RETURN_FALSE_IF_FAILED("Failed to get file extension choices"); - const QStringList nameFilters = dialogOptions->nameFilters(); - for (const QString &namedFilter : nameFilters) { - ComPtr> entry = Make(); - const QStringList cleanFilter = QPlatformFileDialogHelper::cleanFilterList(namedFilter); - for (const QString &filter : cleanFilter) { - // Remove leading star - const int starOffset = (filter.length() > 1 && filter.startsWith(QLatin1Char('*'))) ? 1 : 0; - HStringReference filterRef(reinterpret_cast(filter.utf16() + starOffset), - uint(filter.length() - starOffset)); - hr = entry->Append(filterRef.Get()); - if (FAILED(hr)) { - qWarning("Failed to add named file filter \"%s\": %s", - qPrintable(filter), qPrintable(qt_error_string(hr))); - } - } - const int offset = namedFilter.indexOf(QLatin1String(" (")); - const QString filterTitle = namedFilter.mid(0, offset); - HStringReference namedFilterRef(reinterpret_cast(filterTitle.utf16()), - uint(filterTitle.length())); - boolean replaced; - hr = choices->Insert(namedFilterRef.Get(), entry.Get(), &replaced); - // Only print a warning as * or *.* is not a valid choice on Windows 10 - // but used on a regular basis on all other platforms - if (FAILED(hr)) { - qWarning("Failed to insert file extension choice entry: %s: %s", - qPrintable(filterTitle), qPrintable(qt_error_string(hr))); - } - } - } - - QString suffix = dialogOptions->defaultSuffix(); - if (!suffix.isEmpty()) { - if (!suffix.startsWith(QLatin1Char('.'))) - suffix.prepend(QLatin1Char('.')); - HStringReference nativeSuffix(reinterpret_cast(suffix.utf16()), - uint(suffix.length())); - hr = picker->put_DefaultFileExtension(nativeSuffix.Get()); - RETURN_FALSE_IF_FAILED_WITH_ARGS("Failed to set default file extension \"%s\"", qPrintable(suffix)); - } - - QString suggestedName = QFileInfo(d->saveFileName.toLocalFile()).fileName(); - if (suggestedName.isEmpty() && dialogOptions->initiallySelectedFiles().size() > 0) - suggestedName = QFileInfo(dialogOptions->initiallySelectedFiles().first().toLocalFile()) - .fileName(); - if (suggestedName.isEmpty()) { - const auto fileInfo = QFileInfo(dialogOptions->initialDirectory().toLocalFile()); - if (!fileInfo.isDir()) - suggestedName = fileInfo.fileName(); - } - if (!suggestedName.isEmpty()) { - HStringReference nativeSuggestedName(reinterpret_cast(suggestedName.utf16()), - uint(suggestedName.length())); - hr = picker->put_SuggestedFileName(nativeSuggestedName.Get()); - RETURN_FALSE_IF_FAILED("Failed to set suggested file name"); - } - - if (!pickSaveFile(picker.Get(), this)) - return false; - - break; - } - } - - d->shown = true; - return true; -} - -void QWinRTFileDialogHelper::hide() -{ - Q_D(QWinRTFileDialogHelper); - - if (!d->shown) - return; - - d->shown = false; -} - -void QWinRTFileDialogHelper::setDirectory(const QUrl &directory) -{ - Q_D(QWinRTFileDialogHelper); - d->directory = directory; -} - -QUrl QWinRTFileDialogHelper::directory() const -{ - Q_D(const QWinRTFileDialogHelper); - return d->directory; -} - -void QWinRTFileDialogHelper::selectFile(const QUrl &saveFileName) -{ - Q_D(QWinRTFileDialogHelper); - d->saveFileName = saveFileName; -} - -QList QWinRTFileDialogHelper::selectedFiles() const -{ - Q_D(const QWinRTFileDialogHelper); - return d->selectedFiles; -} - -void QWinRTFileDialogHelper::selectNameFilter(const QString &selectedNameFilter) -{ - Q_D(QWinRTFileDialogHelper); - d->selectedNameFilter = selectedNameFilter; -} - -QString QWinRTFileDialogHelper::selectedNameFilter() const -{ - Q_D(const QWinRTFileDialogHelper); - return d->selectedNameFilter; -} - -HRESULT QWinRTFileDialogHelper::onSingleFilePicked(IAsyncOperation *args, AsyncStatus status) -{ - Q_D(QWinRTFileDialogHelper); - - QEventLoopLocker locker(&d->loop); - d->shown = false; - d->selectedFiles.clear(); - if (status == Canceled || status == Error) { - emit reject(); - return S_OK; - } - - HRESULT hr; - ComPtr file; - hr = args->GetResults(&file); - Q_ASSERT_SUCCEEDED(hr); - return onFilePicked(file.Get()); -} - -HRESULT QWinRTFileDialogHelper::onMultipleFilesPicked(IAsyncOperation *> *args, AsyncStatus status) -{ - Q_D(QWinRTFileDialogHelper); - - QEventLoopLocker locker(&d->loop); - d->shown = false; - d->selectedFiles.clear(); - if (status == Canceled || status == Error) { - emit reject(); - return S_OK; - } - - HRESULT hr; - ComPtr> fileList; - hr = args->GetResults(&fileList); - RETURN_HR_IF_FAILED("Failed to get file list"); - return onFilesPicked(fileList.Get()); -} - -HRESULT QWinRTFileDialogHelper::onSingleFolderPicked(IAsyncOperation *args, AsyncStatus status) -{ - Q_D(QWinRTFileDialogHelper); - - QEventLoopLocker locker(&d->loop); - d->shown = false; - d->selectedFiles.clear(); - if (status == Canceled || status == Error) { - emit reject(); - return S_OK; - } - - HRESULT hr; - ComPtr folder; - hr = args->GetResults(&folder); - Q_ASSERT_SUCCEEDED(hr); - return onFolderPicked(folder.Get()); -} - -HRESULT QWinRTFileDialogHelper::onFilesPicked(IVectorView *files) -{ - HRESULT hr; - quint32 size; - hr = files->get_Size(&size); - Q_ASSERT_SUCCEEDED(hr); - if (!size) { - emit reject(); - return S_OK; - } - - for (quint32 i = 0; i < size; ++i) { - ComPtr file; - hr = files->GetAt(i, &file); - Q_ASSERT_SUCCEEDED(hr); - appendFile(file.Get()); - } - - emit accept(); - return S_OK; -} - -HRESULT QWinRTFileDialogHelper::onFolderPicked(IStorageFolder *folder) -{ - if (!folder) { - emit reject(); - return S_OK; - } - - appendFile(folder); - emit accept(); - return S_OK; -} - -HRESULT QWinRTFileDialogHelper::onFilePicked(IStorageFile *file) -{ - if (!file) { - emit reject(); - return S_OK; - } - - appendFile(file); - emit accept(); - return S_OK; -} - -void QWinRTFileDialogHelper::appendFile(IInspectable *file) -{ - Q_D(QWinRTFileDialogHelper); - - HRESULT hr; - ComPtr item; - hr = file->QueryInterface(IID_PPV_ARGS(&item)); - Q_ASSERT_SUCCEEDED(hr); - - HString path; - hr = item->get_Path(path.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); - - quint32 pathLen; - const wchar_t *pathStr = path.GetRawBuffer(&pathLen); - const QString filePath = QString::fromWCharArray(pathStr, pathLen); - QWinRTFileEngineHandler::registerFile(filePath, item.Get()); - d->selectedFiles.append(QUrl::fromLocalFile(filePath)); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h deleted file mode 100644 index 994d099dcf..0000000000 --- a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h +++ /dev/null @@ -1,107 +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 QWINRTFILEDIALOGHELPER_H -#define QWINRTFILEDIALOGHELPER_H - -#include -#include - -struct IInspectable; -namespace ABI { - namespace Windows { - namespace Storage { - class StorageFile; - class StorageFolder; - struct IStorageFile; - struct IStorageFolder; - } - namespace Foundation { - enum class AsyncStatus; - template struct IAsyncOperation; - namespace Collections { - template struct IVectorView; - } - } - } -} - -QT_BEGIN_NAMESPACE - -class QWinRTFileDialogHelperPrivate; -class QWinRTFileDialogHelper : public QPlatformFileDialogHelper -{ - Q_OBJECT -public: - explicit QWinRTFileDialogHelper(); - ~QWinRTFileDialogHelper() override = default; - - void exec() override; - bool show(Qt::WindowFlags, Qt::WindowModality, QWindow *) override; - void hide() override; - - bool defaultNameFilterDisables() const override { return false; } - void setDirectory(const QUrl &directory) override; - QUrl directory() const override; - void selectFile(const QUrl &saveFileName) override; - QList selectedFiles() const override; - void setFilter() override { } - void selectNameFilter(const QString &selectedNameFilter) override; - QString selectedNameFilter() const override; - - HRESULT onSingleFilePicked(ABI::Windows::Foundation::IAsyncOperation *, - ABI::Windows::Foundation::AsyncStatus); - HRESULT onMultipleFilesPicked(ABI::Windows::Foundation::IAsyncOperation *> *, - ABI::Windows::Foundation::AsyncStatus); - HRESULT onSingleFolderPicked(ABI::Windows::Foundation::IAsyncOperation *, - ABI::Windows::Foundation::AsyncStatus); - -private: - HRESULT onFilesPicked(ABI::Windows::Foundation::Collections::IVectorView *files); - HRESULT onFolderPicked(ABI::Windows::Storage::IStorageFolder *folder); - HRESULT onFilePicked(ABI::Windows::Storage::IStorageFile *file); - void appendFile(IInspectable *); - - QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QWinRTFileDialogHelper) -}; - -QT_END_NAMESPACE - -#endif // QWINRTFILEDIALOGHELPER_H diff --git a/src/plugins/platforms/winrt/qwinrtfileengine.cpp b/src/plugins/platforms/winrt/qwinrtfileengine.cpp deleted file mode 100644 index 962e4ab938..0000000000 --- a/src/plugins/platforms/winrt/qwinrtfileengine.cpp +++ /dev/null @@ -1,554 +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$ -** -****************************************************************************/ - -#include "qwinrtfileengine.h" - -#include -#include -#include -#include -#include - -#include -#include -#include - -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Storage; -using namespace ABI::Windows::Storage::Streams; - -typedef IAsyncOperationCompletedHandler StreamCompletedHandler; -typedef IAsyncOperationWithProgressCompletedHandler StreamReadCompletedHandler; - -QT_BEGIN_NAMESPACE - -#define RETURN_AND_SET_ERROR_IF_FAILED(error, ret) \ - setError(error, qt_error_string(hr)); \ - if (FAILED(hr)) \ - return ret; - -Q_GLOBAL_STATIC(QWinRTFileEngineHandler, handlerInstance) - -class QWinRTFileEngineHandlerPrivate -{ -public: - QHash> files; -}; - -class QWinRTFileEnginePrivate -{ -public: - QWinRTFileEnginePrivate(const QString &fileName, IStorageItem *file) - : fileName(fileName), file(file), openMode(QIODevice::NotOpen) - { - HRESULT hr; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Storage_Streams_Buffer).Get(), - IID_PPV_ARGS(&bufferFactory)); - Q_ASSERT_SUCCEEDED(hr); - - lastSeparator = fileName.size() - 1; - for (int i = lastSeparator; i >= 0; --i) { - if (fileName.at(i).unicode() == '/' || fileName.at(i).unicode() == '\\') { - lastSeparator = i; - break; - } - } - - firstDot = fileName.size(); - for (int i = lastSeparator; i < fileName.size(); ++i) { - if (fileName.at(i).unicode() == '.') { - firstDot = i; - break; - } - } - } - - ComPtr bufferFactory; - - QString fileName; - int lastSeparator; - int firstDot; - ComPtr file; - ComPtr stream; - QIODevice::OpenMode openMode; - - qint64 pos; - -private: - QWinRTFileEngineHandler *q_ptr; - Q_DECLARE_PUBLIC(QWinRTFileEngineHandler) -}; - - -QWinRTFileEngineHandler::QWinRTFileEngineHandler() - : d_ptr(new QWinRTFileEngineHandlerPrivate) -{ -} - -void QWinRTFileEngineHandler::registerFile(const QString &fileName, IStorageItem *file) -{ - handlerInstance->d_func()->files.insert(QDir::cleanPath(fileName), file); -} - -IStorageItem *QWinRTFileEngineHandler::registeredFile(const QString &fileName) -{ - return handlerInstance->d_func()->files.value(fileName).Get(); -} - -QAbstractFileEngine *QWinRTFileEngineHandler::create(const QString &fileName) const -{ - Q_D(const QWinRTFileEngineHandler); - - QHash>::const_iterator file = d->files.find(fileName); - if (file != d->files.end()) - return new QWinRTFileEngine(fileName, file.value().Get()); - - return nullptr; -} - -static HRESULT getDestinationFolder(const QString &fileName, const QString &newFileName, - IStorageItem *file, IStorageFolder **folder) -{ - HRESULT hr; - ComPtr> op; - QFileInfo newFileInfo(newFileName); - QFileInfo fileInfo(fileName); - if (fileInfo.dir() == newFileInfo.dir()) { - ComPtr item; - hr = file->QueryInterface(IID_PPV_ARGS(&item)); - Q_ASSERT_SUCCEEDED(hr); - - hr = item->GetParentAsync(&op); - } else { - ComPtr folderFactory; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Storage_StorageFolder).Get(), - IID_PPV_ARGS(&folderFactory)); - Q_ASSERT_SUCCEEDED(hr); - - const QString newFilePath = QDir::toNativeSeparators(newFileInfo.absolutePath()); - HStringReference nativeNewFilePath(reinterpret_cast(newFilePath.utf16()), - uint(newFilePath.length())); - hr = folderFactory->GetFolderFromPathAsync(nativeNewFilePath.Get(), &op); - } - if (FAILED(hr)) - return hr; - return QWinRTFunctions::await(op, folder); -} - -QWinRTFileEngine::QWinRTFileEngine(const QString &fileName, IStorageItem *file) - : d_ptr(new QWinRTFileEnginePrivate(fileName, file)) -{ -} - -bool QWinRTFileEngine::open(QIODevice::OpenMode openMode) -{ - Q_D(QWinRTFileEngine); - - FileAccessMode fileAccessMode = (openMode & QIODevice::WriteOnly) - ? FileAccessMode_ReadWrite : FileAccessMode_Read; - - HRESULT hr; - ComPtr file; - hr = d->file.As(&file); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::OpenError, false); - - ComPtr> op; - hr = file->OpenAsync(fileAccessMode, &op); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::OpenError, false); - - hr = QWinRTFunctions::await(op, d->stream.GetAddressOf()); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::OpenError, false); - - const ProcessOpenModeResult res = processOpenModeFlags(openMode); - if (!res.ok) { - setError(QFileDevice::OpenError, res.error); - return false; - } - d->openMode = res.openMode; - if (d->openMode & QIODevice::Truncate) { - if (!setSize(0)) { - close(); - setError(QFileDevice::OpenError, QLatin1String("Could not truncate file")); - return false; - } - } - - return SUCCEEDED(hr); -} - -bool QWinRTFileEngine::close() -{ - Q_D(QWinRTFileEngine); - - if (!d->stream) - return false; - - ComPtr closable; - HRESULT hr = d->stream.As(&closable); - Q_ASSERT_SUCCEEDED(hr); - - hr = closable->Close(); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::UnspecifiedError, false); - d->stream.Reset(); - d->openMode = QIODevice::NotOpen; - return SUCCEEDED(hr); -} - -bool QWinRTFileEngine::flush() -{ - Q_D(QWinRTFileEngine); - - if (!d->stream) - return false; - - if (!(d->openMode & QIODevice::WriteOnly)) - return true; - - ComPtr stream; - HRESULT hr = d->stream.As(&stream); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::WriteError, false); - ComPtr> flushOp; - hr = stream->FlushAsync(&flushOp); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::WriteError, false); - boolean flushed; - hr = QWinRTFunctions::await(flushOp, &flushed); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::WriteError, false); - - return true; -} - -qint64 QWinRTFileEngine::size() const -{ - Q_D(const QWinRTFileEngine); - - if (!d->stream) - return 0; - - UINT64 size; - HRESULT hr; - hr = d->stream->get_Size(&size); - RETURN_IF_FAILED("Failed to get file size", return 0); - - return qint64(size); -} - -bool QWinRTFileEngine::setSize(qint64 size) -{ - Q_D(QWinRTFileEngine); - if (!d->stream) { - setError(QFileDevice::ResizeError, QLatin1String("File must be open to be resized")); - return false; - } - - if (size < 0) { - setError(QFileDevice::ResizeError, QLatin1String("File size cannot be negative")); - return false; - } - - HRESULT hr = d->stream->put_Size(static_cast(size)); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::ResizeError, false); - if (!flush()) { - setError(QFileDevice::ResizeError, QLatin1String("Could not flush file")); - return false; - } - - return true; -} - -qint64 QWinRTFileEngine::pos() const -{ - Q_D(const QWinRTFileEngine); - return d->pos; -} - -bool QWinRTFileEngine::seek(qint64 pos) -{ - Q_D(QWinRTFileEngine); - - if (!d->stream) - return false; - - HRESULT hr = d->stream->Seek(UINT64(pos)); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::PositionError, false); - d->pos = pos; - return SUCCEEDED(hr); -} - -bool QWinRTFileEngine::remove() -{ - Q_D(QWinRTFileEngine); - - ComPtr op; - HRESULT hr = d->file->DeleteAsync(StorageDeleteOption_Default, &op); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::RemoveError, false); - - hr = QWinRTFunctions::await(op); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::RemoveError, false); - return SUCCEEDED(hr); -} - -bool QWinRTFileEngine::copy(const QString &newName) -{ - Q_D(QWinRTFileEngine); - - HRESULT hr; - ComPtr destinationFolder; - hr = getDestinationFolder(d->fileName, newName, d->file.Get(), destinationFolder.GetAddressOf()); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::CopyError, false); - - ComPtr file; - hr = d->file.As(&file); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::CopyError, false); - - const QString destinationName = QFileInfo(newName).fileName(); - HStringReference nativeDestinationName(reinterpret_cast(destinationName.utf16()), - uint(destinationName.length())); - ComPtr> op; - hr = file->CopyOverloadDefaultOptions(destinationFolder.Get(), nativeDestinationName.Get(), &op); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::CopyError, false); - - ComPtr newFile; - hr = QWinRTFunctions::await(op, newFile.GetAddressOf()); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::CopyError, false); - return SUCCEEDED(hr); -} - -bool QWinRTFileEngine::rename(const QString &newName) -{ - Q_D(QWinRTFileEngine); - - HRESULT hr; - ComPtr destinationFolder; - hr = getDestinationFolder(d->fileName, newName, d->file.Get(), destinationFolder.GetAddressOf()); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::RenameError, false); - - const QString destinationName = QFileInfo(newName).fileName(); - HStringReference nativeDestinationName(reinterpret_cast(destinationName.utf16()), - uint(destinationName.length())); - ComPtr op; - hr = d->file->RenameAsyncOverloadDefaultOptions(nativeDestinationName.Get(), &op); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::RenameError, false); - return SUCCEEDED(hr); -} - -bool QWinRTFileEngine::renameOverwrite(const QString &newName) -{ - Q_D(QWinRTFileEngine); - - HRESULT hr; - ComPtr destinationFolder; - hr = getDestinationFolder(d->fileName, newName, d->file.Get(), destinationFolder.GetAddressOf()); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::RenameError, false); - - const QString destinationName = QFileInfo(newName).fileName(); - HStringReference nativeDestinationName(reinterpret_cast(destinationName.utf16()), - uint(destinationName.length())); - ComPtr op; - hr = d->file->RenameAsync(nativeDestinationName.Get(), NameCollisionOption_ReplaceExisting, &op); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::RenameError, false); - return SUCCEEDED(hr); -} - -QAbstractFileEngine::FileFlags QWinRTFileEngine::fileFlags(FileFlags type) const -{ - Q_D(const QWinRTFileEngine); - - FileFlags flags = ExistsFlag|ReadOwnerPerm|ReadUserPerm|WriteOwnerPerm|WriteUserPerm; - - HRESULT hr; - FileAttributes attributes; - hr = d->file->get_Attributes(&attributes); - RETURN_IF_FAILED("Failed to get file attributes", return flags); - if (attributes & FileAttributes_ReadOnly) - flags ^= WriteUserPerm; - if (attributes & FileAttributes_Directory) - flags |= DirectoryType; - else - flags |= FileType; - - return type & flags; -} - -bool QWinRTFileEngine::setPermissions(uint perms) -{ - Q_UNUSED(perms); - Q_UNIMPLEMENTED(); - return false; -} - -QString QWinRTFileEngine::fileName(FileName type) const -{ - Q_D(const QWinRTFileEngine); - - switch (type) { - default: - case DefaultName: - case AbsoluteName: - case CanonicalName: - break; - case BaseName: - return d->lastSeparator < 0 - ? d->fileName : d->fileName.mid(d->lastSeparator, d->firstDot - d->lastSeparator); - case PathName: - case AbsolutePathName: - case CanonicalPathName: - return d->fileName.mid(0, d->lastSeparator); - case LinkName: - case BundleName: - return QString(); - } - return d->fileName; -} - -QDateTime QWinRTFileEngine::fileTime(FileTime type) const -{ - Q_D(const QWinRTFileEngine); - - HRESULT hr; - DateTime dateTime = { 0 }; - switch (type) { - case BirthTime: - hr = d->file->get_DateCreated(&dateTime); - RETURN_IF_FAILED("Failed to get file creation time", return QDateTime()); - break; - case MetadataChangeTime: - case ModificationTime: - case AccessTime: { - ComPtr> op; - hr = d->file->GetBasicPropertiesAsync(&op); - RETURN_IF_FAILED("Failed to initiate file properties", return QDateTime()); - ComPtr properties; - hr = QWinRTFunctions::await(op, properties.GetAddressOf()); - RETURN_IF_FAILED("Failed to get file properties", return QDateTime()); - hr = properties->get_DateModified(&dateTime); - RETURN_IF_FAILED("Failed to get file date", return QDateTime()); - } - break; - } - - SYSTEMTIME systemTime; - FileTimeToSystemTime((const FILETIME *)&dateTime, &systemTime); - QDate date(systemTime.wYear, systemTime.wMonth, systemTime.wDay); - QTime time(systemTime.wHour, systemTime.wMinute, systemTime.wSecond, systemTime.wMilliseconds); - return QDateTime(date, time); -} - -qint64 QWinRTFileEngine::read(char *data, qint64 maxlen) -{ - Q_D(QWinRTFileEngine); - - if (!d->stream) - return -1; - - ComPtr stream; - HRESULT hr = d->stream.As(&stream); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::ReadError, -1); - - UINT32 length = UINT32(qBound(quint64(0), quint64(maxlen), quint64(UINT32_MAX))); - ComPtr buffer; - hr = d->bufferFactory->Create(length, &buffer); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::ReadError, -1); - - ComPtr> op; - hr = stream->ReadAsync(buffer.Get(), length, InputStreamOptions_None, &op); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::ReadError, -1); - - // Quoting MSDN IInputStream::ReadAsync() documentation: - // "Depending on the implementation, the data that's read might be placed - // into the input buffer, or it might be returned in a different buffer." - // Using GetAddressOf can cause ref counting errors leaking the original - // buffer. - ComPtr effectiveBuffer; - hr = QWinRTFunctions::await(op, effectiveBuffer.GetAddressOf()); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::ReadError, -1); - - hr = effectiveBuffer->get_Length(&length); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::ReadError, -1); - - ComPtr byteArrayAccess; - hr = effectiveBuffer.As(&byteArrayAccess); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::ReadError, -1); - - byte *bytes; - hr = byteArrayAccess->Buffer(&bytes); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::ReadError, -1); - memcpy(data, bytes, length); - return qint64(length); -} - -qint64 QWinRTFileEngine::write(const char *data, qint64 maxlen) -{ - Q_D(QWinRTFileEngine); - - if (!d->stream) - return -1; - - ComPtr stream; - HRESULT hr = d->stream.As(&stream); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::WriteError, -1); - - UINT32 length = UINT32(qBound(quint64(0), quint64(maxlen), quint64(UINT_MAX))); - ComPtr buffer; - hr = d->bufferFactory->Create(length, &buffer); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::WriteError, -1); - hr = buffer->put_Length(length); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::WriteError, -1); - - ComPtr byteArrayAccess; - hr = buffer.As(&byteArrayAccess); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::WriteError, -1); - - byte *bytes; - hr = byteArrayAccess->Buffer(&bytes); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::WriteError, -1); - memcpy(bytes, data, length); - - ComPtr> op; - hr = stream->WriteAsync(buffer.Get(), &op); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::WriteError, -1); - - hr = QWinRTFunctions::await(op, &length); - RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::WriteError, -1); - - return qint64(length); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/winrt/qwinrtfileengine.h b/src/plugins/platforms/winrt/qwinrtfileengine.h deleted file mode 100644 index 453565a95a..0000000000 --- a/src/plugins/platforms/winrt/qwinrtfileengine.h +++ /dev/null @@ -1,104 +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 QWINRTFILEENGINE_H -#define QWINRTFILEENGINE_H - -#include - -namespace ABI { - namespace Windows { - namespace Storage { - struct IStorageItem; - } - } -} - -QT_BEGIN_NAMESPACE - -class QWinRTFileEngineHandlerPrivate; -class QWinRTFileEngineHandler : public QAbstractFileEngineHandler -{ -public: - QWinRTFileEngineHandler(); - ~QWinRTFileEngineHandler() override = default; - QAbstractFileEngine *create(const QString &fileName) const override; - - static void registerFile(const QString &fileName, ABI::Windows::Storage::IStorageItem *file); - static ABI::Windows::Storage::IStorageItem *registeredFile(const QString &fileName); - -private: - QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QWinRTFileEngineHandler) -}; - -class QWinRTFileEnginePrivate; -class QWinRTFileEngine : public QAbstractFileEngine -{ -public: - QWinRTFileEngine(const QString &fileName, ABI::Windows::Storage::IStorageItem *file); - ~QWinRTFileEngine() override = default; - - bool open(QIODevice::OpenMode openMode) override; - bool close() override; - bool flush() override; - qint64 size() const override; - bool setSize(qint64 size) override; - qint64 pos() const override; - bool seek(qint64 pos) override; - bool remove() override; - bool copy(const QString &newName) override; - bool rename(const QString &newName) override; - bool renameOverwrite(const QString &newName) override; - FileFlags fileFlags(FileFlags type=FileInfoAll) const override; - bool setPermissions(uint perms) override; - QString fileName(FileName type=DefaultName) const override; - QDateTime fileTime(FileTime type) const override; - - qint64 read(char *data, qint64 maxlen) override; - qint64 write(const char *data, qint64 len) override; - -private: - QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QWinRTFileEngine) -}; - -QT_END_NAMESPACE - -#endif // QWINRTFILEENGINE_H diff --git a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp deleted file mode 100644 index 5ae94ba613..0000000000 --- a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp +++ /dev/null @@ -1,222 +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$ -** -****************************************************************************/ - -#include "qwinrtinputcontext.h" -#include "qwinrtscreen.h" -#include -#include -#include - -#include -#include -#include -#include -#include -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::UI::ViewManagement; -using namespace ABI::Windows::UI::Core; - -typedef ITypedEventHandler InputPaneVisibilityHandler; - -QT_BEGIN_NAMESPACE - -Q_LOGGING_CATEGORY(lcQpaInputMethods, "qt.qpa.input.methods") - -inline QRectF getInputPaneRect(ComPtr pane, qreal scaleFactor) -{ - Rect rect; - pane->get_OccludedRect(&rect); - return QRectF(qRound(qreal(rect.X) * scaleFactor), qRound(qreal(rect.Y) * scaleFactor), - qRound(qreal(rect.Width) * scaleFactor), qRound(qreal(rect.Height) * scaleFactor)); -} - -/*! - \class QWinRTInputContext - \brief Manages Input Method visibility - \internal - \ingroup qt-qpa-winrt - - Listens to the native virtual keyboard for hide/show events and provides - hints to the OS for showing/hiding. On WinRT, showInputPanel()/hideInputPanel() - have no effect because WinRT dictates that keyboard presence is user-driven: - (http://msdn.microsoft.com/en-us/library/windows/apps/hh465404.aspx) - Windows Phone, however, supports direct hiding/showing of the keyboard. -*/ - -QWinRTInputContext::QWinRTInputContext(QWinRTScreen *screen) - : m_screen(screen) -{ - qCDebug(lcQpaInputMethods) << __FUNCTION__ << screen; - - QEventDispatcherWinRT::runOnXamlThread([this]() { - ComPtr statics; - if (FAILED(GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_InputPane).Get(), - &statics))) { - qWarning("failed to retrieve input pane statics."); - return S_OK; - } - - ComPtr inputPane; - statics->GetForCurrentView(&inputPane); - if (inputPane) { - EventRegistrationToken showToken, hideToken; - inputPane->add_Showing(Callback( - this, &QWinRTInputContext::onShowing).Get(), &showToken); - inputPane->add_Hiding(Callback( - this, &QWinRTInputContext::onHiding).Get(), &hideToken); - - m_keyboardRect = getInputPaneRect(inputPane, m_screen->scaleFactor()); - m_isInputPanelVisible = !m_keyboardRect.isEmpty(); - } else { - qWarning("failed to retrieve InputPane."); - } - return S_OK; - }); - - connect(QGuiApplication::inputMethod(), &QInputMethod::cursorRectangleChanged, - this, &QWinRTInputContext::updateScreenCursorRect); -} - -QRectF QWinRTInputContext::keyboardRect() const -{ - return m_keyboardRect; -} - -bool QWinRTInputContext::isInputPanelVisible() const -{ - return m_isInputPanelVisible; -} - -void QWinRTInputContext::updateScreenCursorRect() -{ - m_screen->setCursorRect(QGuiApplication::inputMethod()->cursorRectangle()); -} - -HRESULT QWinRTInputContext::onShowing(IInputPane *pane, IInputPaneVisibilityEventArgs *) -{ - qCDebug(lcQpaInputMethods) << __FUNCTION__ << pane; - m_isInputPanelVisible = true; - emitInputPanelVisibleChanged(); - return handleVisibilityChange(pane); -} - -HRESULT QWinRTInputContext::onHiding(IInputPane *pane, IInputPaneVisibilityEventArgs *) -{ - qCDebug(lcQpaInputMethods) << __FUNCTION__ << pane; - m_isInputPanelVisible = false; - emitInputPanelVisibleChanged(); - return handleVisibilityChange(pane); -} - -HRESULT QWinRTInputContext::handleVisibilityChange(IInputPane *pane) -{ - qCDebug(lcQpaInputMethods) << __FUNCTION__ << pane; - const QRectF keyboardRect = getInputPaneRect(pane, m_screen->scaleFactor()); - if (m_keyboardRect != keyboardRect) { - m_keyboardRect = keyboardRect; - m_screen->setKeyboardRect(m_keyboardRect); - emitKeyboardRectChanged(); - } - return S_OK; -} - -static HRESULT getInputPane(ComPtr *inputPane2) -{ - ComPtr factory; - HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_InputPane).Get(), - &factory); - if (FAILED(hr)) { - qErrnoWarning(hr, "Failed to get input pane factory."); - return hr; - } - - ComPtr inputPane; - hr = factory->GetForCurrentView(&inputPane); - if (FAILED(hr)) { - qErrnoWarning(hr, "Failed to get input pane."); - return hr; - } - - hr = inputPane.As(inputPane2); - if (FAILED(hr)) { - qErrnoWarning(hr, "Failed to get extended input pane."); - return hr; - } - return hr; -} - -void QWinRTInputContext::showInputPanel() -{ - qCDebug(lcQpaInputMethods) << __FUNCTION__; - - QEventDispatcherWinRT::runOnXamlThread([&]() { - ComPtr inputPane; - HRESULT hr = getInputPane(&inputPane); - if (FAILED(hr)) - return S_OK; - boolean success; - hr = inputPane->TryShow(&success); - if (FAILED(hr) || !success) - qErrnoWarning(hr, "Failed to show input panel."); - return S_OK; - }); -} - -void QWinRTInputContext::hideInputPanel() -{ - qCDebug(lcQpaInputMethods) << __FUNCTION__; - if (!m_isInputPanelVisible) - return; - - QEventDispatcherWinRT::runOnXamlThread([&]() { - ComPtr inputPane; - HRESULT hr = getInputPane(&inputPane); - if (FAILED(hr)) - return S_OK; - boolean success; - hr = inputPane->TryHide(&success); - if (FAILED(hr) || !success) - qErrnoWarning(hr, "Failed to hide input panel."); - return S_OK; - }); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/winrt/qwinrtinputcontext.h b/src/plugins/platforms/winrt/qwinrtinputcontext.h deleted file mode 100644 index 59db90231f..0000000000 --- a/src/plugins/platforms/winrt/qwinrtinputcontext.h +++ /dev/null @@ -1,99 +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 QWINRTINPUTCONTEXT_H -#define QWINRTINPUTCONTEXT_H - -#include -#include -#include - -#include - -namespace ABI { - namespace Windows { - namespace UI { - namespace Core { - struct ICoreWindow; - } - namespace ViewManagement { - struct IInputPane; - struct IInputPaneVisibilityEventArgs; - } - } - } -} - -QT_BEGIN_NAMESPACE - -Q_DECLARE_LOGGING_CATEGORY(lcQpaInputMethods) - -class QWinRTScreen; -class QWinRTInputContext : public QPlatformInputContext -{ -public: - explicit QWinRTInputContext(QWinRTScreen *); - - QRectF keyboardRect() const override; - - bool isInputPanelVisible() const override; - - void showInputPanel() override; - void hideInputPanel() override; - -private slots: - void updateScreenCursorRect(); - -private: - HRESULT onShowing(ABI::Windows::UI::ViewManagement::IInputPane *, - ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *); - HRESULT onHiding(ABI::Windows::UI::ViewManagement::IInputPane *, - ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *); - - HRESULT handleVisibilityChange(ABI::Windows::UI::ViewManagement::IInputPane *); - - QWinRTScreen *m_screen; - QRectF m_keyboardRect; - QRectF m_cursorRect; - bool m_isInputPanelVisible; -}; - -QT_END_NAMESPACE - -#endif // QWINRTINPUTCONTEXT_H diff --git a/src/plugins/platforms/winrt/qwinrtintegration.cpp b/src/plugins/platforms/winrt/qwinrtintegration.cpp deleted file mode 100644 index 0d87832176..0000000000 --- a/src/plugins/platforms/winrt/qwinrtintegration.cpp +++ /dev/null @@ -1,313 +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$ -** -****************************************************************************/ - -#include "qwinrtintegration.h" -#include "qwinrtwindow.h" -#include "qwinrteventdispatcher.h" -#include "qwinrtbackingstore.h" -#include "qwinrtscreen.h" -#include "qwinrtinputcontext.h" -#include "qwinrtservices.h" -#include "qwinrteglcontext.h" -#include "qwinrttheme.h" -#include "qwinrtclipboard.h" -#if QT_CONFIG(draganddrop) -#include "qwinrtdrag.h" -#endif -#if QT_CONFIG(accessibility) -# include "uiautomation/qwinrtuiaaccessibility.h" -#endif -#if QT_CONFIG(opengl) -#include -#endif - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::ApplicationModel; -using namespace ABI::Windows::ApplicationModel::Core; -using namespace ABI::Windows::UI; -using namespace ABI::Windows::UI::Core; -using namespace ABI::Windows::UI::ViewManagement; -using namespace ABI::Windows::Graphics::Display; -using namespace ABI::Windows::ApplicationModel::Core; - -typedef IEventHandler ResumeHandler; -typedef IEventHandler SuspendHandler; - -QT_BEGIN_NAMESPACE - -typedef HRESULT (__stdcall ICoreApplication::*CoreApplicationCallbackRemover)(EventRegistrationToken); -size_t qHash(CoreApplicationCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); } - -class QWinRTIntegrationPrivate -{ -public: - QPlatformFontDatabase *fontDatabase; - QPlatformServices *platformServices; - QPlatformClipboard *clipboard; - QWinRTScreen *mainScreen; - QScopedPointer inputContext; -#if QT_CONFIG(accessibility) - QWinRTUiaAccessibility *accessibility; -#endif - - ComPtr application; - QHash applicationTokens; -}; - -QWinRTIntegration::QWinRTIntegration() : d_ptr(new QWinRTIntegrationPrivate) -{ - Q_D(QWinRTIntegration); - - d->fontDatabase = new QWinRTFontDatabase; - - HRESULT hr; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(), - IID_PPV_ARGS(&d->application)); - Q_ASSERT_SUCCEEDED(hr); - hr = d->application->add_Suspending(Callback(this, &QWinRTIntegration::onSuspended).Get(), - &d->applicationTokens[&ICoreApplication::remove_Suspending]); - Q_ASSERT_SUCCEEDED(hr); - hr = d->application->add_Resuming(Callback(this, &QWinRTIntegration::onResume).Get(), - &d->applicationTokens[&ICoreApplication::remove_Resuming]); - Q_ASSERT_SUCCEEDED(hr); - - QEventDispatcherWinRT::runOnXamlThread([d]() { - d->mainScreen = new QWinRTScreen; - return S_OK; - }); - d->inputContext.reset(new QWinRTInputContext(d->mainScreen)); - - QWindowSystemInterface::handleScreenAdded(d->mainScreen); - d->platformServices = new QWinRTServices; - d->clipboard = new QWinRTClipboard; -#if QT_CONFIG(accessibility) - d->accessibility = new QWinRTUiaAccessibility; -#endif -} - -QWinRTIntegration::~QWinRTIntegration() -{ - Q_D(QWinRTIntegration); - HRESULT hr; - - // Do not execute this on Windows Phone as the application is already - // shutting down and trying to unregister suspending/resume handler will - // cause exceptions and assert in debug mode - for (QHash::const_iterator i = d->applicationTokens.begin(); i != d->applicationTokens.end(); ++i) { - hr = (d->application.Get()->*i.key())(i.value()); - Q_ASSERT_SUCCEEDED(hr); - } - - QWindowSystemInterface::handleScreenRemoved(d->mainScreen); - Windows::Foundation::Uninitialize(); -} - -bool QWinRTIntegration::succeeded() const -{ - Q_D(const QWinRTIntegration); - return d->mainScreen; -} - -QAbstractEventDispatcher *QWinRTIntegration::createEventDispatcher() const -{ - return new QWinRTEventDispatcher; -} - -void QWinRTIntegration::initialize() -{ - Q_D(const QWinRTIntegration); - QEventDispatcherWinRT::runOnXamlThread([d]() { - d->mainScreen->initialize(); - return S_OK; - }); -} - -bool QWinRTIntegration::hasCapability(QPlatformIntegration::Capability cap) const -{ - switch (cap) { - case ThreadedPixmaps: - case OpenGL: - case ApplicationState: - case NonFullScreenWindows: - case MultipleWindows: - case RasterGLSurface: - return true; - default: - return QPlatformIntegration::hasCapability(cap); - } -} - -QVariant QWinRTIntegration::styleHint(StyleHint hint) const -{ - return QWinRTTheme::styleHint(hint); -} - -QPlatformWindow *QWinRTIntegration::createPlatformWindow(QWindow *window) const -{ - return new QWinRTWindow(window); -} - -QPlatformBackingStore *QWinRTIntegration::createPlatformBackingStore(QWindow *window) const -{ - return new QWinRTBackingStore(window); -} - -QPlatformOpenGLContext *QWinRTIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const -{ - return new QWinRTEGLContext(context); -} - -QPlatformFontDatabase *QWinRTIntegration::fontDatabase() const -{ - Q_D(const QWinRTIntegration); - return d->fontDatabase; -} - -QPlatformInputContext *QWinRTIntegration::inputContext() const -{ - Q_D(const QWinRTIntegration); - return d->inputContext.data(); -} - -QPlatformServices *QWinRTIntegration::services() const -{ - Q_D(const QWinRTIntegration); - return d->platformServices; -} - -QPlatformClipboard *QWinRTIntegration::clipboard() const -{ - Q_D(const QWinRTIntegration); - return d->clipboard; -} - -#if QT_CONFIG(draganddrop) -QPlatformDrag *QWinRTIntegration::drag() const -{ - return QWinRTDrag::instance(); -} -#endif // QT_CONFIG(draganddrop) - -#if QT_CONFIG(accessibility) -QPlatformAccessibility *QWinRTIntegration::accessibility() const -{ - Q_D(const QWinRTIntegration); - return d->accessibility; -} -#endif // QT_CONFIG(accessibility) - -Qt::KeyboardModifiers QWinRTIntegration::queryKeyboardModifiers() const -{ - Q_D(const QWinRTIntegration); - return d->mainScreen->keyboardModifiers(); -} - -QStringList QWinRTIntegration::themeNames() const -{ - return QStringList(QLatin1String("winrt")); -} - -QPlatformTheme *QWinRTIntegration::createPlatformTheme(const QString &name) const -{ - if (name == QLatin1String("winrt")) - return new QWinRTTheme(); - - return 0; -} - -// System-level integration points - -HRESULT QWinRTIntegration::onSuspended(IInspectable *, ISuspendingEventArgs *) -{ - QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationSuspended); - QWindowSystemInterface::flushWindowSystemEvents(); - return S_OK; -} - -HRESULT QWinRTIntegration::onResume(IInspectable *, IInspectable *) -{ - // First the system invokes onResume and then changes - // the visibility of the screen to be active. - QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationHidden); - return S_OK; -} - -QPlatformOffscreenSurface *QWinRTIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const -{ - QEGLPbuffer *pbuffer = nullptr; - HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([&pbuffer, surface]() { - pbuffer = new QEGLPbuffer(QWinRTEGLContext::display(), surface->requestedFormat(), surface); - return S_OK; - }); - if (hr == UI_E_WINDOW_CLOSED) { - // This is only used for shutdown of applications. - // In case we do not return an empty surface the scenegraph will try - // to create a new native window during application exit causing crashes - // or assertions. - return new QPlatformOffscreenSurface(surface); - } - - return pbuffer; -} - - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/winrt/qwinrtintegration.h b/src/plugins/platforms/winrt/qwinrtintegration.h deleted file mode 100644 index e944ed5d79..0000000000 --- a/src/plugins/platforms/winrt/qwinrtintegration.h +++ /dev/null @@ -1,113 +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 QWINRTINTEGRATION_H -#define QWINRTINTEGRATION_H - -#include - -namespace ABI { - namespace Windows { - namespace ApplicationModel { - struct ISuspendingEventArgs; - } - namespace Foundation { - struct IAsyncAction; - } - } -} -struct IAsyncInfo; -struct IInspectable; - -QT_BEGIN_NAMESPACE - -class QAbstractEventDispatcher; - -class QWinRTIntegrationPrivate; -class QWinRTIntegration : public QPlatformIntegration -{ -private: - explicit QWinRTIntegration(); -public: - ~QWinRTIntegration() override; - - static QWinRTIntegration *create() - { - QScopedPointer integration(new QWinRTIntegration); - return integration->succeeded() ? integration.take() : nullptr; - } - - bool succeeded() const; - - bool hasCapability(QPlatformIntegration::Capability cap) const override; - QVariant styleHint(StyleHint hint) const override; - - QPlatformWindow *createPlatformWindow(QWindow *window) const override; - QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override; - QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; - QAbstractEventDispatcher *createEventDispatcher() const override; - void initialize() override; - QPlatformFontDatabase *fontDatabase() const override; - QPlatformInputContext *inputContext() const override; - QPlatformServices *services() const override; - QPlatformClipboard *clipboard() const override; -#if QT_CONFIG(draganddrop) - QPlatformDrag *drag() const override; -#endif -#if QT_CONFIG(accessibility) - QPlatformAccessibility *accessibility() const override; -#endif - - Qt::KeyboardModifiers queryKeyboardModifiers() const override; - - QStringList themeNames() const override; - QPlatformTheme *createPlatformTheme(const QString &name) const override; - - QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override; -private: - HRESULT onSuspended(IInspectable *, ABI::Windows::ApplicationModel::ISuspendingEventArgs *); - HRESULT onResume(IInspectable *, IInspectable *); - - QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QWinRTIntegration) -}; - -QT_END_NAMESPACE - -#endif // QWINRTINTEGRATION_H diff --git a/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp b/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp deleted file mode 100644 index 7016b47f7e..0000000000 --- a/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp +++ /dev/null @@ -1,247 +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$ -** -****************************************************************************/ - -#include "qwinrtmessagedialoghelper.h" -#include "qwinrttheme.h" - -#include -#include -#include - -#include -#include -#include -#include -#include - -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Foundation::Collections; -using namespace ABI::Windows::UI::Popups; -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; - -typedef IAsyncOperationCompletedHandler DialogCompletedHandler; - -QT_BEGIN_NAMESPACE - -class CommandId : public RuntimeClass -{ -public: - CommandId(QPlatformDialogHelper::StandardButton button) - : button(button) { } - QPlatformDialogHelper::StandardButton button; -}; - -class QWinRTMessageDialogHelperPrivate -{ -public: - const QWinRTTheme *theme; - bool shown; - ComPtr info; - QEventLoop loop; -}; - -QWinRTMessageDialogHelper::QWinRTMessageDialogHelper(const QWinRTTheme *theme) - : QPlatformMessageDialogHelper(), d_ptr(new QWinRTMessageDialogHelperPrivate) -{ - Q_D(QWinRTMessageDialogHelper); - - d->theme = theme; - d->shown = false; -} - -QWinRTMessageDialogHelper::~QWinRTMessageDialogHelper() -{ - Q_D(QWinRTMessageDialogHelper); - - if (d->shown) - hide(); -} - -void QWinRTMessageDialogHelper::exec() -{ - Q_D(QWinRTMessageDialogHelper); - - if (!d->shown) - show(Qt::Dialog, Qt::ApplicationModal, nullptr); - d->loop.exec(); -} - -bool QWinRTMessageDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) -{ - Q_UNUSED(windowFlags) - Q_UNUSED(windowModality) - Q_UNUSED(parent) - Q_D(QWinRTMessageDialogHelper); - - QSharedPointer options = this->options(); - if (!options.data()) - return false; - - const QString informativeText = options->informativeText(); - const QString title = options->windowTitle(); - const QString text = informativeText.isEmpty() ? options->text() : (options->text() + QLatin1Char('\n') + informativeText); - if (Qt::mightBeRichText(text)) { - qWarning("Rich text detected, defaulting to QtWidgets-based dialog."); - return false; - } - - HRESULT hr; - ComPtr dialogFactory; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_Popups_MessageDialog).Get(), - IID_PPV_ARGS(&dialogFactory)); - RETURN_FALSE_IF_FAILED("Failed to create dialog factory"); - - ComPtr commandFactory; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_Popups_UICommand).Get(), - IID_PPV_ARGS(&commandFactory)); - RETURN_FALSE_IF_FAILED("Failed to create command factory"); - - ComPtr dialog; - HStringReference nativeText(reinterpret_cast(text.utf16()), - uint(text.size())); - if (!title.isEmpty()) { - HStringReference nativeTitle(reinterpret_cast(title.utf16()), - uint(title.size())); - hr = dialogFactory->CreateWithTitle(nativeText.Get(), nativeTitle.Get(), &dialog); - RETURN_FALSE_IF_FAILED("Failed to create dialog with title"); - } else { - hr = dialogFactory->Create(nativeText.Get(), &dialog); - RETURN_FALSE_IF_FAILED("Failed to create dialog"); - } - - hr = QEventDispatcherWinRT::runOnXamlThread([this, d, options, commandFactory, dialog]() { - HRESULT hr; - - // Add Buttons - ComPtr> dialogCommands; - hr = dialog->get_Commands(&dialogCommands); - RETURN_HR_IF_FAILED("Failed to get dialog commands"); - - // If no button is specified we need to create one to get close notification - int buttons = options->standardButtons(); - if (buttons == 0) - buttons = Ok; - - for (int i = FirstButton; i < LastButton; i<<=1) { - if (!(buttons & i)) - continue; - // Add native command - const QString label = d->theme->standardButtonText(i); - HStringReference nativeLabel(reinterpret_cast(label.utf16()), - uint(label.size())); - ComPtr command; - hr = commandFactory->Create(nativeLabel.Get(), &command); - RETURN_HR_IF_FAILED("Failed to create message box command"); - ComPtr id = Make(static_cast(i)); - hr = command->put_Id(id.Get()); - RETURN_HR_IF_FAILED("Failed to set command ID"); - hr = dialogCommands->Append(command.Get()); - if (hr == E_BOUNDS) { - qErrnoWarning(hr, "The WinRT message dialog supports a maximum of three buttons"); - continue; - } - RETURN_HR_IF_FAILED("Failed to append message box command"); - if (i == Abort || i == Cancel || i == Close) { - quint32 size; - hr = dialogCommands->get_Size(&size); - RETURN_HR_IF_FAILED("Failed to get command list size"); - hr = dialog->put_CancelCommandIndex(size - 1); - RETURN_HR_IF_FAILED("Failed to set cancel index"); - } - } - - ComPtr> op; - hr = dialog->ShowAsync(&op); - RETURN_HR_IF_FAILED("Failed to show dialog"); - hr = op->put_Completed(Callback(this, &QWinRTMessageDialogHelper::onCompleted).Get()); - RETURN_HR_IF_FAILED("Failed to set dialog callback"); - d->shown = true; - hr = op.As(&d->info); - RETURN_HR_IF_FAILED("Failed to acquire AsyncInfo for MessageDialog"); - return hr; - }); - - RETURN_FALSE_IF_FAILED("Failed to show dialog") - return true; -} - -void QWinRTMessageDialogHelper::hide() -{ - Q_D(QWinRTMessageDialogHelper); - - if (!d->shown) - return; - - HRESULT hr = d->info->Cancel(); - if (FAILED(hr)) - qErrnoWarning(hr, "Failed to cancel dialog operation"); - - d->shown = false; -} - -HRESULT QWinRTMessageDialogHelper::onCompleted(IAsyncOperation *asyncInfo, AsyncStatus status) -{ - Q_UNUSED(status); - Q_D(QWinRTMessageDialogHelper); - - QEventLoopLocker locker(&d->loop); - - d->shown = false; - - if (status == Canceled) { - emit reject(); - return S_OK; - } - - HRESULT hr; - ComPtr command; - hr = asyncInfo->GetResults(&command); - RETURN_OK_IF_FAILED("Failed to get command"); - - ComPtr id; - hr = command->get_Id(&id); - RETURN_OK_IF_FAILED("Failed to get command ID"); - - ButtonRole role = buttonRole(id->button); - emit clicked(id->button, role); - return S_OK; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.h b/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.h deleted file mode 100644 index ab704b1c7d..0000000000 --- a/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.h +++ /dev/null @@ -1,88 +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 QWINRTMESSAGEDIALOGHELPER_H -#define QWINRTMESSAGEDIALOGHELPER_H - -#include -#include - -namespace ABI { - namespace Windows { - namespace UI { - namespace Popups { - struct IUICommand; - } - } - namespace Foundation { - enum class AsyncStatus; - template struct IAsyncOperation; - } - } -} - -QT_BEGIN_NAMESPACE - -class QWinRTTheme; - -class QWinRTMessageDialogHelperPrivate; -class QWinRTMessageDialogHelper : public QPlatformMessageDialogHelper -{ - Q_OBJECT -public: - explicit QWinRTMessageDialogHelper(const QWinRTTheme *theme); - ~QWinRTMessageDialogHelper() override; - - void exec() override; - bool show(Qt::WindowFlags windowFlags, - Qt::WindowModality windowModality, - QWindow *parent) override; - void hide() override; - -private: - HRESULT onCompleted(ABI::Windows::Foundation::IAsyncOperation *asyncInfo, - ABI::Windows::Foundation::AsyncStatus status); - - QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QWinRTMessageDialogHelper) -}; - -QT_END_NAMESPACE - -#endif // QWINRTMESSAGEDIALOGHELPER_H diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp deleted file mode 100644 index 5db1459213..0000000000 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ /dev/null @@ -1,1543 +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$ -** -****************************************************************************/ - -#include "qwinrtscreen.h" - -#include "qwinrtbackingstore.h" -#include "qwinrtinputcontext.h" -#include "qwinrtcursor.h" -#if QT_CONFIG(draganddrop) -#include "qwinrtdrag.h" -#endif -#include "qwinrtwindow.h" -#include "qwinrtcanvas.h" -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::ApplicationModel; -using namespace ABI::Windows::ApplicationModel::Core; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::System; -using namespace ABI::Windows::UI; -using namespace ABI::Windows::UI::Core; -using namespace ABI::Windows::UI::Input; -using namespace ABI::Windows::UI::ViewManagement; -using namespace ABI::Windows::Devices::Input; -using namespace ABI::Windows::Graphics::Display; - -typedef ITypedEventHandler ActivatedHandler; -typedef ITypedEventHandler ClosedHandler; -typedef ITypedEventHandler CharacterReceivedHandler; -typedef ITypedEventHandler InputEnabledHandler; -typedef ITypedEventHandler KeyHandler; -typedef ITypedEventHandler PointerHandler; -typedef ITypedEventHandler VisibilityChangedHandler; -typedef ITypedEventHandler DisplayInformationHandler; -typedef ITypedEventHandler RedirectHandler; -typedef ITypedEventHandler VisibleBoundsChangedHandler; - -QT_BEGIN_NAMESPACE - -Q_LOGGING_CATEGORY(lcQpaEvents, "qt.qpa.events") - -#if !defined(QT_NO_DEBUG_STREAM) -QDebug operator<<(QDebug dbg, QWinRTScreen::MousePositionTransition transition) -{ - QDebugStateSaver saver(dbg); - dbg.nospace() << "QWinRTScreen::MousePositionTransition::"; - switch (transition) { - case QWinRTScreen::MousePositionTransition::MovedOut: - dbg << "MovedOut"; - break; - case QWinRTScreen::MousePositionTransition::MovedIn: - dbg << "MovedIn"; - break; - case QWinRTScreen::MousePositionTransition::StayedOut: - dbg << "StayedOut"; - break; - case QWinRTScreen::MousePositionTransition::StayedIn: - dbg << "StayedIn"; - break; - } - return dbg; -} -#endif - -struct KeyInfo { - KeyInfo() - { - } - - KeyInfo(quint32 virtualKey) - : virtualKey(virtualKey) - { - } - - QString text; - quint32 virtualKey{0}; - bool isAutoRepeat{false}; -}; - -static inline Qt::ScreenOrientations qtOrientationsFromNative(DisplayOrientations native) -{ - Qt::ScreenOrientations orientations = Qt::PrimaryOrientation; - if (native & DisplayOrientations_Portrait) - orientations |= Qt::PortraitOrientation; - if (native & DisplayOrientations_PortraitFlipped) - orientations |= Qt::InvertedPortraitOrientation; - if (native & DisplayOrientations_Landscape) - orientations |= Qt::LandscapeOrientation; - if (native & DisplayOrientations_LandscapeFlipped) - orientations |= Qt::InvertedLandscapeOrientation; - return orientations; -} - -static inline DisplayOrientations nativeOrientationsFromQt(Qt::ScreenOrientations orientation) -{ - DisplayOrientations native = DisplayOrientations_None; - if (orientation & Qt::PortraitOrientation) - native |= DisplayOrientations_Portrait; - if (orientation & Qt::InvertedPortraitOrientation) - native |= DisplayOrientations_PortraitFlipped; - if (orientation & Qt::LandscapeOrientation) - native |= DisplayOrientations_Landscape; - if (orientation & Qt::InvertedLandscapeOrientation) - native |= DisplayOrientations_LandscapeFlipped; - return native; -} - -static inline bool qIsNonPrintable(quint32 keyCode) -{ - switch (keyCode) { - case '\b': - case '\n': - case '\t': - case '\r': - case '\v': - case '\f': - return true; - default: - return false; - } -} - -// Return Qt meta key from VirtualKey -static inline Qt::Key qKeyFromVirtual(VirtualKey key) -{ - switch (key) { - - default: - return Qt::Key_unknown; - - // Non-printable characters - case VirtualKey_Enter: - return Qt::Key_Enter; - case VirtualKey_Tab: - return Qt::Key_Tab; - case VirtualKey_Back: - return Qt::Key_Backspace; - - // Modifiers - case VirtualKey_Shift: - case VirtualKey_LeftShift: - case VirtualKey_RightShift: - return Qt::Key_Shift; - case VirtualKey_Control: - case VirtualKey_LeftControl: - case VirtualKey_RightControl: - return Qt::Key_Control; - case VirtualKey_Menu: - case VirtualKey_LeftMenu: - case VirtualKey_RightMenu: - return Qt::Key_Alt; - case VirtualKey_LeftWindows: - case VirtualKey_RightWindows: - return Qt::Key_Meta; - - // Toggle keys - case VirtualKey_CapitalLock: - return Qt::Key_CapsLock; - case VirtualKey_NumberKeyLock: - return Qt::Key_NumLock; - case VirtualKey_Scroll: - return Qt::Key_ScrollLock; - - // East-Asian language keys - case VirtualKey_Kana: - //case VirtualKey_Hangul: // Same enum as Kana - return Qt::Key_Kana_Shift; - case VirtualKey_Junja: - return Qt::Key_Hangul_Jeonja; - case VirtualKey_Kanji: - //case VirtualKey_Hanja: // Same enum as Kanji - return Qt::Key_Kanji; - case VirtualKey_ModeChange: - return Qt::Key_Mode_switch; - case VirtualKey_Convert: - return Qt::Key_Henkan; - case VirtualKey_NonConvert: - return Qt::Key_Muhenkan; - - // Misc. keys - case VirtualKey_Cancel: - return Qt::Key_Cancel; - case VirtualKey_Clear: - return Qt::Key_Clear; - case VirtualKey_Application: - return Qt::Key_ApplicationLeft; - case VirtualKey_Sleep: - return Qt::Key_Sleep; - case VirtualKey_Pause: - return Qt::Key_Pause; - case VirtualKey_PageUp: - return Qt::Key_PageUp; - case VirtualKey_PageDown: - return Qt::Key_PageDown; - case VirtualKey_End: - return Qt::Key_End; - case VirtualKey_Home: - return Qt::Key_Home; - case VirtualKey_Left: - return Qt::Key_Left; - case VirtualKey_Up: - return Qt::Key_Up; - case VirtualKey_Right: - return Qt::Key_Right; - case VirtualKey_Down: - return Qt::Key_Down; - case VirtualKey_Select: - return Qt::Key_Select; - case VirtualKey_Print: - return Qt::Key_Print; - case VirtualKey_Execute: - return Qt::Key_Execute; - case VirtualKey_Insert: - return Qt::Key_Insert; - case VirtualKey_Delete: - return Qt::Key_Delete; - case VirtualKey_Help: - return Qt::Key_Help; - case VirtualKey_Snapshot: - return Qt::Key_Camera; - case VirtualKey_Escape: - return Qt::Key_Escape; - - // Function Keys - case VirtualKey_F1: - return Qt::Key_F1; - case VirtualKey_F2: - return Qt::Key_F2; - case VirtualKey_F3: - return Qt::Key_F3; - case VirtualKey_F4: - return Qt::Key_F4; - case VirtualKey_F5: - return Qt::Key_F5; - case VirtualKey_F6: - return Qt::Key_F6; - case VirtualKey_F7: - return Qt::Key_F7; - case VirtualKey_F8: - return Qt::Key_F8; - case VirtualKey_F9: - return Qt::Key_F9; - case VirtualKey_F10: - return Qt::Key_F10; - case VirtualKey_F11: - return Qt::Key_F11; - case VirtualKey_F12: - return Qt::Key_F12; - case VirtualKey_F13: - return Qt::Key_F13; - case VirtualKey_F14: - return Qt::Key_F14; - case VirtualKey_F15: - return Qt::Key_F15; - case VirtualKey_F16: - return Qt::Key_F16; - case VirtualKey_F17: - return Qt::Key_F17; - case VirtualKey_F18: - return Qt::Key_F18; - case VirtualKey_F19: - return Qt::Key_F19; - case VirtualKey_F20: - return Qt::Key_F20; - case VirtualKey_F21: - return Qt::Key_F21; - case VirtualKey_F22: - return Qt::Key_F22; - case VirtualKey_F23: - return Qt::Key_F23; - case VirtualKey_F24: - return Qt::Key_F24; - - // Character keys - case VirtualKey_Space: - return Qt::Key_Space; - case VirtualKey_Number0: - case VirtualKey_NumberPad0: - return Qt::Key_0; - case VirtualKey_Number1: - case VirtualKey_NumberPad1: - return Qt::Key_1; - case VirtualKey_Number2: - case VirtualKey_NumberPad2: - return Qt::Key_2; - case VirtualKey_Number3: - case VirtualKey_NumberPad3: - return Qt::Key_3; - case VirtualKey_Number4: - case VirtualKey_NumberPad4: - return Qt::Key_4; - case VirtualKey_Number5: - case VirtualKey_NumberPad5: - return Qt::Key_5; - case VirtualKey_Number6: - case VirtualKey_NumberPad6: - return Qt::Key_6; - case VirtualKey_Number7: - case VirtualKey_NumberPad7: - return Qt::Key_7; - case VirtualKey_Number8: - case VirtualKey_NumberPad8: - return Qt::Key_8; - case VirtualKey_Number9: - case VirtualKey_NumberPad9: - return Qt::Key_9; - case VirtualKey_A: - return Qt::Key_A; - case VirtualKey_B: - return Qt::Key_B; - case VirtualKey_C: - return Qt::Key_C; - case VirtualKey_D: - return Qt::Key_D; - case VirtualKey_E: - return Qt::Key_E; - case VirtualKey_F: - return Qt::Key_F; - case VirtualKey_G: - return Qt::Key_G; - case VirtualKey_H: - return Qt::Key_H; - case VirtualKey_I: - return Qt::Key_I; - case VirtualKey_J: - return Qt::Key_J; - case VirtualKey_K: - return Qt::Key_K; - case VirtualKey_L: - return Qt::Key_L; - case VirtualKey_M: - return Qt::Key_M; - case VirtualKey_N: - return Qt::Key_N; - case VirtualKey_O: - return Qt::Key_O; - case VirtualKey_P: - return Qt::Key_P; - case VirtualKey_Q: - return Qt::Key_Q; - case VirtualKey_R: - return Qt::Key_R; - case VirtualKey_S: - return Qt::Key_S; - case VirtualKey_T: - return Qt::Key_T; - case VirtualKey_U: - return Qt::Key_U; - case VirtualKey_V: - return Qt::Key_V; - case VirtualKey_W: - return Qt::Key_W; - case VirtualKey_X: - return Qt::Key_X; - case VirtualKey_Y: - return Qt::Key_Y; - case VirtualKey_Z: - return Qt::Key_Z; - case VirtualKey_Multiply: - return Qt::Key_9; - case VirtualKey_Add: - return Qt::Key_9; - case VirtualKey_Separator: - return Qt::Key_9; - case VirtualKey_Subtract: - return Qt::Key_9; - case VirtualKey_Decimal: - return Qt::Key_9; - case VirtualKey_Divide: - return Qt::Key_9; - - /* Keys with no matching Qt enum (?) - case VirtualKey_None: - case VirtualKey_LeftButton: - case VirtualKey_RightButton: - case VirtualKey_MiddleButton: - case VirtualKey_XButton1: - case VirtualKey_XButton2: - case VirtualKey_Final: - case VirtualKey_Accept:*/ - } -} - -// Some keys like modifiers, caps lock etc. should not be automatically repeated if the key is held down -static inline bool shouldAutoRepeat(Qt::Key key) -{ - switch (key) { - case Qt::Key_Shift: - case Qt::Key_Control: - case Qt::Key_Alt: - case Qt::Key_Meta: - case Qt::Key_CapsLock: - case Qt::Key_NumLock: - case Qt::Key_ScrollLock: - return false; - default: - return true; - } -} - -static inline Qt::Key qKeyFromCode(quint32 code, int mods) -{ - if (code >= 'a' && code <= 'z') - code = toupper(code); - if ((mods & Qt::ControlModifier) != 0) { - if (code >= 0 && code <= 31) // Ctrl+@..Ctrl+A..CTRL+Z..Ctrl+_ - code += '@'; // to @..A..Z.._ - } - return static_cast(code & 0xff); -} - -typedef HRESULT (__stdcall ICoreWindow::*CoreWindowCallbackRemover)(EventRegistrationToken); -size_t qHash(CoreWindowCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); } -typedef HRESULT (__stdcall IDisplayInformation::*DisplayCallbackRemover)(EventRegistrationToken); -size_t qHash(DisplayCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); } -typedef HRESULT (__stdcall ICorePointerRedirector::*RedirectorCallbackRemover)(EventRegistrationToken); -size_t qHash(RedirectorCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); } -typedef HRESULT (__stdcall IApplicationView2::*ApplicationView2CallbackRemover)(EventRegistrationToken); -size_t qHash(ApplicationView2CallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); } - -class QWinRTScreenPrivate -{ -public: - QTouchDevice *touchDevice; - ComPtr coreWindow; - ComPtr redirect; - ComPtr canvas; - ComPtr view; - ComPtr displayInformation; - - QScopedPointer cursor; - QHash touchPoints; - QRectF logicalRect; - QRectF visibleRect; - QSurfaceFormat surfaceFormat; - qreal logicalDpi; - QDpi physicalDpi; - qreal scaleFactor; - Qt::ScreenOrientation nativeOrientation; - Qt::ScreenOrientation orientation; - QList visibleWindows; - QHash activeKeys; - QHash windowTokens; - QHash displayTokens; - QHash redirectTokens; - QHash view2Tokens; - ComPtr view2; - QAtomicPointer mouseGrabWindow; - QAtomicPointer keyboardGrabWindow; - QWindow *currentPressWindow = nullptr; - QWindow *currentTargetWindow = nullptr; - bool firstMouseMove = true; - bool resizePending = false; -}; - -// To be called from the XAML thread -QWinRTScreen::QWinRTScreen() - : d_ptr(new QWinRTScreenPrivate) -{ - Q_D(QWinRTScreen); - qCDebug(lcQpaWindows) << __FUNCTION__; - d->orientation = Qt::PrimaryOrientation; - d->touchDevice = nullptr; - - HRESULT hr; - ComPtr windowStatics; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_Xaml_Window).Get(), - IID_PPV_ARGS(&windowStatics)); - Q_ASSERT_SUCCEEDED(hr); - ComPtr window; - hr = windowStatics->get_Current(&window); - Q_ASSERT_SUCCEEDED(hr); - hr = window->Activate(); - Q_ASSERT_SUCCEEDED(hr); - - hr = window->get_CoreWindow(&d->coreWindow); - Q_ASSERT_SUCCEEDED(hr); - - hr = d->coreWindow.As(&d->redirect); - Q_ASSERT_SUCCEEDED(hr); - - hr = d->coreWindow->Activate(); - Q_ASSERT_SUCCEEDED(hr); - - Rect rect; - hr = d->coreWindow->get_Bounds(&rect); - Q_ASSERT_SUCCEEDED(hr); - d->logicalRect = QRectF(0.0f, 0.0f, rect.Width, rect.Height); - d->visibleRect = QRectF(0.0f, 0.0f, rect.Width, rect.Height); - - // Orientation handling - ComPtr displayInformationStatics; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Graphics_Display_DisplayInformation).Get(), - IID_PPV_ARGS(&displayInformationStatics)); - Q_ASSERT_SUCCEEDED(hr); - - hr = displayInformationStatics->GetForCurrentView(&d->displayInformation); - Q_ASSERT_SUCCEEDED(hr); - - // Set native orientation - DisplayOrientations displayOrientation; - hr = d->displayInformation->get_NativeOrientation(&displayOrientation); - Q_ASSERT_SUCCEEDED(hr); - d->nativeOrientation = static_cast(static_cast(qtOrientationsFromNative(displayOrientation))); - // Set initial pixel density - onDpiChanged(nullptr, nullptr); - d->orientation = d->nativeOrientation; - - ComPtr applicationViewStatics; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_ApplicationView).Get(), - IID_PPV_ARGS(&applicationViewStatics)); - RETURN_VOID_IF_FAILED("Could not get ApplicationViewStatics"); - - hr = applicationViewStatics->GetForCurrentView(&d->view); - RETURN_VOID_IF_FAILED("Could not access currentView"); - - d->canvas = Make([this]() { return topWindow(); }); - - ComPtr frameworkElement; - hr = d->canvas.As(&frameworkElement); - Q_ASSERT_SUCCEEDED(hr); - hr = frameworkElement->put_Width(d->logicalRect.width()); - Q_ASSERT_SUCCEEDED(hr); - hr = frameworkElement->put_Height(d->logicalRect.height()); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr uiElement; - hr = d->canvas.As(&uiElement); - Q_ASSERT_SUCCEEDED(hr); - -#if QT_CONFIG(draganddrop) - QWinRTDrag::instance()->setUiElement(uiElement); -#endif - hr = window->put_Content(uiElement.Get()); - Q_ASSERT_SUCCEEDED(hr); - - d->cursor.reset(new QWinRTCursor); - - hr = d->view.As(&d->view2); - Q_ASSERT_SUCCEEDED(hr); -} - -QWinRTScreen::~QWinRTScreen() -{ - Q_D(QWinRTScreen); - qCDebug(lcQpaWindows) << __FUNCTION__ << this; - - // Unregister callbacks - HRESULT hr; - hr = QEventDispatcherWinRT::runOnXamlThread([this, d]() { - HRESULT hr; - for (QHash::const_iterator i = d->windowTokens.begin(); i != d->windowTokens.end(); ++i) { - hr = (d->coreWindow.Get()->*i.key())(i.value()); - Q_ASSERT_SUCCEEDED(hr); - } - for (QHash::const_iterator i = d->displayTokens.begin(); i != d->displayTokens.end(); ++i) { - hr = (d->displayInformation.Get()->*i.key())(i.value()); - Q_ASSERT_SUCCEEDED(hr); - } - for (QHash::const_iterator i = d->redirectTokens.begin(); i != d->redirectTokens.end(); ++i) { - hr = (d->redirect.Get()->*i.key())(i.value()); - Q_ASSERT_SUCCEEDED(hr); - } - for (QHash::const_iterator i = d->view2Tokens.begin(); i != d->view2Tokens.end(); ++i) { - hr = (d->view2.Get()->*i.key())(i.value()); - Q_ASSERT_SUCCEEDED(hr); - } - return hr; - }); - RETURN_VOID_IF_FAILED("Failed to unregister screen event callbacks"); -} - -QRect QWinRTScreen::geometry() const -{ - Q_D(const QWinRTScreen); - return QRect(QPoint(), QSizeF(d->logicalRect.size() * d->scaleFactor).toSize()); -} - -QRect QWinRTScreen::availableGeometry() const -{ - Q_D(const QWinRTScreen); - return QRectF((d->visibleRect.x() - d->logicalRect.x())* d->scaleFactor, - (d->visibleRect.y() - d->logicalRect.y()) * d->scaleFactor, - d->visibleRect.width() * d->scaleFactor, - d->visibleRect.height() * d->scaleFactor).toRect(); -} - -int QWinRTScreen::depth() const -{ - return 32; -} - -QImage::Format QWinRTScreen::format() const -{ - return QImage::Format_RGB32; -} - -QSizeF QWinRTScreen::physicalSize() const -{ - Q_D(const QWinRTScreen); - return QSizeF(d->logicalRect.width() * d->scaleFactor / d->physicalDpi.first * qreal(25.4), - d->logicalRect.height() * d->scaleFactor / d->physicalDpi.second * qreal(25.4)); -} - -QDpi QWinRTScreen::logicalDpi() const -{ - Q_D(const QWinRTScreen); - return QDpi(d->logicalDpi, d->logicalDpi); -} - -qreal QWinRTScreen::scaleFactor() const -{ - Q_D(const QWinRTScreen); - return d->scaleFactor; -} - -QPlatformCursor *QWinRTScreen::cursor() const -{ - Q_D(const QWinRTScreen); - return d->cursor.data(); -} - -Qt::KeyboardModifiers QWinRTScreen::keyboardModifiers() const -{ - Q_D(const QWinRTScreen); - - Qt::KeyboardModifiers mods; - CoreVirtualKeyStates mod; - HRESULT hr = d->coreWindow->GetAsyncKeyState(VirtualKey_Shift, &mod); - Q_ASSERT_SUCCEEDED(hr); - if (mod & CoreVirtualKeyStates_Down) - mods |= Qt::ShiftModifier; - hr = d->coreWindow->GetAsyncKeyState(VirtualKey_Menu, &mod); - Q_ASSERT_SUCCEEDED(hr); - if (mod & CoreVirtualKeyStates_Down) - mods |= Qt::AltModifier; - hr = d->coreWindow->GetAsyncKeyState(VirtualKey_Control, &mod); - Q_ASSERT_SUCCEEDED(hr); - if (mod & CoreVirtualKeyStates_Down) - mods |= Qt::ControlModifier; - hr = d->coreWindow->GetAsyncKeyState(VirtualKey_LeftWindows, &mod); - Q_ASSERT_SUCCEEDED(hr); - if (mod & CoreVirtualKeyStates_Down) { - mods |= Qt::MetaModifier; - } else { - hr = d->coreWindow->GetAsyncKeyState(VirtualKey_RightWindows, &mod); - Q_ASSERT_SUCCEEDED(hr); - if (mod & CoreVirtualKeyStates_Down) - mods |= Qt::MetaModifier; - } - return mods; -} - -Qt::ScreenOrientation QWinRTScreen::nativeOrientation() const -{ - Q_D(const QWinRTScreen); - return d->nativeOrientation; -} - -Qt::ScreenOrientation QWinRTScreen::orientation() const -{ - Q_D(const QWinRTScreen); - return d->orientation; -} - -ICoreWindow *QWinRTScreen::coreWindow() const -{ - Q_D(const QWinRTScreen); - return d->coreWindow.Get(); -} - -Xaml::IDependencyObject *QWinRTScreen::canvas() const -{ - Q_D(const QWinRTScreen); - Xaml::IDependencyObject *depCanvas; - if (SUCCEEDED(d->canvas.CopyTo(&depCanvas))) - return depCanvas; - return nullptr; -} - -void QWinRTScreen::initialize() -{ - Q_D(QWinRTScreen); - HRESULT hr; - hr = d->coreWindow->add_KeyDown(Callback(this, &QWinRTScreen::onKeyDown).Get(), &d->windowTokens[&ICoreWindow::remove_KeyDown]); - Q_ASSERT_SUCCEEDED(hr); - hr = d->coreWindow->add_KeyUp(Callback(this, &QWinRTScreen::onKeyUp).Get(), &d->windowTokens[&ICoreWindow::remove_KeyUp]); - Q_ASSERT_SUCCEEDED(hr); - hr = d->coreWindow->add_CharacterReceived(Callback(this, &QWinRTScreen::onCharacterReceived).Get(), &d->windowTokens[&ICoreWindow::remove_CharacterReceived]); - Q_ASSERT_SUCCEEDED(hr); - hr = d->coreWindow->add_PointerEntered(Callback(this, &QWinRTScreen::onPointerEntered).Get(), &d->windowTokens[&ICoreWindow::remove_PointerEntered]); - Q_ASSERT_SUCCEEDED(hr); - hr = d->coreWindow->add_PointerExited(Callback(this, &QWinRTScreen::onPointerExited).Get(), &d->windowTokens[&ICoreWindow::remove_PointerExited]); - Q_ASSERT_SUCCEEDED(hr); - hr = d->coreWindow->add_PointerMoved(Callback(this, &QWinRTScreen::onPointerUpdated).Get(), &d->windowTokens[&ICoreWindow::remove_PointerMoved]); - Q_ASSERT_SUCCEEDED(hr); - hr = d->coreWindow->add_PointerPressed(Callback(this, &QWinRTScreen::onPointerUpdated).Get(), &d->windowTokens[&ICoreWindow::remove_PointerPressed]); - Q_ASSERT_SUCCEEDED(hr); - hr = d->coreWindow->add_PointerReleased(Callback(this, &QWinRTScreen::onPointerUpdated).Get(), &d->windowTokens[&ICoreWindow::remove_PointerReleased]); - Q_ASSERT_SUCCEEDED(hr); - hr = d->coreWindow->add_PointerWheelChanged(Callback(this, &QWinRTScreen::onPointerUpdated).Get(), &d->windowTokens[&ICoreWindow::remove_PointerWheelChanged]); - Q_ASSERT_SUCCEEDED(hr); - hr = d->view2->add_VisibleBoundsChanged(Callback(this, &QWinRTScreen::onWindowSizeChanged).Get(), &d->view2Tokens[&IApplicationView2::remove_VisibleBoundsChanged]); - Q_ASSERT_SUCCEEDED(hr); - hr = d->coreWindow->add_Activated(Callback(this, &QWinRTScreen::onActivated).Get(), &d->windowTokens[&ICoreWindow::remove_Activated]); - Q_ASSERT_SUCCEEDED(hr); - hr = d->coreWindow->add_Closed(Callback(this, &QWinRTScreen::onClosed).Get(), &d->windowTokens[&ICoreWindow::remove_Closed]); - Q_ASSERT_SUCCEEDED(hr); - hr = d->coreWindow->add_VisibilityChanged(Callback(this, &QWinRTScreen::onVisibilityChanged).Get(), &d->windowTokens[&ICoreWindow::remove_VisibilityChanged]); - Q_ASSERT_SUCCEEDED(hr); - hr = d->displayInformation->add_OrientationChanged(Callback(this, &QWinRTScreen::onOrientationChanged).Get(), &d->displayTokens[&IDisplayInformation::remove_OrientationChanged]); - Q_ASSERT_SUCCEEDED(hr); - hr = d->displayInformation->add_DpiChanged(Callback(this, &QWinRTScreen::onDpiChanged).Get(), &d->displayTokens[&IDisplayInformation::remove_DpiChanged]); - Q_ASSERT_SUCCEEDED(hr); - onOrientationChanged(nullptr, nullptr); - onVisibilityChanged(nullptr, nullptr); - - hr = d->redirect->add_PointerRoutedReleased(Callback(this, &QWinRTScreen::onRedirectReleased).Get(), &d->redirectTokens[&ICorePointerRedirector::remove_PointerRoutedReleased]); - Q_ASSERT_SUCCEEDED(hr); -} - -void QWinRTScreen::setCursorRect(const QRectF &cursorRect) -{ - mCursorRect = cursorRect; -} - -void QWinRTScreen::setKeyboardRect(const QRectF &keyboardRect) -{ - Q_D(QWinRTScreen); - QRectF visibleRectF; - HRESULT hr; - Rect windowSize; - - hr = d->coreWindow->get_Bounds(&windowSize); - if (FAILED(hr)) { - qErrnoWarning(hr, "Failed to get window bounds"); - return; - } - d->logicalRect = QRectF(windowSize.X, windowSize.Y, windowSize.Width, windowSize.Height); - Rect visibleRect; - hr = d->view2->get_VisibleBounds(&visibleRect); - if (FAILED(hr)) { - qErrnoWarning(hr, "Failed to get window visible bounds"); - return; - } - visibleRectF = QRectF(visibleRect.X, visibleRect.Y, visibleRect.Width, visibleRect.Height); - // if keyboard is snapped to the bottom of the screen and would cover the cursor the content is - // moved up to make it visible - if (keyboardRect.intersects(mCursorRect) - && qFuzzyCompare(geometry().height(), keyboardRect.y() + keyboardRect.height())) { - visibleRectF.moveTop(visibleRectF.top() - keyboardRect.height() / d->scaleFactor); - } - d->visibleRect = visibleRectF; - - qCDebug(lcQpaWindows) << __FUNCTION__ << d->visibleRect; - QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), availableGeometry()); - QPlatformScreen::resizeMaximizedWindows(); - handleExpose(); -} - -QWindow *QWinRTScreen::topWindow() const -{ - Q_D(const QWinRTScreen); - return d->visibleWindows.isEmpty() ? 0 : d->visibleWindows.first(); -} - -QWindow *QWinRTScreen::windowAt(const QPoint &pos) -{ - Q_D(const QWinRTScreen); - for (auto w : qAsConst(d->visibleWindows)) { - if (w->geometry().contains(pos)) - return w; - } - qCDebug(lcQpaWindows) << __FUNCTION__ << ": No window found at:" << pos; - return nullptr; -} - -void QWinRTScreen::addWindow(QWindow *window) -{ - Q_D(QWinRTScreen); - qCDebug(lcQpaWindows) << __FUNCTION__ << window; - if (window == topWindow() || window->surfaceClass() == QSurface::Offscreen) - return; - - d->visibleWindows.prepend(window); - const Qt::WindowType type = window->type(); - if (type != Qt::Popup && type != Qt::ToolTip && type != Qt::Tool) { - updateWindowTitle(window->title()); - QWindowSystemInterface::handleWindowActivated(window, Qt::OtherFocusReason); - } - - handleExpose(); - d->firstMouseMove = true; - QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); - -#if QT_CONFIG(draganddrop) - QWinRTDrag::instance()->setDropTarget(window); -#endif -} - -void QWinRTScreen::removeWindow(QWindow *window) -{ - Q_D(QWinRTScreen); - qCDebug(lcQpaWindows) << __FUNCTION__ << window; - - handleExpose(); - - const bool wasTopWindow = window == topWindow(); - if (!d->visibleWindows.removeAll(window)) - return; - - const Qt::WindowType type = window->type(); - if (wasTopWindow && type != Qt::Popup && type != Qt::ToolTip && type != Qt::Tool) - QWindowSystemInterface::handleWindowActivated(nullptr, Qt::OtherFocusReason); - QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); -#if QT_CONFIG(draganddrop) - if (wasTopWindow) - QWinRTDrag::instance()->setDropTarget(topWindow()); -#endif -} - -void QWinRTScreen::raise(QWindow *window) -{ - Q_D(QWinRTScreen); - d->visibleWindows.removeAll(window); - addWindow(window); -} - -void QWinRTScreen::lower(QWindow *window) -{ - Q_D(QWinRTScreen); - const bool wasTopWindow = window == topWindow(); - if (wasTopWindow && d->visibleWindows.size() == 1) - return; - if (window->surfaceClass() == QSurface::Offscreen) - return; - d->visibleWindows.removeAll(window); - d->visibleWindows.append(window); - if (wasTopWindow) - QWindowSystemInterface::handleWindowActivated(window, Qt::OtherFocusReason); - handleExpose(); -} - -bool QWinRTScreen::setMouseGrabWindow(QWinRTWindow *window, bool grab) -{ - Q_D(QWinRTScreen); - qCDebug(lcQpaWindows) << __FUNCTION__ << window - << "(" << window->window()->objectName() << "):" << grab; - - if (!grab || window == nullptr) - d->mouseGrabWindow = nullptr; - else if (d->mouseGrabWindow != window) - d->mouseGrabWindow = window; - return grab; -} - -QWinRTWindow *QWinRTScreen::mouseGrabWindow() const -{ - Q_D(const QWinRTScreen); - return d->mouseGrabWindow; -} - -bool QWinRTScreen::setKeyboardGrabWindow(QWinRTWindow *window, bool grab) -{ - Q_D(QWinRTScreen); - qCDebug(lcQpaWindows) << __FUNCTION__ << window - << "(" << window->window()->objectName() << "):" << grab; - - if (!grab || window == nullptr) - d->keyboardGrabWindow = nullptr; - else if (d->keyboardGrabWindow != window) - d->keyboardGrabWindow = window; - return grab; -} - -QWinRTWindow *QWinRTScreen::keyboardGrabWindow() const -{ - Q_D(const QWinRTScreen); - return d->keyboardGrabWindow; -} - -void QWinRTScreen::updateWindowTitle(const QString &title) -{ - Q_D(QWinRTScreen); - - HStringReference titleRef(reinterpret_cast(title.utf16()), title.length()); - HRESULT hr = d->view->put_Title(titleRef.Get()); - RETURN_VOID_IF_FAILED("Unable to set window title"); -} - -void QWinRTScreen::handleExpose() -{ - Q_D(QWinRTScreen); - if (d->visibleWindows.isEmpty()) - return; - QList::const_iterator it = d->visibleWindows.constBegin(); - QWindowSystemInterface::handleExposeEvent(*it, geometry()); - while (++it != d->visibleWindows.constEnd()) - QWindowSystemInterface::handleExposeEvent(*it, QRegion()); -} - -HRESULT QWinRTScreen::onKeyDown(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IKeyEventArgs *args) -{ - Q_D(QWinRTScreen); - VirtualKey virtualKey; - HRESULT hr = args->get_VirtualKey(&virtualKey); - Q_ASSERT_SUCCEEDED(hr); - CorePhysicalKeyStatus status; - hr = args->get_KeyStatus(&status); - Q_ASSERT_SUCCEEDED(hr); - - Qt::Key key = qKeyFromVirtual(virtualKey); - - const bool wasPressed = d->activeKeys.contains(key); - if (wasPressed) { - if (!shouldAutoRepeat(key)) - return S_OK; - - d->activeKeys[key].isAutoRepeat = true; - // If the key was pressed before trigger a key release before the next key press - QWindowSystemInterface::handleExtendedKeyEvent( - topWindow(), - QEvent::KeyRelease, - key, - keyboardModifiers(), - !status.ScanCode ? -1 : status.ScanCode, - virtualKey, - 0, - QString(), - d->activeKeys.value(key).isAutoRepeat); - } else { - d->activeKeys.insert(key, KeyInfo(virtualKey)); - } - - // Defer character key presses to onCharacterReceived - if (key == Qt::Key_unknown || (key >= Qt::Key_Space && key <= Qt::Key_ydiaeresis)) - return S_OK; - - Qt::KeyboardModifiers modifiers = keyboardModifiers(); - // If the key actually pressed is a modifier key, then we remove its modifier key from the - // state, since a modifier-key can't have itself as a modifier (see qwindowskeymapper.cpp) - if (key == Qt::Key_Control) - modifiers = modifiers ^ Qt::ControlModifier; - else if (key == Qt::Key_Shift) - modifiers = modifiers ^ Qt::ShiftModifier; - else if (key == Qt::Key_Alt) - modifiers = modifiers ^ Qt::AltModifier; - - QWindowSystemInterface::handleExtendedKeyEvent( - topWindow(), - QEvent::KeyPress, - key, - modifiers, - !status.ScanCode ? -1 : status.ScanCode, - virtualKey, - 0, - QString(), - d->activeKeys.value(key).isAutoRepeat); - return S_OK; -} - -HRESULT QWinRTScreen::onKeyUp(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IKeyEventArgs *args) -{ - Q_D(QWinRTScreen); - VirtualKey virtualKey; - HRESULT hr = args->get_VirtualKey(&virtualKey); - Q_ASSERT_SUCCEEDED(hr); - CorePhysicalKeyStatus status; - hr = args->get_KeyStatus(&status); - Q_ASSERT_SUCCEEDED(hr); - - Qt::Key key = qKeyFromVirtual(virtualKey); - const KeyInfo info = d->activeKeys.take(key); - QWindowSystemInterface::handleExtendedKeyEvent( - topWindow(), - QEvent::KeyRelease, - key, - keyboardModifiers(), - !status.ScanCode ? -1 : status.ScanCode, - virtualKey, - 0, - info.text, - false); // The final key release does not have autoRepeat set on Windows - return S_OK; -} - -HRESULT QWinRTScreen::onCharacterReceived(ICoreWindow *, ICharacterReceivedEventArgs *args) -{ - Q_D(QWinRTScreen); - quint32 keyCode; - HRESULT hr = args->get_KeyCode(&keyCode); - Q_ASSERT_SUCCEEDED(hr); - CorePhysicalKeyStatus status; - hr = args->get_KeyStatus(&status); - Q_ASSERT_SUCCEEDED(hr); - - // Don't generate character events for non-printables; the meta key stage is enough - if (qIsNonPrintable(keyCode)) - return S_OK; - - const Qt::KeyboardModifiers modifiers = keyboardModifiers(); - const Qt::Key key = qKeyFromCode(keyCode, modifiers); - const QString text = QChar(keyCode); - KeyInfo &info = d->activeKeys[key]; - info.text = text; - QWindowSystemInterface::handleExtendedKeyEvent( - topWindow(), - QEvent::KeyPress, - key, - modifiers, - !status.ScanCode ? -1 : status.ScanCode, - info.virtualKey, - 0, - text, - info.isAutoRepeat); - return S_OK; -} - -HRESULT QWinRTScreen::onPointerEntered(ICoreWindow *, IPointerEventArgs *args) -{ - Q_D(QWinRTScreen); - qCDebug(lcQpaEvents) << __FUNCTION__; - - ComPtr pointerPoint; - if (SUCCEEDED(args->get_CurrentPoint(&pointerPoint))) { - // Assumes full-screen window - Point point; - pointerPoint->get_Position(&point); - QPoint pos(point.X * d->scaleFactor, point.Y * d->scaleFactor); - - d->currentTargetWindow = topWindow(); - if (d->mouseGrabWindow) - d->currentTargetWindow = d->mouseGrabWindow.loadRelaxed()->window(); - - qCDebug(lcQpaEvents) << __FUNCTION__ << "handleEnterEvent" << d->currentTargetWindow << pos; - QWindowSystemInterface::handleEnterEvent(d->currentTargetWindow, pos, pos); - d->firstMouseMove = false; - } - return S_OK; -} - -HRESULT QWinRTScreen::onPointerExited(ICoreWindow *, IPointerEventArgs *args) -{ - Q_D(QWinRTScreen); - qCDebug(lcQpaEvents) << __FUNCTION__; - ComPtr pointerPoint; - if (FAILED(args->get_CurrentPoint(&pointerPoint))) - return E_INVALIDARG; - - quint32 id; - if (FAILED(pointerPoint->get_PointerId(&id))) - return E_INVALIDARG; - - d->touchPoints.remove(id); - - if (d->mouseGrabWindow) - d->currentTargetWindow = d->mouseGrabWindow.loadRelaxed()->window(); - - qCDebug(lcQpaEvents) << __FUNCTION__ << "handleLeaveEvent" << d->currentTargetWindow; - QWindowSystemInterface::handleLeaveEvent(d->currentTargetWindow); - d->currentTargetWindow = nullptr; - return S_OK; -} - -// Required for qwinrtdrag.cpp -ComPtr qt_winrt_lastPointerPoint; - -HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args) -{ - Q_D(QWinRTScreen); - qCDebug(lcQpaEvents) << __FUNCTION__; - ComPtr pointerPoint; - if (FAILED(args->get_CurrentPoint(&pointerPoint))) - return E_INVALIDARG; - - qt_winrt_lastPointerPoint = pointerPoint; - // Common traits - point, modifiers, properties - Point point; - pointerPoint->get_Position(&point); - const QPointF pos(point.X * d->scaleFactor, point.Y * d->scaleFactor); - QPointF localPos = pos; - - const QPoint posPoint = pos.toPoint(); - QWindow *windowUnderPointer = windowAt(QHighDpiScaling::mapPositionFromNative(posPoint, this)); - d->currentTargetWindow = windowUnderPointer; - - if (d->mouseGrabWindow) - d->currentTargetWindow = d->mouseGrabWindow.loadRelaxed()->window(); - - if (d->currentTargetWindow) { - const QPointF globalPosDelta = pos - posPoint; - localPos = d->currentTargetWindow->mapFromGlobal(posPoint) + globalPosDelta; - } - - VirtualKeyModifiers modifiers; - args->get_KeyModifiers(&modifiers); - Qt::KeyboardModifiers mods; - if (modifiers & VirtualKeyModifiers_Control) - mods |= Qt::ControlModifier; - if (modifiers & VirtualKeyModifiers_Menu) - mods |= Qt::AltModifier; - if (modifiers & VirtualKeyModifiers_Shift) - mods |= Qt::ShiftModifier; - if (modifiers & VirtualKeyModifiers_Windows) - mods |= Qt::MetaModifier; - - ComPtr properties; - if (FAILED(pointerPoint->get_Properties(&properties))) - return E_INVALIDARG; - - ComPtr pointerDevice; - HRESULT hr = pointerPoint->get_PointerDevice(&pointerDevice); - RETURN_OK_IF_FAILED("Failed to get pointer device."); - - PointerDeviceType pointerDeviceType; - hr = pointerDevice->get_PointerDeviceType(&pointerDeviceType); - RETURN_OK_IF_FAILED("Failed to get pointer device type."); - - switch (pointerDeviceType) { - case PointerDeviceType_Mouse: { - qint32 delta; - properties->get_MouseWheelDelta(&delta); - if (delta) { - boolean isHorizontal; - properties->get_IsHorizontalMouseWheel(&isHorizontal); - QPoint angleDelta(isHorizontal ? delta : 0, isHorizontal ? 0 : delta); - qCDebug(lcQpaEvents) << __FUNCTION__ << "handleWheelEvent" << d->currentTargetWindow - << localPos << pos << angleDelta << mods; - QWindowSystemInterface::handleWheelEvent(d->currentTargetWindow, localPos, pos, QPoint(), angleDelta, mods); - break; - } - - boolean isPressed; - Qt::MouseButtons buttons = Qt::NoButton; - properties->get_IsLeftButtonPressed(&isPressed); - if (isPressed) - buttons |= Qt::LeftButton; - - properties->get_IsMiddleButtonPressed(&isPressed); - if (isPressed) - buttons |= Qt::MiddleButton; - - properties->get_IsRightButtonPressed(&isPressed); - if (isPressed) - buttons |= Qt::RightButton; - - properties->get_IsXButton1Pressed(&isPressed); - if (isPressed) - buttons |= Qt::XButton1; - - properties->get_IsXButton2Pressed(&isPressed); - if (isPressed) - buttons |= Qt::XButton2; - - // In case of a mouse grab we have to store the target of a press event - // to be able to send one additional release event to this target when the mouse - // button is released. This is a similar approach to AutoMouseCapture in the - // windows qpa backend. Otherwise the release might not be propagated and the original - // press event receiver considers a button to still be pressed, as in Qt Quick Controls 1 - // menus. - if (buttons != Qt::NoButton && d->currentPressWindow == nullptr && !d->mouseGrabWindow) - d->currentPressWindow = windowUnderPointer; - if (buttons == Qt::NoButton && d->currentPressWindow && d->mouseGrabWindow) { - const QPointF globalPosDelta = pos - posPoint; - const QPointF localPressPos = d->currentPressWindow->mapFromGlobal(posPoint) + globalPosDelta; - - qCDebug(lcQpaEvents) << __FUNCTION__ << "handleMouseEvent" << d->currentPressWindow - << localPressPos << pos << buttons << mods; - QWindowSystemInterface::handleMouseEvent(d->currentPressWindow, localPressPos, pos, buttons, mods); - d->currentPressWindow = nullptr; - } - // If the mouse button is released outside of a window, targetWindow is 0, but the event - // has to be delivered to the window, that initially received the mouse press. Do not reset - // d->currentTargetWindow though, as it is used (and reset) in onPointerExited. - if (buttons == Qt::NoButton && d->currentPressWindow && !d->currentTargetWindow) { - d->currentTargetWindow = d->currentPressWindow; - d->currentPressWindow = nullptr; - } - - qCDebug(lcQpaEvents) << __FUNCTION__ << "handleMouseEvent" << d->currentTargetWindow - << localPos << pos << buttons << mods; - QWindowSystemInterface::handleMouseEvent(d->currentTargetWindow, localPos, pos, buttons, mods); - - break; - } - case PointerDeviceType_Pen: - case PointerDeviceType_Touch: { - if (!d->touchDevice) { - d->touchDevice = new QTouchDevice; - d->touchDevice->setName(QStringLiteral("WinRTTouchScreen")); - d->touchDevice->setType(QTouchDevice::TouchScreen); - d->touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::Pressure | QTouchDevice::NormalizedPosition); - QWindowSystemInterface::registerTouchDevice(d->touchDevice); - } - - quint32 id; - pointerPoint->get_PointerId(&id); - - Rect area; - properties->get_ContactRect(&area); - - float pressure; - properties->get_Pressure(&pressure); - - boolean isPressed; - pointerPoint->get_IsInContact(&isPressed); - - // Devices like the Hololens set a static pressure of 0.0 or 0.5 - // (depending on the image) independent of the pressed state. - // In those cases we need to synthesize the pressure value. To our - // knowledge this does not apply to pens - if (pointerDeviceType == PointerDeviceType_Touch && (pressure == 0.0f || pressure == 0.5f)) - pressure = isPressed ? 1. : 0.; - - const QRectF areaRect(area.X * d->scaleFactor, area.Y * d->scaleFactor, - area.Width * d->scaleFactor, area.Height * d->scaleFactor); - - QHash::iterator it = d->touchPoints.find(id); - if (it == d->touchPoints.end()) { - it = d->touchPoints.insert(id, QWindowSystemInterface::TouchPoint()); - it.value().id = id; - } - - const bool wasPressEvent = isPressed && it.value().pressure == 0.; - if (wasPressEvent) - it.value().state = Qt::TouchPointPressed; - else if (!isPressed && it.value().pressure > 0.) - it.value().state = Qt::TouchPointReleased; - else if (it.value().area == areaRect) - it.value().state = Qt::TouchPointStationary; - else - it.value().state = Qt::TouchPointMoved; - - it.value().area = areaRect; - it.value().normalPosition = QPointF(point.X/d->logicalRect.width(), point.Y/d->logicalRect.height()); - it.value().pressure = pressure; - - qCDebug(lcQpaEvents) << __FUNCTION__ << "handleTouchEvent" << d->currentTargetWindow - << d->touchDevice << d->touchPoints.values() << mods; - QWindowSystemInterface::handleTouchEvent(d->currentTargetWindow, d->touchDevice, d->touchPoints.values(), mods); - if (wasPressEvent) - it.value().state = Qt::TouchPointStationary; - - // Fall-through for pen to generate tablet event - if (pointerDeviceType != PointerDeviceType_Pen) - break; - - boolean isEraser; - properties->get_IsEraser(&isEraser); - int pointerType = isEraser ? 3 : 1; - - float xTilt; - properties->get_XTilt(&xTilt); - - float yTilt; - properties->get_YTilt(&yTilt); - - float rotation; - properties->get_Twist(&rotation); - - qCDebug(lcQpaEvents) << __FUNCTION__ << "handleTabletEvent" << d->currentTargetWindow - << isPressed << pos << pointerType << pressure << xTilt << yTilt - << rotation << id << mods; - QWindowSystemInterface::handleTabletEvent(d->currentTargetWindow, isPressed, pos, pos, 0, - pointerType, pressure, xTilt, yTilt, - 0, rotation, 0, id, mods); - - break; - } - } - - return S_OK; -} - -void QWinRTScreen::emulateMouseMove(const QPointF &point, MousePositionTransition transition) -{ - Q_D(QWinRTScreen); - qCDebug(lcQpaEvents) << __FUNCTION__ << point << transition; - if (transition == MousePositionTransition::StayedOut) - return; - qt_winrt_lastPointerPoint = nullptr; - const QPointF pos(point.x() * d->scaleFactor, point.y() * d->scaleFactor); - QPointF localPos = pos; - - const QPoint posPoint = pos.toPoint(); - QWindow *windowUnderPointer = windowAt(QHighDpiScaling::mapPositionFromNative(posPoint, this)); - d->currentTargetWindow = windowUnderPointer; - - if (d->mouseGrabWindow) - d->currentTargetWindow = d->mouseGrabWindow.loadRelaxed()->window(); - - if (d->currentTargetWindow) { - const QPointF globalPosDelta = pos - posPoint; - localPos = d->currentTargetWindow->mapFromGlobal(posPoint) + globalPosDelta; - } - - // In case of a mouse grab we have to store the target of a press event - // to be able to send one additional release event to this target when the mouse - // button is released. This is a similar approach to AutoMouseCapture in the - // windows qpa backend. Otherwise the release might not be propagated and the original - // press event receiver considers a button to still be pressed, as in Qt Quick Controls 1 - // menus. - if (d->currentPressWindow && d->mouseGrabWindow) { - const QPointF globalPosDelta = pos - posPoint; - const QPointF localPressPos = d->currentPressWindow->mapFromGlobal(posPoint) + globalPosDelta; - - qCDebug(lcQpaEvents) << __FUNCTION__ << "handleMouseEvent" << d->currentPressWindow - << localPressPos << pos << Qt::NoButton << Qt::NoModifier; - QWindowSystemInterface::handleMouseEvent(d->currentPressWindow, localPressPos, pos, - Qt::NoButton, Qt::NoModifier); - d->currentPressWindow = nullptr; - } - // If the mouse button is released outside of a window, targetWindow is 0, but the event - // has to be delivered to the window, that initially received the mouse press. Do not reset - // d->currentTargetWindow though, as it is used (and reset) in onPointerExited. - if (d->currentPressWindow && !d->currentTargetWindow) { - d->currentTargetWindow = d->currentPressWindow; - d->currentPressWindow = nullptr; - } - - if (transition == MousePositionTransition::MovedOut) { - qCDebug(lcQpaEvents) << __FUNCTION__ << "handleLeaveEvent" << d->currentTargetWindow; - QWindowSystemInterface::handleLeaveEvent(d->currentTargetWindow); - return; - } - - if (transition == MousePositionTransition::MovedIn || d->firstMouseMove) { - qCDebug(lcQpaEvents) << __FUNCTION__ << "handleEnterEvent" << d->currentTargetWindow - << localPos << pos; - QWindowSystemInterface::handleEnterEvent(d->currentTargetWindow, localPos, pos); - d->firstMouseMove = false; - } - qCDebug(lcQpaEvents) << __FUNCTION__ << "handleMouseEvent" << d->currentTargetWindow - << localPos << pos << Qt::NoButton << Qt::NoModifier; - QWindowSystemInterface::handleMouseEvent(d->currentTargetWindow, localPos, pos, Qt::NoButton, - Qt::NoModifier); -} - -void QWinRTScreen::setResizePending() -{ - Q_D(QWinRTScreen); - d->resizePending = true; -} - -bool QWinRTScreen::resizePending() const -{ - Q_D(const QWinRTScreen); - return d->resizePending; -} - -HRESULT QWinRTScreen::onActivated(ICoreWindow *, IWindowActivatedEventArgs *args) -{ - Q_D(QWinRTScreen); - qCDebug(lcQpaWindows) << __FUNCTION__; - - CoreWindowActivationState activationState; - args->get_WindowActivationState(&activationState); - if (activationState == CoreWindowActivationState_Deactivated) { - QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationInactive); - return S_OK; - } - - QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationActive); - - // Activate topWindow - if (!d->visibleWindows.isEmpty()) { - Qt::FocusReason focusReason = activationState == CoreWindowActivationState_PointerActivated - ? Qt::MouseFocusReason : Qt::ActiveWindowFocusReason; - QWindowSystemInterface::handleWindowActivated(topWindow(), focusReason); - } - return S_OK; -} - -HRESULT QWinRTScreen::onClosed(ICoreWindow *, ICoreWindowEventArgs *) -{ - qCDebug(lcQpaWindows) << __FUNCTION__; - - foreach (QWindow *w, QGuiApplication::topLevelWindows()) - QWindowSystemInterface::handleCloseEvent(w); - return S_OK; -} - -HRESULT QWinRTScreen::onVisibilityChanged(ICoreWindow *, IVisibilityChangedEventArgs *args) -{ - Q_D(QWinRTScreen); - boolean visible; - HRESULT hr = args ? args->get_Visible(&visible) : d->coreWindow->get_Visible(&visible); - RETURN_OK_IF_FAILED("Failed to get visibility."); - qCDebug(lcQpaWindows) << __FUNCTION__ << visible; - QWindowSystemInterface::handleApplicationStateChanged(visible ? Qt::ApplicationActive : Qt::ApplicationHidden); - if (visible) { - handleExpose(); - onWindowSizeChanged(nullptr, nullptr); - } - return S_OK; -} - -HRESULT QWinRTScreen::onOrientationChanged(IDisplayInformation *, IInspectable *) -{ - Q_D(QWinRTScreen); - qCDebug(lcQpaWindows) << __FUNCTION__; - DisplayOrientations displayOrientation; - HRESULT hr = d->displayInformation->get_CurrentOrientation(&displayOrientation); - RETURN_OK_IF_FAILED("Failed to get current orientations."); - - Qt::ScreenOrientation newOrientation = static_cast(static_cast(qtOrientationsFromNative(displayOrientation))); - if (d->orientation != newOrientation) { - d->orientation = newOrientation; - qCDebug(lcQpaWindows) << " New orientation:" << newOrientation; - onWindowSizeChanged(nullptr, nullptr); - QWindowSystemInterface::handleScreenOrientationChange(screen(), d->orientation); - handleExpose(); // Clean broken frames caused by race between Qt and ANGLE - } - return S_OK; -} - -HRESULT QWinRTScreen::onDpiChanged(IDisplayInformation *, IInspectable *) -{ - Q_D(QWinRTScreen); - - HRESULT hr; - ResolutionScale resolutionScale; - hr = d->displayInformation->get_ResolutionScale(&resolutionScale); - d->scaleFactor = qreal(resolutionScale) / 100; - - qCDebug(lcQpaWindows) << __FUNCTION__ << "Scale Factor:" << d->scaleFactor; - - RETURN_OK_IF_FAILED("Failed to get scale factor"); - - FLOAT dpi; - hr = d->displayInformation->get_LogicalDpi(&dpi); - RETURN_OK_IF_FAILED("Failed to get logical DPI."); - d->logicalDpi = dpi; - - hr = d->displayInformation->get_RawDpiX(&dpi); - RETURN_OK_IF_FAILED("Failed to get x raw DPI."); - d->physicalDpi.first = dpi ? dpi : 96.0; - - hr = d->displayInformation->get_RawDpiY(&dpi); - RETURN_OK_IF_FAILED("Failed to get y raw DPI."); - d->physicalDpi.second = dpi ? dpi : 96.0; - qCDebug(lcQpaWindows) << __FUNCTION__ << "Logical DPI:" << d->logicalDpi - << "Physical DPI:" << d->physicalDpi; - - return S_OK; -} - -HRESULT QWinRTScreen::onRedirectReleased(ICorePointerRedirector *, IPointerEventArgs *args) -{ - // When dragging ends with a non-mouse input device then onRedirectRelease is invoked. - // QTBUG-58781 - qCDebug(lcQpaEvents) << __FUNCTION__; - return onPointerUpdated(nullptr, args); -} - -HRESULT QWinRTScreen::onWindowSizeChanged(IApplicationView *w, IInspectable *) -{ - Q_D(QWinRTScreen); - - HRESULT hr; - Rect windowSize; - - hr = d->coreWindow->get_Bounds(&windowSize); - RETURN_OK_IF_FAILED("Failed to get window bounds"); - d->logicalRect = QRectF(windowSize.X, windowSize.Y, windowSize.Width, windowSize.Height); - - Rect visibleRect; - hr = d->view2->get_VisibleBounds(&visibleRect); - RETURN_OK_IF_FAILED("Failed to get window visible bounds"); - d->visibleRect = QRectF(visibleRect.X, visibleRect.Y, visibleRect.Width, visibleRect.Height); - - qCDebug(lcQpaWindows) << __FUNCTION__ << d->logicalRect; - QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), availableGeometry()); - QPlatformScreen::resizeMaximizedWindows(); - handleExpose(); - // If we "emulate" a resize, w will be nullptr.Checking w shows whether it's a real resize - if (w) - d->resizePending = false; - return S_OK; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/winrt/qwinrtscreen.h b/src/plugins/platforms/winrt/qwinrtscreen.h deleted file mode 100644 index 6b57780fa1..0000000000 --- a/src/plugins/platforms/winrt/qwinrtscreen.h +++ /dev/null @@ -1,168 +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 QWINRTSCREEN_H -#define QWINRTSCREEN_H - -#include -#include - -namespace ABI { - namespace Windows { - namespace ApplicationModel { - struct ISuspendingEventArgs; - } - namespace UI { - namespace Core { - struct IAutomationProviderRequestedEventArgs; - struct ICharacterReceivedEventArgs; - struct ICorePointerRedirector; - struct ICoreWindow; - struct ICoreWindowEventArgs; - struct IKeyEventArgs; - struct IPointerEventArgs; - struct IVisibilityChangedEventArgs; - struct IWindowActivatedEventArgs; - } - namespace Xaml { - struct IDependencyObject; - struct IWindow; - } - namespace ViewManagement { - struct IApplicationView; - } - } - namespace Graphics { - namespace Display { - struct IDisplayInformation; - } - } - } -} -struct IInspectable; - -QT_BEGIN_NAMESPACE - -class QTouchDevice; -class QWinRTCursor; -class QWinRTInputContext; -class QWinRTScreenPrivate; -class QWinRTWindow; -class QWinRTScreen : public QPlatformScreen -{ -public: - explicit QWinRTScreen(); - ~QWinRTScreen() override; - - QRect geometry() const override; - QRect availableGeometry() const override; - int depth() const override; - QImage::Format format() const override; - QSizeF physicalSize() const override; - QDpi logicalDpi() const override; - qreal scaleFactor() const; - QPlatformCursor *cursor() const override; - Qt::KeyboardModifiers keyboardModifiers() const; - - Qt::ScreenOrientation nativeOrientation() const override; - Qt::ScreenOrientation orientation() const override; - - QWindow *topWindow() const; - QWindow *windowAt(const QPoint &pos); - void addWindow(QWindow *window); - void removeWindow(QWindow *window); - void raise(QWindow *window); - void lower(QWindow *window); - - bool setMouseGrabWindow(QWinRTWindow *window, bool grab); - QWinRTWindow* mouseGrabWindow() const; - - bool setKeyboardGrabWindow(QWinRTWindow *window, bool grab); - QWinRTWindow* keyboardGrabWindow() const; - - void updateWindowTitle(const QString &title); - - ABI::Windows::UI::Core::ICoreWindow *coreWindow() const; - ABI::Windows::UI::Xaml::IDependencyObject *canvas() const; - - void initialize(); - - void setCursorRect(const QRectF &cursorRect); - void setKeyboardRect(const QRectF &keyboardRect); - - enum class MousePositionTransition { - MovedOut, - MovedIn, - StayedIn, - StayedOut - }; - - void emulateMouseMove(const QPointF &point, MousePositionTransition transition); - - void setResizePending(); - bool resizePending() const; - -private: - void handleExpose(); - - HRESULT onKeyDown(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IKeyEventArgs *); - HRESULT onKeyUp(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IKeyEventArgs *); - HRESULT onCharacterReceived(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::ICharacterReceivedEventArgs *); - HRESULT onPointerEntered(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IPointerEventArgs *); - HRESULT onPointerExited(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IPointerEventArgs *); - HRESULT onPointerUpdated(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IPointerEventArgs *); - - HRESULT onActivated(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IWindowActivatedEventArgs *); - - HRESULT onClosed(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::ICoreWindowEventArgs *); - HRESULT onVisibilityChanged(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IVisibilityChangedEventArgs *); - - HRESULT onOrientationChanged(ABI::Windows::Graphics::Display::IDisplayInformation *, IInspectable *); - HRESULT onDpiChanged(ABI::Windows::Graphics::Display::IDisplayInformation *, IInspectable *); - HRESULT onWindowSizeChanged(ABI::Windows::UI::ViewManagement::IApplicationView *, IInspectable *); - HRESULT onRedirectReleased(ABI::Windows::UI::Core::ICorePointerRedirector *, ABI::Windows::UI::Core::IPointerEventArgs *); - - QScopedPointer d_ptr; - QRectF mCursorRect; - Q_DECLARE_PRIVATE(QWinRTScreen) -}; - -QT_END_NAMESPACE - -#endif // QWINRTSCREEN_H diff --git a/src/plugins/platforms/winrt/qwinrtservices.cpp b/src/plugins/platforms/winrt/qwinrtservices.cpp deleted file mode 100644 index 04d7417801..0000000000 --- a/src/plugins/platforms/winrt/qwinrtservices.cpp +++ /dev/null @@ -1,154 +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$ -** -****************************************************************************/ - -#include "qwinrtservices.h" -#include "qwinrtfileengine.h" -#include -#include -#include -#include -#include - -#include -#include -#include -#include -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Storage; -using namespace ABI::Windows::System; - -QT_BEGIN_NAMESPACE - -class QWinRTServicesPrivate -{ -public: - ComPtr uriFactory; - ComPtr fileFactory; - ComPtr launcher; -}; - -QWinRTServices::QWinRTServices() - : d_ptr(new QWinRTServicesPrivate) -{ - Q_D(QWinRTServices); - - HRESULT hr; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Foundation_Uri).Get(), - IID_PPV_ARGS(&d->uriFactory)); - Q_ASSERT_X(SUCCEEDED(hr), Q_FUNC_INFO, qPrintable(qt_error_string(hr))); - - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Storage_StorageFile).Get(), - IID_PPV_ARGS(&d->fileFactory)); - Q_ASSERT_X(SUCCEEDED(hr), Q_FUNC_INFO, qPrintable(qt_error_string(hr))); - - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_System_Launcher).Get(), - IID_PPV_ARGS(&d->launcher)); - Q_ASSERT_X(SUCCEEDED(hr), Q_FUNC_INFO, qPrintable(qt_error_string(hr))); -} - -bool QWinRTServices::openUrl(const QUrl &url) -{ - Q_D(QWinRTServices); - - ComPtr uri; - QString urlString = url.toString(); - HStringReference uriString(reinterpret_cast(urlString.utf16()), - uint(urlString.length())); - HRESULT hr = d->uriFactory->CreateUri(uriString.Get(), &uri); - RETURN_FALSE_IF_FAILED("Failed to create URI from QUrl."); - - boolean result; - hr = QEventDispatcherWinRT::runOnXamlThread([this, d, uri, &result]() { - ComPtr> op; - HRESULT hr = d->launcher->LaunchUriAsync(uri.Get(), &op); - RETURN_HR_IF_FAILED("Failed to start URI launch."); - - hr = QWinRTFunctions::await(op, &result); - RETURN_HR_IF_FAILED("Failed to launch URI."); - return hr; - }); - RETURN_FALSE_IF_FAILED("Failed to launch URI from Xaml thread."); - - return result; -} - -bool QWinRTServices::openDocument(const QUrl &url) -{ - Q_D(QWinRTServices); - - HRESULT hr; - ComPtr file; - ComPtr item = QWinRTFileEngineHandler::registeredFile(url.toLocalFile()); - if (item) { - hr = item.As(&file); - if (FAILED(hr)) - qErrnoWarning(hr, "Failed to cast picked item to a file"); - } - if (!file) { - const QString pathString = QDir::toNativeSeparators(url.toLocalFile()); - HStringReference path(reinterpret_cast(pathString.utf16()), - uint(pathString.length())); - ComPtr> op; - hr = d->fileFactory->GetFileFromPathAsync(path.Get(), &op); - RETURN_FALSE_IF_FAILED("Failed to initialize file URI."); - - hr = QWinRTFunctions::await(op, file.GetAddressOf()); - RETURN_FALSE_IF_FAILED("Failed to get file URI."); - } - - boolean result; - { - hr = QEventDispatcherWinRT::runOnXamlThread([this, d, file, &result]() { - ComPtr> op; - HRESULT hr = d->launcher->LaunchFileAsync(file.Get(), &op); - RETURN_HR_IF_FAILED("Failed to start file launch."); - - hr = QWinRTFunctions::await(op, &result); - RETURN_HR_IF_FAILED("Failed to launch file."); - return hr; - }); - RETURN_FALSE_IF_FAILED("Failed to launch file from Xaml thread."); - } - - return result; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/winrt/qwinrtservices.h b/src/plugins/platforms/winrt/qwinrtservices.h deleted file mode 100644 index 202ce722cf..0000000000 --- a/src/plugins/platforms/winrt/qwinrtservices.h +++ /dev/null @@ -1,65 +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 QWINRTSERVICES_H -#define QWINRTSERVICES_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class QWinRTServicesPrivate; -class QWinRTServices : public QPlatformServices -{ -public: - explicit QWinRTServices(); - ~QWinRTServices() override = default; - - bool openUrl(const QUrl &url) override; - bool openDocument(const QUrl &url) override; - -private: - QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QWinRTServices) -}; - -QT_END_NAMESPACE - -#endif // QWINRTSERVICES_H diff --git a/src/plugins/platforms/winrt/qwinrttheme.cpp b/src/plugins/platforms/winrt/qwinrttheme.cpp deleted file mode 100644 index 0e1504b1c1..0000000000 --- a/src/plugins/platforms/winrt/qwinrttheme.cpp +++ /dev/null @@ -1,342 +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$ -** -****************************************************************************/ - -#include "qwinrttheme.h" -#include "qwinrtmessagedialoghelper.h" -#include "qwinrtfiledialoghelper.h" - -#include -#include - -#include - -#include -#include -#include -#if _MSC_VER >= 1900 -#include -using namespace ABI::Windows::Foundation::Metadata; -#endif - -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::UI; -using namespace ABI::Windows::UI::ViewManagement; - -QT_BEGIN_NAMESPACE - -Q_LOGGING_CATEGORY(lcQpaTheme, "qt.qpa.theme") - -class QWinRTApiInformationHandler { -public: - QWinRTApiInformationHandler() - { - HRESULT hr; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Foundation_Metadata_ApiInformation).Get(), - IID_PPV_ARGS(&m_apiInformationStatics)); - Q_ASSERT_SUCCEEDED(hr); - } - - ComPtr apiInformationStatics() const - { - return m_apiInformationStatics; - } - -private: - ComPtr m_apiInformationStatics; -}; -Q_GLOBAL_STATIC(QWinRTApiInformationHandler, gApiHandler); - -static IUISettings *uiSettings() -{ - static ComPtr settings; - if (!settings) { - HRESULT hr; - hr = RoActivateInstance(Wrappers::HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_UISettings).Get(), - &settings); - Q_ASSERT_SUCCEEDED(hr); - } - return settings.Get(); -} - -class QWinRTThemePrivate -{ -public: - QWinRTThemePrivate() - : monospaceFont(QWinRTFontDatabase::familyForStyleHint(QFont::Monospace)) - { - } - - QPalette palette; - QFont monospaceFont; -}; - -static inline QColor fromColor(const Color &color) -{ - return QColor(color.R, color.G, color.B, color.A); -} - -static bool uiColorSettings(const wchar_t *value, UIElementType type, Color *color) -{ - ComPtr apiInformationStatics = gApiHandler->apiInformationStatics(); - if (!apiInformationStatics) { - qErrnoWarning("Could not get ApiInformationStatics"); - return false; - } - - static const HStringReference enumRef(L"Windows.UI.ViewManagement.UIElementType"); - HStringReference valueRef(value); - - HRESULT hr; - boolean exists; - hr = apiInformationStatics->IsEnumNamedValuePresent(enumRef.Get(), valueRef.Get(), &exists); - - if (hr != S_OK || !exists) - return false; - - return SUCCEEDED(uiSettings()->UIElementColor(type, color)); -} - -static void nativeColorSettings(QPalette &p) -{ - Color color; - - if (uiColorSettings(L"ActiveCaption", UIElementType_ActiveCaption, &color)) - p.setColor(QPalette::ToolTipBase, fromColor(color)); - - if (uiColorSettings(L"Background", UIElementType_Background, &color)) - p.setColor(QPalette::AlternateBase, fromColor(color)); - - if (uiColorSettings(L"ButtonFace", UIElementType_ButtonFace, &color)) { - p.setColor(QPalette::Button, fromColor(color)); - p.setColor(QPalette::Midlight, fromColor(color).lighter(110)); - p.setColor(QPalette::Light, fromColor(color).lighter(150)); - p.setColor(QPalette::Mid, fromColor(color).dark(130)); - p.setColor(QPalette::Dark, fromColor(color).dark(150)); - } - - if (uiColorSettings(L"ButtonText", UIElementType_ButtonText, &color)) { - p.setColor(QPalette::ButtonText, fromColor(color)); - p.setColor(QPalette::Text, fromColor(color)); - } - - if (uiColorSettings(L"CaptionText", UIElementType_CaptionText, &color)) - p.setColor(QPalette::ToolTipText, fromColor(color)); - - if (uiColorSettings(L"Highlight", UIElementType_Highlight, &color)) - p.setColor(QPalette::Highlight, fromColor(color)); - - if (uiColorSettings(L"HighlightText", UIElementType_HighlightText, &color)) - p.setColor(QPalette::HighlightedText, fromColor(color)); - - if (uiColorSettings(L"Window", UIElementType_Window, &color)) { - p.setColor(QPalette::Window, fromColor(color)); - p.setColor(QPalette::Base, fromColor(color)); - } - - if (uiColorSettings(L"Hotlight", UIElementType_Hotlight, &color)) - p.setColor(QPalette::BrightText, fromColor(color)); - - // Starting with SDK 15063 those have been removed. -#ifndef QT_WINRT_DISABLE_PHONE_COLORS - //Phone related - ComPtr apiInformationStatics = gApiHandler->apiInformationStatics(); - boolean phoneApiPresent = false; - HRESULT hr; - HStringReference phoneRef(L"Windows.Phone.PhoneContract"); - hr = apiInformationStatics.Get()->IsApiContractPresentByMajor(phoneRef.Get(), 1, &phoneApiPresent); - if (FAILED(hr) || !phoneApiPresent) - return; - - if (uiColorSettings(L"PopupBackground", UIElementType_PopupBackground, &color)) { - p.setColor(QPalette::ToolTipBase, fromColor(color)); - p.setColor(QPalette::AlternateBase, fromColor(color)); - } - - if (uiColorSettings(L"NonTextMedium", UIElementType_NonTextMedium, &color)) - p.setColor(QPalette::Button, fromColor(color)); - - if (uiColorSettings(L"NonTextMediumHigh", UIElementType_NonTextMediumHigh, &color)) - p.setColor(QPalette::Midlight, fromColor(color)); - - if (uiColorSettings(L"NonTextHigh", UIElementType_NonTextHigh, &color)) - p.setColor(QPalette::Light, fromColor(color)); - - if (uiColorSettings(L"NonTextMediumLow", UIElementType_NonTextMediumLow, &color)) - p.setColor(QPalette::Mid, fromColor(color)); - - if (uiColorSettings(L"NonTextLow", UIElementType_NonTextLow, &color)) - p.setColor(QPalette::Dark, fromColor(color)); - - if (uiColorSettings(L"TextHigh", UIElementType_TextHigh, &color)) { - p.setColor(QPalette::ButtonText, fromColor(color)); - p.setColor(QPalette::Text, fromColor(color)); - p.setColor(QPalette::WindowText, fromColor(color)); - } - - if (uiColorSettings(L"TextMedium", UIElementType_TextMedium, &color)) - p.setColor(QPalette::ToolTipText, fromColor(color)); - - if (uiColorSettings(L"AccentColor", UIElementType_AccentColor, &color)) - p.setColor(QPalette::Highlight, fromColor(color)); - - if (uiColorSettings(L"PageBackground", UIElementType_PageBackground, &color)) { - p.setColor(QPalette::Window, fromColor(color)); - p.setColor(QPalette::Base, fromColor(color)); - } - - if (uiColorSettings(L"TextContrastWithHigh", UIElementType_TextContrastWithHigh, &color)) - p.setColor(QPalette::BrightText, fromColor(color)); -#endif // QT_WINRT_DISABLE_PHONE_COLORS -} - -QWinRTTheme::QWinRTTheme() - : d_ptr(new QWinRTThemePrivate) -{ - Q_D(QWinRTTheme); - qCDebug(lcQpaTheme) << __FUNCTION__; - - nativeColorSettings(d->palette); -} - -bool QWinRTTheme::usePlatformNativeDialog(DialogType type) const -{ - qCDebug(lcQpaTheme) << __FUNCTION__ << type; - static bool useNativeDialogs = qEnvironmentVariableIsSet("QT_USE_WINRT_NATIVE_DIALOGS") - ? qEnvironmentVariableIntValue("QT_USE_WINRT_NATIVE_DIALOGS") : true; - - if (type == FileDialog || type == MessageDialog) - return useNativeDialogs; - return false; -} - -QPlatformDialogHelper *QWinRTTheme::createPlatformDialogHelper(DialogType type) const -{ - qCDebug(lcQpaTheme) << __FUNCTION__ << type; - switch (type) { - case FileDialog: - return new QWinRTFileDialogHelper; - case MessageDialog: - return new QWinRTMessageDialogHelper(this); - default: - break; - } - return QPlatformTheme::createPlatformDialogHelper(type); -} - -QVariant QWinRTTheme::styleHint(QPlatformIntegration::StyleHint hint) -{ - qCDebug(lcQpaTheme) << __FUNCTION__ << hint; - HRESULT hr; - switch (hint) { - case QPlatformIntegration::CursorFlashTime: { - quint32 blinkRate; - hr = uiSettings()->get_CaretBlinkRate(&blinkRate); - RETURN_IF_FAILED("Failed to get caret blink rate", return defaultThemeHint(CursorFlashTime)); - return blinkRate; - } - case QPlatformIntegration::KeyboardInputInterval: - return defaultThemeHint(KeyboardInputInterval); - case QPlatformIntegration::MouseDoubleClickInterval: { - quint32 doubleClickTime; - hr = uiSettings()->get_DoubleClickTime(&doubleClickTime); - RETURN_IF_FAILED("Failed to get double click time", return defaultThemeHint(MouseDoubleClickInterval)); - return doubleClickTime; - } - case QPlatformIntegration::StartDragDistance: - return defaultThemeHint(StartDragDistance); - case QPlatformIntegration::StartDragTime: - return defaultThemeHint(StartDragTime); - case QPlatformIntegration::KeyboardAutoRepeatRate: - return defaultThemeHint(KeyboardAutoRepeatRate); - case QPlatformIntegration::ShowIsFullScreen: - return false; - case QPlatformIntegration::PasswordMaskDelay: - return defaultThemeHint(PasswordMaskDelay); - case QPlatformIntegration::FontSmoothingGamma: - return qreal(1.7); - case QPlatformIntegration::StartDragVelocity: - return defaultThemeHint(StartDragVelocity); - case QPlatformIntegration::UseRtlExtensions: - return false; - case QPlatformIntegration::PasswordMaskCharacter: - return defaultThemeHint(PasswordMaskCharacter); - case QPlatformIntegration::SetFocusOnTouchRelease: - return true; - case QPlatformIntegration::ShowIsMaximized: - return true; - case QPlatformIntegration::MousePressAndHoldInterval: - return defaultThemeHint(MousePressAndHoldInterval); - default: - break; - } - return QVariant(); -} - -QVariant QWinRTTheme::themeHint(ThemeHint hint) const -{ - qCDebug(lcQpaTheme) << __FUNCTION__ << hint; - switch (hint) { - case StyleNames: - return QStringList() << QStringLiteral("fusion") << QStringLiteral("windows"); - default: - return QPlatformTheme::themeHint(hint); - } -} - -const QPalette *QWinRTTheme::palette(Palette type) const -{ - Q_D(const QWinRTTheme); - qCDebug(lcQpaTheme) << __FUNCTION__ << type; - if (type == SystemPalette) - return &d->palette; - return QPlatformTheme::palette(type); -} - -const QFont *QWinRTTheme::font(QPlatformTheme::Font type) const -{ - Q_D(const QWinRTTheme); - qCDebug(lcQpaTheme) << __FUNCTION__ << type; - if (type == QPlatformTheme::FixedFont) - return &d->monospaceFont; - - return QPlatformTheme::font(type); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/winrt/qwinrttheme.h b/src/plugins/platforms/winrt/qwinrttheme.h deleted file mode 100644 index acf5a54a94..0000000000 --- a/src/plugins/platforms/winrt/qwinrttheme.h +++ /dev/null @@ -1,72 +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 QWINRTTHEME_H -#define QWINRTTHEME_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -Q_DECLARE_LOGGING_CATEGORY(lcQpaTheme) - -class QWinRTThemePrivate; -class QWinRTTheme : public QPlatformTheme -{ -public: - QWinRTTheme(); - - bool usePlatformNativeDialog(DialogType type) const override; - QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const override; - - const QPalette *palette(Palette type = SystemPalette) const override; - const QFont *font(Font type = SystemFont) const override; - - static QVariant styleHint(QPlatformIntegration::StyleHint hint); - QVariant themeHint(ThemeHint hint) const override; -private: - QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QWinRTTheme) -}; - -QT_END_NAMESPACE - -#endif // QWINRTTHEME_H diff --git a/src/plugins/platforms/winrt/qwinrtwindow.cpp b/src/plugins/platforms/winrt/qwinrtwindow.cpp deleted file mode 100644 index 73816b6512..0000000000 --- a/src/plugins/platforms/winrt/qwinrtwindow.cpp +++ /dev/null @@ -1,438 +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$ -** -****************************************************************************/ - -#include "qwinrtwindow.h" -#include "qwinrtscreen.h" -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -using namespace ABI::Windows::UI::ViewManagement; -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Foundation::Collections; -using namespace ABI::Windows::UI; -using namespace ABI::Windows::UI::Xaml; -using namespace ABI::Windows::UI::Xaml::Controls; - -QT_BEGIN_NAMESPACE - -Q_LOGGING_CATEGORY(lcQpaWindows, "qt.qpa.windows"); - -static void setUIElementVisibility(IUIElement *uiElement, bool visibility) -{ - Q_ASSERT(uiElement); - QEventDispatcherWinRT::runOnXamlThread([uiElement, visibility]() { - HRESULT hr; - hr = uiElement->put_Visibility(visibility ? Visibility_Visible : Visibility_Collapsed); - Q_ASSERT_SUCCEEDED(hr); - return S_OK; - }); -} - -class QWinRTWindowPrivate -{ -public: - QWinRTScreen *screen; - - QSurfaceFormat surfaceFormat; - QString windowTitle; - Qt::WindowStates state; - EGLDisplay display; - EGLSurface surface; - - ComPtr swapChainPanel; - ComPtr canvas; - ComPtr uiElement; -}; - -QWinRTWindow::QWinRTWindow(QWindow *window) - : QPlatformWindow(window) - , d_ptr(new QWinRTWindowPrivate) -{ - Q_D(QWinRTWindow); - qCDebug(lcQpaWindows) << __FUNCTION__ << this; - - d->surface = EGL_NO_SURFACE; - d->display = EGL_NO_DISPLAY; - d->screen = static_cast(screen()); - handleContentOrientationChange(window->contentOrientation()); - - d->surfaceFormat.setMajorVersion(3); - d->surfaceFormat.setMinorVersion(0); - d->surfaceFormat.setAlphaBufferSize(0); - d->surfaceFormat.setRedBufferSize(8); - d->surfaceFormat.setGreenBufferSize(8); - d->surfaceFormat.setBlueBufferSize(8); - d->surfaceFormat.setDepthBufferSize(24); - d->surfaceFormat.setStencilBufferSize(8); - d->surfaceFormat.setRenderableType(QSurfaceFormat::OpenGLES); - d->surfaceFormat.setSamples(1); - d->surfaceFormat.setSwapBehavior(QSurfaceFormat::DoubleBuffer); - - HRESULT hr; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_Xaml_Controls_Canvas).Get(), - IID_PPV_ARGS(&d->canvas)); - Q_ASSERT_SUCCEEDED(hr); - hr = QEventDispatcherWinRT::runOnXamlThread([d]() { - // Create a new swapchain and place it inside the canvas - HRESULT hr; - hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_UI_Xaml_Controls_SwapChainPanel).Get(), - &d->swapChainPanel); - Q_ASSERT_SUCCEEDED(hr); - hr = d->swapChainPanel.As(&d->uiElement); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr frameworkElement; - hr = d->swapChainPanel.As(&frameworkElement); - Q_ASSERT_SUCCEEDED(hr); - const QSizeF size = QSizeF(d->screen->geometry().size()) / d->screen->scaleFactor(); - hr = frameworkElement->put_Width(size.width()); - Q_ASSERT_SUCCEEDED(hr); - hr = frameworkElement->put_Height(size.height()); - Q_ASSERT_SUCCEEDED(hr); - - ComPtr canvas = d->screen->canvas(); - ComPtr panel; - hr = canvas.As(&panel); - Q_ASSERT_SUCCEEDED(hr); - ComPtr> children; - hr = panel->get_Children(&children); - Q_ASSERT_SUCCEEDED(hr); - hr = children->Append(d->uiElement.Get()); - Q_ASSERT_SUCCEEDED(hr); - return S_OK; - }); - Q_ASSERT_SUCCEEDED(hr); - - setWindowFlags(window->flags()); - setWindowState(window->windowStates()); - setWindowTitle(window->title()); - - setGeometry(window->geometry()); -} - -QWinRTWindow::~QWinRTWindow() -{ - Q_D(QWinRTWindow); - qCDebug(lcQpaWindows) << __FUNCTION__ << this; - - HRESULT hr; - hr = QEventDispatcherWinRT::runOnXamlThread([d]() { - HRESULT hr; - ComPtr canvas = d->screen->canvas(); - ComPtr panel; - hr = canvas.As(&panel); - Q_ASSERT_SUCCEEDED(hr); - ComPtr> children; - hr = panel->get_Children(&children); - Q_ASSERT_SUCCEEDED(hr); - quint32 index; - boolean found; - hr = children->IndexOf(d->uiElement.Get(), &index, &found); - Q_ASSERT_SUCCEEDED(hr); - if (found) { - hr = children->RemoveAt(index); - Q_ASSERT_SUCCEEDED(hr); - } - return S_OK; - }); - RETURN_VOID_IF_FAILED("Failed to completely destroy window resources, likely because the application is shutting down"); - - if (d->screen->mouseGrabWindow() == this) - d->screen->setMouseGrabWindow(this, false); - if (d->screen->keyboardGrabWindow() == this) - d->screen->setKeyboardGrabWindow(this, false); - - d->screen->removeWindow(window()); - - if (!d->surface) - return; - - qCDebug(lcQpaWindows) << __FUNCTION__ << ": Destroying surface"; - - EGLBoolean value = eglDestroySurface(d->display, d->surface); - d->surface = EGL_NO_SURFACE; - if (Q_UNLIKELY(value == EGL_FALSE)) - qCritical("Failed to destroy EGL window surface: 0x%x", eglGetError()); -} - -QSurfaceFormat QWinRTWindow::format() const -{ - Q_D(const QWinRTWindow); - return d->surfaceFormat; -} - -bool QWinRTWindow::isActive() const -{ - Q_D(const QWinRTWindow); - return d->screen->topWindow() == window(); -} - -bool QWinRTWindow::isExposed() const -{ - Q_D(const QWinRTWindow); - const bool exposed = isActive() && !d->screen->resizePending(); - return exposed; -} - -void QWinRTWindow::setGeometry(const QRect &rect) -{ - Q_D(QWinRTWindow); - qCDebug(lcQpaWindows) << __FUNCTION__ << this << rect; - - const Qt::WindowFlags windowFlags = window()->flags(); - const Qt::WindowFlags windowType = windowFlags & Qt::WindowType_Mask; - if (window()->isTopLevel() && (windowType == Qt::Window || windowType == Qt::Dialog)) { - const QRect screenRect = windowFlags & Qt::MaximizeUsingFullscreenGeometryHint - ? d->screen->geometry() : d->screen->availableGeometry(); - qCDebug(lcQpaWindows) << __FUNCTION__ << "top-level, overwrite" << screenRect; - QPlatformWindow::setGeometry(screenRect); - QWindowSystemInterface::handleGeometryChange(window(), geometry()); - } else { - QPlatformWindow::setGeometry(rect); - QWindowSystemInterface::handleGeometryChange(window(), rect); - } - - HRESULT hr; - hr = QEventDispatcherWinRT::runOnXamlThread([this, d]() { - HRESULT hr; - const QRect windowGeometry = geometry(); - const QPointF topLeft= QPointF(windowGeometry.topLeft()) / d->screen->scaleFactor(); - hr = d->canvas->SetTop(d->uiElement.Get(), topLeft.y()); - Q_ASSERT_SUCCEEDED(hr); - hr = d->canvas->SetLeft(d->uiElement.Get(), topLeft.x()); - Q_ASSERT_SUCCEEDED(hr); - ComPtr frameworkElement; - hr = d->swapChainPanel.As(&frameworkElement); - Q_ASSERT_SUCCEEDED(hr); - const QSizeF size = QSizeF(windowGeometry.size()) / d->screen->scaleFactor(); - hr = frameworkElement->put_Width(size.width()); - Q_ASSERT_SUCCEEDED(hr); - hr = frameworkElement->put_Height(size.height()); - Q_ASSERT_SUCCEEDED(hr); - qCDebug(lcQpaWindows) << __FUNCTION__ << "(setGeometry Xaml)" << this - << topLeft << size; - return S_OK; - }); - Q_ASSERT_SUCCEEDED(hr); -} - -void QWinRTWindow::setVisible(bool visible) -{ - Q_D(QWinRTWindow); - qCDebug(lcQpaWindows) << __FUNCTION__ << this << visible; - - if (!window()->isTopLevel()) - return; - if (visible) { - d->screen->addWindow(window()); - setUIElementVisibility(d->uiElement.Get(), d->state != Qt::WindowMinimized); - } else { - d->screen->removeWindow(window()); - setUIElementVisibility(d->uiElement.Get(), false); - } -} - -void QWinRTWindow::setWindowTitle(const QString &title) -{ - Q_D(QWinRTWindow); - d->windowTitle = title; - - if (d->screen->topWindow() == window()) - d->screen->updateWindowTitle(title); -} - -void QWinRTWindow::raise() -{ - Q_D(QWinRTWindow); - qCDebug(lcQpaWindows) << __FUNCTION__ << this; - if (!window()->isTopLevel()) - return; - d->screen->raise(window()); -} - -void QWinRTWindow::lower() -{ - Q_D(QWinRTWindow); - qCDebug(lcQpaWindows) << __FUNCTION__ << this; - if (!window()->isTopLevel()) - return; - d->screen->lower(window()); -} - -WId QWinRTWindow::winId() const -{ - Q_D(const QWinRTWindow); - return WId(d->swapChainPanel.Get()); -} - -qreal QWinRTWindow::devicePixelRatio() const -{ - return screen()->devicePixelRatio(); -} - -void QWinRTWindow::setWindowState(Qt::WindowStates state) -{ - Q_D(QWinRTWindow); - qCDebug(lcQpaWindows) << __FUNCTION__ << this << state; - - if (d->state == state) - return; - - if (state & Qt::WindowMinimized) { - setUIElementVisibility(d->uiElement.Get(), false); - d->state = state; - return; - } - - if (state & Qt::WindowFullScreen) { - HRESULT hr; - boolean success; - hr = QEventDispatcherWinRT::runOnXamlThread([&hr, &success]() { - ComPtr applicationViewStatics; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_ApplicationView).Get(), - IID_PPV_ARGS(&applicationViewStatics)); - RETURN_HR_IF_FAILED("Could not access application view statics."); - ComPtr view; - hr = applicationViewStatics->GetForCurrentView(&view); - RETURN_HR_IF_FAILED("Could not access application view."); - ComPtr view3; - hr = view.As(&view3); - Q_ASSERT_SUCCEEDED(hr); - hr = view3->TryEnterFullScreenMode(&success); - return hr; - }); - if (FAILED(hr) || !success) { - qCDebug(lcQpaWindows) << "Failed to enter full screen mode."; - return; - } - d->screen->setResizePending(); - d->state = state; - return; - } - - if (d->state & Qt::WindowFullScreen) { - HRESULT hr; - hr = QEventDispatcherWinRT::runOnXamlThread([&hr]() { - ComPtr applicationViewStatics; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_ApplicationView).Get(), - IID_PPV_ARGS(&applicationViewStatics)); - RETURN_HR_IF_FAILED("Could not access application view statics."); - ComPtr view; - hr = applicationViewStatics->GetForCurrentView(&view); - RETURN_HR_IF_FAILED("Could not access application view."); - ComPtr view3; - hr = view.As(&view3); - Q_ASSERT_SUCCEEDED(hr); - hr = view3->ExitFullScreenMode(); - return hr; - }); - if (FAILED(hr)) { - qCDebug(lcQpaWindows) << "Failed to exit full screen mode."; - return; - } - d->screen->setResizePending(); - } - - if (d->state & Qt::WindowMinimized || state == Qt::WindowNoState || state == Qt::WindowActive) - setUIElementVisibility(d->uiElement.Get(), true); - - d->state = state; -} - -bool QWinRTWindow::setMouseGrabEnabled(bool grab) -{ - Q_D(QWinRTWindow); - if (!isActive() && grab) { - qWarning("%s: Not setting mouse grab for invisible window %s/'%s'", - __FUNCTION__, window()->metaObject()->className(), - qPrintable(window()->objectName())); - return false; - } - return d->screen->setMouseGrabWindow(this, grab); -} - -bool QWinRTWindow::setKeyboardGrabEnabled(bool grab) -{ - Q_D(QWinRTWindow); - return d->screen->setKeyboardGrabWindow(this, grab); -} - -EGLSurface QWinRTWindow::eglSurface() const -{ - Q_D(const QWinRTWindow); - return d->surface; -} - -void QWinRTWindow::createEglSurface(EGLDisplay display, EGLConfig config) -{ - Q_D(QWinRTWindow); - if (d->surface == EGL_NO_SURFACE) { - d->display = display; - QEventDispatcherWinRT::runOnXamlThread([this, d, display, config]() { - d->surface = eglCreateWindowSurface(display, config, - reinterpret_cast(winId()), - nullptr); - if (Q_UNLIKELY(d->surface == EGL_NO_SURFACE)) - qCritical("Failed to create EGL window surface: 0x%x", eglGetError()); - return S_OK; - }); - } -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/winrt/qwinrtwindow.h b/src/plugins/platforms/winrt/qwinrtwindow.h deleted file mode 100644 index 0445e6bf54..0000000000 --- a/src/plugins/platforms/winrt/qwinrtwindow.h +++ /dev/null @@ -1,86 +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 QWINRTWINDOW_H -#define QWINRTWINDOW_H - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -Q_DECLARE_LOGGING_CATEGORY(lcQpaWindows) - -class QWinRTWindowPrivate; -class QWinRTWindow : public QPlatformWindow -{ -public: - QWinRTWindow(QWindow *window); - ~QWinRTWindow() override; - - QSurfaceFormat format() const override; - bool isActive() const override; - bool isExposed() const override; - void setGeometry(const QRect &rect) override; - void setVisible(bool visible) override; - void setWindowTitle(const QString &title) override; - void raise() override; - void lower() override; - - WId winId() const override; - - qreal devicePixelRatio() const override; - void setWindowState(Qt::WindowStates state) override; - - bool setMouseGrabEnabled(bool grab) override; - bool setKeyboardGrabEnabled(bool grab) override; - - EGLSurface eglSurface() const; - void createEglSurface(EGLDisplay display, EGLConfig config); - -private: - QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QWinRTWindow) -}; - -QT_END_NAMESPACE - -#endif // QWINRTWINDOW_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiaaccessibility.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiaaccessibility.cpp deleted file mode 100644 index 40274fb967..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiaaccessibility.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiaaccessibility.h" -#include "qwinrtuiamainprovider.h" - -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QWinRTUiaAccessibility::QWinRTUiaAccessibility() -{ -} - -QWinRTUiaAccessibility::~QWinRTUiaAccessibility() -{ -} - -// Handles UI Automation window messages. -void QWinRTUiaAccessibility::activate() -{ - // Start handling accessibility internally - QGuiApplicationPrivate::platformIntegration()->accessibility()->setActive(true); -} - -// Handles accessibility update notifications. -void QWinRTUiaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) -{ - if (!event) - return; - - QAccessibleInterface *accessible = event->accessibleInterface(); - if (!isActive() || !accessible || !accessible->isValid()) - return; - - switch (event->type()) { - case QAccessible::Focus: - QWinRTUiaMainProvider::notifyFocusChange(event); - break; - case QAccessible::ObjectCreated: - case QAccessible::ObjectDestroyed: - case QAccessible::ObjectShow: - case QAccessible::ObjectHide: - case QAccessible::ObjectReorder: - QWinRTUiaMainProvider::notifyVisibilityChange(event); - break; - case QAccessible::StateChanged: - QWinRTUiaMainProvider::notifyStateChange(static_cast(event)); - break; - case QAccessible::ValueChanged: - QWinRTUiaMainProvider::notifyValueChange(static_cast(event)); - break; - case QAccessible::TextAttributeChanged: - case QAccessible::TextColumnChanged: - case QAccessible::TextInserted: - case QAccessible::TextRemoved: - case QAccessible::TextUpdated: - case QAccessible::TextSelectionChanged: - case QAccessible::TextCaretMoved: - QWinRTUiaMainProvider::notifyTextChange(event); - break; - default: - break; - } -} - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiaaccessibility.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiaaccessibility.h deleted file mode 100644 index b966271e21..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiaaccessibility.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIAACCESSIBILITY_H -#define QWINRTUIAACCESSIBILITY_H - -#include -#if QT_CONFIG(accessibility) - -#include - -QT_BEGIN_NAMESPACE - -// WinRT platform accessibility implemented over UI Automation. -class QWinRTUiaAccessibility : public QPlatformAccessibility -{ -public: - explicit QWinRTUiaAccessibility(); - virtual ~QWinRTUiaAccessibility(); - static void activate(); - void notifyAccessibilityUpdate(QAccessibleEvent *event) override; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIAACCESSIBILITY_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiabaseprovider.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiabaseprovider.cpp deleted file mode 100644 index ee53714caa..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiabaseprovider.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiabaseprovider.h" - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QWinRTUiaBaseProvider::QWinRTUiaBaseProvider(QAccessible::Id id) : - m_id(id) -{ -} - -QWinRTUiaBaseProvider::~QWinRTUiaBaseProvider() -{ -} - -QAccessibleInterface *QWinRTUiaBaseProvider::accessibleInterface() const -{ - QAccessibleInterface *accessible = QAccessible::accessibleInterface(m_id); - if (accessible && accessible->isValid()) - return accessible; - return nullptr; -} - -QAccessible::Id QWinRTUiaBaseProvider::id() const -{ - return m_id; -} - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiabaseprovider.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiabaseprovider.h deleted file mode 100644 index d8837354dc..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiabaseprovider.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIABASEPROVIDER_H -#define QWINRTUIABASEPROVIDER_H - -#include -#if QT_CONFIG(accessibility) - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -// Base class for UI Automation providers. -class QWinRTUiaBaseProvider : public QObject -{ - Q_OBJECT - Q_DISABLE_COPY(QWinRTUiaBaseProvider) -public: - explicit QWinRTUiaBaseProvider(QAccessible::Id id); - virtual ~QWinRTUiaBaseProvider(); - - QAccessibleInterface *accessibleInterface() const; - QAccessible::Id id() const; - -private: - QAccessible::Id m_id; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIABASEPROVIDER_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiacontrolmetadata.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiacontrolmetadata.cpp deleted file mode 100644 index 4e406a3545..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiacontrolmetadata.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiacontrolmetadata.h" -#include "qwinrtuiautils.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -using namespace QWinRTUiAutomation; - -QWinRTUiaControlMetadata::QWinRTUiaControlMetadata() -{ -} - -QWinRTUiaControlMetadata::QWinRTUiaControlMetadata(QAccessible::Id id) -{ - update(id); -} - -void QWinRTUiaControlMetadata::update(QAccessible::Id id) -{ - if (QAccessibleInterface *accessible = accessibleForId(id)) { - m_automationId = generateAutomationId(accessible); - m_className = generateClassName(accessible); - m_controlName = generateControlName(accessible); - m_role = generateRole(accessible); - m_state = accessible->state(); - m_accelerator = accessible->text(QAccessible::Accelerator); - m_access = accessible->text(QAccessible::Accelerator); - m_help = accessible->text(QAccessible::Help); - m_description = accessible->text(QAccessible::Description); - m_value = accessible->text(QAccessible::Value); - m_boundingRect = accessible->rect(); - updateValueData(accessible); - updateTableData(accessible); - updateTextData(accessible); - } -} - -QString QWinRTUiaControlMetadata::generateControlName(QAccessibleInterface *accessible) -{ - const bool clientTopLevel = (accessible->role() == QAccessible::Client) - && accessible->parent() && (accessible->parent()->role() == QAccessible::Application); - - QString name = accessible->text(QAccessible::Name); - if (name.isEmpty() && clientTopLevel) - name = QCoreApplication::applicationName(); - return name; -} - -QString QWinRTUiaControlMetadata::generateClassName(QAccessibleInterface *accessible) -{ - QString name; - - if (QObject *obj = accessible->object()) - name = QLatin1String(obj->metaObject()->className()); - return name; -} - -// Generates an ID based on the name of the controls and their parents. -QString QWinRTUiaControlMetadata::generateAutomationId(QAccessibleInterface *accessible) -{ - QString autid; - QObject *obj = accessible->object(); - while (obj) { - QString name = obj->objectName(); - if (name.isEmpty()) { - autid = QStringLiteral(""); - break; - } - if (!autid.isEmpty()) - autid.prepend(QLatin1Char('.')); - autid.prepend(name); - obj = obj->parent(); - } - return autid; -} - -QAccessible::Role QWinRTUiaControlMetadata::generateRole(QAccessibleInterface *accessible) -{ - const bool clientTopLevel = (accessible->role() == QAccessible::Client) - && accessible->parent() && (accessible->parent()->role() == QAccessible::Application); - - if (clientTopLevel) { - // Reports a top-level widget as a window. - return QAccessible::Window; - } else { - return accessible->role(); - } -} - -void QWinRTUiaControlMetadata::updateValueData(QAccessibleInterface *accessible) -{ - if (QAccessibleValueInterface *valueInterface = accessible->valueInterface()) { - m_minimumValue = valueInterface->minimumValue().toDouble(); - m_maximumValue = valueInterface->maximumValue().toDouble(); - m_currentValue = valueInterface->currentValue().toDouble(); - m_minimumStepSize = valueInterface->minimumStepSize().toDouble(); - } else { - m_minimumValue = 0.0; - m_maximumValue = 0.0; - m_currentValue = 0.0; - m_minimumStepSize = 0.0; - } -} - -void QWinRTUiaControlMetadata::updateTableData(QAccessibleInterface *accessible) -{ - if (QAccessibleTableInterface *tableInterface = accessible->tableInterface()) { - m_rowIndex = 0; - m_columnIndex = 0; - m_rowCount = tableInterface->rowCount(); - m_columnCount = tableInterface->columnCount(); - } else if (QAccessibleTableCellInterface *tableCellInterface = accessible->tableCellInterface()) { - m_rowIndex = tableCellInterface->rowIndex(); - m_columnIndex = tableCellInterface->columnIndex(); - m_rowCount = tableCellInterface->rowExtent(); - m_columnCount = tableCellInterface->columnExtent(); - } else { - m_rowIndex = 0; - m_columnIndex = 0; - m_rowCount = 0; - m_columnCount = 0; - } -} - -void QWinRTUiaControlMetadata::updateTextData(QAccessibleInterface *accessible) -{ - if (QAccessibleTextInterface *textInterface = accessible->textInterface()) { - m_cursorPosition = textInterface->cursorPosition(); - m_text = textInterface->text(0, textInterface->characterCount()); - } else { - m_cursorPosition = 0; - m_text = QStringLiteral(""); - } -} - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiacontrolmetadata.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiacontrolmetadata.h deleted file mode 100644 index 769f073a1b..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiacontrolmetadata.h +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIACONTROLMETADATA_H -#define QWINRTUIACONTROLMETADATA_H - -#include -#if QT_CONFIG(accessibility) - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -// Cacheable control metadata -class QWinRTUiaControlMetadata -{ -public: - QWinRTUiaControlMetadata(); - QWinRTUiaControlMetadata(QAccessible::Id id); - void update(QAccessible::Id id); - QString automationId() const { return m_automationId; } - QString className() const { return m_className; } - QString controlName() const { return m_controlName; } - QString accelerator() const { return m_accelerator; } - QString access() const { return m_access; } - QString help() const { return m_help; } - QString description() const { return m_description; } - QString value() const { return m_value; } - QString text() const { return m_text; } - QAccessible::Role role() const { return m_role; } - QAccessible::State state() const { return m_state; } - QRect boundingRect() const { return m_boundingRect; } - double minimumValue() const { return m_minimumValue; } - double maximumValue() const { return m_maximumValue; } - double currentValue() const { return m_currentValue; } - double minimumStepSize() const { return m_minimumStepSize; } - int rowIndex() const { return m_rowIndex; } - int columnIndex() const { return m_columnIndex; } - int rowCount() const { return m_rowCount; } - int columnCount() const { return m_columnCount; } - int characterCount() const { return m_text.length(); } - int cursorPosition() const { return m_cursorPosition; } - -private: - QString generateControlName(QAccessibleInterface *accessible); - QString generateClassName(QAccessibleInterface *accessible); - QString generateAutomationId(QAccessibleInterface *accessible); - QAccessible::Role generateRole(QAccessibleInterface *accessible); - void updateValueData(QAccessibleInterface *accessible); - void updateTableData(QAccessibleInterface *accessible); - void updateTextData(QAccessibleInterface *accessible); - QString m_automationId; - QString m_className; - QString m_controlName; - QString m_accelerator; - QString m_access; - QString m_help; - QString m_description; - QString m_value; - QString m_text; - QAccessible::Role m_role = QAccessible::NoRole; - QAccessible::State m_state; - QRect m_boundingRect; - double m_minimumValue = 0.0; - double m_maximumValue = 0.0; - double m_currentValue = 0.0; - double m_minimumStepSize = 0.0; - int m_rowIndex = 0; - int m_columnIndex = 0; - int m_rowCount = 0; - int m_columnCount = 0; - int m_cursorPosition = 0; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIACONTROLMETADATA_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiaemptypropertyvalue.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiaemptypropertyvalue.h deleted file mode 100644 index 35e4df75fc..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiaemptypropertyvalue.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIAEMPTYPROPERTYVALUE_H -#define QWINRTUIAEMPTYPROPERTYVALUE_H - -#include -#if QT_CONFIG(accessibility) - -#include -#include - -QT_BEGIN_NAMESPACE - -// Implements an empty property value. -class QWinRTUiaEmptyPropertyValue : - public Microsoft::WRL::RuntimeClass -{ - InspectableClass(L"QWinRTUiaEmptyPropertyValue", BaseTrust); -public: - - HRESULT STDMETHODCALLTYPE get_Type(ABI::Windows::Foundation::PropertyType *value) - { - *value = ABI::Windows::Foundation::PropertyType_Empty; - return S_OK; - } - - HRESULT STDMETHODCALLTYPE get_IsNumericScalar(boolean*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetUInt8(BYTE*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetInt16(INT16*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetUInt16(UINT16*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetInt32(INT32*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetUInt32(UINT32*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetInt64(INT64*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetUInt64(UINT64*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetSingle(FLOAT*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetDouble(DOUBLE*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetChar16(WCHAR*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetBoolean(boolean*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetString(HSTRING*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetGuid(GUID*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetDateTime(ABI::Windows::Foundation::DateTime*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetTimeSpan(ABI::Windows::Foundation::TimeSpan*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetPoint(ABI::Windows::Foundation::Point*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetSize(ABI::Windows::Foundation::Size*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetRect(ABI::Windows::Foundation::Rect*) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetUInt8Array(UINT32*, BYTE**) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetInt16Array(UINT32*, INT16**) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetUInt16Array(UINT32*, UINT16**) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetInt32Array(UINT32*, INT32**) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetUInt32Array(UINT32*, UINT32**) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetInt64Array(UINT32*, INT64**) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetUInt64Array(UINT32*, UINT64**) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetSingleArray(UINT32*, FLOAT**) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetDoubleArray(UINT32*, DOUBLE**) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetChar16Array(UINT32*, WCHAR**) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetBooleanArray(UINT32*, boolean**) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetStringArray(UINT32*, HSTRING**) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetInspectableArray(UINT32*, IInspectable***) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetGuidArray(UINT32*, GUID**) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetDateTimeArray(UINT32*, ABI::Windows::Foundation::DateTime**) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetTimeSpanArray(UINT32*, ABI::Windows::Foundation::TimeSpan**) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetPointArray(UINT32*, ABI::Windows::Foundation::Point**) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetSizeArray(UINT32*, ABI::Windows::Foundation::Size**) { return E_FAIL; } - HRESULT STDMETHODCALLTYPE GetRectArray(UINT32*, ABI::Windows::Foundation::Rect**) { return E_FAIL; } -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIAEMPTYPROPERTYVALUE_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiagriditemprovider.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiagriditemprovider.cpp deleted file mode 100644 index 355dbf7d20..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiagriditemprovider.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiagriditemprovider.h" -#include "qwinrtuiamainprovider.h" -#include "qwinrtuiametadatacache.h" -#include "qwinrtuiautils.h" - -#include -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -using namespace QWinRTUiAutomation; -using namespace ABI::Windows::UI::Xaml::Automation; -using namespace ABI::Windows::UI::Xaml::Automation::Provider; -using namespace ABI::Windows::UI::Xaml::Automation::Peers; - -QWinRTUiaGridItemProvider::QWinRTUiaGridItemProvider(QAccessible::Id id) : - QWinRTUiaBaseProvider(id) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -QWinRTUiaGridItemProvider::~QWinRTUiaGridItemProvider() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -// Returns the column index of the item. -HRESULT STDMETHODCALLTYPE QWinRTUiaGridItemProvider::get_Column(INT32 *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *value = metadata->columnIndex(); - return S_OK; -} - -// Returns the number of columns occupied by the item. -HRESULT STDMETHODCALLTYPE QWinRTUiaGridItemProvider::get_ColumnSpan(INT32 *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *value = metadata->columnCount(); - return S_OK; -} - -// Returns the provider for the containing table/tree. -HRESULT STDMETHODCALLTYPE QWinRTUiaGridItemProvider::get_ContainingGrid(IIRawElementProviderSimple **value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - *value = nullptr; - - auto accid = id(); - auto elementId = std::make_shared(0); - - if (!SUCCEEDED(QEventDispatcherWinRT::runOnMainThread([accid, elementId]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) { - if (QAccessibleTableCellInterface *tableCellInterface = accessible->tableCellInterface()) { - if (QAccessibleInterface *table = tableCellInterface->table()) { - *elementId = idForAccessible(table); - QWinRTUiaMetadataCache::instance()->load(*elementId); - } - } - } - return S_OK; - }))) { - return E_FAIL; - } - - if (!*elementId) - return S_OK; - - return QWinRTUiaMainProvider::rawProviderForAccessibleId(*elementId, value); -} - -// Returns the row index of the item. -HRESULT STDMETHODCALLTYPE QWinRTUiaGridItemProvider::get_Row(INT32 *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *value = metadata->rowIndex(); - return S_OK; -} - -// Returns the number of rows occupied by the item. -HRESULT STDMETHODCALLTYPE QWinRTUiaGridItemProvider::get_RowSpan(INT32 *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *value = metadata->rowCount(); - return S_OK; -} - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiagriditemprovider.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiagriditemprovider.h deleted file mode 100644 index 70504fc555..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiagriditemprovider.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIAGRIDITEMPROVIDER_H -#define QWINRTUIAGRIDITEMPROVIDER_H - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiabaseprovider.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -// Implements the Grid Item control pattern provider. Used by items within a table/tree. -class QWinRTUiaGridItemProvider : - public QWinRTUiaBaseProvider, - public Microsoft::WRL::RuntimeClass -{ - Q_OBJECT - Q_DISABLE_COPY(QWinRTUiaGridItemProvider) - InspectableClass(L"QWinRTUiaGridItemProvider", BaseTrust); - -public: - explicit QWinRTUiaGridItemProvider(QAccessible::Id id); - virtual ~QWinRTUiaGridItemProvider(); - - // IGridItemProvider - HRESULT STDMETHODCALLTYPE get_Column(INT32 *value) override; - HRESULT STDMETHODCALLTYPE get_ColumnSpan(INT32 *value) override; - HRESULT STDMETHODCALLTYPE get_ContainingGrid(ABI::Windows::UI::Xaml::Automation::Provider::IIRawElementProviderSimple **value) override; - HRESULT STDMETHODCALLTYPE get_Row(INT32 *value) override; - HRESULT STDMETHODCALLTYPE get_RowSpan(INT32 *value) override; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIAGRIDITEMPROVIDER_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiagridprovider.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiagridprovider.cpp deleted file mode 100644 index 3bd90f6850..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiagridprovider.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiagridprovider.h" -#include "qwinrtuiamainprovider.h" -#include "qwinrtuiametadatacache.h" -#include "qwinrtuiautils.h" - -#include -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -using namespace QWinRTUiAutomation; -using namespace ABI::Windows::UI::Xaml::Automation; -using namespace ABI::Windows::UI::Xaml::Automation::Provider; -using namespace ABI::Windows::UI::Xaml::Automation::Peers; - -QWinRTUiaGridProvider::QWinRTUiaGridProvider(QAccessible::Id id) : - QWinRTUiaBaseProvider(id) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -QWinRTUiaGridProvider::~QWinRTUiaGridProvider() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -// Returns the number of columns. -HRESULT STDMETHODCALLTYPE QWinRTUiaGridProvider::get_ColumnCount(INT32 *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *value = metadata->columnCount(); - return S_OK; -} - -// Returns the number of rows. -HRESULT STDMETHODCALLTYPE QWinRTUiaGridProvider::get_RowCount(INT32 *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *value = metadata->rowCount(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaGridProvider::GetItem(INT32 row, INT32 column, IIRawElementProviderSimple **returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - *returnValue = nullptr; - - auto accid = id(); - auto elementId = std::make_shared(0); - - if (!SUCCEEDED(QEventDispatcherWinRT::runOnMainThread([accid, row, column, elementId]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) { - if (QAccessibleTableInterface *tableInterface = accessible->tableInterface()) { - if ((row >= 0) && (row < tableInterface->rowCount()) && (column >= 0) && (column < tableInterface->columnCount())) { - if (QAccessibleInterface *cell = tableInterface->cellAt(row, column)) { - *elementId = idForAccessible(cell); - QWinRTUiaMetadataCache::instance()->load(*elementId); - } - } - } - } - return S_OK; - }))) { - return E_FAIL; - } - - if (!*elementId) - return E_FAIL; - - return QWinRTUiaMainProvider::rawProviderForAccessibleId(*elementId, returnValue); -} - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiagridprovider.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiagridprovider.h deleted file mode 100644 index d6dfaed315..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiagridprovider.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIAGRIDPROVIDER_H -#define QWINRTUIAGRIDPROVIDER_H - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiabaseprovider.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -// Implements the Grid control pattern provider. Used by tables/trees. -class QWinRTUiaGridProvider : - public QWinRTUiaBaseProvider, - public Microsoft::WRL::RuntimeClass -{ - Q_OBJECT - Q_DISABLE_COPY(QWinRTUiaGridProvider) - InspectableClass(L"QWinRTUiaGridProvider", BaseTrust); - -public: - explicit QWinRTUiaGridProvider(QAccessible::Id id); - virtual ~QWinRTUiaGridProvider(); - - // IGridProvider - HRESULT STDMETHODCALLTYPE get_ColumnCount(INT32 *value) override; - HRESULT STDMETHODCALLTYPE get_RowCount(INT32 *value) override; - HRESULT STDMETHODCALLTYPE GetItem(INT32 row, INT32 column, ABI::Windows::UI::Xaml::Automation::Provider::IIRawElementProviderSimple **returnValue) override; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIAGRIDPROVIDER_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiainvokeprovider.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiainvokeprovider.cpp deleted file mode 100644 index e2cf7bc107..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiainvokeprovider.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiainvokeprovider.h" -#include "qwinrtuiametadatacache.h" -#include "qwinrtuiautils.h" - -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -using namespace QWinRTUiAutomation; -using namespace ABI::Windows::UI::Xaml::Automation; -using namespace ABI::Windows::UI::Xaml::Automation::Provider; - -QWinRTUiaInvokeProvider::QWinRTUiaInvokeProvider(QAccessible::Id id) : - QWinRTUiaBaseProvider(id) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -QWinRTUiaInvokeProvider::~QWinRTUiaInvokeProvider() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaInvokeProvider::Invoke() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - auto accid = id(); - - QEventDispatcherWinRT::runOnMainThread([accid]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) - if (QAccessibleActionInterface *actionInterface = accessible->actionInterface()) - actionInterface->doAction(QAccessibleActionInterface::pressAction()); - QWinRTUiaMetadataCache::instance()->load(accid); - return S_OK; - }, 0); - return S_OK; -} - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiainvokeprovider.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiainvokeprovider.h deleted file mode 100644 index dfe7917a16..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiainvokeprovider.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIAINVOKEPROVIDER_H -#define QWINRTUIAINVOKEPROVIDER_H - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiabaseprovider.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -// Implements the Invoke control pattern provider. -class QWinRTUiaInvokeProvider : - public QWinRTUiaBaseProvider, - public Microsoft::WRL::RuntimeClass -{ - Q_OBJECT - Q_DISABLE_COPY(QWinRTUiaInvokeProvider) - InspectableClass(L"QWinRTUiaInvokeProvider", BaseTrust); - -public: - explicit QWinRTUiaInvokeProvider(QAccessible::Id id); - virtual ~QWinRTUiaInvokeProvider(); - - // IInvokeProvider - HRESULT STDMETHODCALLTYPE Invoke() override; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIAINVOKEPROVIDER_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiamainprovider.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiamainprovider.cpp deleted file mode 100644 index 0b1db306bd..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiamainprovider.cpp +++ /dev/null @@ -1,787 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiamainprovider.h" -#include "qwinrtuiaprovidercache.h" -#include "qwinrtuiavalueprovider.h" -#include "qwinrtuiarangevalueprovider.h" -#include "qwinrtuiatextprovider.h" -#include "qwinrtuiatoggleprovider.h" -#include "qwinrtuiainvokeprovider.h" -#include "qwinrtuiaselectionprovider.h" -#include "qwinrtuiaselectionitemprovider.h" -#include "qwinrtuiatableprovider.h" -#include "qwinrtuiatableitemprovider.h" -#include "qwinrtuiagridprovider.h" -#include "qwinrtuiagriditemprovider.h" -#include "qwinrtuiapeervector.h" -#include "qwinrtuiametadatacache.h" -#include "qwinrtuiaemptypropertyvalue.h" -#include "qwinrtuiautils.h" - -#include -#include -#include -#include -#include - -#include - -using namespace QWinRTUiAutomation; -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::System; -using namespace ABI::Windows::UI; -using namespace ABI::Windows::UI::Core; -using namespace ABI::Windows::UI::Xaml; -using namespace ABI::Windows::UI::Xaml::Automation; -using namespace ABI::Windows::UI::Xaml::Automation::Provider; -using namespace ABI::Windows::UI::Xaml::Automation::Peers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Foundation::Collections; - -QT_BEGIN_NAMESPACE - -QWinRTUiaMainProvider::QWinRTUiaMainProvider(QAccessible::Id id) - : QWinRTUiaBaseProvider(id) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - ComPtr factory; - HRESULT hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_Xaml_Automation_Peers_AutomationPeer).Get(), IID_PPV_ARGS(&factory)); - Q_ASSERT_SUCCEEDED(hr); - - hr = factory->CreateInstance(this, &m_base, &m_core); - Q_ASSERT_SUCCEEDED(hr); -} - -QWinRTUiaMainProvider::~QWinRTUiaMainProvider() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::QueryInterface(REFIID iid, LPVOID *iface) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!iface) - return E_POINTER; - *iface = nullptr; - - if (iid == IID_IUnknown) { - *iface = static_cast(this); - AddRef(); - return S_OK; - } else if (iid == IID_IAutomationPeerOverrides) { - *iface = static_cast(this); - AddRef(); - return S_OK; - } else { - return m_base.CopyTo(iid, iface); - } -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetIids(ULONG *iidCount, IID **iids) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - *iidCount = 0; - *iids = nullptr; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetRuntimeClassName(HSTRING *className) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - return qHString(QStringLiteral("QWinRTUiaMainProvider"), className); -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetTrustLevel(TrustLevel *trustLevel) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - *trustLevel = TrustLevel::BaseTrust; - return S_OK; -} - -// Returns a cached instance of the provider for a specific accessible interface. -QWinRTUiaMainProvider *QWinRTUiaMainProvider::providerForAccessibleId(QAccessible::Id id) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - QWinRTUiaProviderCache *providerCache = QWinRTUiaProviderCache::instance(); - QWinRTUiaMainProvider *provider = qobject_cast(providerCache->providerForId(id)); - - if (provider) { - provider->AddRef(); - } else { - ComPtr p = Make(id); - provider = p.Get(); - provider->AddRef(); - providerCache->insert(id, provider); - } - return provider; -} - -// Returns an IIRawElementProviderSimple for a specific accessible interface. -HRESULT QWinRTUiaMainProvider::rawProviderForAccessibleId(QAccessible::Id elementId, - IIRawElementProviderSimple **returnValue) -{ - if (!returnValue) - return E_INVALIDARG; - *returnValue = nullptr; - - if (ComPtr provider = providerForAccessibleId(elementId)) { - ComPtr automationPeer; - if (SUCCEEDED(provider.As(&automationPeer))) { - ComPtr automationPeerProtected; - if (SUCCEEDED(provider.As(&automationPeerProtected))) { - return automationPeerProtected->ProviderFromPeer(automationPeer.Get(), returnValue); - } - } - } - return E_FAIL; -} - -// Returns an array of IIRawElementProviderSimple instances for a list of accessible interface ids. -HRESULT QWinRTUiaMainProvider::rawProviderArrayForAccessibleIdList(const QVarLengthArray &elementIds, - UINT32 *returnValueSize, - IIRawElementProviderSimple ***returnValue) -{ - if (!returnValueSize || !returnValue) - return E_INVALIDARG; - *returnValueSize = 0; - *returnValue = nullptr; - - QList rawProviderList; - - for (auto elementId : elementIds) { - IIRawElementProviderSimple *rawProvider; - if (SUCCEEDED(rawProviderForAccessibleId(elementId, &rawProvider))) - rawProviderList.append(rawProvider); - } - - if (rawProviderList.size() == 0) - return S_OK; - - *returnValue = static_cast(CoTaskMemAlloc(rawProviderList.size() * sizeof(IIRawElementProviderSimple *))); - if (!*returnValue) { - for (auto rawProvider : qAsConst(rawProviderList)) - rawProvider->Release(); - return E_OUTOFMEMORY; - } - - int index = 0; - for (auto rawProvider : qAsConst(rawProviderList)) - (*returnValue)[index++] = rawProvider; - *returnValueSize = rawProviderList.size(); - return S_OK; -} - -void QWinRTUiaMainProvider::notifyFocusChange(QAccessibleEvent *event) -{ - if (QAccessibleInterface *accessible = event->accessibleInterface()) { - QAccessible::Id accid = idForAccessible(accessible); - QWinRTUiaMetadataCache::instance()->load(accid); - QEventDispatcherWinRT::runOnXamlThread([accid]() { - if (ComPtr provider = providerForAccessibleId(accid)) { - ComPtr automationPeer; - if (SUCCEEDED(provider->QueryInterface(IID_PPV_ARGS(&automationPeer)))) { - automationPeer->RaiseAutomationEvent(AutomationEvents_AutomationFocusChanged); - } - } - return S_OK; - }, false); - } -} - -void QWinRTUiaMainProvider::notifyVisibilityChange(QAccessibleEvent *event) -{ - if (QAccessibleInterface *accessible = event->accessibleInterface()) { - QAccessible::Id accid = idForAccessible(accessible); - QWinRTUiaMetadataCache::instance()->load(accid); - } -} - -void QWinRTUiaMainProvider::notifyStateChange(QAccessibleStateChangeEvent *event) -{ - if (QAccessibleInterface *accessible = event->accessibleInterface()) { - QAccessible::Id accid = idForAccessible(accessible); - QWinRTUiaMetadataCache::instance()->load(accid); - - if (event->changedStates().checked || event->changedStates().checkStateMixed) { - // Notifies states changes in checkboxes. - if (accessible->role() == QAccessible::CheckBox) { - QEventDispatcherWinRT::runOnXamlThread([accid]() { - if (ComPtr provider = providerForAccessibleId(accid)) { - ComPtr automationPeer; - if (SUCCEEDED(provider->QueryInterface(IID_PPV_ARGS(&automationPeer)))) { - ComPtr toggleStatics; - if (SUCCEEDED(RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_Xaml_Automation_TogglePatternIdentifiers).Get(), IID_PPV_ARGS(&toggleStatics)))) { - ComPtr toggleStateProperty; - if (SUCCEEDED(toggleStatics->get_ToggleStateProperty(&toggleStateProperty))) { - ComPtr emptyValue = Make(); - // by sending an event with an empty value we force ui automation to refresh its state - automationPeer->RaisePropertyChangedEvent(toggleStateProperty.Get(), emptyValue.Get(), emptyValue.Get()); - } - } - } - } - return S_OK; - }, false); - } - } - if (event->changedStates().active) { - if (accessible->role() == QAccessible::Window) { - // Notifies window opened/closed. - bool active = accessible->state().active; - QEventDispatcherWinRT::runOnXamlThread([accid, active]() { - if (ComPtr provider = providerForAccessibleId(accid)) { - ComPtr automationPeer; - if (SUCCEEDED(provider->QueryInterface(IID_PPV_ARGS(&automationPeer)))) { - if (active) { - automationPeer->RaiseAutomationEvent(AutomationEvents_WindowOpened); - } else { - automationPeer->RaiseAutomationEvent(AutomationEvents_WindowClosed); - } - } - } - return S_OK; - }, false); - } - } - } -} - -void QWinRTUiaMainProvider::notifyValueChange(QAccessibleValueChangeEvent *event) -{ - if (QAccessibleInterface *accessible = event->accessibleInterface()) { - QAccessible::Id accid = idForAccessible(accessible); - QWinRTUiaMetadataCache::instance()->load(accid); - if (QAccessibleValueInterface *valueInterface = accessible->valueInterface()) { - // Notifies changes in values of controls supporting the value interface. - double value = valueInterface->currentValue().toDouble(); - QEventDispatcherWinRT::runOnXamlThread([accid, value]() { - // For some reason RaisePropertyChangedEvent() does not seem to be - // forwarding notifications for any property types except empty, - // which would do nothing here. ToDo: find a workaround. - return S_OK; - }, false); - } - } -} - -// Notifies changes in text content and selection state of text controls. -void QWinRTUiaMainProvider::notifyTextChange(QAccessibleEvent *event) -{ - if (QAccessibleInterface *accessible = event->accessibleInterface()) { - QAccessible::Id accid = idForAccessible(accessible); - QWinRTUiaMetadataCache::instance()->load(accid); - bool readOnly = accessible->state().readOnly; - QAccessible::Event eventType = event->type(); - if (accessible->textInterface()) { - QEventDispatcherWinRT::runOnXamlThread([accid, eventType, readOnly]() { - if (ComPtr provider = providerForAccessibleId(accid)) { - ComPtr automationPeer; - if (SUCCEEDED(provider->QueryInterface(IID_PPV_ARGS(&automationPeer)))) { - if (eventType == QAccessible::TextSelectionChanged) { - automationPeer->RaiseAutomationEvent(AutomationEvents_TextPatternOnTextSelectionChanged); - } else if (eventType == QAccessible::TextCaretMoved) { - if (!readOnly) { - automationPeer->RaiseAutomationEvent(AutomationEvents_TextPatternOnTextSelectionChanged); - } - } else { - automationPeer->RaiseAutomationEvent(AutomationEvents_TextPatternOnTextChanged); - } - } - } - return S_OK; - }, false); - } - } -} - -// Return providers for specific control patterns -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetPatternCore(PatternInterface patternInterface, IInspectable **returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__ << patternInterface; - - if (!returnValue) - return E_INVALIDARG; - *returnValue = nullptr; - - QAccessibleInterface *accessible = accessibleInterface(); - if (!accessible) - return E_FAIL; - - switch (patternInterface) { - case PatternInterface_Text: - case PatternInterface_Text2: { - // All text controls. - if (accessible->textInterface()) { - ComPtr provider = Make(id()); - return provider.CopyTo(returnValue); - } - break; - } - case PatternInterface_Value: { - // All accessible controls return text(QAccessible::Value) (which may be empty). - ComPtr provider = Make(id()); - return provider.CopyTo(returnValue); - } - case PatternInterface_RangeValue: { - // Controls providing a numeric value within a range (e.g., sliders, scroll bars, dials). - if (accessible->valueInterface()) { - ComPtr provider = Make(id()); - return provider.CopyTo(returnValue); - } - break; - } - case PatternInterface_Toggle: { - // Checkbox controls. - if (accessible->role() == QAccessible::CheckBox) { - ComPtr provider = Make(id()); - return provider.CopyTo(returnValue); - } - break; - } - case PatternInterface_Selection: { - // Lists of items. - if (accessible->role() == QAccessible::List) { - ComPtr provider = Make(id()); - return provider.CopyTo(returnValue); - } - break; - } - case PatternInterface_SelectionItem: { - // Items within a list and radio buttons. - if ((accessible->role() == QAccessible::RadioButton) - || (accessible->role() == QAccessible::ListItem)) { - ComPtr provider = Make(id()); - return provider.CopyTo(returnValue); - } - break; - } - case PatternInterface_Table: { - // Table/tree. - if (accessible->tableInterface() - && ((accessible->role() == QAccessible::Table) || (accessible->role() == QAccessible::Tree))) { - ComPtr provider = Make(id()); - return provider.CopyTo(returnValue); - } - break; - } - case PatternInterface_TableItem: { - // Item within a table/tree. - if (accessible->tableCellInterface() - && ((accessible->role() == QAccessible::Cell) || (accessible->role() == QAccessible::TreeItem))) { - ComPtr provider = Make(id()); - return provider.CopyTo(returnValue); - } - break; - } - case PatternInterface_Grid: { - // Table/tree. - if (accessible->tableInterface() - && ((accessible->role() == QAccessible::Table) || (accessible->role() == QAccessible::Tree))) { - ComPtr provider = Make(id()); - return provider.CopyTo(returnValue); - } - break; - } - case PatternInterface_GridItem: { - // Item within a table/tree. - if (accessible->tableCellInterface() - && ((accessible->role() == QAccessible::Cell) || (accessible->role() == QAccessible::TreeItem))) { - ComPtr provider = Make(id()); - return provider.CopyTo(returnValue); - } - break; - } - case PatternInterface_Invoke: { - // Things that have an invokable action (e.g., simple buttons). - if (accessible->actionInterface()) { - ComPtr provider = Make(id()); - return provider.CopyTo(returnValue); - } - break; - } - default: - break; - } - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetAcceleratorKeyCore(HSTRING *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - return qHString(metadata->accelerator(), returnValue); -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetAccessKeyCore(HSTRING *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - return qHString(metadata->access(), returnValue); -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetAutomationControlTypeCore(AutomationControlType *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *returnValue = roleToControlType(metadata->role()); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetAutomationIdCore(HSTRING *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - return qHString(metadata->automationId(), returnValue); -} - -// Returns the bounding rectangle for the accessible control. -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetBoundingRectangleCore(ABI::Windows::Foundation::Rect *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - - QRect rect = metadata->boundingRect(); - returnValue->X = rect.x(); - returnValue->Y = rect.y(); - returnValue->Width = rect.width(); - returnValue->Height = rect.height(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetChildrenCore(IVector **returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - *returnValue = nullptr; - - auto accid = id(); - auto children = std::make_shared>(); - - if (!SUCCEEDED(QEventDispatcherWinRT::runOnMainThread([accid, children]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) { - int childCount = accessible->childCount(); - for (int i = 0; i < childCount; ++i) { - if (QAccessibleInterface *childAcc = accessible->child(i)) { - QAccessible::Id childId = idForAccessible(childAcc); - QWinRTUiaMetadataCache::instance()->load(childId); - if (!childAcc->state().invisible) - children->append(childId); - } - } - } - return S_OK; - }))) { - return E_FAIL; - } - - ComPtr> peerVector = Make(); - - for (auto childId : *children) { - if (ComPtr provider = providerForAccessibleId(childId)) { - IAutomationPeer *peer; - if (SUCCEEDED(provider.CopyTo(&peer))) - peerVector->Append(peer); - } - } - return peerVector.CopyTo(returnValue); -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetClassNameCore(HSTRING *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - return qHString(metadata->className(), returnValue); -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetClickablePointCore(ABI::Windows::Foundation::Point *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetHelpTextCore(HSTRING *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - return qHString(metadata->help(), returnValue); -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetItemStatusCore(HSTRING *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetItemTypeCore(HSTRING *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetLabeledByCore(IAutomationPeer **returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetLocalizedControlTypeCore(HSTRING *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetNameCore(HSTRING *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - return qHString(metadata->controlName(), returnValue); -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetOrientationCore(AutomationOrientation *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - *returnValue = AutomationOrientation_None; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::HasKeyboardFocusCore(boolean *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *returnValue = (metadata->state().focused != 0); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::IsContentElementCore(boolean *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - *returnValue = true; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::IsControlElementCore(boolean *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - *returnValue = true; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::IsEnabledCore(boolean *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *returnValue = (metadata->state().disabled == 0); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::IsKeyboardFocusableCore(boolean *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *returnValue = (metadata->state().focusable != 0); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::IsOffscreenCore(boolean *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *returnValue = (metadata->state().offscreen != 0); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::IsPasswordCore(boolean *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *returnValue = (metadata->role() == QAccessible::EditableText) && (metadata->state().passwordEdit != 0); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::IsRequiredForFormCore(boolean *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - *returnValue = false; - return S_OK; -} - -// Sets focus to the control. -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::SetFocusCore() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - QAccessibleInterface *accessible = accessibleInterface(); - if (!accessible) - return E_FAIL; - - QAccessibleActionInterface *actionInterface = accessible->actionInterface(); - if (!actionInterface) - return E_FAIL; - - QEventDispatcherWinRT::runOnMainThread([actionInterface]() { - actionInterface->doAction(QAccessibleActionInterface::setFocusAction()); - return S_OK; - }); - return S_OK; -} - -// Returns a provider for the UI element present at the specified screen coordinates. -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetPeerFromPointCore(ABI::Windows::Foundation::Point point, IAutomationPeer **returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - *returnValue = nullptr; - - // Scale coordinates from High DPI screens? - - auto accid = id(); - auto elementId = std::make_shared(0); - - if (!SUCCEEDED(QEventDispatcherWinRT::runOnMainThread([accid, elementId, point]() { - // Controls can be embedded within grouping elements. By default returns the innermost control. - QAccessibleInterface *target = accessibleForId(accid); - while (QAccessibleInterface *tmpacc = target->childAt(point.X, point.Y)) { - target = tmpacc; - // For accessibility tools it may be better to return the text element instead of its subcomponents. - if (target->textInterface()) break; - } - *elementId = idForAccessible(target); - QWinRTUiaMetadataCache::instance()->load(*elementId); - return S_OK; - }))) { - return E_FAIL; - } - - if (ComPtr provider = providerForAccessibleId(*elementId)) - return provider.CopyTo(returnValue); - return E_FAIL; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaMainProvider::GetLiveSettingCore(AutomationLiveSetting *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - return E_NOTIMPL; -} - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiamainprovider.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiamainprovider.h deleted file mode 100644 index 23a6e56ae7..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiamainprovider.h +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIAMAINPROVIDER_H -#define QWINRTUIAMAINPROVIDER_H - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiabaseprovider.h" - -#include -#include -#include -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -// The main WinRT UI Automation class. -class QWinRTUiaMainProvider: - public QWinRTUiaBaseProvider, - public Microsoft::WRL::RuntimeClass -{ - Q_OBJECT - Q_DISABLE_COPY(QWinRTUiaMainProvider) - -public: - explicit QWinRTUiaMainProvider(QAccessible::Id id); - virtual ~QWinRTUiaMainProvider(); - static QWinRTUiaMainProvider *providerForAccessibleId(QAccessible::Id id); - static HRESULT rawProviderForAccessibleId(QAccessible::Id elementId, ABI::Windows::UI::Xaml::Automation::Provider::IIRawElementProviderSimple **returnValue); - static HRESULT rawProviderArrayForAccessibleIdList(const QVarLengthArray &elementIds, UINT32 *returnValueSize, ABI::Windows::UI::Xaml::Automation::Provider::IIRawElementProviderSimple ***returnValue); - static void notifyFocusChange(QAccessibleEvent *event); - static void notifyVisibilityChange(QAccessibleEvent *event); - static void notifyStateChange(QAccessibleStateChangeEvent *event); - static void notifyValueChange(QAccessibleValueChangeEvent *event); - static void notifyTextChange(QAccessibleEvent *event); - - // IUnknown - HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, LPVOID *iface) override; - - // IInspectable - HRESULT STDMETHODCALLTYPE GetIids(ULONG *iidCount, IID **iids) override; - HRESULT STDMETHODCALLTYPE GetRuntimeClassName(HSTRING *className) override; - HRESULT STDMETHODCALLTYPE GetTrustLevel(TrustLevel *trustLevel) override; - - // IAutomationPeerOverrides - HRESULT STDMETHODCALLTYPE GetPatternCore(ABI::Windows::UI::Xaml::Automation::Peers::PatternInterface patternInterface, IInspectable **returnValue) override; - HRESULT STDMETHODCALLTYPE GetAcceleratorKeyCore(HSTRING *returnValue) override; - HRESULT STDMETHODCALLTYPE GetAccessKeyCore(HSTRING *returnValue) override; - HRESULT STDMETHODCALLTYPE GetAutomationControlTypeCore(ABI::Windows::UI::Xaml::Automation::Peers::AutomationControlType *returnValue) override; - HRESULT STDMETHODCALLTYPE GetAutomationIdCore(HSTRING *returnValue) override; - HRESULT STDMETHODCALLTYPE GetBoundingRectangleCore(ABI::Windows::Foundation::Rect *returnValue) override; - HRESULT STDMETHODCALLTYPE GetChildrenCore(ABI::Windows::Foundation::Collections::IVector **returnValue) override; - HRESULT STDMETHODCALLTYPE GetClassNameCore(HSTRING *returnValue) override; - HRESULT STDMETHODCALLTYPE GetClickablePointCore(ABI::Windows::Foundation::Point *returnValue) override; - HRESULT STDMETHODCALLTYPE GetHelpTextCore(HSTRING *returnValue) override; - HRESULT STDMETHODCALLTYPE GetItemStatusCore(HSTRING *returnValue) override; - HRESULT STDMETHODCALLTYPE GetItemTypeCore(HSTRING *returnValue) override; - HRESULT STDMETHODCALLTYPE GetLabeledByCore(ABI::Windows::UI::Xaml::Automation::Peers::IAutomationPeer **returnValue) override; - HRESULT STDMETHODCALLTYPE GetLocalizedControlTypeCore(HSTRING *returnValue) override; - HRESULT STDMETHODCALLTYPE GetNameCore(HSTRING *returnValue) override; - HRESULT STDMETHODCALLTYPE GetOrientationCore(ABI::Windows::UI::Xaml::Automation::Peers::AutomationOrientation *returnValue) override; - HRESULT STDMETHODCALLTYPE HasKeyboardFocusCore(boolean *returnValue) override; - HRESULT STDMETHODCALLTYPE IsContentElementCore(boolean *returnValue) override; - HRESULT STDMETHODCALLTYPE IsControlElementCore(boolean *returnValue) override; - HRESULT STDMETHODCALLTYPE IsEnabledCore(boolean *returnValue) override; - HRESULT STDMETHODCALLTYPE IsKeyboardFocusableCore(boolean *returnValue) override; - HRESULT STDMETHODCALLTYPE IsOffscreenCore(boolean *returnValue) override; - HRESULT STDMETHODCALLTYPE IsPasswordCore(boolean *returnValue) override; - HRESULT STDMETHODCALLTYPE IsRequiredForFormCore(boolean *returnValue) override; - HRESULT STDMETHODCALLTYPE SetFocusCore() override; - HRESULT STDMETHODCALLTYPE GetPeerFromPointCore(ABI::Windows::Foundation::Point point, ABI::Windows::UI::Xaml::Automation::Peers::IAutomationPeer **returnValue) override; - HRESULT STDMETHODCALLTYPE GetLiveSettingCore(ABI::Windows::UI::Xaml::Automation::Peers::AutomationLiveSetting *returnValue) override; - -private: - Microsoft::WRL::ComPtr m_base; - Microsoft::WRL::ComPtr m_core; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIAMAINPROVIDER_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiametadatacache.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiametadatacache.cpp deleted file mode 100644 index 442ff184a8..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiametadatacache.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiametadatacache.h" -#include "qwinrtuiautils.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -using namespace QWinRTUiAutomation; - -// Private constructor -QWinRTUiaMetadataCache::QWinRTUiaMetadataCache() -{ -} - -// shared instance -QWinRTUiaMetadataCache *QWinRTUiaMetadataCache::instance() -{ - static QWinRTUiaMetadataCache metadataCache; - return &metadataCache; -} - -// Returns the cached metadata associated with the ID, or an instance with default values. -QSharedPointer QWinRTUiaMetadataCache::metadataForId(QAccessible::Id id) -{ - QSharedPointer metadata; - - m_mutex.lock(); - if (m_metadataTable.contains(id)) - metadata = m_metadataTable[id]; - else - metadata = QSharedPointer(new QWinRTUiaControlMetadata); - m_mutex.unlock(); - return metadata; -} - -// Caches metadata from the accessibility framework within the main thread. -bool QWinRTUiaMetadataCache::load(QAccessible::Id id) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!SUCCEEDED(QEventDispatcherWinRT::runOnMainThread([id]() { - QWinRTUiaMetadataCache::instance()->insert(id, QSharedPointer(new QWinRTUiaControlMetadata(id))); - return S_OK; - }))) { - return false; - } - return true; -} - -// Inserts metadata in the cache and associates it with an accessibility ID. -void QWinRTUiaMetadataCache::insert(QAccessible::Id id, const QSharedPointer &metadata) -{ - m_mutex.lock(); - m_metadataTable[id] = metadata; - m_mutex.unlock(); -} - -// Removes metadata with a given id from the cache. -void QWinRTUiaMetadataCache::remove(QAccessible::Id id) -{ - m_mutex.lock(); - m_metadataTable.remove(id); - m_mutex.unlock(); -} - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiametadatacache.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiametadatacache.h deleted file mode 100644 index 2d68d1b654..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiametadatacache.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIAMETADATACACHE_H -#define QWINRTUIAMETADATACACHE_H - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiacontrolmetadata.h" - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -// Singleton used to cache metadata using the accessibility ID as the key. -class QWinRTUiaMetadataCache : public QObject -{ - QWinRTUiaMetadataCache(); - Q_OBJECT -public: - static QWinRTUiaMetadataCache *instance(); - QSharedPointer metadataForId(QAccessible::Id id); - void insert(QAccessible::Id id, const QSharedPointer &metadata); - void remove(QAccessible::Id id); - bool load(QAccessible::Id id); - -private: - QHash> m_metadataTable; - QMutex m_mutex; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIAMETADATACACHE_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiapeervector.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiapeervector.cpp deleted file mode 100644 index e3d6bcae4b..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiapeervector.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiapeervector.h" -#include "qwinrtuiautils.h" - -using namespace ABI::Windows::UI::Xaml::Automation::Peers; -using namespace ABI::Windows::Foundation::Collections; - -QT_BEGIN_NAMESPACE - -HRESULT QWinRTUiaPeerVector::GetAt(quint32 index, IAutomationPeer **item) -{ - if (index >= quint32(m_impl.size())) - return E_FAIL; - if ((*item = m_impl.at(index))) - (*item)->AddRef(); - return S_OK; -} - -HRESULT QWinRTUiaPeerVector::get_Size(quint32 *size) -{ - *size = m_impl.size(); - return S_OK; -} - -HRESULT QWinRTUiaPeerVector::GetView(IVectorView **view) -{ - *view = nullptr; - return E_NOTIMPL; -} - -HRESULT QWinRTUiaPeerVector::IndexOf(IAutomationPeer *value, quint32 *index, boolean *found) -{ - int idx = m_impl.indexOf(value); - if (idx > -1) { - *index = quint32(idx); - *found = true; - } else { - *found = false; - } - return S_OK; -} - -HRESULT QWinRTUiaPeerVector::SetAt(quint32 index, IAutomationPeer *item) -{ - if (index >= quint32(m_impl.size())) - return E_FAIL; - if (IAutomationPeer *elem = m_impl.at(index)) { - if (elem == item) - return S_OK; - else - elem->Release(); - } - if (item) - item->AddRef(); - m_impl[index] = item; - return S_OK; -} - -HRESULT QWinRTUiaPeerVector::InsertAt(quint32 index, IAutomationPeer *item) -{ - if (index >= quint32(m_impl.size())) - return E_FAIL; - if (item) - item->AddRef(); - m_impl.insert(index, item); - return S_OK; -} - -HRESULT QWinRTUiaPeerVector::RemoveAt(quint32 index) -{ - if (index >= quint32(m_impl.size())) - return E_FAIL; - if (IAutomationPeer *elem = m_impl.at(index)) - elem->Release(); - m_impl.remove(index); - return S_OK; -} - -HRESULT QWinRTUiaPeerVector::Append(IAutomationPeer *item) -{ - if (item) - item->AddRef(); - m_impl.append(item); - return S_OK; -} - -HRESULT QWinRTUiaPeerVector::RemoveAtEnd() -{ - if (m_impl.size() == 0) - return E_FAIL; - if (IAutomationPeer *elem = m_impl.last()) - elem->Release(); - m_impl.removeLast(); - return S_OK; -} - -HRESULT QWinRTUiaPeerVector::Clear() -{ - for (auto elem : qAsConst(m_impl)) - if (elem) - elem->Release(); - m_impl.clear(); - return S_OK; -} - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiapeervector.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiapeervector.h deleted file mode 100644 index 265526de09..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiapeervector.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIAPEERVECTOR_H -#define QWINRTUIAPEERVECTOR_H - -#include -#if QT_CONFIG(accessibility) - -#include -#include -#include -#include -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -// Implements IVector -class QWinRTUiaPeerVector : public Microsoft::WRL::RuntimeClass> -{ -public: - HRESULT STDMETHODCALLTYPE GetAt(quint32 index, ABI::Windows::UI::Xaml::Automation::Peers::IAutomationPeer **item) override; - HRESULT STDMETHODCALLTYPE get_Size(quint32 *size) override; - HRESULT STDMETHODCALLTYPE GetView(ABI::Windows::Foundation::Collections::IVectorView **view) override; - HRESULT STDMETHODCALLTYPE IndexOf(ABI::Windows::UI::Xaml::Automation::Peers::IAutomationPeer *value, quint32 *index, boolean *found) override; - HRESULT STDMETHODCALLTYPE SetAt(quint32 index, ABI::Windows::UI::Xaml::Automation::Peers::IAutomationPeer *item) override; - HRESULT STDMETHODCALLTYPE InsertAt(quint32 index, ABI::Windows::UI::Xaml::Automation::Peers::IAutomationPeer *item) override; - HRESULT STDMETHODCALLTYPE RemoveAt(quint32 index) override; - HRESULT STDMETHODCALLTYPE Append(ABI::Windows::UI::Xaml::Automation::Peers::IAutomationPeer *item) override; - HRESULT STDMETHODCALLTYPE RemoveAtEnd() override; - HRESULT STDMETHODCALLTYPE Clear() override; -private: - QVector m_impl; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIAPEERVECTOR_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiaprovidercache.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiaprovidercache.cpp deleted file mode 100644 index 06ff094c45..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiaprovidercache.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiaprovidercache.h" - -QT_BEGIN_NAMESPACE - -// Private constructor -QWinRTUiaProviderCache::QWinRTUiaProviderCache() -{ -} - -// shared instance -QWinRTUiaProviderCache *QWinRTUiaProviderCache::instance() -{ - static QWinRTUiaProviderCache providerCache; - return &providerCache; -} - -// Returns the provider instance associated with the ID, or nullptr. -QWinRTUiaBaseProvider *QWinRTUiaProviderCache::providerForId(QAccessible::Id id) const -{ - return m_providerTable.value(id); -} - -// Inserts a provider in the cache and associates it with an accessibility ID. -void QWinRTUiaProviderCache::insert(QAccessible::Id id, QWinRTUiaBaseProvider *provider) -{ - remove(id); - if (provider) { - m_providerTable[id] = provider; - m_inverseTable[provider] = id; - // Connects the destroyed signal to our slot, to remove deleted objects from the cache. - QObject::connect(provider, &QObject::destroyed, this, &QWinRTUiaProviderCache::objectDestroyed); - } -} - -// Removes deleted provider objects from the cache. -void QWinRTUiaProviderCache::objectDestroyed(QObject *obj) -{ - // We have to use the inverse table to map the object address back to its ID, - // since at this point (called from QObject destructor), it has already been - // partially destroyed and we cannot treat it as a provider. - auto it = m_inverseTable.find(obj); - if (it != m_inverseTable.end()) { - m_providerTable.remove(*it); - m_inverseTable.remove(obj); - } -} - -// Removes a provider with a given id from the cache. -void QWinRTUiaProviderCache::remove(QAccessible::Id id) -{ - m_inverseTable.remove(m_providerTable.value(id)); - m_providerTable.remove(id); -} - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiaprovidercache.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiaprovidercache.h deleted file mode 100644 index 393ef7d562..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiaprovidercache.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIAPROVIDERCACHE_H -#define QWINRTUIAPROVIDERCACHE_H - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiabaseprovider.h" - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -// Singleton used to cache provider instances using the accessibility ID as the key. -class QWinRTUiaProviderCache : public QObject -{ - QWinRTUiaProviderCache(); - Q_OBJECT -public: - static QWinRTUiaProviderCache *instance(); - QWinRTUiaBaseProvider *providerForId(QAccessible::Id id) const; - void insert(QAccessible::Id id, QWinRTUiaBaseProvider *provider); - void remove(QAccessible::Id id); - -private Q_SLOTS: - void objectDestroyed(QObject *obj); - -private: - QHash m_providerTable; - QHash m_inverseTable; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIAPROVIDERCACHE_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiarangevalueprovider.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiarangevalueprovider.cpp deleted file mode 100644 index 4ac59c890a..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiarangevalueprovider.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiarangevalueprovider.h" -#include "qwinrtuiametadatacache.h" -#include "qwinrtuiautils.h" - -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -using namespace QWinRTUiAutomation; -using namespace ABI::Windows::UI::Xaml::Automation; -using namespace ABI::Windows::UI::Xaml::Automation::Provider; - -QWinRTUiaRangeValueProvider::QWinRTUiaRangeValueProvider(QAccessible::Id id) : - QWinRTUiaBaseProvider(id) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -QWinRTUiaRangeValueProvider::~QWinRTUiaRangeValueProvider() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaRangeValueProvider::get_IsReadOnly(boolean *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *value = (metadata->state().readOnly != 0); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaRangeValueProvider::get_LargeChange(DOUBLE *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *value = metadata->minimumStepSize(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaRangeValueProvider::get_Maximum(DOUBLE *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *value = metadata->maximumValue(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaRangeValueProvider::get_Minimum(DOUBLE *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *value = metadata->minimumValue(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaRangeValueProvider::get_SmallChange(DOUBLE *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *value = metadata->minimumStepSize(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaRangeValueProvider::get_Value(DOUBLE *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *value = metadata->currentValue(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaRangeValueProvider::SetValue(DOUBLE value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - auto accid = id(); - - QEventDispatcherWinRT::runOnMainThread([accid, value]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) { - if (QAccessibleValueInterface *valueInterface = accessible->valueInterface()) { - double minimum = valueInterface->minimumValue().toDouble(); - double maximum = valueInterface->maximumValue().toDouble(); - if ((value >= minimum) && (value <= maximum)) { - valueInterface->setCurrentValue(QVariant(value)); - } - } - } - QWinRTUiaMetadataCache::instance()->load(accid); - return S_OK; - }, 0); - - return S_OK; -} - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiarangevalueprovider.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiarangevalueprovider.h deleted file mode 100644 index 4e98959526..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiarangevalueprovider.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIARANGEVALUEPROVIDER_H -#define QWINRTUIARANGEVALUEPROVIDER_H - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiabaseprovider.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -// Implements the Range Value control pattern provider. -class QWinRTUiaRangeValueProvider : - public QWinRTUiaBaseProvider, - public Microsoft::WRL::RuntimeClass -{ - Q_OBJECT - Q_DISABLE_COPY(QWinRTUiaRangeValueProvider) - InspectableClass(L"QWinRTUiaRangeValueProvider", BaseTrust); - -public: - explicit QWinRTUiaRangeValueProvider(QAccessible::Id id); - virtual ~QWinRTUiaRangeValueProvider(); - - // IRangeValueProvider - HRESULT STDMETHODCALLTYPE get_IsReadOnly(boolean *value) override; - HRESULT STDMETHODCALLTYPE get_LargeChange(DOUBLE *value) override; - HRESULT STDMETHODCALLTYPE get_Maximum(DOUBLE *value) override; - HRESULT STDMETHODCALLTYPE get_Minimum(DOUBLE *value) override; - HRESULT STDMETHODCALLTYPE get_SmallChange(DOUBLE *value) override; - HRESULT STDMETHODCALLTYPE get_Value(DOUBLE *value) override; - HRESULT STDMETHODCALLTYPE SetValue(DOUBLE value) override; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIARANGEVALUEPROVIDER_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiaselectionitemprovider.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiaselectionitemprovider.cpp deleted file mode 100644 index 2cb5aa685c..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiaselectionitemprovider.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiaselectionitemprovider.h" -#include "qwinrtuiamainprovider.h" -#include "qwinrtuiametadatacache.h" -#include "qwinrtuiautils.h" - -#include -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -using namespace QWinRTUiAutomation; -using namespace ABI::Windows::UI::Xaml::Automation; -using namespace ABI::Windows::UI::Xaml::Automation::Provider; -using namespace ABI::Windows::UI::Xaml::Automation::Peers; - -QWinRTUiaSelectionItemProvider::QWinRTUiaSelectionItemProvider(QAccessible::Id id) : - QWinRTUiaBaseProvider(id) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -QWinRTUiaSelectionItemProvider::~QWinRTUiaSelectionItemProvider() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -// Returns true if element is currently selected. -HRESULT STDMETHODCALLTYPE QWinRTUiaSelectionItemProvider::get_IsSelected(boolean *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - if (metadata->role() == QAccessible::RadioButton) - *value = metadata->state().checked; - else - *value = metadata->state().selected; - return S_OK; -} - -// Returns the provider for the container element (e.g., the list for the list item). -HRESULT STDMETHODCALLTYPE QWinRTUiaSelectionItemProvider::get_SelectionContainer(IIRawElementProviderSimple **value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - *value = nullptr; - - auto accid = id(); - auto elementId = std::make_shared(0); - - if (!SUCCEEDED(QEventDispatcherWinRT::runOnMainThread([accid, elementId]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) { - // Radio buttons do not require a container. - if (accessible->role() == QAccessible::ListItem) { - if (QAccessibleInterface *parent = accessible->parent()) { - if (parent->role() == QAccessible::List) { - *elementId = idForAccessible(parent); - } - } - } - } - return S_OK; - }))) { - return E_FAIL; - } - - if (!*elementId) - return S_OK; - - return QWinRTUiaMainProvider::rawProviderForAccessibleId(*elementId, value); -} - -// Adds the element to the list of selected elements. -HRESULT STDMETHODCALLTYPE QWinRTUiaSelectionItemProvider::AddToSelection() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - auto accid = id(); - - QEventDispatcherWinRT::runOnMainThread([accid]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) { - if (QAccessibleActionInterface *actionInterface = accessible->actionInterface()) { - if (accessible->role() == QAccessible::RadioButton) { - // For radio buttons we invoke the selection action. - actionInterface->doAction(QAccessibleActionInterface::pressAction()); - } else { - // Toggle list item if not already selected. - if (!accessible->state().selected) { - actionInterface->doAction(QAccessibleActionInterface::toggleAction()); - } - } - } - } - QWinRTUiaMetadataCache::instance()->load(accid); - return S_OK; - }, 0); - return S_OK; -} - -// Removes a list item from selection. -HRESULT STDMETHODCALLTYPE QWinRTUiaSelectionItemProvider::RemoveFromSelection() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - auto accid = id(); - - QEventDispatcherWinRT::runOnMainThread([accid]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) { - if (QAccessibleActionInterface *actionInterface = accessible->actionInterface()) { - if (accessible->role() != QAccessible::RadioButton) { - if (accessible->state().selected) { - actionInterface->doAction(QAccessibleActionInterface::toggleAction()); - } - } - } - } - QWinRTUiaMetadataCache::instance()->load(accid); - return S_OK; - }, 0); - return S_OK; -} - -// Selects the element (deselecting all others). -HRESULT STDMETHODCALLTYPE QWinRTUiaSelectionItemProvider::Select() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - auto accid = id(); - - QEventDispatcherWinRT::runOnMainThread([accid]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) { - if (QAccessibleActionInterface *actionInterface = accessible->actionInterface()) { - if (accessible->role() == QAccessible::RadioButton) { - // For radio buttons we just invoke the selection action; others are automatically deselected. - actionInterface->doAction(QAccessibleActionInterface::pressAction()); - } else { - // Toggle list item if not already selected. It must be done first to support all selection modes. - if (!accessible->state().selected) { - actionInterface->doAction(QAccessibleActionInterface::toggleAction()); - } - // Toggle selected siblings. - if (QAccessibleInterface *parent = accessible->parent()) { - for (int i = 0; i < parent->childCount(); ++i) { - if (QAccessibleInterface *sibling = parent->child(i)) { - if ((sibling != accessible) && (sibling->state().selected)) { - if (QAccessibleActionInterface *siblingAction = sibling->actionInterface()) { - siblingAction->doAction(QAccessibleActionInterface::toggleAction()); - } - } - } - } - } - } - } - } - QWinRTUiaMetadataCache::instance()->load(accid); - return S_OK; - }, 0); - return S_OK; -} - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiaselectionitemprovider.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiaselectionitemprovider.h deleted file mode 100644 index 1b3cce7495..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiaselectionitemprovider.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIASELECTIONITEMPROVIDER_H -#define QWINRTUIASELECTIONITEMPROVIDER_H - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiabaseprovider.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -// Implements the Selection Item control pattern provider. Used for List items and radio buttons. -class QWinRTUiaSelectionItemProvider : - public QWinRTUiaBaseProvider, - public Microsoft::WRL::RuntimeClass -{ - Q_OBJECT - Q_DISABLE_COPY(QWinRTUiaSelectionItemProvider) - InspectableClass(L"QWinRTUiaSelectionItemProvider", BaseTrust); - -public: - explicit QWinRTUiaSelectionItemProvider(QAccessible::Id id); - virtual ~QWinRTUiaSelectionItemProvider(); - - // ISelectionItemProvider - HRESULT STDMETHODCALLTYPE get_IsSelected(boolean *value) override; - HRESULT STDMETHODCALLTYPE get_SelectionContainer(ABI::Windows::UI::Xaml::Automation::Provider::IIRawElementProviderSimple **value) override; - HRESULT STDMETHODCALLTYPE AddToSelection() override; - HRESULT STDMETHODCALLTYPE RemoveFromSelection() override; - HRESULT STDMETHODCALLTYPE Select() override; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIASELECTIONITEMPROVIDER_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiaselectionprovider.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiaselectionprovider.cpp deleted file mode 100644 index 4d825351c8..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiaselectionprovider.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiaselectionprovider.h" -#include "qwinrtuiametadatacache.h" -#include "qwinrtuiamainprovider.h" -#include "qwinrtuiautils.h" - -#include -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -using namespace QWinRTUiAutomation; -using namespace ABI::Windows::UI::Xaml::Automation; -using namespace ABI::Windows::UI::Xaml::Automation::Provider; -using namespace ABI::Windows::UI::Xaml::Automation::Peers; - -QWinRTUiaSelectionProvider::QWinRTUiaSelectionProvider(QAccessible::Id id) : - QWinRTUiaBaseProvider(id) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -QWinRTUiaSelectionProvider::~QWinRTUiaSelectionProvider() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaSelectionProvider::get_CanSelectMultiple(boolean *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *value = (metadata->state().multiSelectable != 0); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaSelectionProvider::get_IsSelectionRequired(boolean *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - *value = false; - - auto accid = id(); - auto selectionRequired = std::make_shared(false); - - if (!SUCCEEDED(QEventDispatcherWinRT::runOnMainThread([accid, selectionRequired]() { - // Initially returns false if none are selected. After the first selection, it may be required. - bool anySelected = false; - if (QAccessibleInterface *accessible = accessibleForId(accid)) { - int childCount = accessible->childCount(); - for (int i = 0; i < childCount; ++i) { - if (QAccessibleInterface *childAcc = accessible->child(i)) { - if (childAcc->state().selected) { - anySelected = true; - break; - } - } - } - *selectionRequired = anySelected && !accessible->state().multiSelectable && !accessible->state().extSelectable; - } - return S_OK; - }))) { - return E_FAIL; - } - - *value = *selectionRequired; - return S_OK; -} - -// Returns an array of providers with the selected items. -HRESULT STDMETHODCALLTYPE QWinRTUiaSelectionProvider::GetSelection(UINT32 *returnValueSize, IIRawElementProviderSimple ***returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValueSize || !returnValue) - return E_INVALIDARG; - *returnValueSize = 0; - *returnValue = nullptr; - - auto accid = id(); - auto elementIds = std::make_shared>(); - - if (!SUCCEEDED(QEventDispatcherWinRT::runOnMainThread([accid, elementIds]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) { - int childCount = accessible->childCount(); - for (int i = 0; i < childCount; ++i) { - if (QAccessibleInterface *childAcc = accessible->child(i)) { - if (childAcc->state().selected) { - QAccessible::Id childId = idForAccessible(childAcc); - QWinRTUiaMetadataCache::instance()->load(childId); - elementIds->append(childId); - } - } - } - } - return S_OK; - }))) { - return E_FAIL; - } - - return QWinRTUiaMainProvider::rawProviderArrayForAccessibleIdList(*elementIds, returnValueSize, returnValue); -} - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiaselectionprovider.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiaselectionprovider.h deleted file mode 100644 index dcd286800f..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiaselectionprovider.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIASELECTIONPROVIDER_H -#define QWINRTUIASELECTIONPROVIDER_H - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiabaseprovider.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -// Implements the Selection control pattern provider. Used for Lists. -class QWinRTUiaSelectionProvider : - public QWinRTUiaBaseProvider, - public Microsoft::WRL::RuntimeClass -{ - Q_OBJECT - Q_DISABLE_COPY(QWinRTUiaSelectionProvider) - InspectableClass(L"QWinRTUiaSelectionProvider", BaseTrust); - -public: - explicit QWinRTUiaSelectionProvider(QAccessible::Id id); - virtual ~QWinRTUiaSelectionProvider(); - - // ISelectionProvider - HRESULT STDMETHODCALLTYPE get_CanSelectMultiple(boolean *value) override; - HRESULT STDMETHODCALLTYPE get_IsSelectionRequired(boolean *value) override; - HRESULT STDMETHODCALLTYPE GetSelection(UINT32 *returnValueSize, ABI::Windows::UI::Xaml::Automation::Provider::IIRawElementProviderSimple ***returnValue) override; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIASELECTIONPROVIDER_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatableitemprovider.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiatableitemprovider.cpp deleted file mode 100644 index 7cd953de87..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatableitemprovider.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiatableitemprovider.h" -#include "qwinrtuiamainprovider.h" -#include "qwinrtuiametadatacache.h" -#include "qwinrtuiautils.h" - -#include -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -using namespace QWinRTUiAutomation; -using namespace ABI::Windows::UI::Xaml::Automation; -using namespace ABI::Windows::UI::Xaml::Automation::Provider; - -QWinRTUiaTableItemProvider::QWinRTUiaTableItemProvider(QAccessible::Id id) : - QWinRTUiaBaseProvider(id) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -QWinRTUiaTableItemProvider::~QWinRTUiaTableItemProvider() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -// Returns the providers for the column headers associated with the item. -HRESULT STDMETHODCALLTYPE QWinRTUiaTableItemProvider::GetColumnHeaderItems(UINT32 *returnValueSize, IIRawElementProviderSimple ***returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValueSize || !returnValue) - return E_INVALIDARG; - *returnValueSize = 0; - *returnValue = nullptr; - - auto accid = id(); - auto elementIds = std::make_shared>(); - - if (!SUCCEEDED(QEventDispatcherWinRT::runOnMainThread([accid, elementIds]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) { - if (QAccessibleTableCellInterface *tableCellInterface = accessible->tableCellInterface()) { - QList headers = tableCellInterface->columnHeaderCells(); - for (auto header : qAsConst(headers)) { - QAccessible::Id headerId = idForAccessible(header); - QWinRTUiaMetadataCache::instance()->load(headerId); - elementIds->append(headerId); - } - } - } - return S_OK; - }))) { - return E_FAIL; - } - - return QWinRTUiaMainProvider::rawProviderArrayForAccessibleIdList(*elementIds, returnValueSize, returnValue); -} - -// Returns the providers for the row headers associated with the item. -HRESULT STDMETHODCALLTYPE QWinRTUiaTableItemProvider::GetRowHeaderItems(UINT32 *returnValueSize, IIRawElementProviderSimple ***returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValueSize || !returnValue) - return E_INVALIDARG; - *returnValueSize = 0; - *returnValue = nullptr; - - auto accid = id(); - auto elementIds = std::make_shared>(); - - if (!SUCCEEDED(QEventDispatcherWinRT::runOnMainThread([accid, elementIds]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) { - if (QAccessibleTableCellInterface *tableCellInterface = accessible->tableCellInterface()) { - QList headers = tableCellInterface->rowHeaderCells(); - for (auto header : qAsConst(headers)) { - QAccessible::Id headerId = idForAccessible(header); - QWinRTUiaMetadataCache::instance()->load(headerId); - elementIds->append(headerId); - } - } - } - return S_OK; - }))) { - return E_FAIL; - } - - return QWinRTUiaMainProvider::rawProviderArrayForAccessibleIdList(*elementIds, returnValueSize, returnValue); -} - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatableitemprovider.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiatableitemprovider.h deleted file mode 100644 index cb759864ae..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatableitemprovider.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIATABLEITEMPROVIDER_H -#define QWINRTUIATABLEITEMPROVIDER_H - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiabaseprovider.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -// Implements the Table Item control pattern provider. Used by items within a table/tree. -class QWinRTUiaTableItemProvider : - public QWinRTUiaBaseProvider, - public Microsoft::WRL::RuntimeClass -{ - Q_OBJECT - Q_DISABLE_COPY(QWinRTUiaTableItemProvider) - InspectableClass(L"QWinRTUiaTableItemProvider", BaseTrust); - -public: - explicit QWinRTUiaTableItemProvider(QAccessible::Id id); - virtual ~QWinRTUiaTableItemProvider(); - - // ITableItemProvider - HRESULT STDMETHODCALLTYPE GetColumnHeaderItems(UINT32 *returnValueSize, ABI::Windows::UI::Xaml::Automation::Provider::IIRawElementProviderSimple ***returnValue) override; - HRESULT STDMETHODCALLTYPE GetRowHeaderItems(UINT32 *returnValueSize, ABI::Windows::UI::Xaml::Automation::Provider::IIRawElementProviderSimple ***returnValue) override; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIATABLEITEMPROVIDER_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatableprovider.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiatableprovider.cpp deleted file mode 100644 index d763b320b1..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatableprovider.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiatableprovider.h" -#include "qwinrtuiamainprovider.h" -#include "qwinrtuiametadatacache.h" -#include "qwinrtuiautils.h" - -#include -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -using namespace QWinRTUiAutomation; -using namespace ABI::Windows::UI::Xaml::Automation; -using namespace ABI::Windows::UI::Xaml::Automation::Provider; -using namespace ABI::Windows::UI::Xaml::Automation::Peers; - -QWinRTUiaTableProvider::QWinRTUiaTableProvider(QAccessible::Id id) : - QWinRTUiaBaseProvider(id) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -QWinRTUiaTableProvider::~QWinRTUiaTableProvider() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -// Returns the primary direction of traversal for the table. -HRESULT STDMETHODCALLTYPE QWinRTUiaTableProvider::get_RowOrColumnMajor(RowOrColumnMajor *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - *value = RowOrColumnMajor_Indeterminate; - return S_OK; -} - -// Gets the providers for all the column headers in the table. -HRESULT STDMETHODCALLTYPE QWinRTUiaTableProvider::GetColumnHeaders(UINT32 *returnValueSize, IIRawElementProviderSimple ***returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValueSize || !returnValue) - return E_INVALIDARG; - *returnValueSize = 0; - *returnValue = nullptr; - - auto accid = id(); - auto elementIds = std::make_shared>(); - - if (!SUCCEEDED(QEventDispatcherWinRT::runOnMainThread([accid, elementIds]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) { - if (QAccessibleTableInterface *tableInterface = accessible->tableInterface()) { - for (int i = 0; i < tableInterface->columnCount(); ++i) { - if (QAccessibleInterface *cell = tableInterface->cellAt(0, i)) { - QWinRTUiaMetadataCache::instance()->load(idForAccessible(cell)); - if (QAccessibleTableCellInterface *tableCellInterface = cell->tableCellInterface()) { - QList headers = tableCellInterface->columnHeaderCells(); - for (auto header : qAsConst(headers)) { - QAccessible::Id headerId = idForAccessible(header); - QWinRTUiaMetadataCache::instance()->load(headerId); - elementIds->append(headerId); - } - } - } - } - } - } - return S_OK; - }))) { - return E_FAIL; - } - - return QWinRTUiaMainProvider::rawProviderArrayForAccessibleIdList(*elementIds, returnValueSize, returnValue); -} - -// Gets the providers for all the row headers in the table. -HRESULT STDMETHODCALLTYPE QWinRTUiaTableProvider::GetRowHeaders(UINT32 *returnValueSize, IIRawElementProviderSimple ***returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValueSize || !returnValue) - return E_INVALIDARG; - *returnValueSize = 0; - *returnValue = nullptr; - - auto accid = id(); - auto elementIds = std::make_shared>(); - - if (!SUCCEEDED(QEventDispatcherWinRT::runOnMainThread([accid, elementIds]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) { - if (QAccessibleTableInterface *tableInterface = accessible->tableInterface()) { - for (int i = 0; i < tableInterface->rowCount(); ++i) { - if (QAccessibleInterface *cell = tableInterface->cellAt(i, 0)) { - QWinRTUiaMetadataCache::instance()->load(idForAccessible(cell)); - if (QAccessibleTableCellInterface *tableCellInterface = cell->tableCellInterface()) { - QList headers = tableCellInterface->rowHeaderCells(); - for (auto header : qAsConst(headers)) { - QAccessible::Id headerId = idForAccessible(header); - QWinRTUiaMetadataCache::instance()->load(headerId); - elementIds->append(headerId); - } - } - } - } - } - } - return S_OK; - }))) { - return E_FAIL; - } - - return QWinRTUiaMainProvider::rawProviderArrayForAccessibleIdList(*elementIds, returnValueSize, returnValue); -} - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatableprovider.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiatableprovider.h deleted file mode 100644 index 0cd174e401..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatableprovider.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIATABLEPROVIDER_H -#define QWINRTUIATABLEPROVIDER_H - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiabaseprovider.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -// Implements the Table control pattern provider. Used by tables/trees. -class QWinRTUiaTableProvider : - public QWinRTUiaBaseProvider, - public Microsoft::WRL::RuntimeClass -{ - Q_OBJECT - Q_DISABLE_COPY(QWinRTUiaTableProvider) - InspectableClass(L"QWinRTUiaTableProvider", BaseTrust); - -public: - explicit QWinRTUiaTableProvider(QAccessible::Id id); - virtual ~QWinRTUiaTableProvider(); - - // ITableProvider - HRESULT STDMETHODCALLTYPE get_RowOrColumnMajor(ABI::Windows::UI::Xaml::Automation::RowOrColumnMajor *value) override; - HRESULT STDMETHODCALLTYPE GetColumnHeaders(UINT32 *returnValueSize, ABI::Windows::UI::Xaml::Automation::Provider::IIRawElementProviderSimple ***returnValue) override; - HRESULT STDMETHODCALLTYPE GetRowHeaders(UINT32 *returnValueSize, ABI::Windows::UI::Xaml::Automation::Provider::IIRawElementProviderSimple ***returnValue) override; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIATABLEPROVIDER_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatextprovider.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiatextprovider.cpp deleted file mode 100644 index cd7420f360..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatextprovider.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiatextprovider.h" -#include "qwinrtuiametadatacache.h" -#include "qwinrtuiatextrangeprovider.h" -#include "qwinrtuiautils.h" - -#include -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -using namespace QWinRTUiAutomation; -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::UI::Xaml::Automation; -using namespace ABI::Windows::UI::Xaml::Automation::Provider; - -QWinRTUiaTextProvider::QWinRTUiaTextProvider(QAccessible::Id id) : - QWinRTUiaBaseProvider(id) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -QWinRTUiaTextProvider::~QWinRTUiaTextProvider() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -// Returns a text range provider for the entire text. -HRESULT STDMETHODCALLTYPE QWinRTUiaTextProvider::get_DocumentRange(ITextRangeProvider **value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - ComPtr textRangeProvider = Make(id(), 0, metadata->characterCount()); - return textRangeProvider.CopyTo(value); -} - -// Currently supporting single selection. -HRESULT STDMETHODCALLTYPE QWinRTUiaTextProvider::get_SupportedTextSelection(SupportedTextSelection *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - if (!value) - return E_INVALIDARG; - *value = SupportedTextSelection_Single; - return S_OK; - -} - -// Returns an array of providers for the selected text ranges. -HRESULT STDMETHODCALLTYPE QWinRTUiaTextProvider::GetSelection(UINT32 *returnValueSize, ITextRangeProvider ***returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValueSize || !returnValue) - return E_INVALIDARG; - *returnValueSize = 0; - *returnValue = nullptr; - - struct Selection { int startOffset, endOffset; }; - - auto accid = id(); - auto selections = std::make_shared>(); - - if (!SUCCEEDED(QEventDispatcherWinRT::runOnMainThread([accid, selections]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) { - if (QAccessibleTextInterface *textInterface = accessible->textInterface()) { - for (int i = 0; i < textInterface->selectionCount(); ++i) { - int startOffset, endOffset; - textInterface->selection(i, &startOffset, &endOffset); - selections->append({startOffset, endOffset}); - } - if (selections->size() == 0) { - // If there is no selection, we return an array with a single degenerate (empty) text range at the cursor position. - auto cur = textInterface->cursorPosition(); - selections->append({cur, cur}); - } - } - } - return S_OK; - }))) { - return E_FAIL; - } - - int selCount = selections->size(); - if (selCount < 1) - return E_FAIL; - - ITextRangeProvider **providerArray = static_cast(CoTaskMemAlloc(selCount * sizeof(ITextRangeProvider *))); - if (!providerArray) - return E_OUTOFMEMORY; - - auto dst = providerArray; - for (auto sel : *selections) { - ComPtr textRangeProvider - = Make(id(), sel.startOffset, sel.endOffset); - textRangeProvider.CopyTo(dst++); - } - *returnValueSize = selCount; - *returnValue = providerArray; - return S_OK; -} - -// Returns an array of providers for the visible text ranges. -HRESULT STDMETHODCALLTYPE QWinRTUiaTextProvider::GetVisibleRanges(UINT32 *returnValueSize, ITextRangeProvider ***returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValueSize || !returnValue) - return E_INVALIDARG; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - - // Considering the entire text as visible. - ComPtr textRangeProvider = Make(id(), 0, metadata->characterCount()); - textRangeProvider.CopyTo(*returnValue); - *returnValueSize = 1; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaTextProvider::RangeFromChild(IIRawElementProviderSimple *childElement, ITextRangeProvider **returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - if (!childElement || !returnValue) - return E_INVALIDARG; - *returnValue = nullptr; - // No children supported. - return S_OK; -} - -// Returns a degenerate text range at the specified point. -HRESULT STDMETHODCALLTYPE QWinRTUiaTextProvider::RangeFromPoint(ABI::Windows::Foundation::Point screenLocation, ITextRangeProvider **returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - *returnValue = nullptr; - - const QPoint pt(screenLocation.X, screenLocation.Y); - auto accid = id(); - auto offset = std::make_shared(); - - if (!SUCCEEDED(QEventDispatcherWinRT::runOnMainThread([accid, pt, offset]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) - if (QAccessibleTextInterface *textInterface = accessible->textInterface()) - *offset = qBound(0, textInterface->offsetAtPoint(pt), textInterface->characterCount() - 1); - return S_OK; - }))) { - return E_FAIL; - } - - ComPtr textRangeProvider = Make(id(), *offset, *offset); - textRangeProvider.CopyTo(returnValue); - return S_OK; -} - -// Not supporting annotations. -HRESULT STDMETHODCALLTYPE QWinRTUiaTextProvider::RangeFromAnnotation(IIRawElementProviderSimple *annotationElement, ITextRangeProvider **returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - if (!annotationElement || !returnValue) - return E_INVALIDARG; - *returnValue = nullptr; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaTextProvider::GetCaretRange(boolean *isActive, ITextRangeProvider **returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!isActive || !returnValue) - return E_INVALIDARG; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *isActive = metadata->state().focused; - - ComPtr textRangeProvider = Make(id(), metadata->cursorPosition(), metadata->cursorPosition()); - return textRangeProvider.CopyTo(returnValue); -} - - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatextprovider.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiatextprovider.h deleted file mode 100644 index 80d88e4115..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatextprovider.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIATEXTPROVIDER_H -#define QWINRTUIATEXTPROVIDER_H - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiabaseprovider.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -// Implements the Text control pattern provider. Used for text controls. -class QWinRTUiaTextProvider : - public QWinRTUiaBaseProvider, - public Microsoft::WRL::RuntimeClass -{ - Q_OBJECT - Q_DISABLE_COPY(QWinRTUiaTextProvider) - InspectableClass(L"QWinRTUiaTextProvider", BaseTrust); - -public: - explicit QWinRTUiaTextProvider(QAccessible::Id id); - virtual ~QWinRTUiaTextProvider(); - - // ITextProvider - HRESULT STDMETHODCALLTYPE get_DocumentRange(ABI::Windows::UI::Xaml::Automation::Provider::ITextRangeProvider **value) override; - HRESULT STDMETHODCALLTYPE get_SupportedTextSelection(ABI::Windows::UI::Xaml::Automation::SupportedTextSelection *value) override; - HRESULT STDMETHODCALLTYPE GetSelection(UINT32 *returnValueSize, ABI::Windows::UI::Xaml::Automation::Provider::ITextRangeProvider ***returnValue) override; - HRESULT STDMETHODCALLTYPE GetVisibleRanges(UINT32 *returnValueSize, ABI::Windows::UI::Xaml::Automation::Provider::ITextRangeProvider ***returnValue) override; - HRESULT STDMETHODCALLTYPE RangeFromChild(ABI::Windows::UI::Xaml::Automation::Provider::IIRawElementProviderSimple *childElement, ABI::Windows::UI::Xaml::Automation::Provider::ITextRangeProvider **returnValue) override; - HRESULT STDMETHODCALLTYPE RangeFromPoint(ABI::Windows::Foundation::Point screenLocation, ABI::Windows::UI::Xaml::Automation::Provider::ITextRangeProvider **returnValue) override; - - // ITextProvider2 - HRESULT STDMETHODCALLTYPE RangeFromAnnotation(ABI::Windows::UI::Xaml::Automation::Provider::IIRawElementProviderSimple *annotationElement, ABI::Windows::UI::Xaml::Automation::Provider::ITextRangeProvider **returnValue) override; - HRESULT STDMETHODCALLTYPE GetCaretRange(boolean *isActive, ABI::Windows::UI::Xaml::Automation::Provider::ITextRangeProvider **returnValue) override; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIATEXTPROVIDER_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatextrangeprovider.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiatextrangeprovider.cpp deleted file mode 100644 index ca15feaff9..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatextrangeprovider.cpp +++ /dev/null @@ -1,498 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiatextrangeprovider.h" -#include "qwinrtuiametadatacache.h" -#include "qwinrtuiamainprovider.h" -#include "qwinrtuiautils.h" - -#include -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -using namespace QWinRTUiAutomation; -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::UI::Xaml; -using namespace ABI::Windows::UI::Xaml::Automation; -using namespace ABI::Windows::UI::Xaml::Automation::Provider; -using namespace ABI::Windows::UI::Xaml::Automation::Text; - -QWinRTUiaTextRangeProvider::QWinRTUiaTextRangeProvider(QAccessible::Id id, int startOffset, int endOffset) : - QWinRTUiaBaseProvider(id), - m_startOffset(startOffset), - m_endOffset(endOffset) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__ << startOffset << endOffset; -} - -QWinRTUiaTextRangeProvider::~QWinRTUiaTextRangeProvider() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaTextRangeProvider::Clone(ITextRangeProvider **returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - if (!returnValue) - return E_INVALIDARG; - - ComPtr textRangeProvider = Make(id(), m_startOffset, m_endOffset); - textRangeProvider.CopyTo(returnValue); - return S_OK; -} - -// Two ranges are considered equal if their start/end points are the same. -HRESULT STDMETHODCALLTYPE QWinRTUiaTextRangeProvider::Compare(ITextRangeProvider *textRangeProvider, boolean *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - if (!textRangeProvider || !returnValue) - return E_INVALIDARG; - - QWinRTUiaTextRangeProvider *targetProvider = static_cast(textRangeProvider); - *returnValue = ((targetProvider->m_startOffset == m_startOffset) && (targetProvider->m_endOffset == m_endOffset)); - return S_OK; -} - -// Compare different endpoinds between two providers. -HRESULT STDMETHODCALLTYPE QWinRTUiaTextRangeProvider::CompareEndpoints(TextPatternRangeEndpoint endpoint, ITextRangeProvider *textRangeProvider, TextPatternRangeEndpoint targetEndpoint, INT32 *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!textRangeProvider || !returnValue) - return E_INVALIDARG; - - QWinRTUiaTextRangeProvider *targetProvider = static_cast(textRangeProvider); - - int point = (endpoint == TextPatternRangeEndpoint_Start) ? m_startOffset : m_endOffset; - int targetPoint = (targetEndpoint == TextPatternRangeEndpoint_Start) ? - targetProvider->m_startOffset : targetProvider->m_endOffset; - *returnValue = point - targetPoint; - return S_OK; -} - -// Expands/normalizes the range for a given text unit. -HRESULT STDMETHODCALLTYPE QWinRTUiaTextRangeProvider::ExpandToEnclosingUnit(TextUnit unit) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__ << "unit=" << unit << "this: " << this; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - - int len = metadata->characterCount(); - if (len < 1) { - m_startOffset = 0; - m_endOffset = 0; - } else { - if (unit == TextUnit_Character) { - m_startOffset = qBound(0, m_startOffset, len - 1); - m_endOffset = m_startOffset + 1; - } else { - QString text = metadata->text(); - for (int t = m_startOffset; t >= 0; --t) { - if (!isTextUnitSeparator(unit, text[t]) && ((t == 0) || isTextUnitSeparator(unit, text[t - 1]))) { - m_startOffset = t; - break; - } - } - for (int t = m_startOffset; t < len; ++t) { - if ((t == len - 1) || (isTextUnitSeparator(unit, text[t]) && ((unit == TextUnit_Word) || !isTextUnitSeparator(unit, text[t + 1])))) { - m_endOffset = t + 1; - break; - } - } - } - } - return S_OK; -} - -// Not supported. -HRESULT STDMETHODCALLTYPE QWinRTUiaTextRangeProvider::FindAttribute(INT32 /*attributeId*/, IInspectable * /*value*/, boolean /*backward*/, ITextRangeProvider **returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - if (!returnValue) - return E_INVALIDARG; - *returnValue = nullptr; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaTextRangeProvider::FindText(HSTRING /*text*/, boolean /*backward*/, boolean /*ignoreCase*/, ITextRangeProvider **returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - if (!returnValue) - return E_INVALIDARG; - *returnValue = nullptr; - return S_OK; -} - -// Returns the value of a given attribute. -HRESULT STDMETHODCALLTYPE QWinRTUiaTextRangeProvider::GetAttributeValue(INT32 attributeId, IInspectable **returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__ << "attributeId=" << attributeId; - - if (!returnValue) - return E_INVALIDARG; - *returnValue = nullptr; - - ComPtr propertyValueStatics; - if (FAILED(RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Foundation_PropertyValue).Get(), IID_PPV_ARGS(&propertyValueStatics)))) - return E_FAIL; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - - switch (attributeId) { - case AutomationTextAttributesEnum_IsReadOnlyAttribute: - return propertyValueStatics->CreateBoolean(metadata->state().readOnly, returnValue); - case AutomationTextAttributesEnum_CaretPositionAttribute: - if (metadata->cursorPosition() == 0) - return propertyValueStatics->CreateInt32(AutomationCaretPosition_BeginningOfLine, returnValue); - else if (metadata->cursorPosition() == metadata->characterCount()) - return propertyValueStatics->CreateInt32(AutomationCaretPosition_EndOfLine, returnValue); - else - return propertyValueStatics->CreateInt32(AutomationCaretPosition_Unknown, returnValue); - default: - break; - } - return E_FAIL; -} - -// Returns an array of bounding rectangles for text lines within the range. -HRESULT STDMETHODCALLTYPE QWinRTUiaTextRangeProvider::GetBoundingRectangles(UINT32 *returnValueSize, DOUBLE **returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValueSize || !returnValue) - return E_INVALIDARG; - *returnValueSize = 0; - *returnValue = nullptr; - - auto accid = id(); - auto startOffset = m_startOffset; - auto endOffset = m_endOffset; - auto rects = std::make_shared>(); - - if (!SUCCEEDED(QEventDispatcherWinRT::runOnMainThread([accid, startOffset, endOffset, rects]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) { - if (QAccessibleTextInterface *textInterface = accessible->textInterface()) { - int len = textInterface->characterCount(); - if ((startOffset >= 0) && (endOffset <= len) && (startOffset < endOffset)) { - int start, end; - textInterface->textAtOffset(startOffset, QAccessible::LineBoundary, &start, &end); - while ((start >= 0) && (end >= 0)) { - int startRange = qMax(start, startOffset); - int endRange = qMin(end, endOffset); - if (startRange < endRange) { - // Calculates a bounding rectangle for the line and adds it to the list. - const QRect startRect = textInterface->characterRect(startRange); - const QRect endRect = textInterface->characterRect(endRange - 1); - const QRect lineRect(qMin(startRect.x(), endRect.x()), - qMin(startRect.y(), endRect.y()), - qMax(startRect.x() + startRect.width(), endRect.x() + endRect.width()) - qMin(startRect.x(), endRect.x()), - qMax(startRect.y() + startRect.height(), endRect.y() + endRect.height()) - qMin(startRect.y(), endRect.y())); - rects->append(lineRect); - } - if (end >= len) break; - textInterface->textAfterOffset(end + 1, QAccessible::LineBoundary, &start, &end); - } - } - } - } - return S_OK; - }))) { - return E_FAIL; - } - - DOUBLE *doubleArray = static_cast(CoTaskMemAlloc(4 * rects->size() * sizeof(DOUBLE))); - if (!doubleArray) - return E_OUTOFMEMORY; - - DOUBLE *dst = doubleArray; - for (auto rect : *rects) { - *dst++ = rect.left(); - *dst++ = rect.top(); - *dst++ = rect.width(); - *dst++ = rect.height(); - } - *returnValue = doubleArray; - *returnValueSize = 4 * rects->size(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaTextRangeProvider::GetEnclosingElement(IIRawElementProviderSimple **returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - if (!returnValue) - return E_INVALIDARG; - return QWinRTUiaMainProvider::rawProviderForAccessibleId(id(), returnValue); -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaTextRangeProvider::GetText(INT32 maxLength, HSTRING *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - if (!returnValue) - return E_INVALIDARG; - *returnValue = nullptr; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - - QString rangeText = metadata->text().mid(m_startOffset, m_endOffset - m_startOffset); - - if ((maxLength > -1) && (rangeText.size() > maxLength)) - rangeText.truncate(maxLength); - return qHString(rangeText, returnValue); -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaTextRangeProvider::Move(TextUnit unit, INT32 count, INT32 *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - if (!returnValue) - return E_INVALIDARG; - *returnValue = 0; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - - int len = metadata->characterCount(); - if (len < 1) - return S_OK; - - if (unit == TextUnit_Character) { - // Moves the start point, ensuring it lies within the bounds. - int start = qBound(0, m_startOffset + count, len - 1); - // If range was initially empty, leaves it as is; otherwise, normalizes it to one char. - m_endOffset = (m_endOffset > m_startOffset) ? start + 1 : start; - *returnValue = start - m_startOffset; // Returns the actually moved distance. - m_startOffset = start; - } else { - if (count > 0) { - MoveEndpointByUnit(TextPatternRangeEndpoint_End, unit, count, returnValue); - MoveEndpointByUnit(TextPatternRangeEndpoint_Start, unit, count, returnValue); - } else { - MoveEndpointByUnit(TextPatternRangeEndpoint_Start, unit, count, returnValue); - MoveEndpointByUnit(TextPatternRangeEndpoint_End, unit, count, returnValue); - } - } - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaTextRangeProvider::MoveEndpointByUnit(TextPatternRangeEndpoint endpoint, TextUnit unit, INT32 count, INT32 *returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - if (!returnValue) - return E_INVALIDARG; - *returnValue = 0; - - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - - int len = metadata->characterCount(); - if (len < 1) - return S_OK; - - if (unit == TextUnit_Character) { - if (endpoint == TextPatternRangeEndpoint_Start) { - int boundedValue = qBound(0, m_startOffset + count, len - 1); - *returnValue = boundedValue - m_startOffset; - m_startOffset = boundedValue; - m_endOffset = qBound(m_startOffset, m_endOffset, len); - } else { - int boundedValue = qBound(0, m_endOffset + count, len); - *returnValue = boundedValue - m_endOffset; - m_endOffset = boundedValue; - m_startOffset = qBound(0, m_startOffset, m_endOffset); - } - } else { - QString text = metadata->text(); - int moved = 0; - - if (endpoint == TextPatternRangeEndpoint_Start) { - if (count > 0) { - for (int t = m_startOffset; (t < len - 1) && (moved < count); ++t) { - if (isTextUnitSeparator(unit, text[t]) && !isTextUnitSeparator(unit, text[t + 1])) { - m_startOffset = t + 1; - ++moved; - } - } - m_endOffset = qBound(m_startOffset, m_endOffset, len); - } else { - for (int t = m_startOffset - 1; (t >= 0) && (moved > count); --t) { - if (!isTextUnitSeparator(unit, text[t]) && ((t == 0) || isTextUnitSeparator(unit, text[t - 1]))) { - m_startOffset = t; - --moved; - } - } - } - } else { - if (count > 0) { - for (int t = m_endOffset; (t < len) && (moved < count); ++t) { - if ((t == len - 1) || (isTextUnitSeparator(unit, text[t]) && ((unit == TextUnit_Word) || !isTextUnitSeparator(unit, text[t + 1])))) { - m_endOffset = t + 1; - ++moved; - } - } - } else { - int end = 0; - for (int t = m_endOffset - 2; (t > 0) && (moved > count); --t) { - if (isTextUnitSeparator(unit, text[t]) && ((unit == TextUnit_Word) || !isTextUnitSeparator(unit, text[t + 1]))) { - end = t + 1; - --moved; - } - } - m_endOffset = end; - m_startOffset = qBound(0, m_startOffset, m_endOffset); - } - } - *returnValue = moved; - } - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaTextRangeProvider::MoveEndpointByRange(TextPatternRangeEndpoint endpoint, ITextRangeProvider *textRangeProvider, TextPatternRangeEndpoint targetEndpoint) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - if (!textRangeProvider) - return E_INVALIDARG; - - QWinRTUiaTextRangeProvider *targetProvider = static_cast(textRangeProvider); - - int targetPoint = (targetEndpoint == TextPatternRangeEndpoint_Start) ? - targetProvider->m_startOffset : targetProvider->m_endOffset; - - // If the moved endpoint crosses the other endpoint, that one is moved too. - if (endpoint == TextPatternRangeEndpoint_Start) { - m_startOffset = targetPoint; - if (m_endOffset < m_startOffset) - m_endOffset = m_startOffset; - } else { - m_endOffset = targetPoint; - if (m_endOffset < m_startOffset) - m_startOffset = m_endOffset; - } - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaTextRangeProvider::Select() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - auto accid = id(); - auto startOffset = m_startOffset; - auto endOffset = m_endOffset; - - QEventDispatcherWinRT::runOnMainThread([accid, startOffset, endOffset]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) - if (QAccessibleTextInterface *textInterface = accessible->textInterface()) { - // unselects all and adds a new selection - for (int i = textInterface->selectionCount() - 1; i >= 0; --i) - textInterface->removeSelection(i); - textInterface->addSelection(startOffset, endOffset); - } - QWinRTUiaMetadataCache::instance()->load(accid); - return S_OK; - }, 0); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaTextRangeProvider::AddToSelection() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - return Select(); -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaTextRangeProvider::RemoveFromSelection() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - auto accid = id(); - - QEventDispatcherWinRT::runOnMainThread([accid]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) - if (QAccessibleTextInterface *textInterface = accessible->textInterface()) { - // unselects all - for (int i = textInterface->selectionCount() - 1; i >= 0; --i) - textInterface->removeSelection(i); - } - QWinRTUiaMetadataCache::instance()->load(accid); - return S_OK; - }, 0); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE QWinRTUiaTextRangeProvider::ScrollIntoView(boolean /*alignToTop*/) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - auto accid = id(); - auto startOffset = m_startOffset; - auto endOffset = m_endOffset; - - QEventDispatcherWinRT::runOnMainThread([accid, startOffset, endOffset]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) - if (QAccessibleTextInterface *textInterface = accessible->textInterface()) { - textInterface->scrollToSubstring(startOffset, endOffset); - } - QWinRTUiaMetadataCache::instance()->load(accid); - return S_OK; - }, 0); - return S_OK; -} - -// Returns an array of children elements embedded within the range. -HRESULT STDMETHODCALLTYPE QWinRTUiaTextRangeProvider::GetChildren(UINT32 *returnValueSize, IIRawElementProviderSimple ***returnValue) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!returnValue) - return E_INVALIDARG; - // Not supporting any children. - returnValueSize = 0; - *returnValue = nullptr; - return S_OK; -} - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatextrangeprovider.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiatextrangeprovider.h deleted file mode 100644 index 81b5f0d400..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatextrangeprovider.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIATEXTRANGEPROVIDER_H -#define QWINRTUIATEXTRANGEPROVIDER_H - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiabaseprovider.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -// Implements the Text Range control pattern provider. Used for text controls. -class QWinRTUiaTextRangeProvider : - public QWinRTUiaBaseProvider, - public Microsoft::WRL::RuntimeClass -{ - Q_OBJECT - Q_DISABLE_COPY(QWinRTUiaTextRangeProvider) - InspectableClass(L"QWinRTUiaTextRangeProvider", BaseTrust); - -public: - explicit QWinRTUiaTextRangeProvider(QAccessible::Id id, int startOffset, int endOffset); - virtual ~QWinRTUiaTextRangeProvider(); - - // ITextRangeProvider - HRESULT STDMETHODCALLTYPE Clone(ABI::Windows::UI::Xaml::Automation::Provider::ITextRangeProvider **returnValue) override; - HRESULT STDMETHODCALLTYPE Compare(ABI::Windows::UI::Xaml::Automation::Provider::ITextRangeProvider *textRangeProvider, boolean *returnValue) override; - HRESULT STDMETHODCALLTYPE CompareEndpoints(ABI::Windows::UI::Xaml::Automation::Text::TextPatternRangeEndpoint endpoint, ABI::Windows::UI::Xaml::Automation::Provider::ITextRangeProvider *textRangeProvider, ABI::Windows::UI::Xaml::Automation::Text::TextPatternRangeEndpoint targetEndpoint, INT32 *returnValue) override; - HRESULT STDMETHODCALLTYPE ExpandToEnclosingUnit(ABI::Windows::UI::Xaml::Automation::Text::TextUnit unit) override; - HRESULT STDMETHODCALLTYPE FindAttribute(INT32 attributeId, IInspectable *value, boolean backward, ABI::Windows::UI::Xaml::Automation::Provider::ITextRangeProvider **returnValue) override; - HRESULT STDMETHODCALLTYPE FindText(HSTRING text, boolean backward, boolean ignoreCase, ABI::Windows::UI::Xaml::Automation::Provider::ITextRangeProvider **returnValue) override; - HRESULT STDMETHODCALLTYPE GetAttributeValue(INT32 attributeId, IInspectable **returnValue) override; - HRESULT STDMETHODCALLTYPE GetBoundingRectangles(UINT32 *returnValueSize, DOUBLE **returnValue) override; - HRESULT STDMETHODCALLTYPE GetEnclosingElement(ABI::Windows::UI::Xaml::Automation::Provider::IIRawElementProviderSimple **returnValue) override; - HRESULT STDMETHODCALLTYPE GetText(INT32 maxLength, HSTRING *returnValue) override; - HRESULT STDMETHODCALLTYPE Move(ABI::Windows::UI::Xaml::Automation::Text::TextUnit unit, INT32 count, INT32 *returnValue) override; - HRESULT STDMETHODCALLTYPE MoveEndpointByUnit(ABI::Windows::UI::Xaml::Automation::Text::TextPatternRangeEndpoint endpoint, ABI::Windows::UI::Xaml::Automation::Text::TextUnit unit, INT32 count, INT32 *returnValue) override; - HRESULT STDMETHODCALLTYPE MoveEndpointByRange(ABI::Windows::UI::Xaml::Automation::Text::TextPatternRangeEndpoint endpoint, ABI::Windows::UI::Xaml::Automation::Provider::ITextRangeProvider *textRangeProvider, ABI::Windows::UI::Xaml::Automation::Text::TextPatternRangeEndpoint targetEndpoint) override; - HRESULT STDMETHODCALLTYPE Select() override; - HRESULT STDMETHODCALLTYPE AddToSelection() override; - HRESULT STDMETHODCALLTYPE RemoveFromSelection() override; - HRESULT STDMETHODCALLTYPE ScrollIntoView(boolean alignToTop) override; - HRESULT STDMETHODCALLTYPE GetChildren(UINT32 *returnValueSize, ABI::Windows::UI::Xaml::Automation::Provider::IIRawElementProviderSimple ***returnValue) override; - -private: - int m_startOffset; - int m_endOffset; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIATEXTRANGEPROVIDER_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatoggleprovider.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiatoggleprovider.cpp deleted file mode 100644 index 59f55eb422..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatoggleprovider.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiatoggleprovider.h" -#include "qwinrtuiametadatacache.h" -#include "qwinrtuiautils.h" - -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -using namespace QWinRTUiAutomation; -using namespace ABI::Windows::UI::Xaml::Automation; -using namespace ABI::Windows::UI::Xaml::Automation::Provider; - -QWinRTUiaToggleProvider::QWinRTUiaToggleProvider(QAccessible::Id id) : - QWinRTUiaBaseProvider(id) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -QWinRTUiaToggleProvider::~QWinRTUiaToggleProvider() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -// Gets the current toggle state. -HRESULT STDMETHODCALLTYPE QWinRTUiaToggleProvider::get_ToggleState(ToggleState *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - if (metadata->state().checked) - *value = metadata->state().checkStateMixed ? ToggleState_Indeterminate : ToggleState_On; - else - *value = ToggleState_Off; - return S_OK; -} - -// Toggles the state by invoking the toggle action. -HRESULT STDMETHODCALLTYPE QWinRTUiaToggleProvider::Toggle() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - auto accid = id(); - - QEventDispatcherWinRT::runOnMainThread([accid]() { - if (QAccessibleInterface *accessible = accessibleForId(accid)) - if (QAccessibleActionInterface *actionInterface = accessible->actionInterface()) - actionInterface->doAction(QAccessibleActionInterface::toggleAction()); - QWinRTUiaMetadataCache::instance()->load(accid); - return S_OK; - }, 0); - return S_OK; -} - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatoggleprovider.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiatoggleprovider.h deleted file mode 100644 index 3d1740c0a1..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiatoggleprovider.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIATOGGLEPROVIDER_H -#define QWINRTUIATOGGLEPROVIDER_H - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiabaseprovider.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -// Implements the Toggle control pattern provider. Used for checkboxes. -class QWinRTUiaToggleProvider : - public QWinRTUiaBaseProvider, - public Microsoft::WRL::RuntimeClass -{ - Q_OBJECT - Q_DISABLE_COPY(QWinRTUiaToggleProvider) - InspectableClass(L"QWinRTUiaToggleProvider", BaseTrust); - -public: - explicit QWinRTUiaToggleProvider(QAccessible::Id id); - virtual ~QWinRTUiaToggleProvider(); - - // IToggleProvider - HRESULT STDMETHODCALLTYPE get_ToggleState(ABI::Windows::UI::Xaml::Automation::ToggleState *value) override; - HRESULT STDMETHODCALLTYPE Toggle() override; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIATOGGLEPROVIDER_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiautils.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiautils.cpp deleted file mode 100644 index 16197c99b9..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiautils.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiautils.h" - -using namespace ABI::Windows::UI::Xaml::Automation::Peers; -using namespace ABI::Windows::UI::Xaml::Automation::Text; -using namespace ABI::Windows::Foundation::Collections; - -QT_BEGIN_NAMESPACE - -Q_LOGGING_CATEGORY(lcQpaUiAutomation, "qt.qpa.uiautomation") - -namespace QWinRTUiAutomation { - -// Returns the window containing the element (usually the top window), -QWindow *windowForAccessible(const QAccessibleInterface *accessible) -{ - QWindow *window = accessible->window(); - if (!window) { - QAccessibleInterface *acc = accessible->parent(); - while (acc && acc->isValid() && !window) { - window = acc->window(); - QAccessibleInterface *par = acc->parent(); - acc = par; - } - } - return window; -} - -QAccessibleInterface *accessibleForId(QAccessible::Id id) -{ - QAccessibleInterface *accessible = QAccessible::accessibleInterface(id); - if (!accessible || !accessible->isValid()) - return nullptr; - return accessible; -} - -QAccessible::Id idForAccessible(QAccessibleInterface *accessible) -{ - if (!accessible) - return QAccessible::Id(0); - return QAccessible::uniqueId(accessible); -} - -// Maps an accessibility role ID to an UI Automation control type ID. -AutomationControlType roleToControlType(QAccessible::Role role) -{ - static const QHash mapping { - {QAccessible::TitleBar, AutomationControlType::AutomationControlType_TitleBar}, - {QAccessible::MenuBar, AutomationControlType::AutomationControlType_MenuBar}, - {QAccessible::ScrollBar, AutomationControlType::AutomationControlType_ScrollBar}, - {QAccessible::Grip, AutomationControlType::AutomationControlType_Thumb}, - {QAccessible::Sound, AutomationControlType::AutomationControlType_Custom}, - {QAccessible::Cursor, AutomationControlType::AutomationControlType_Custom}, - {QAccessible::Caret, AutomationControlType::AutomationControlType_Custom}, - {QAccessible::AlertMessage, AutomationControlType::AutomationControlType_Custom}, - {QAccessible::Window, AutomationControlType::AutomationControlType_Window}, - {QAccessible::Client, AutomationControlType::AutomationControlType_Custom}, - {QAccessible::PopupMenu, AutomationControlType::AutomationControlType_Menu}, - {QAccessible::MenuItem, AutomationControlType::AutomationControlType_MenuItem}, - {QAccessible::ToolTip, AutomationControlType::AutomationControlType_ToolTip}, - {QAccessible::Application, AutomationControlType::AutomationControlType_Custom}, - {QAccessible::Document, AutomationControlType::AutomationControlType_Document}, - {QAccessible::Pane, AutomationControlType::AutomationControlType_Pane}, - {QAccessible::Chart, AutomationControlType::AutomationControlType_Custom}, - {QAccessible::Dialog, AutomationControlType::AutomationControlType_Window}, - {QAccessible::Border, AutomationControlType::AutomationControlType_Custom}, - {QAccessible::Grouping, AutomationControlType::AutomationControlType_Group}, - {QAccessible::Separator, AutomationControlType::AutomationControlType_Separator}, - {QAccessible::ToolBar, AutomationControlType::AutomationControlType_ToolBar}, - {QAccessible::StatusBar, AutomationControlType::AutomationControlType_StatusBar}, - {QAccessible::Table, AutomationControlType::AutomationControlType_Table}, - {QAccessible::ColumnHeader, AutomationControlType::AutomationControlType_Header}, - {QAccessible::RowHeader, AutomationControlType::AutomationControlType_Header}, - {QAccessible::Column, AutomationControlType::AutomationControlType_HeaderItem}, - {QAccessible::Row, AutomationControlType::AutomationControlType_HeaderItem}, - {QAccessible::Cell, AutomationControlType::AutomationControlType_DataItem}, - {QAccessible::Link, AutomationControlType::AutomationControlType_Hyperlink}, - {QAccessible::HelpBalloon, AutomationControlType::AutomationControlType_ToolTip}, - {QAccessible::Assistant, AutomationControlType::AutomationControlType_Custom}, - {QAccessible::List, AutomationControlType::AutomationControlType_List}, - {QAccessible::ListItem, AutomationControlType::AutomationControlType_ListItem}, - {QAccessible::Tree, AutomationControlType::AutomationControlType_Tree}, - {QAccessible::TreeItem, AutomationControlType::AutomationControlType_TreeItem}, - {QAccessible::PageTab, AutomationControlType::AutomationControlType_TabItem}, - {QAccessible::PropertyPage, AutomationControlType::AutomationControlType_Custom}, - {QAccessible::Indicator, AutomationControlType::AutomationControlType_Custom}, - {QAccessible::Graphic, AutomationControlType::AutomationControlType_Image}, - {QAccessible::StaticText, AutomationControlType::AutomationControlType_Text}, - {QAccessible::EditableText, AutomationControlType::AutomationControlType_Edit}, - {QAccessible::Button, AutomationControlType::AutomationControlType_Button}, - {QAccessible::CheckBox, AutomationControlType::AutomationControlType_CheckBox}, - {QAccessible::RadioButton, AutomationControlType::AutomationControlType_RadioButton}, - {QAccessible::ComboBox, AutomationControlType::AutomationControlType_ComboBox}, - {QAccessible::ProgressBar, AutomationControlType::AutomationControlType_ProgressBar}, - {QAccessible::Dial, AutomationControlType::AutomationControlType_Custom}, - {QAccessible::HotkeyField, AutomationControlType::AutomationControlType_Custom}, - {QAccessible::Slider, AutomationControlType::AutomationControlType_Slider}, - {QAccessible::SpinBox, AutomationControlType::AutomationControlType_Spinner}, - {QAccessible::Canvas, AutomationControlType::AutomationControlType_Custom}, - {QAccessible::Animation, AutomationControlType::AutomationControlType_Custom}, - {QAccessible::Equation, AutomationControlType::AutomationControlType_Custom}, - {QAccessible::ButtonDropDown, AutomationControlType::AutomationControlType_Button}, - {QAccessible::ButtonMenu, AutomationControlType::AutomationControlType_Button}, - {QAccessible::ButtonDropGrid, AutomationControlType::AutomationControlType_Button}, - {QAccessible::Whitespace, AutomationControlType::AutomationControlType_Custom}, - {QAccessible::PageTabList, AutomationControlType::AutomationControlType_Tab}, - {QAccessible::Clock, AutomationControlType::AutomationControlType_Custom}, - {QAccessible::Splitter, AutomationControlType::AutomationControlType_Custom}, - }; - - return mapping.value(role, AutomationControlType::AutomationControlType_Custom); -} - -// True if a character can be a separator for a text unit. -bool isTextUnitSeparator(TextUnit unit, const QChar &ch) -{ - return (((unit == TextUnit_Word) || (unit == TextUnit_Format)) && ch.isSpace()) - || ((unit == TextUnit_Line) && (ch.toLatin1() == '\n')); -} - -HRESULT qHString(const QString &str, HSTRING *returnValue) -{ - if (!returnValue) - return E_INVALIDARG; - - const wchar_t *wstr = reinterpret_cast(str.utf16()); - return ::WindowsCreateString(wstr, static_cast(::wcslen(wstr)), returnValue); -} - -QString hStrToQStr(const HSTRING &hStr) -{ - quint32 len; - const wchar_t *wstr = ::WindowsGetStringRawBuffer(hStr, &len); - return QString::fromWCharArray(wstr, len); -} - -} // namespace QWinRTUiAutomation - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiautils.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiautils.h deleted file mode 100644 index 9519cb4eb5..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiautils.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIAUTILS_H -#define QWINRTUIAUTILS_H - -#include -#if QT_CONFIG(accessibility) - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -Q_DECLARE_LOGGING_CATEGORY(lcQpaUiAutomation) - -namespace QWinRTUiAutomation { - -QWindow *windowForAccessible(const QAccessibleInterface *accessible); - -QAccessibleInterface *accessibleForId(QAccessible::Id id); - -QAccessible::Id idForAccessible(QAccessibleInterface *accessible); - -ABI::Windows::UI::Xaml::Automation::Peers::AutomationControlType roleToControlType(QAccessible::Role role); - -bool isTextUnitSeparator(ABI::Windows::UI::Xaml::Automation::Text::TextUnit unit, const QChar &ch); - -HRESULT qHString(const QString &str, HSTRING *returnValue); - -QString hStrToQStr(const HSTRING &hStr); - -} // namespace QWinRTUiAutomation - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIAUTILS_H diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiavalueprovider.cpp b/src/plugins/platforms/winrt/uiautomation/qwinrtuiavalueprovider.cpp deleted file mode 100644 index 255d8ee49e..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiavalueprovider.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiavalueprovider.h" -#include "qwinrtuiametadatacache.h" -#include "qwinrtuiautils.h" - -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -using namespace QWinRTUiAutomation; -using namespace ABI::Windows::UI::Xaml::Automation; -using namespace ABI::Windows::UI::Xaml::Automation::Provider; - -QWinRTUiaValueProvider::QWinRTUiaValueProvider(QAccessible::Id id) : - QWinRTUiaBaseProvider(id) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -QWinRTUiaValueProvider::~QWinRTUiaValueProvider() -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; -} - -// True for read-only controls. -HRESULT STDMETHODCALLTYPE QWinRTUiaValueProvider::get_IsReadOnly(boolean *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - *value = (metadata->state().readOnly != 0); - return S_OK; -} - -// Returns the value in text form. -HRESULT STDMETHODCALLTYPE QWinRTUiaValueProvider::get_Value(HSTRING *value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - if (!value) - return E_INVALIDARG; - QSharedPointer metadata = QWinRTUiaMetadataCache::instance()->metadataForId(id()); - return qHString(metadata->value(), value); -} - -// Sets the value associated with the control. -HRESULT STDMETHODCALLTYPE QWinRTUiaValueProvider::SetValue(HSTRING value) -{ - qCDebug(lcQpaUiAutomation) << __FUNCTION__; - - auto accid = id(); - - QString tmpValue = hStrToQStr(value); - - QEventDispatcherWinRT::runOnMainThread([accid, tmpValue]() { - - if (QAccessibleInterface *accessible = accessibleForId(accid)) { - - // First sets the value as a text. - accessible->setText(QAccessible::Value, tmpValue); - - // Then, if the control supports the value interface (range value) - // and the supplied text can be converted to a number, and that number - // lies within the min/max limits, sets it as the control's current (numeric) value. - if (QAccessibleValueInterface *valueInterface = accessible->valueInterface()) { - bool ok = false; - double numval = tmpValue.toDouble(&ok); - if (ok) { - double minimum = valueInterface->minimumValue().toDouble(); - double maximum = valueInterface->maximumValue().toDouble(); - if ((numval >= minimum) && (numval <= maximum)) { - valueInterface->setCurrentValue(QVariant(numval)); - } - } - } - } - QWinRTUiaMetadataCache::instance()->load(accid); - return S_OK; - }, 0); - - return S_OK; -} - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) diff --git a/src/plugins/platforms/winrt/uiautomation/qwinrtuiavalueprovider.h b/src/plugins/platforms/winrt/uiautomation/qwinrtuiavalueprovider.h deleted file mode 100644 index d9cd5d200d..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/qwinrtuiavalueprovider.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 QWINRTUIAVALUEPROVIDER_H -#define QWINRTUIAVALUEPROVIDER_H - -#include -#if QT_CONFIG(accessibility) - -#include "qwinrtuiabaseprovider.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -// Implements the Value control pattern provider. -// Supported for all controls that can return text(QAccessible::Value). -class QWinRTUiaValueProvider : - public QWinRTUiaBaseProvider, - public Microsoft::WRL::RuntimeClass -{ - Q_OBJECT - Q_DISABLE_COPY(QWinRTUiaValueProvider) - InspectableClass(L"QWinRTUiaValueProvider", BaseTrust); - -public: - explicit QWinRTUiaValueProvider(QAccessible::Id id); - virtual ~QWinRTUiaValueProvider(); - - // IValueProvider - HRESULT STDMETHODCALLTYPE get_IsReadOnly(boolean *value) override; - HRESULT STDMETHODCALLTYPE get_Value(HSTRING *value) override; - HRESULT STDMETHODCALLTYPE SetValue(HSTRING value) override; -}; - -QT_END_NAMESPACE - -#endif // QT_CONFIG(accessibility) - -#endif // QWINRTUIAVALUEPROVIDER_H diff --git a/src/plugins/platforms/winrt/uiautomation/uiautomation.pri b/src/plugins/platforms/winrt/uiautomation/uiautomation.pri deleted file mode 100644 index ca0dfae53f..0000000000 --- a/src/plugins/platforms/winrt/uiautomation/uiautomation.pri +++ /dev/null @@ -1,45 +0,0 @@ - -SOURCES += \ - $$PWD/qwinrtuiaaccessibility.cpp \ - $$PWD/qwinrtuiabaseprovider.cpp \ - $$PWD/qwinrtuiacontrolmetadata.cpp \ - $$PWD/qwinrtuiagriditemprovider.cpp \ - $$PWD/qwinrtuiagridprovider.cpp \ - $$PWD/qwinrtuiainvokeprovider.cpp \ - $$PWD/qwinrtuiamainprovider.cpp \ - $$PWD/qwinrtuiametadatacache.cpp \ - $$PWD/qwinrtuiapeervector.cpp \ - $$PWD/qwinrtuiaprovidercache.cpp \ - $$PWD/qwinrtuiarangevalueprovider.cpp \ - $$PWD/qwinrtuiaselectionitemprovider.cpp \ - $$PWD/qwinrtuiaselectionprovider.cpp \ - $$PWD/qwinrtuiatableitemprovider.cpp \ - $$PWD/qwinrtuiatableprovider.cpp \ - $$PWD/qwinrtuiatextprovider.cpp \ - $$PWD/qwinrtuiatextrangeprovider.cpp \ - $$PWD/qwinrtuiatoggleprovider.cpp \ - $$PWD/qwinrtuiautils.cpp \ - $$PWD/qwinrtuiavalueprovider.cpp - -HEADERS += \ - $$PWD/qwinrtuiaaccessibility.h \ - $$PWD/qwinrtuiabaseprovider.h \ - $$PWD/qwinrtuiacontrolmetadata.h \ - $$PWD/qwinrtuiaemptypropertyvalue.h \ - $$PWD/qwinrtuiagriditemprovider.h \ - $$PWD/qwinrtuiagridprovider.h \ - $$PWD/qwinrtuiainvokeprovider.h \ - $$PWD/qwinrtuiamainprovider.h \ - $$PWD/qwinrtuiametadatacache.h \ - $$PWD/qwinrtuiapeervector.h \ - $$PWD/qwinrtuiaprovidercache.h \ - $$PWD/qwinrtuiarangevalueprovider.h \ - $$PWD/qwinrtuiaselectionitemprovider.h \ - $$PWD/qwinrtuiaselectionprovider.h \ - $$PWD/qwinrtuiatableitemprovider.h \ - $$PWD/qwinrtuiatableprovider.h \ - $$PWD/qwinrtuiatextprovider.h \ - $$PWD/qwinrtuiatextrangeprovider.h \ - $$PWD/qwinrtuiatoggleprovider.h \ - $$PWD/qwinrtuiautils.h \ - $$PWD/qwinrtuiavalueprovider.h diff --git a/src/plugins/platforms/winrt/winrt.json b/src/plugins/platforms/winrt/winrt.json deleted file mode 100644 index 962747b697..0000000000 --- a/src/plugins/platforms/winrt/winrt.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Keys": [ "winrt" ] -} diff --git a/src/plugins/platforms/winrt/winrt.pro b/src/plugins/platforms/winrt/winrt.pro deleted file mode 100644 index 3d9f9a36d1..0000000000 --- a/src/plugins/platforms/winrt/winrt.pro +++ /dev/null @@ -1,68 +0,0 @@ -TARGET = qwinrt - -CONFIG -= precompile_header - -QT += \ - core-private gui-private \ - fontdatabase_support-private egl_support-private - -qtConfig(opengl): QT += opengl-private - -DEFINES *= QT_NO_CAST_FROM_ASCII __WRL_NO_DEFAULT_LIB__ - -QMAKE_USE_PRIVATE += d3d11 ws2_32 - -SOURCES = \ - main.cpp \ - qwinrtbackingstore.cpp \ - qwinrtcanvas.cpp \ - qwinrtclipboard.cpp \ - qwinrtcursor.cpp \ - qwinrteglcontext.cpp \ - qwinrteventdispatcher.cpp \ - qwinrtfiledialoghelper.cpp \ - qwinrtfileengine.cpp \ - qwinrtinputcontext.cpp \ - qwinrtintegration.cpp \ - qwinrtmessagedialoghelper.cpp \ - qwinrtscreen.cpp \ - qwinrtservices.cpp \ - qwinrttheme.cpp \ - qwinrtwindow.cpp - - -HEADERS = \ - qwinrtbackingstore.h \ - qwinrtcanvas.h \ - qwinrtclipboard.h \ - qwinrtcursor.h \ - qwinrteglcontext.h \ - qwinrteventdispatcher.h \ - qwinrtfiledialoghelper.h \ - qwinrtfileengine.h \ - qwinrtinputcontext.h \ - qwinrtintegration.h \ - qwinrtmessagedialoghelper.h \ - qwinrtscreen.h \ - qwinrtservices.h \ - qwinrttheme.h \ - qwinrtwindow.h - -OTHER_FILES += winrt.json - -WINRT_SDK_VERSION_STRING = $$(UCRTVersion) -WINRT_SDK_VERSION = $$member($$list($$split(WINRT_SDK_VERSION_STRING, .)), 2) -lessThan(WINRT_SDK_VERSION, 14322): DEFINES += QT_WINRT_LIMITED_DRAGANDDROP -greaterThan(WINRT_SDK_VERSION, 14393): DEFINES += QT_WINRT_DISABLE_PHONE_COLORS - -qtConfig(draganddrop) { - SOURCES += qwinrtdrag.cpp - HEADERS += qwinrtdrag.h -} - -qtConfig(accessibility): include($$PWD/uiautomation/uiautomation.pri) - -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QWinRTIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index df738c419f..880bd1c631 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -9,5 +9,5 @@ qtHaveModule(gui) { } qtHaveModule(widgets): SUBDIRS += styles -!winrt:qtHaveModule(printsupport): \ +qtHaveModule(printsupport): \ SUBDIRS += printsupport diff --git a/src/plugins/sqldrivers/sqlite/.prev_CMakeLists.txt b/src/plugins/sqldrivers/sqlite/.prev_CMakeLists.txt index 6413515efe..25796d9bb5 100644 --- a/src/plugins/sqldrivers/sqlite/.prev_CMakeLists.txt +++ b/src/plugins/sqldrivers/sqlite/.prev_CMakeLists.txt @@ -61,20 +61,12 @@ qt_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_posix_fallocate AND NO HAVE_POSIX_FALLOCATE=1 ) -qt_extend_target(QSQLiteDriverPlugin CONDITION WINRT AND NOT QT_FEATURE_system_sqlite - DEFINES - SQLITE_OS_WINRT -) - -#### Keys ignored in scope 8:.:../../../3rdparty:../../../3rdparty/sqlite.pri:WINRT: -# QMAKE_CFLAGS = "-Gy" - qt_extend_target(QSQLiteDriverPlugin CONDITION QNX AND NOT QT_FEATURE_system_sqlite DEFINES _QNX_SOURCE ) -qt_extend_target(QSQLiteDriverPlugin CONDITION UNIX AND NOT QT_FEATURE_system_sqlite AND NOT WINRT AND NOT winphone +qt_extend_target(QSQLiteDriverPlugin CONDITION UNIX AND NOT QT_FEATURE_system_sqlite DEFINES HAVE_USLEEP=1 ) @@ -89,5 +81,5 @@ qt_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_dlopen AND NOT QT_ SQLITE_OMIT_LOAD_EXTENSION ) -#### Keys ignored in scope 13:.:../../../3rdparty:../../../3rdparty/sqlite.pri:INTEGRITY: +#### Keys ignored in scope 12:.:../../../3rdparty:../../../3rdparty/sqlite.pri:INTEGRITY: # QMAKE_CFLAGS = "-include" "qplatformdefs.h" diff --git a/src/plugins/sqldrivers/sqlite/CMakeLists.txt b/src/plugins/sqldrivers/sqlite/CMakeLists.txt index 8f1faeef9e..5cc2791e7d 100644 --- a/src/plugins/sqldrivers/sqlite/CMakeLists.txt +++ b/src/plugins/sqldrivers/sqlite/CMakeLists.txt @@ -71,20 +71,12 @@ qt_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_posix_fallocate AND NO HAVE_POSIX_FALLOCATE=1 ) -qt_extend_target(QSQLiteDriverPlugin CONDITION WINRT AND NOT QT_FEATURE_system_sqlite - DEFINES - SQLITE_OS_WINRT -) - -#### Keys ignored in scope 8:.:../../../3rdparty:../../../3rdparty/sqlite.pri:WINRT: -# QMAKE_CFLAGS = "-Gy" - qt_extend_target(QSQLiteDriverPlugin CONDITION QNX AND NOT QT_FEATURE_system_sqlite DEFINES _QNX_SOURCE ) -qt_extend_target(QSQLiteDriverPlugin CONDITION UNIX AND NOT QT_FEATURE_system_sqlite AND NOT WINRT AND NOT winphone +qt_extend_target(QSQLiteDriverPlugin CONDITION UNIX AND NOT QT_FEATURE_system_sqlite DEFINES HAVE_USLEEP=1 ) @@ -99,5 +91,5 @@ qt_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_dlopen AND NOT QT_ SQLITE_OMIT_LOAD_EXTENSION ) -#### Keys ignored in scope 13:.:../../../3rdparty:../../../3rdparty/sqlite.pri:INTEGRITY: +#### Keys ignored in scope 12:.:../../../3rdparty:../../../3rdparty/sqlite.pri:INTEGRITY: # QMAKE_CFLAGS = "-include" "qplatformdefs.h" diff --git a/src/printsupport/CMakeLists.txt b/src/printsupport/CMakeLists.txt index 698875e1f3..e310296002 100644 --- a/src/printsupport/CMakeLists.txt +++ b/src/printsupport/CMakeLists.txt @@ -53,9 +53,6 @@ qt_extend_target(PrintSupport CONDITION QT_FEATURE_printpreviewwidget qt_extend_target(PrintSupport CONDITION WIN32 SOURCES kernel/qprintengine_win.cpp kernel/qprintengine_win_p.h -) - -qt_extend_target(PrintSupport CONDITION WIN32 AND NOT WINRT LIBRARIES comdlg32 gdi32 diff --git a/src/printsupport/configure.cmake b/src/printsupport/configure.cmake index 3339d351d3..4e2bb9e7de 100644 --- a/src/printsupport/configure.cmake +++ b/src/printsupport/configure.cmake @@ -32,7 +32,7 @@ qt_feature("printer" PUBLIC SECTION "Painting" LABEL "QPrinter" PURPOSE "Provides a printer backend of QPainter." - CONDITION NOT UIKIT AND NOT WINRT AND QT_FEATURE_picture AND QT_FEATURE_temporaryfile AND QT_FEATURE_pdf + CONDITION NOT UIKIT AND QT_FEATURE_picture AND QT_FEATURE_temporaryfile AND QT_FEATURE_pdf ) qt_feature_definition("printer" "QT_NO_PRINTER" NEGATE VALUE "1") qt_feature("printpreviewwidget" PUBLIC diff --git a/src/printsupport/configure.json b/src/printsupport/configure.json index 7183d2e737..9bd85b0707 100644 --- a/src/printsupport/configure.json +++ b/src/printsupport/configure.json @@ -53,7 +53,7 @@ "label": "QPrinter", "purpose": "Provides a printer backend of QPainter.", "section": "Painting", - "condition": "!config.uikit && !config.winrt && features.picture && features.temporaryfile && features.pdf", + "condition": "!config.uikit && features.picture && features.temporaryfile && features.pdf", "output": [ "publicFeature", "feature" ] }, "printpreviewwidget": { diff --git a/src/printsupport/kernel/kernel.pri b/src/printsupport/kernel/kernel.pri index 2ceaf152eb..5c0feaf7a9 100644 --- a/src/printsupport/kernel/kernel.pri +++ b/src/printsupport/kernel/kernel.pri @@ -33,10 +33,8 @@ win32 { $$PWD/qprintengine_win_p.h SOURCES += \ $$PWD/qprintengine_win.cpp - !winrt { - LIBS_PRIVATE += -lwinspool -lcomdlg32 - QMAKE_USE_PRIVATE += user32 gdi32 - } + LIBS_PRIVATE += -lwinspool -lcomdlg32 + QMAKE_USE_PRIVATE += user32 gdi32 } unix:!darwin:qtConfig(cups) { diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index 25855d6da7..8fd98d1e4c 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -2233,8 +2233,4 @@ QPrinter::PrintRange QPrinter::printRange() const QT_END_NAMESPACE -#elif defined(Q_OS_WINRT) -QT_BEGIN_NAMESPACE -bool Q_PRINTSUPPORT_EXPORT qt_winrt_export_lib_creation_variable; -QT_END_NAMESPACE #endif // QT_NO_PRINTER diff --git a/src/testlib/qtestblacklist.cpp b/src/testlib/qtestblacklist.cpp index 4554d6017a..d4165fb240 100644 --- a/src/testlib/qtestblacklist.cpp +++ b/src/testlib/qtestblacklist.cpp @@ -106,7 +106,7 @@ static QSet keywords() << "osx" << "macos" #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) << "windows" #endif #ifdef Q_OS_IOS @@ -124,9 +124,6 @@ static QSet keywords() #ifdef Q_OS_QNX << "qnx" #endif -#ifdef Q_OS_WINRT - << "winrt" -#endif #if QT_POINTER_SIZE == 8 << "64bit" diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index f25beee485..35fad9e708 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -787,11 +787,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, const char *const argv[], bool } else if (strcmp(argv[i], "-vb") == 0) { QBenchmarkGlobalData::current->verboseOutput = true; -#if defined(Q_OS_WINRT) - } else if (strncmp(argv[i], "-ServerName:", 12) == 0 || - strncmp(argv[i], "-qdevel", 7) == 0) { - continue; -#elif defined(Q_OS_MAC) && defined(HAVE_XCTEST) +#if defined(Q_OS_MAC) && defined(HAVE_XCTEST) } else if (int skip = QXcodeTestLogger::parseCommandLineArgument(argv[i])) { i += (skip - 1); // Eating argv[i] with a continue counts towards skips continue; @@ -1523,7 +1519,7 @@ void TestMethods::invokeTests(QObject *testObject) const QTestResult::setCurrentTestFunction(nullptr); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) // Helper class for resolving symbol names by dynamically loading "dbghelp.dll". class DebugSymbolResolver @@ -1621,7 +1617,7 @@ DebugSymbolResolver::Symbol DebugSymbolResolver::resolveSymbol(DWORD64 address) return result; } -#endif // Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN class FatalSignalHandler { @@ -1632,10 +1628,8 @@ public: # if !defined(Q_CC_MINGW) _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG); # endif -# if !defined(Q_OS_WINRT) SetErrorMode(SetErrorMode(0) | SEM_NOGPFAULTERRORBOX); SetUnhandledExceptionFilter(windowsFaultHandler); -# endif #elif defined(Q_OS_UNIX) && !defined(Q_OS_WASM) sigemptyset(&handledSignals); @@ -1717,7 +1711,7 @@ public: } private: -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) static LONG WINAPI windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo) { enum { maxStackFrames = 100 }; @@ -1760,7 +1754,7 @@ private: return EXCEPTION_EXECUTE_HANDLER; } -#endif // defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#endif // defined(Q_OS_WIN) #if defined(Q_OS_UNIX) && !defined(Q_OS_WASM) static void signal(int signum) diff --git a/src/widgets/.prev_CMakeLists.txt b/src/widgets/.prev_CMakeLists.txt index 10453e683a..0e7aaaf793 100644 --- a/src/widgets/.prev_CMakeLists.txt +++ b/src/widgets/.prev_CMakeLists.txt @@ -306,7 +306,7 @@ qt_extend_target(Widgets CONDITION MACOS z ) -qt_extend_target(Widgets CONDITION WIN32 AND NOT WINRT +qt_extend_target(Widgets CONDITION WIN32 LIBRARIES dwmapi shell32 diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt index 1219e1a45b..400df76d70 100644 --- a/src/widgets/CMakeLists.txt +++ b/src/widgets/CMakeLists.txt @@ -308,7 +308,7 @@ qt_extend_target(Widgets CONDITION MACOS z ) -qt_extend_target(Widgets CONDITION WIN32 AND NOT WINRT +qt_extend_target(Widgets CONDITION WIN32 LIBRARIES dwmapi shell32 diff --git a/src/widgets/configure.cmake b/src/widgets/configure.cmake index 4c35defc09..a250a3f888 100644 --- a/src/widgets/configure.cmake +++ b/src/widgets/configure.cmake @@ -32,7 +32,7 @@ qt_feature("style-windows" PRIVATE ) qt_feature("style-windowsvista" PRIVATE LABEL "WindowsVista" - CONDITION QT_FEATURE_style_windows AND QT_FEATURE_animation AND WIN32 AND NOT WINRT + CONDITION QT_FEATURE_style_windows AND QT_FEATURE_animation AND WIN32 ) qt_feature("style-android" PRIVATE LABEL "Android" diff --git a/src/widgets/configure.json b/src/widgets/configure.json index 7fd45250a3..89a319e897 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -48,7 +48,7 @@ }, "style-windowsvista": { "label": "WindowsVista", - "condition": "features.style-windows && features.animation && config.win32 && !config.winrt", + "condition": "features.style-windows && features.animation && config.win32", "output": [ "privateFeature", "styles" ] }, "style-android": { diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index e5f2fd1c49..3337cf328a 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -1616,7 +1616,7 @@ void QColorDialogPrivate::_q_pickScreenColor() q->grabMouse(); #endif -#ifdef Q_OS_WIN32 // excludes WinRT +#ifdef Q_OS_WIN32 // On Windows mouse tracking doesn't work over other processes's windows updateTimer->start(30); diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index b268864132..28153baceb 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -1832,9 +1832,6 @@ int QFileDialogPrivate::maxNameLength(const QString &path) { #if defined(Q_OS_UNIX) return ::pathconf(QFile::encodeName(path).data(), _PC_NAME_MAX); -#elif defined(Q_OS_WINRT) - Q_UNUSED(path); - return MAX_PATH; #elif defined(Q_OS_WIN) DWORD maxLength; const QString drive = path.left(3); diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp index 7342efbd0d..b6fdac61d1 100644 --- a/src/widgets/dialogs/qfileinfogatherer.cpp +++ b/src/widgets/dialogs/qfileinfogatherer.cpp @@ -204,7 +204,7 @@ void QFileInfoGatherer::createWatcher() m_watcher = new QFileSystemWatcher(this); connect(m_watcher, &QFileSystemWatcher::directoryChanged, this, &QFileInfoGatherer::list); connect(m_watcher, &QFileSystemWatcher::fileChanged, this, &QFileInfoGatherer::updateFile); -# if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +# if defined(Q_OS_WIN) const QVariant listener = m_watcher->property("_q_driveListener"); if (listener.canConvert()) { if (QObject *driveListener = listener.value()) { @@ -212,7 +212,7 @@ void QFileInfoGatherer::createWatcher() connect(driveListener, SIGNAL(driveRemoved()), this, SLOT(driveRemoved())); } } -# endif // Q_OS_WIN && !Q_OS_WINRT +# endif // Q_OS_WIN #endif } diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index 1c6495f9b6..bbe1ef4376 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -57,9 +57,7 @@ #ifdef Q_OS_WIN # include # include -# ifndef Q_OS_WINRT -# include -# endif +# include #endif QT_BEGIN_NAMESPACE @@ -1777,7 +1775,7 @@ void QFileSystemModelPrivate::_q_directoryChanged(const QString &directory, cons removeNode(parentNode, toRemove[i]); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) static QString volumeName(const QString &path) { IShellItem *item = nullptr; @@ -1796,7 +1794,7 @@ static QString volumeName(const QString &path) item->Release(); return result; } -#endif // Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN /*! \internal @@ -1814,7 +1812,7 @@ QFileSystemModelPrivate::QFileSystemNode* QFileSystemModelPrivate::addNode(QFile #else Q_UNUSED(info) #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) //The parentNode is "" so we are listing the drives if (parentNode->fileName.isEmpty()) node->volumeName = volumeName(fileName); diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 513a5c5658..c65d91cf9e 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -74,7 +74,7 @@ QT_BEGIN_NAMESPACE -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) HMENU qt_getWindowsSystemMenu(const QWidget *w) { if (QWindow *window = QApplicationPrivate::windowForWidget(w)) @@ -1600,7 +1600,7 @@ void QMessageBox::showEvent(QShowEvent *e) QAccessibleEvent event(this, QAccessible::Alert); QAccessible::updateAccessibility(&event); #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) if (const HMENU systemMenu = qt_getWindowsSystemMenu(this)) { EnableMenuItem(systemMenu, SC_CLOSE, d->detectedEscapeButton ? MF_BYCOMMAND|MF_ENABLED : MF_BYCOMMAND|MF_GRAYED); diff --git a/src/widgets/itemviews/qfileiconprovider.cpp b/src/widgets/itemviews/qfileiconprovider.cpp index 690866ce0a..d70d47be5e 100644 --- a/src/widgets/itemviews/qfileiconprovider.cpp +++ b/src/widgets/itemviews/qfileiconprovider.cpp @@ -53,10 +53,8 @@ #if defined(Q_OS_WIN) # include -# ifndef Q_OS_WINRT -# include -# include -# endif +# include +# include #endif QT_BEGIN_NAMESPACE @@ -250,7 +248,7 @@ QIcon QFileIconProvider::icon(const QFileInfo &info) const const QString &path = info.absoluteFilePath(); if (path.isEmpty() || QFileSystemEntry::isRootPath(path)) -#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) { UINT type = GetDriveType(reinterpret_cast(path.utf16())); diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp index ca5025ef8f..e90158cf83 100644 --- a/src/widgets/kernel/qtooltip.cpp +++ b/src/widgets/kernel/qtooltip.cpp @@ -217,11 +217,7 @@ void QTipLabel::reuseTip(const QString &text, int msecDisplayTime, const QPoint void QTipLabel::updateSize(const QPoint &pos) { -#ifndef Q_OS_WINRT - // ### The code below does not always work well on WinRT - // (e.g COIN fails an auto test - tst_QToolTip::qtbug64550_stylesheet - QTBUG-72652) d_func()->setScreenForPoint(pos); -#endif // Ensure that we get correct sizeHints by placing this window on the right screen. QFontMetrics fm(font()); QSize extra(1, 0); @@ -230,8 +226,7 @@ void QTipLabel::updateSize(const QPoint &pos) ++extra.rheight(); setWordWrap(Qt::mightBeRichText(text())); QSize sh = sizeHint(); - // ### When the above WinRT code is fixed, windowhandle should be used to find the screen. - QScreen *screen = QGuiApplication::screenAt(pos); + QScreen *screen = windowHandle() ? windowHandle()->screen() : QGuiApplication::screenAt(pos); if (!screen) screen = QGuiApplication::primaryScreen(); if (screen) { diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index a217ef5352..630ca7fef8 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -4332,7 +4332,7 @@ const QPalette &QWidget::palette() const if (!isEnabled()) { data->pal.setCurrentColorGroup(QPalette::Disabled); } else if ((!isVisible() || isActiveWindow()) -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !QApplicationPrivate::isBlockedByModal(const_cast(this)) #endif ) { diff --git a/src/widgets/kernel/win.pri b/src/widgets/kernel/win.pri index eede987b4c..007fd19eb5 100644 --- a/src/widgets/kernel/win.pri +++ b/src/widgets/kernel/win.pri @@ -1,7 +1,5 @@ # Qt/Windows only configuration file # -------------------------------------------------------------------- -!winrt { - LIBS_PRIVATE *= -luxtheme -ldwmapi - QMAKE_USE_PRIVATE += shell32 -} +LIBS_PRIVATE *= -luxtheme -ldwmapi +QMAKE_USE_PRIVATE += shell32 diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 6c7ea3740e..ae238c8951 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -267,7 +267,7 @@ void QWindowsStyle::polish(QApplication *app) d->inactiveCaptionColor = d->inactiveGradientCaptionColor; d->inactiveCaptionText = palette.window().color(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //fetch native title bar colors +#if defined(Q_OS_WIN) //fetch native title bar colors if(app->desktopSettingsAware()){ DWORD activeCaption = GetSysColor(COLOR_ACTIVECAPTION); DWORD gradientActiveCaption = GetSysColor(COLOR_GRADIENTACTIVECAPTION); @@ -312,7 +312,7 @@ void QWindowsStyle::polish(QPalette &pal) int QWindowsStylePrivate::pixelMetricFromSystemDp(QStyle::PixelMetric pm, const QStyleOption *, const QWidget *widget) { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) switch (pm) { case QStyle::PM_DockWidgetFrameWidth: return GetSystemMetrics(SM_CXFRAME); @@ -339,7 +339,7 @@ int QWindowsStylePrivate::pixelMetricFromSystemDp(QStyle::PixelMetric pm, const default: break; } -#else // Q_OS_WIN && !Q_OS_WINRT +#else // Q_OS_WIN Q_UNUSED(pm); Q_UNUSED(widget); #endif @@ -498,7 +498,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) QPixmap desktopIcon; switch(standardPixmap) { case SP_DriveCDIcon: @@ -537,7 +537,7 @@ QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyl if (!desktopIcon.isNull()) { return desktopIcon; } -#endif // Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN return QCommonStyle::standardPixmap(standardPixmap, opt, widget); } @@ -577,7 +577,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid ret = 0; break; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // Option not used on WinRT -> common style +#if defined(Q_OS_WIN) case SH_UnderlineShortcut: { ret = 1; @@ -613,15 +613,15 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid #endif // QT_NO_ACCESSIBILITY break; } -#endif // Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN case SH_Menu_SubMenuSloppyCloseTimeout: case SH_Menu_SubMenuPopupDelay: { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) DWORD delay; if (SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &delay, 0)) ret = delay; else -#endif // Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN ret = 400; break; } diff --git a/src/widgets/widgets/qsplashscreen.cpp b/src/widgets/widgets/qsplashscreen.cpp index 3cb275b56a..b6fa97eaed 100644 --- a/src/widgets/widgets/qsplashscreen.cpp +++ b/src/widgets/widgets/qsplashscreen.cpp @@ -253,9 +253,7 @@ inline static bool waitForWindowExposed(QWindow *window, int timeout = 1000) break; QCoreApplication::processEvents(QEventLoop::AllEvents, remaining); QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); -#if defined(Q_OS_WINRT) - WaitForSingleObjectEx(GetCurrentThread(), TimeOutMs, false); -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) Sleep(uint(TimeOutMs)); #else struct timespec ts = { TimeOutMs / 1000, (TimeOutMs % 1000) * 1000 * 1000 }; diff --git a/src/winmain/.prev_CMakeLists.txt b/src/winmain/.prev_CMakeLists.txt index a6077dd467..5b08a0e863 100644 --- a/src/winmain/.prev_CMakeLists.txt +++ b/src/winmain/.prev_CMakeLists.txt @@ -32,12 +32,7 @@ extend_target(qtLibraryTarget$$TARGET$$QT_LIBINFIX CONDITION mingw QT_NEEDS_QMAIN ) -extend_target(qtLibraryTarget$$TARGET$$QT_LIBINFIX CONDITION WINRT - SOURCES - qtmain_winrt.cpp -) - -extend_target(qtLibraryTarget$$TARGET$$QT_LIBINFIX CONDITION NOT WINRT +extend_target(qtLibraryTarget$$TARGET$$QT_LIBINFIX SOURCES qtmain_win.cpp LIBRARIES diff --git a/src/winmain/CMakeLists.txt b/src/winmain/CMakeLists.txt index fb83894a9f..73a1149717 100644 --- a/src/winmain/CMakeLists.txt +++ b/src/winmain/CMakeLists.txt @@ -16,11 +16,7 @@ qt_add_module(WinMain set_property(TARGET WinMain PROPERTY OUTPUT_NAME qtmain) -qt_extend_target(WinMain CONDITION WINRT - SOURCES qtmain_winrt.cpp -) - -qt_extend_target(WinMain CONDITION NOT WINRT +qt_extend_target(WinMain CONDITION SOURCES qtmain_win.cpp LIBRARIES shell32 ) diff --git a/src/winmain/qtmain_winrt.cpp b/src/winmain/qtmain_winrt.cpp deleted file mode 100644 index 1828c4ca16..0000000000 --- a/src/winmain/qtmain_winrt.cpp +++ /dev/null @@ -1,430 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Windows main function of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - This file contains the code in the qtmain library for WinRT. - qtmain contains the WinRT startup code and is required for - linking to the Qt DLL. - - When a Windows application starts, the WinMain function is - invoked. This WinMain creates the WinRT application - container, which in turn calls the application's main() - entry point within the newly created GUI thread. -*/ - -extern "C" { - int main(int, char **); -} - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -using namespace ABI::Windows::ApplicationModel; -using namespace ABI::Windows::ApplicationModel::Activation; -using namespace ABI::Windows::ApplicationModel::Core; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::UI; -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; - -#define qHString(x) Wrappers::HString::MakeReference(x).Get() -#define CoreApplicationClass RuntimeClass_Windows_ApplicationModel_Core_CoreApplication -typedef ITypedEventHandler ActivatedHandler; - -const quint32 resizeMessageType = QtInfoMsg + 1; - -const PCWSTR shmemName = L"qdebug-shmem"; -const PCWSTR eventName = L"qdebug-event"; -const PCWSTR ackEventName = L"qdebug-event-ack"; - -static QtMessageHandler defaultMessageHandler; -static void devMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &message) -{ - static HANDLE shmem = 0; - static HANDLE event = 0; - static HANDLE ackEvent = 0; - - static QMutex messageMutex; - QMutexLocker locker(&messageMutex); - - static quint64 mappingSize = 4096; - const quint32 copiedMessageLength = message.length() + 1; - // Message format is message type + message. We need the message's length + 4 bytes for the type - const quint64 copiedMessageSize = copiedMessageLength * sizeof(wchar_t) + sizeof(quint32); - if (copiedMessageSize > mappingSize) { - if (!shmem) - shmem = CreateFileMappingFromApp(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, mappingSize, shmemName); - Q_ASSERT_X(shmem, Q_FUNC_INFO, "Could not create file mapping"); - - quint32 *data = reinterpret_cast(MapViewOfFileFromApp(shmem, FILE_MAP_WRITE, 0, mappingSize)); - Q_ASSERT_X(data, Q_FUNC_INFO, "Could not map size file"); - - mappingSize = copiedMessageSize; - - memcpy(data, (void *)&resizeMessageType, sizeof(quint32)); - memcpy(data + 1, (void *)&mappingSize, sizeof(quint64)); - UnmapViewOfFile(data); - SetEvent(event); - WaitForSingleObjectEx(ackEvent, INFINITE, false); - if (shmem) { - if (!CloseHandle(shmem)) - Q_ASSERT_X(false, Q_FUNC_INFO, "Could not close shared file handle"); - shmem = 0; - } - } - - if (!shmem) - shmem = CreateFileMappingFromApp(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, mappingSize, shmemName); - if (!event) - event = CreateEventEx(NULL, eventName, 0, EVENT_ALL_ACCESS); - if (!ackEvent) - ackEvent = CreateEventEx(NULL, ackEventName, 0, EVENT_ALL_ACCESS); - - Q_ASSERT_X(shmem, Q_FUNC_INFO, "Could not create file mapping"); - Q_ASSERT_X(event, Q_FUNC_INFO, "Could not create debug event"); - - void *data = MapViewOfFileFromApp(shmem, FILE_MAP_WRITE, 0, mappingSize); - Q_ASSERT_X(data, Q_FUNC_INFO, "Could not map file"); - - memset(data, quint32(type), sizeof(quint32)); - memcpy_s(static_cast(data) + 1, mappingSize - sizeof(quint32), - message.data(), copiedMessageLength * sizeof(wchar_t)); - UnmapViewOfFile(data); - SetEvent(event); - WaitForSingleObjectEx(ackEvent, INFINITE, false); - locker.unlock(); - defaultMessageHandler(type, context, message); -} - -class QActivationEvent : public QEvent -{ -public: - explicit QActivationEvent(IInspectable *args) - : QEvent(QEvent::WinEventAct) - { - setAccepted(false); - args->AddRef(); - d = reinterpret_cast(args); - } - - ~QActivationEvent() { - IUnknown *args = reinterpret_cast(d); - args->Release(); - d = nullptr; - } -}; - -class AppContainer : public RuntimeClass -{ -public: - AppContainer() - { - ComPtr applicationFactory; - HRESULT hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_Xaml_Application).Get(), - IID_PPV_ARGS(&applicationFactory)); - Q_ASSERT_SUCCEEDED(hr); - - hr = applicationFactory->CreateInstance(this, &base, &core); - RETURN_VOID_IF_FAILED("Failed to create application container instance"); - - pidFile = INVALID_HANDLE_VALUE; - } - - ~AppContainer() - { - } - - int exec() - { - mainThread = CreateThread(NULL, 0, [](void *param) -> DWORD { - AppContainer *app = reinterpret_cast(param); - int argc = app->args.count() - 1; - char **argv = app->args.data(); - const int res = main(argc, argv); - if (app->pidFile != INVALID_HANDLE_VALUE) { - const QByteArray resString = QByteArray::number(res); - WriteFile(app->pidFile, reinterpret_cast(resString.constData()), - resString.size(), NULL, NULL); - FlushFileBuffers(app->pidFile); - CloseHandle(app->pidFile); - } - app->core->Exit(); - return res; - }, this, CREATE_SUSPENDED, nullptr); - Q_ASSERT_X(mainThread, Q_FUNC_INFO, "Could not create Qt main thread"); - - HRESULT hr; - ComPtr appStatics; - hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_Xaml_Application).Get(), - IID_PPV_ARGS(&appStatics)); - Q_ASSERT_SUCCEEDED(hr); - hr = appStatics->Start(Callback([](Xaml::IApplicationInitializationCallbackParams *) { - return S_OK; - }).Get()); - Q_ASSERT_SUCCEEDED(hr); - - WaitForSingleObjectEx(mainThread, INFINITE, FALSE); - DWORD exitCode; - GetExitCodeThread(mainThread, &exitCode); - return exitCode; - } - -private: - HRESULT activatedLaunch(IInspectable *activateArgs) { - // Check if an application instance is already running - // This is mostly needed for Windows Phone and file pickers - QAbstractEventDispatcher *dispatcher = QCoreApplication::eventDispatcher(); - if (dispatcher) { - QCoreApplication::postEvent(dispatcher, new QActivationEvent(activateArgs)); - return S_OK; - } - - QCoreApplication *app = QCoreApplication::instance(); - - // Check whether the app already runs - if (!app) { - // I*EventArgs have no launch arguments, hence we - // need to prepend the application binary manually - wchar_t fn[513]; - DWORD res = GetModuleFileName(0, fn, 512); - - if (SUCCEEDED(res)) - args.prepend(QString::fromWCharArray(fn, res).toUtf8().data()); - - ResumeThread(mainThread); - - // We give main() a max of 100ms to create an application object. - // No eventhandling needs to happen at that point, all we want is - // append our activation event - int iterations = 0; - while (true) { - app = QCoreApplication::instance(); - if (app || iterations++ > 10) - break; - Sleep(10); - } - } - - if (app) - QCoreApplication::postEvent(app, new QActivationEvent(activateArgs)); - return S_OK; - } - - HRESULT __stdcall OnActivated(IActivatedEventArgs *args) override - { - return activatedLaunch(args); - } - - HRESULT __stdcall OnLaunched(ILaunchActivatedEventArgs *launchArgs) override - { - ComPtr preArgs; - HRESULT hr = launchArgs->QueryInterface(preArgs.GetAddressOf()); - if (SUCCEEDED(hr)) { - boolean prelaunched; - preArgs->get_PrelaunchActivated(&prelaunched); - if (prelaunched) - return S_OK; - } - - commandLine = QString::fromWCharArray(GetCommandLine()).toUtf8(); - - HString launchCommandLine; - launchArgs->get_Arguments(launchCommandLine.GetAddressOf()); - if (launchCommandLine.IsValid()) { - quint32 launchCommandLineLength; - const wchar_t *launchCommandLineBuffer = launchCommandLine.GetRawBuffer(&launchCommandLineLength); - if (!commandLine.isEmpty() && launchCommandLineLength) - commandLine += ' '; - if (launchCommandLineLength) - commandLine += QString::fromWCharArray(launchCommandLineBuffer, launchCommandLineLength).toUtf8(); - } - if (!commandLine.isEmpty()) - args.append(commandLine.data()); - - bool quote = false; - bool escape = false; - for (int i = 0; i < commandLine.size(); ++i) { - switch (commandLine.at(i)) { - case '\\': - escape = true; - break; - case '"': - if (escape) { - escape = false; - break; - } - quote = !quote; - commandLine[i] = '\0'; - break; - case ' ': - if (quote) - break; - commandLine[i] = '\0'; - if (!args.isEmpty() && args.last() && args.last()[0] != '\0') - args.append(commandLine.data() + i + 1); - // fall through - default: - if (!args.isEmpty() && args.last() && args.last()[0] == '\0') - args.last() = commandLine.data() + i; - escape = false; // only quotes are escaped - break; - } - } - - if (args.count() >= 2 && args.at(1) && strncmp(args.at(1), "-ServerName:", 12) == 0) - args.remove(1); - - bool develMode = false; - bool debugWait = false; - for (int i = args.count() - 1; i >= 0; --i) { - if (!args.at(i)) - continue; - - const char *arg = args.at(i); - if (strcmp(arg, "-qdevel") == 0) { - develMode = true; - args.remove(i); - } else if (strcmp(arg, "-qdebug") == 0) { - debugWait = true; - args.remove(i); - } - } - args.append(nullptr); - - if (develMode) { - // Write a PID file to help runner - const QString pidFileName = QDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation)) - .absoluteFilePath(QString::asprintf("%u.pid", uint(GetCurrentProcessId()))); - CREATEFILE2_EXTENDED_PARAMETERS params = { - sizeof(CREATEFILE2_EXTENDED_PARAMETERS), - FILE_ATTRIBUTE_NORMAL - }; - pidFile = CreateFile2(reinterpret_cast(pidFileName.utf16()), - GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ, CREATE_ALWAYS, ¶ms); - // Install the develMode message handler - defaultMessageHandler = qInstallMessageHandler(devMessageHandler); - } - // Wait for debugger before continuing - if (debugWait) { - while (!IsDebuggerPresent()) - WaitForSingleObjectEx(GetCurrentThread(), 1, true); - } - - ResumeThread(mainThread); - return S_OK; - } - - HRESULT __stdcall OnFileActivated(IFileActivatedEventArgs *args) override - { - return activatedLaunch(args); - } - - HRESULT __stdcall OnSearchActivated(ISearchActivatedEventArgs *args) override - { - Q_UNUSED(args); - return S_OK; - } - - HRESULT __stdcall OnShareTargetActivated(IShareTargetActivatedEventArgs *args) override - { - return activatedLaunch(args); - } - - HRESULT __stdcall OnFileOpenPickerActivated(IFileOpenPickerActivatedEventArgs *args) override - { - Q_UNUSED(args); - return S_OK; - } - - HRESULT __stdcall OnFileSavePickerActivated(IFileSavePickerActivatedEventArgs *args) override - { - Q_UNUSED(args); - return S_OK; - } - - HRESULT __stdcall OnCachedFileUpdaterActivated(ICachedFileUpdaterActivatedEventArgs *args) override - { - Q_UNUSED(args); - return S_OK; - } - - HRESULT __stdcall OnWindowCreated(Xaml::IWindowCreatedEventArgs *args) override - { - Q_UNUSED(args); - return S_OK; - } - - ComPtr base; - ComPtr core; - QByteArray commandLine; - QVarLengthArray args; - HANDLE mainThread{0}; - HANDLE pidFile; -}; - -// Main entry point for Appx containers -int __stdcall WinMain(HINSTANCE, HINSTANCE, LPSTR, int) -{ - if (FAILED(RoInitialize(RO_INIT_MULTITHREADED))) - return 1; - - ComPtr app = Make(); - return app->exec(); -} diff --git a/src/winmain/winmain.pro b/src/winmain/winmain.pro index 1f54c846ec..19ce9ffa82 100644 --- a/src/winmain/winmain.pro +++ b/src/winmain/winmain.pro @@ -18,13 +18,9 @@ msvc: QMAKE_CFLAGS_DEBUG *= -Z7 msvc: QMAKE_CXXFLAGS_DEBUG *= -Z7 mingw: DEFINES += QT_NEEDS_QMAIN -winrt { - SOURCES = qtmain_winrt.cpp -} else { - CONFIG -= qt - SOURCES = qtmain_win.cpp - QMAKE_USE_PRIVATE += shell32 -} +CONFIG -= qt +SOURCES = qtmain_win.cpp +QMAKE_USE_PRIVATE += shell32 load(qt_installs) diff --git a/tests/auto/.prev_CMakeLists.txt b/tests/auto/.prev_CMakeLists.txt index 6bbd881af3..8a491d7b9c 100644 --- a/tests/auto/.prev_CMakeLists.txt +++ b/tests/auto/.prev_CMakeLists.txt @@ -18,13 +18,13 @@ endif() if(TARGET Qt::Concurrent) add_subdirectory(concurrent) endif() -if((((TARGET Qt::DBus AND NOT CMAKE_CROSSCOMPILING AND NOT boot2qt) AND (system("dbus-send --session --type=signal / local.AutotestCheck.Hello >_ss_QMAKE_SYSTEM_NULL_DEVICE 2>&1"))))) +if((((system("dbus-send --session --type=signal / local.AutotestCheck.Hello >_ss_QMAKE_SYSTEM_NULL_DEVICE 2>&1")) AND (TARGET Qt::DBus AND NOT CMAKE_CROSSCOMPILING AND NOT boot2qt)))) add_subdirectory(dbus) endif() -if(TARGET Qt::Network AND NOT WINRT) +if(TARGET Qt::Network) add_subdirectory(network) endif() -if(TARGET Qt::OpenGL AND NOT WINRT) +if(TARGET Qt::OpenGL) add_subdirectory(opengl) endif() if(TARGET Qt::PrintSupport) diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt index 703459bb9d..df7bebd0d5 100644 --- a/tests/auto/CMakeLists.txt +++ b/tests/auto/CMakeLists.txt @@ -49,10 +49,10 @@ endif() if (TARGET Qt::Gui) add_subdirectory(gui) endif() -if (TARGET Qt::Network AND NOT WINRT) +if (TARGET Qt::Network) add_subdirectory(network) endif() -if (TARGET Qt::OpenGL AND NOT WINRT) +if (TARGET Qt::OpenGL) add_subdirectory(opengl) endif() if (TARGET Qt::PrintSupport) diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index b0b732d372..25519233a1 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -26,8 +26,8 @@ qtHaveModule(dbus):!cross_compile:!boot2qt { } } qtHaveModule(gui): SUBDIRS += gui -qtHaveModule(network):!winrt: SUBDIRS += network -qtHaveModule(opengl):!winrt: SUBDIRS += opengl +qtHaveModule(network): SUBDIRS += network +qtHaveModule(opengl): SUBDIRS += opengl qtHaveModule(printsupport): SUBDIRS += printsupport qtHaveModule(sql): SUBDIRS += sql qtHaveModule(widgets): SUBDIRS += widgets diff --git a/tests/auto/corelib/global/global.pro b/tests/auto/corelib/global/global.pro index 0f77d191ee..0b37bf63cf 100644 --- a/tests/auto/corelib/global/global.pro +++ b/tests/auto/corelib/global/global.pro @@ -13,5 +13,5 @@ SUBDIRS=\ qglobalstatic \ qhooks -win32:!winrt: SUBDIRS += \ +win32: SUBDIRS += \ qwinregistry diff --git a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp index 544cb1bf07..8cc66c6477 100644 --- a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp +++ b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp @@ -135,9 +135,7 @@ void tst_QGetPutEnv::encoding() static const wchar_t rawvalue[] = { 'a', 0x00E1, 0x03B1, 0x0430, 0 }; QString value = QString::fromWCharArray(rawvalue); -#if defined(Q_OS_WINRT) - QSKIP("Test cannot be run on this platform"); -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) const wchar_t wvarName[] = L"should_not_exist"; _wputenv_s(wvarName, rawvalue); #else diff --git a/tests/auto/corelib/global/qlogging/CMakeLists.txt b/tests/auto/corelib/global/qlogging/CMakeLists.txt index 7c74656215..ce9235f91e 100644 --- a/tests/auto/corelib/global/qlogging/CMakeLists.txt +++ b/tests/auto/corelib/global/qlogging/CMakeLists.txt @@ -1,19 +1,17 @@ -if(NOT WINRT) - add_qt_executable(qlogging_helper - NO_INSTALL # special case - OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} # special case - SOURCES app/main.cpp - DEFINES QT_MESSAGELOGCONTEXT - LIBRARIES Qt::Core) +add_qt_executable(qlogging_helper + NO_INSTALL # special case + OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} # special case + SOURCES app/main.cpp + DEFINES QT_MESSAGELOGCONTEXT + LIBRARIES Qt::Core) - #special case begin - # Fixes required for the backtrace stack to be correct - if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" AND NOT MINGW) - target_link_options(qlogging_helper PRIVATE -rdynamic) - endif() - set_target_properties(qlogging_helper PROPERTIES CXX_VISIBILITY_PRESET default) - # special case end +#special case begin +# Fixes required for the backtrace stack to be correct +if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" AND NOT MINGW) + target_link_options(qlogging_helper PRIVATE -rdynamic) endif() +set_target_properties(qlogging_helper PROPERTIES CXX_VISIBILITY_PRESET default) +# special case end add_qt_test(tst_qlogging SOURCES tst_qlogging.cpp DEFINES diff --git a/tests/auto/corelib/global/qlogging/qlogging.pro b/tests/auto/corelib/global/qlogging/qlogging.pro index bbe75297d5..c81e257a2d 100644 --- a/tests/auto/corelib/global/qlogging/qlogging.pro +++ b/tests/auto/corelib/global/qlogging/qlogging.pro @@ -1,8 +1,6 @@ TEMPLATE = subdirs -!winrt { - test.depends = app - SUBDIRS += app -} +test.depends = app +SUBDIRS += app SUBDIRS += test diff --git a/tests/auto/corelib/global/qlogging/test/test.pro b/tests/auto/corelib/global/qlogging/test/test.pro index 81445247e0..c6c5950ff1 100644 --- a/tests/auto/corelib/global/qlogging/test/test.pro +++ b/tests/auto/corelib/global/qlogging/test/test.pro @@ -4,14 +4,14 @@ qtConfig(c++14): CONFIG += c++14 debug_and_release { CONFIG(debug, debug|release) { TARGET = ../../debug/tst_qlogging - !android:!winrt: TEST_HELPER_INSTALLS = ../debug/helper + !android: TEST_HELPER_INSTALLS = ../debug/helper } else { TARGET = ../../release/tst_qlogging - !android:!winrt: TEST_HELPER_INSTALLS = ../release/helper + !android: TEST_HELPER_INSTALLS = ../release/helper } } else { TARGET = ../tst_qlogging - !android:!winrt: TEST_HELPER_INSTALLS = ../helper + !android: TEST_HELPER_INSTALLS = ../helper } QT = core testlib diff --git a/tests/auto/corelib/io/.prev_CMakeLists.txt b/tests/auto/corelib/io/.prev_CMakeLists.txt index 5baf4c35de..b9d2954156 100644 --- a/tests/auto/corelib/io/.prev_CMakeLists.txt +++ b/tests/auto/corelib/io/.prev_CMakeLists.txt @@ -18,6 +18,7 @@ add_subdirectory(qloggingcategory) add_subdirectory(qnodebug) add_subdirectory(qsavefile) add_subdirectory(qstandardpaths) +add_subdirectory(qstorageinfo) add_subdirectory(qtemporarydir) add_subdirectory(qtemporaryfile) add_subdirectory(qurlquery) @@ -51,6 +52,3 @@ endif() if(QT_FEATURE_settings AND TARGET Qt::Gui) add_subdirectory(qsettings) endif() -if(NOT WINRT) - add_subdirectory(qstorageinfo) -endif() diff --git a/tests/auto/corelib/io/CMakeLists.txt b/tests/auto/corelib/io/CMakeLists.txt index 9ec9da18c9..18fc2bf375 100644 --- a/tests/auto/corelib/io/CMakeLists.txt +++ b/tests/auto/corelib/io/CMakeLists.txt @@ -18,6 +18,7 @@ add_subdirectory(qloggingcategory) add_subdirectory(qnodebug) add_subdirectory(qsavefile) add_subdirectory(qstandardpaths) +add_subdirectory(qstorageinfo) add_subdirectory(qtemporarydir) add_subdirectory(qtemporaryfile) add_subdirectory(qurlquery) @@ -51,6 +52,3 @@ endif() if(QT_FEATURE_settings AND TARGET Qt::Gui) add_subdirectory(qsettings) endif() -if(NOT WINRT) - add_subdirectory(qstorageinfo) -endif() diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro index eee2c0e30d..84a4cf0dab 100644 --- a/tests/auto/corelib/io/io.pro +++ b/tests/auto/corelib/io/io.pro @@ -68,9 +68,6 @@ win32:!qtConfig(private_tests): SUBDIRS -= \ !qtConfig(settings): SUBDIRS -= \ qsettings -winrt: SUBDIRS -= \ - qstorageinfo - android: SUBDIRS -= \ qprocess \ qdir \ diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp index e6d2f10c16..33d7ea1da3 100644 --- a/tests/auto/corelib/io/largefile/tst_largefile.cpp +++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp @@ -62,7 +62,7 @@ public: , fd_(-1) , stream_(0) { - #if defined(QT_LARGEFILE_SUPPORT) && !defined(Q_OS_MAC) && !defined(Q_OS_WINRT) + #if defined(QT_LARGEFILE_SUPPORT) && !defined(Q_OS_MAC) maxSizeBits = 36; // 64 GiB #elif defined(Q_OS_MAC) // HFS+ does not support sparse files, so we limit file size for the test diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 5462a63fab..56b19bc4c0 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -51,7 +51,7 @@ # include #endif -#if defined(Q_OS_VXWORKS) || defined(Q_OS_WINRT) +#if defined(Q_OS_VXWORKS) #define Q_NO_SYMLINKS #endif @@ -587,7 +587,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_WINRT) +#if defined(Q_OS_WIN) const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); QTest::newRow("unc 1") << uncRoot << true; QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true; @@ -599,7 +599,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_WINRT)) +#if defined (Q_OS_WIN) QTest::newRow("This drive should exist") << "C:/" << true; // find a non-existing drive and check if it does not exist #ifdef QT_BUILD_INTERNAL @@ -977,7 +977,7 @@ void tst_QDir::entryListSimple_data() QTest::newRow("simple dir") << (m_dataPath + "/resources") << 2; QTest::newRow("simple dir with slash") << (m_dataPath + "/resources/") << 2; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); QTest::newRow("unc 1") << uncRoot << 2; QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << 2; @@ -1248,7 +1248,7 @@ tst_QDir::cleanPath_data() #else QTest::newRow("data10") << "/:/" << "/:"; #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) QTest::newRow("data11") << "//foo//bar" << "//foo/bar"; #endif QTest::newRow("data12") << "ab/a/" << "ab/a"; // Path item with length of 2 @@ -1260,11 +1260,7 @@ tst_QDir::cleanPath_data() QTest::newRow("data14") << "c://foo" << "c:/foo"; // Drive letters and unc path in one string -#if defined(Q_OS_WINRT) - const QString root = QDir::rootPath(); // has trailing slash - QTest::newRow("root-up") << (root + "path/..") << root; - QTest::newRow("above-root") << (root + "..") << (root + ".."); -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) QTest::newRow("data15") << "//c:/foo" << "//c:/foo"; QTest::newRow("drive-up") << "A:/path/.." << "A:/"; QTest::newRow("drive-above-root") << "A:/.." << "A:/.."; @@ -1387,7 +1383,7 @@ void tst_QDir::absoluteFilePath_data() QTest::addColumn("fileName"); QTest::addColumn("expectedFilePath"); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) QTest::newRow("UNC-rel") << "//machine/share" << "dir" << "//machine/share/dir"; QTest::newRow("UNC-abs") << "//machine/share/path/to/blah" << "/dir" << "//machine/share/dir"; QTest::newRow("UNC-UNC") << "//machine/share/path/to/blah" << "//host/share/path" << "//host/share/path"; @@ -1425,7 +1421,7 @@ void tst_QDir::absolutePath_data() QTest::addColumn("expectedPath"); QTest::newRow("0") << "/machine/share/dir1" << "/machine/share/dir1"; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT)) +#if defined(Q_OS_WIN) 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"; @@ -1493,12 +1489,10 @@ void tst_QDir::relativeFilePath_data() QTest::newRow("27") << "C:" << "D:/" << "D:/"; QTest::newRow("28") << "C:/" << "D:" << "D:"; QTest::newRow("29") << "C:/" << "D:/" << "D:/"; -#ifndef Q_OS_WINRT QTest::newRow("30") << "C:/foo/bar" << "//anotherHost/foo/bar" << "//anotherHost/foo/bar"; QTest::newRow("31") << "//anotherHost/foo" << "//anotherHost/foo/bar" << "bar"; QTest::newRow("32") << "//anotherHost/foo" << "bar" << "bar"; QTest::newRow("33") << "//anotherHost/foo" << "C:/foo/bar" << "C:/foo/bar"; -#endif // !Q_OS_WINRT #endif QTest::newRow("resource0") << ":/prefix" << "foo.bar" << "foo.bar"; @@ -1692,11 +1686,7 @@ void tst_QDir::homePath() qputenv("HOME", envHome); #elif defined(Q_OS_WIN) - if (strHome.length() > 3 // root dir = "c:/"; "//" is not really valid... -#if defined(Q_OS_WINRT) - && strHome.length() > QDir::rootPath().length() -#endif - ) + if (strHome.length() > 3) // root dir = "c:/"; "//" is not really valid... QVERIFY(!strHome.endsWith('/')); #endif @@ -2149,9 +2139,6 @@ void tst_QDir::drives() QVERIFY(list.count() >= 1); //system QLatin1Char systemdrive('c'); #endif -#if defined(Q_OS_WINRT) - QSKIP("WinRT has no concept of drives"); -#endif #if defined(Q_OS_WIN) QVERIFY(list.count() <= 26); bool foundsystem = false; @@ -2208,9 +2195,7 @@ void tst_QDir::equalityOperator_data() << true; //need a path in the root directory that is unlikely to be a symbolic link. -#if defined (Q_OS_WINRT) - QString pathinroot(QDir::rootPath() + QLatin1String("assets/..")); -#elif defined (Q_OS_WIN) +#if defined (Q_OS_WIN) QString pathinroot("c:/windows/.."); #elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QString pathinroot("/system/.."); @@ -2341,8 +2326,6 @@ void tst_QDir::cdBelowRoot_data() QTest::newRow("android") << "/" << "system" << "/system"; #elif defined(Q_OS_UNIX) QTest::newRow("unix") << "/" << "tmp" << "/tmp"; -#elif defined(Q_OS_WINRT) - QTest::newRow("winrt") << QDir::rootPath() << QDir::rootPath() << QDir::rootPath(); #else // Windows+CE const QString systemDrive = QString::fromLocal8Bit(qgetenv("SystemDrive")) + QLatin1Char('/'); const QString systemRoot = QString::fromLocal8Bit(qgetenv("SystemRoot")); @@ -2369,9 +2352,6 @@ void tst_QDir::cdBelowRoot() #ifdef Q_OS_UNIX if (::getuid() == 0) QSKIP("Running this test as root doesn't make sense"); -#endif -#ifdef Q_OS_WINRT - QSKIP("WinRT has no concept of system root"); #endif QDir dir(targetPath); QVERIFY2(!dir.cd("../.."), qPrintable(dir.absolutePath())); diff --git a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp index 00e1c74d07..24e6128b4d 100644 --- a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp +++ b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp @@ -37,7 +37,7 @@ #include -#if defined(Q_OS_VXWORKS) || defined(Q_OS_WINRT) +#if defined(Q_OS_VXWORKS) #define Q_NO_SYMLINKS #endif @@ -220,11 +220,6 @@ void tst_QDirIterator::cleanupTestCase() Q_FOREACH(QString dirName, createdDirectories) currentDir.rmdir(dirName); - -#ifdef Q_OS_WINRT - QDir::setCurrent(QCoreApplication::applicationDirPath()); -#endif // Q_OS_WINRT - } void tst_QDirIterator::iterateRelativeDirectory_data() diff --git a/tests/auto/corelib/io/qfile/.prev_CMakeLists.txt b/tests/auto/corelib/io/qfile/.prev_CMakeLists.txt index cf329d37b7..196a0c056f 100644 --- a/tests/auto/corelib/io/qfile/.prev_CMakeLists.txt +++ b/tests/auto/corelib/io/qfile/.prev_CMakeLists.txt @@ -79,11 +79,9 @@ extend_target(tst_qfile CONDITION CONFIG___contains___builtin_testdata BUILTIN_TESTDATA ) -extend_target(tst_qfile CONDITION WIN32 AND NOT WINRT +extend_target(tst_qfile CONDITION WIN32 PUBLIC_LIBRARIES ole32 uuid ) -if(NOT WINRT) - add_subdirectory(stdinprocess) -endif() +add_subdirectory(stdinprocess) diff --git a/tests/auto/corelib/io/qfile/CMakeLists.txt b/tests/auto/corelib/io/qfile/CMakeLists.txt index 6bfb3fe8fd..bfea2c7f49 100644 --- a/tests/auto/corelib/io/qfile/CMakeLists.txt +++ b/tests/auto/corelib/io/qfile/CMakeLists.txt @@ -79,11 +79,9 @@ extend_target(tst_qfile CONDITION CONFIG___contains___builtin_testdata BUILTIN_TESTDATA ) -extend_target(tst_qfile CONDITION WIN32 AND NOT WINRT +extend_target(tst_qfile CONDITION WIN32 PUBLIC_LIBRARIES ole32 uuid ) -if(NOT WINRT) - add_subdirectory(stdinprocess) -endif() +add_subdirectory(stdinprocess) diff --git a/tests/auto/corelib/io/qfile/qfile.pro b/tests/auto/corelib/io/qfile/qfile.pro index 91c5c15f66..1b434a2a74 100644 --- a/tests/auto/corelib/io/qfile/qfile.pro +++ b/tests/auto/corelib/io/qfile/qfile.pro @@ -1,3 +1,3 @@ TEMPLATE = subdirs -SUBDIRS = test.pro -!winrt: SUBDIRS += stdinprocess +SUBDIRS = test.pro \ + stdinprocess diff --git a/tests/auto/corelib/io/qfile/test.pro b/tests/auto/corelib/io/qfile/test.pro index 47b778bc33..7841973a65 100644 --- a/tests/auto/corelib/io/qfile/test.pro +++ b/tests/auto/corelib/io/qfile/test.pro @@ -23,6 +23,6 @@ TESTDATA += \ Makefile forCopying.txt forRenaming.txt \ resources/file1.ext1 -win32:!winrt: QMAKE_USE += ole32 uuid +win32: QMAKE_USE += ole32 uuid CONFIG += c++17 diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index d2a83757d2..9416796c6c 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -189,19 +189,17 @@ private slots: void copyRemovesTemporaryFile() const; void copyShouldntOverwrite(); void copyFallback(); -#ifndef Q_OS_WINRT void link(); void linkToDir(); void absolutePathLinkToRelativePath(); void readBrokenLink(); -#endif void readTextFile_data(); void readTextFile(); void readTextFile2(); void writeTextFile_data(); void writeTextFile(); /* void largeFileSupport(); */ -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) void largeUncFileSupport(); #endif void flush(); @@ -550,7 +548,7 @@ void tst_QFile::exists() file.remove(); QVERIFY(!file.exists()); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) const QString uncPath = "//" + QtNetworkSettings::winServerName() + "/testshare/readme.txt"; QFile unc(uncPath); QVERIFY2(unc.exists(), msgFileDoesNotExist(uncPath).constData()); @@ -606,7 +604,7 @@ void tst_QFile::open_data() << int(QIODevice::ReadOnly) << false << QFile::OpenError; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) //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) { @@ -637,7 +635,7 @@ void tst_QFile::open() QSKIP("Running this test as root doesn't make sense"); #endif -#if defined(Q_OS_WIN32) || defined(Q_OS_WINRT) +#if defined(Q_OS_WIN32) QEXPECT_FAIL("noreadfile", "Windows does not currently support non-readable files.", Abort); #endif if (filename.isEmpty()) @@ -689,7 +687,7 @@ void tst_QFile::size_data() QTest::addColumn("size"); QTest::newRow( "exist01" ) << m_testFile << (qint64)245; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) // Only test UNC on Windows./ QTest::newRow("unc") << "//" + QString(QtNetworkSettings::winServerName() + "/testshare/test.pri") << (qint64)34; #endif @@ -1173,7 +1171,7 @@ void tst_QFile::ungetChar() QCOMPARE(buf[2], '4'); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) QString driveLetters() { wchar_t volumeName[MAX_PATH]; @@ -1210,9 +1208,7 @@ void tst_QFile::invalidFile_data() #if !defined(Q_OS_WIN) QTest::newRow( "x11" ) << QString( "qwe//" ); #else -#if !defined(Q_OS_WINRT) QTest::newRow( "colon2" ) << invalidDriveLetter() + QString::fromLatin1(":ail:invalid"); -#endif QTest::newRow( "colon3" ) << QString( ":failinvalid" ); QTest::newRow( "forwardslash" ) << QString( "fail/invalid" ); QTest::newRow( "asterisk" ) << QString( "fail*invalid" ); @@ -1351,7 +1347,7 @@ void tst_QFile::permissions() QFile::remove(file); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) if (qt_ntfs_permission_lookup) QEXPECT_FAIL("readonly", "QTBUG-25630", Abort); #endif @@ -1497,7 +1493,7 @@ void tst_QFile::copyFallback() #include #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) static QString getWorkingDirectoryForLink(const QString &linkFileName) { bool neededCoInit = false; @@ -1536,7 +1532,6 @@ static QString getWorkingDirectoryForLink(const QString &linkFileName) } #endif -#ifndef Q_OS_WINRT void tst_QFile::link() { QFile::remove("myLink.lnk"); @@ -1611,7 +1606,6 @@ void tst_QFile::readBrokenLink() QVERIFY(QFile::link("ole/..", "myLink2.lnk")); QCOMPARE(QFileInfo("myLink2.lnk").symLinkTarget(), QDir::currentPath()); } -#endif // Q_OS_WINRT void tst_QFile::readTextFile_data() { @@ -1696,7 +1690,7 @@ void tst_QFile::writeTextFile() QCOMPARE(file.readAll(), out); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) // Helper for executing QFile::open() with warning in QTRY_VERIFY(), which evaluates the condition // multiple times static bool qFileOpen(QFile &file, QIODevice::OpenMode ioFlags) @@ -2427,7 +2421,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_WINRT) && !defined(QT_NO_NETWORK) +#if defined(Q_OS_WIN) && !defined(QT_NO_NETWORK) // Some semi-randomness to avoid collisions. QTest::newRow("unc file") << QString("//" + QtNetworkSettings::winServerName() + "/TESTSHAREWRITABLE/largefile-%1-%2.txt") @@ -2787,7 +2781,7 @@ void tst_QFile::appendAndRead() void tst_QFile::miscWithUncPathAsCurrentDir() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) QString current = QDir::currentPath(); const QString path = QLatin1String("//") + QtNetworkSettings::winServerName() + QLatin1String("/testshare"); @@ -2876,12 +2870,8 @@ void tst_QFile::nativeHandleLeaks() } #ifdef Q_OS_WIN -# ifndef Q_OS_WINRT handle1 = ::CreateFileA("qt_file.tmp", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); -# else - handle1 = ::CreateFile2(L"qt_file.tmp", GENERIC_READ, 0, OPEN_ALWAYS, NULL); -# endif QVERIFY( INVALID_HANDLE_VALUE != handle1 ); QVERIFY( ::CloseHandle(handle1) ); #endif @@ -2895,12 +2885,8 @@ void tst_QFile::nativeHandleLeaks() } #ifdef Q_OS_WIN -# ifndef Q_OS_WINRT handle2 = ::CreateFileA("qt_file.tmp", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); -# else - handle2 = ::CreateFile2(L"qt_file.tmp", GENERIC_READ, 0, OPEN_ALWAYS, NULL); -# endif QVERIFY( INVALID_HANDLE_VALUE != handle2 ); QVERIFY( ::CloseHandle(handle2) ); #endif @@ -3720,10 +3706,6 @@ void tst_QFile::moveToTrash() QFETCH(bool, create); QFETCH(bool, result); -#if defined(Q_OS_WINRT) - QSKIP("WinRT does not have a trash", SkipAll); -#endif - auto ensureFile = [](const QString &source, bool create) { if (QFileInfo::exists(source) || !create) return; diff --git a/tests/auto/corelib/io/qfileinfo/CMakeLists.txt b/tests/auto/corelib/io/qfileinfo/CMakeLists.txt index a6cf3a38f1..05a14d4e1a 100644 --- a/tests/auto/corelib/io/qfileinfo/CMakeLists.txt +++ b/tests/auto/corelib/io/qfileinfo/CMakeLists.txt @@ -40,7 +40,7 @@ add_qt_resource(tst_qfileinfo "testdata" ## Scopes: ##################################################################### -extend_target(tst_qfileinfo CONDITION WIN32 AND NOT WINRT +extend_target(tst_qfileinfo CONDITION WIN32 PUBLIC_LIBRARIES advapi32 netapi32 diff --git a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro index af764f3679..7c0e6f1537 100644 --- a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro +++ b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro @@ -5,7 +5,7 @@ SOURCES = tst_qfileinfo.cpp RESOURCES += qfileinfo.qrc \ testdata.qrc -win32:!winrt: QMAKE_USE += advapi32 netapi32 +win32: QMAKE_USE += advapi32 netapi32 # for std::filesystem tests qtConfig(c++17): CONFIG += c++17 diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index c5dafb1a29..ce41e49985 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -48,11 +48,9 @@ #endif #ifdef Q_OS_WIN #include -#if !defined(Q_OS_WINRT) #include #include #endif -#endif #include #include #if defined(Q_OS_WIN) @@ -61,7 +59,7 @@ #include #include "../../../../shared/filesystem.h" -#if defined(Q_OS_VXWORKS) || defined(Q_OS_WINRT) +#if defined(Q_OS_VXWORKS) #define Q_NO_SYMLINKS #endif @@ -69,9 +67,7 @@ QT_BEGIN_NAMESPACE extern Q_CORE_EXPORT int qt_ntfs_permission_lookup; QT_END_NAMESPACE -# ifndef Q_OS_WINRT bool IsUserAdmin(); -# endif #endif inline bool qIsLikelyToBeFat(const QString &path) @@ -96,7 +92,7 @@ inline bool qIsLikelyToBeNfs(const QString &path) #endif } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) # ifndef SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE // MinGW # define SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE (0x2) # endif @@ -126,7 +122,7 @@ static QByteArray msgInsufficientPrivileges(const QString &errorMessage) { return "Insufficient privileges (" + errorMessage.toLocal8Bit() + ')'; } -#endif // Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN static QString seedAndTemplate() { @@ -261,7 +257,7 @@ private slots: void refresh(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) void ntfsJunctionPointsAndSymlinks_data(); void ntfsJunctionPointsAndSymlinks(); void brokenShortcut(); @@ -278,9 +274,7 @@ private slots: void detachingOperations(); -#if !defined(Q_OS_WINRT) void owner(); -#endif void group(); void invalidState_data(); @@ -421,12 +415,12 @@ void tst_QFileInfo::isDir_data() QTest::newRow("broken link") << "brokenlink.lnk" << false; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT)) +#if defined(Q_OS_WIN) 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_WINRT) +#if defined(Q_OS_WIN) const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); QTest::newRow("unc 1") << uncRoot << true; QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true; @@ -463,13 +457,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_WINRT)) +#if defined(Q_OS_WIN) 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_WINRT) +#if defined(Q_OS_WIN) const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); QTest::newRow("unc 1") << uncRoot << true; QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true; @@ -507,18 +501,13 @@ void tst_QFileInfo::exists_data() QTest::newRow("data8") << (m_resourcesDir + "/*.ext1") << false; QTest::newRow("data9") << (m_resourcesDir + "/file?.ext1") << false; QTest::newRow("data10") << "." << true; - - // Skip for the WinRT case, as GetFileAttributesEx removes _any_ - // trailing whitespace and "." is a valid entry as seen in data10 -#ifndef Q_OS_WINRT QTest::newRow("data11") << ". " << false; -#endif QTest::newRow("empty") << "" << false; 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_WINRT) +#if defined(Q_OS_WIN) const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); QTest::newRow("unc 1") << uncRoot << true; QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true; @@ -553,7 +542,7 @@ void tst_QFileInfo::absolutePath_data() QTest::addColumn("filename"); QString drivePrefix; -#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT)) +#if defined(Q_OS_WIN) drivePrefix = QDir::currentPath().left(2); QString nonCurrentDrivePrefix = drivePrefix.left(1).compare("X", Qt::CaseInsensitive) == 0 ? QString("Y:") : QString("X:"); @@ -563,8 +552,6 @@ void tst_QFileInfo::absolutePath_data() QTest::newRow(":my.dll") << nonCurrentDrivePrefix + "my.dll" << nonCurrentDrivePrefix + "/" << "my.dll"; -#elif defined(Q_OS_WINRT) - drivePrefix = QDir::currentPath().left(2); #endif QTest::newRow("0") << "/machine/share/dir1/" << drivePrefix + "/machine/share/dir1" << ""; QTest::newRow("1") << "/machine/share/dir1" << drivePrefix + "/machine/share" << "dir1"; @@ -572,7 +559,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_WINRT) +#if defined(Q_OS_WIN) QTest::newRow("c:\\autoexec.bat") << "c:\\autoexec.bat" << "C:/" << "autoexec.bat"; QTest::newRow("c:autoexec.bat") << QDir::currentPath().left(2) + "autoexec.bat" << QDir::currentPath() @@ -748,7 +735,7 @@ void tst_QFileInfo::canonicalFilePath() } #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) { QString errorMessage; const QString linkTarget = QStringLiteral("res"); @@ -846,7 +833,7 @@ void tst_QFileInfo::dir_data() QTest::newRow("absFilePath") << QDir::currentPath() + "/tmp.txt" << false << QDir::currentPath(); QTest::newRow("absFilePathAbsPath") << QDir::currentPath() + "/tmp.txt" << true << QDir::currentPath(); QTest::newRow("resource1") << ":/tst_qfileinfo/resources/file1.ext1" << true << ":/tst_qfileinfo/resources"; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) QTest::newRow("driveWithSlash") << "C:/file1.ext1.ext2" << true << "C:/"; QTest::newRow("driveWithoutSlash") << QDir::currentPath().left(2) + "file1.ext1.ext2" << false << QDir::currentPath().left(2); #endif @@ -1037,7 +1024,7 @@ void tst_QFileInfo::size() void tst_QFileInfo::systemFiles() { -#if !defined(Q_OS_WIN) || defined(Q_OS_WINRT) +#if !defined(Q_OS_WIN) QSKIP("This is a Windows only test"); #endif QFileInfo fi("c:\\pagefile.sys"); @@ -1240,7 +1227,7 @@ void tst_QFileInfo::fileTimes() QCOMPARE(fileInfo.birthTime(), birthTime); // mustn't have changed QVERIFY(readTime.isValid()); -#if defined(Q_OS_WINRT) || defined(Q_OS_QNX) || (defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)) +#if defined(Q_OS_QNX) || (defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)) noAccessTime = true; #elif defined(Q_OS_WIN) //In Vista the last-access timestamp is not updated when the file is accessed/touched (by default). @@ -1361,7 +1348,7 @@ void tst_QFileInfo::isShortcut_data() << regularFile.fileName() << false; QTest::newRow("directory") << QDir::currentPath() << false; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) // windows shortcuts QVERIFY(regularFile.link("link.lnk")); QTest::newRow("shortcut") @@ -1397,7 +1384,6 @@ void tst_QFileInfo::isSymbolicLink_data() #ifndef Q_NO_SYMLINKS #if defined(Q_OS_WIN) -#if !defined(Q_OS_WINRT) QString errorMessage; const DWORD creationResult = createSymbolicLink("symlink", m_sourceFile, &errorMessage); if (creationResult == ERROR_PRIVILEGE_NOT_HELD) { @@ -1407,7 +1393,6 @@ void tst_QFileInfo::isSymbolicLink_data() QTest::newRow("NTFS-symlink") << "symlink" << true; } -#endif // !Q_OS_WINRT #else // Unix: QVERIFY(regularFile.link("symlink.lnk")); QTest::newRow("symlink.lnk") @@ -1450,7 +1435,7 @@ void tst_QFileInfo::link_data() file2.open(QIODevice::WriteOnly); QTest::newRow("existent file") << m_sourceFile << false << false << ""; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) // windows shortcuts QVERIFY(file1.link("link.lnk")); QTest::newRow("link.lnk") @@ -1463,7 +1448,6 @@ void tst_QFileInfo::link_data() #ifndef Q_NO_SYMLINKS #if defined(Q_OS_WIN) -#if !defined(Q_OS_WINRT) QString errorMessage; DWORD creationResult = createSymbolicLink("link", m_sourceFile, &errorMessage); if (creationResult == ERROR_PRIVILEGE_NOT_HELD) { @@ -1482,7 +1466,6 @@ void tst_QFileInfo::link_data() QTest::newRow("broken link") << "brokenlink" << false << true << QFileInfo("dummyfile").absoluteFilePath(); } -#endif // !Q_OS_WINRT #else // Unix: QVERIFY(file1.link("link")); QTest::newRow("link") @@ -1662,7 +1645,7 @@ void tst_QFileInfo::refresh() QCOMPARE(info2.size(), info.size()); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) struct NtfsTestResource { @@ -1872,13 +1855,13 @@ void tst_QFileInfo::isWritable() QVERIFY(QFileInfo("tempfile.txt").isWritable()); tempfile.remove(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) QFileInfo fi("c:\\pagefile.sys"); QVERIFY2(fi.exists(), msgDoesNotExist(fi.absoluteFilePath()).constData()); QVERIFY(!fi.isWritable()); #endif -#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) QScopedValueRollback ntfsMode(qt_ntfs_permission_lookup); qt_ntfs_permission_lookup = 1; QFileInfo fi2(QFile::decodeName(qgetenv("SystemRoot") + "/system.ini")); @@ -2059,7 +2042,7 @@ void tst_QFileInfo::detachingOperations() QVERIFY(!info1.caching()); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) bool IsUserAdmin() { BOOL b; @@ -2081,9 +2064,8 @@ bool IsUserAdmin() return b != FALSE; } -#endif // Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN -#ifndef Q_OS_WINRT void tst_QFileInfo::owner() { QString userName; @@ -2145,7 +2127,6 @@ void tst_QFileInfo::owner() qt_ntfs_permission_lookup = 0; #endif } -#endif // !Q_OS_WINRT void tst_QFileInfo::group() { diff --git a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp index bac7a69e0f..efdfc071a3 100644 --- a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp +++ b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp @@ -96,7 +96,7 @@ void tst_QFileSelector::basicTest_data() expectedPlatform2File = QString(":/platforms/test2"); #else QString distributionName; -# if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) || defined(Q_OS_FREEBSD) || defined(Q_OS_WINRT) +# if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) || defined(Q_OS_FREEBSD) distributionName = QSysInfo::productType(); # endif foreach (const QString &selector, QFileSelectorPrivate::platformSelectors()) { diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 7d88601e54..4f07581587 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -34,7 +34,7 @@ #include #include #include -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) #include #endif @@ -82,7 +82,7 @@ private slots: void signalsEmittedAfterFileMoved(); void watchUnicodeCharacters(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) void watchDirectoryAttributeChanges(); #endif @@ -819,7 +819,7 @@ void tst_QFileSystemWatcher::watchUnicodeCharacters() QTRY_COMPARE(changedSpy.count(), 1); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) void tst_QFileSystemWatcher::watchDirectoryAttributeChanges() { QTemporaryDir temporaryDirectory(m_tempDirPattern); diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp index da5327594c..10214f2996 100644 --- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp @@ -104,9 +104,6 @@ void tst_QIODevice::getSetCheck() //---------------------------------------------------------------------------------- void tst_QIODevice::constructing_QTcpSocket() { -#if defined(Q_OS_WINRT) - QSKIP("Synchronous socket calls are broken on winrt. See QTBUG-40922"); -#endif if (!QtNetworkSettings::verifyTestNetworkSettings()) QSKIP("No network test server available"); @@ -263,9 +260,6 @@ void tst_QIODevice::unget() buffer.ungetChar('Q'); QCOMPARE(buffer.readLine(buf, 3), qint64(1)); -#if defined(Q_OS_WINRT) - QSKIP("Synchronous socket calls are broken on winrt. See QTBUG-40922"); -#endif for (int i = 0; i < 2; ++i) { QTcpSocket socket; QIODevice *dev; diff --git a/tests/auto/corelib/io/qlockfile/CMakeLists.txt b/tests/auto/corelib/io/qlockfile/CMakeLists.txt index a41c442b58..d422ae9d24 100644 --- a/tests/auto/corelib/io/qlockfile/CMakeLists.txt +++ b/tests/auto/corelib/io/qlockfile/CMakeLists.txt @@ -15,7 +15,7 @@ add_qt_test(tst_qlockfile ## Scopes: ##################################################################### -extend_target(tst_qlockfile CONDITION WIN32 AND NOT WINRT +extend_target(tst_qlockfile CONDITION WIN32 PUBLIC_LIBRARIES advapi32 ) diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp index 1d79d0dd1f..42bdf3eabf 100644 --- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp +++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp @@ -35,7 +35,7 @@ #if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS) #include #include -#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#elif defined(Q_OS_WIN) # include #endif @@ -289,7 +289,7 @@ void tst_QLockFile::staleLockFromCrashedProcessReusedPid() { #if !QT_CONFIG(process) QSKIP("This test requires QProcess support"); -#elif defined(Q_OS_WINRT) || defined(QT_PLATFORM_UIKIT) +#elif defined(QT_PLATFORM_UIKIT) QSKIP("We cannot retrieve information about other processes on this platform."); #else const QString fileName = dir.path() + "/staleLockFromCrashedProcessReusedPid"; @@ -463,7 +463,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(ProcessProperties) static inline ProcessProperties processProperties() { ProcessProperties result; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) HANDLE processToken = NULL; if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &processToken)) { DWORD elevation; // struct containing a DWORD, not present in some MinGW headers. @@ -492,7 +492,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_WINRT) +#if !defined(Q_OS_WIN) 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 e33e22b36f..8ac76b0317 100644 --- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro +++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro @@ -3,4 +3,4 @@ TARGET = tst_qlockfile SOURCES += tst_qlockfile.cpp QT = core-private testlib concurrent -win32:!winrt: QMAKE_USE += advapi32 +win32: QMAKE_USE += advapi32 diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index cef03c4591..d5f2da06d2 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -56,9 +56,7 @@ #if defined(Q_OS_WIN) #include -#ifndef Q_OS_WINRT -# include -#endif +#include #else #include #endif @@ -77,7 +75,7 @@ QT_FORWARD_DECLARE_CLASS(QSettings) static inline bool canWriteNativeSystemSettings() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) HKEY key; const LONG result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software", 0, KEY_WRITE, &key); if (result == ERROR_SUCCESS) @@ -159,7 +157,7 @@ private slots: #if !defined(Q_OS_WIN) && !defined(QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER) void dontReorderIniKeysNeedlessly(); #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) void consistentRegistryStorage(); #endif @@ -214,12 +212,7 @@ void tst_QSettings::getSetCheck() static QString settingsPath(const char *path = nullptr) { // Temporary path for files that are specified explicitly in the constructor. -#ifndef Q_OS_WINRT static const QString tempPath = QDir::tempPath() + QLatin1String("/tst_QSettings"); -#else - static const QString tempPath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) - + QLatin1String("/tst_QSettings"); -#endif return path && *path ? tempPath + QLatin1Char('/') + QLatin1String(path) : tempPath; } @@ -324,7 +317,7 @@ void tst_QSettings::cleanupTestFiles() if (settingsDir.exists()) QVERIFY(settingsDir.removeRecursively()); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) QSettings("HKEY_CURRENT_USER\\Software\\software.org", QSettings::NativeFormat).clear(); QSettings("HKEY_CURRENT_USER\\Software\\other.software.org", QSettings::NativeFormat).clear(); QSettings("HKEY_CURRENT_USER\\Software\\foo", QSettings::NativeFormat).clear(); @@ -339,7 +332,7 @@ void tst_QSettings::cleanupTestFiles() QSettings("HKEY_LOCAL_MACHINE\\Software\\bat", QSettings::NativeFormat).clear(); QSettings("HKEY_LOCAL_MACHINE\\Software\\baz", QSettings::NativeFormat).clear(); } -#elif defined(Q_OS_DARWIN) || defined(Q_OS_WINRT) +#elif defined(Q_OS_DARWIN) QSettings(QSettings::UserScope, "software.org", "KillerAPP").clear(); QSettings(QSettings::SystemScope, "software.org", "KillerAPP").clear(); QSettings(QSettings::UserScope, "other.software.org", "KillerAPP").clear(); @@ -352,12 +345,7 @@ void tst_QSettings::cleanupTestFiles() const QString foo(QLatin1String("foo")); -#if defined(Q_OS_WINRT) - QSettings(foo, QSettings::NativeFormat).clear(); - QFile fooFile(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + QLatin1Char('/') + foo); -#else QFile fooFile(foo); -#endif if (fooFile.exists()) QVERIFY2(fooFile.remove(), qPrintable(fooFile.errorString())); } @@ -540,7 +528,7 @@ void tst_QSettings::ctor() } else { caseSensitive = pathconf(settings5.fileName().toLatin1().constData(), _PC_CASE_SENSITIVE); } -#elif defined(Q_OS_WIN32) || defined(Q_OS_WINRT) +#elif defined(Q_OS_WIN32) caseSensitive = false; #endif if (caseSensitive) @@ -614,8 +602,8 @@ void tst_QSettings::ctor() QCoreApplication::instance()->setOrganizationName(""); QCoreApplication::instance()->setApplicationName(""); QSettings settings; -#if defined(Q_OS_MAC) || defined(Q_OS_WINRT) - QEXPECT_FAIL("native", "Default settings on Mac/WinRT are valid, despite organization domain, name, and app name being null", Continue); +#if defined(Q_OS_MAC) + QEXPECT_FAIL("native", "Default settings on Mac are valid, despite organization domain, name, and app name being null", Continue); #endif QCOMPARE(settings.status(), QSettings::AccessError); QCoreApplication::instance()->setOrganizationName("software.org"); @@ -629,8 +617,8 @@ void tst_QSettings::ctor() } QSettings settings(format, QSettings::UserScope, "", ""); -#if defined(Q_OS_MAC) || defined(Q_OS_WINRT) - QEXPECT_FAIL("native", "Default settings on Mac/WinRT are valid, despite organization domain, name, and app name being null", Continue); +#if defined(Q_OS_MAC) + QEXPECT_FAIL("native", "Default settings on Mac are valid, despite organization domain, name, and app name being null", Continue); #endif QCOMPARE(settings.status(), QSettings::AccessError); QSettings settings2(format, QSettings::UserScope, "software.org", "KillerAPP"); @@ -1724,14 +1712,9 @@ void tst_QSettings::sync() // Now "some other app" will change other.software.org.ini QString userConfDir = settingsPath("__user__") + QDir::separator(); -#if !defined(Q_OS_WINRT) unlink((userConfDir + "other.software.org.ini").toLatin1()); rename((userConfDir + "software.org.ini").toLatin1(), (userConfDir + "other.software.org.ini").toLatin1()); -#else - QFile::remove(userConfDir + "other.software.org.ini"); - QFile::rename(userConfDir + "software.org.ini" , userConfDir + "other.software.org.ini"); -#endif settings2.sync(); @@ -2265,7 +2248,7 @@ void tst_QSettings::testRegistryShortRootNames() void tst_QSettings::testRegistry32And64Bit() { -#if !defined (Q_OS_WIN) || defined(Q_OS_WINRT) +#if !defined (Q_OS_WIN) QSKIP("This test is specific to the Windows registry.", SkipAll); #else @@ -2346,7 +2329,7 @@ void tst_QSettings::fromFile() QString path = "foo"; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) if (format == QSettings::NativeFormat) path = "\\HKEY_CURRENT_USER\\Software\\foo"; #endif @@ -3491,7 +3474,7 @@ void tst_QSettings::rainersSyncBugOnMac() { QFETCH(QSettings::Format, format); -#if defined(Q_OS_DARWIN) || defined(Q_OS_WINRT) +#if defined(Q_OS_DARWIN) if (format == QSettings::NativeFormat) QSKIP("Apple OSes do not support direct reads from and writes to .plist files, due to caching and background syncing. See QTBUG-34899."); #endif @@ -3526,7 +3509,7 @@ void tst_QSettings::recursionBug() } } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) static DWORD readKeyType(HKEY handle, QStringView rSubKey) { diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index d0fbdb7a2a..cba7dfe9fc 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -33,7 +33,7 @@ #include #include #include -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) # include #endif @@ -131,7 +131,7 @@ static const char * const enumNames[MaxStandardLocation + 1 - int(QStandardPaths void tst_qstandardpaths::initTestCase() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) // Disable WOW64 redirection, see testFindExecutable() if (QSysInfo::buildCpuArchitecture() != QSysInfo::currentCpuArchitecture()) { void *oldMode; @@ -140,7 +140,7 @@ void tst_qstandardpaths::initTestCase() qErrnoWarning("Wow64DisableWow64FsRedirection() failed"); QVERIFY(disabledDisableWow64FsRedirection); } -#endif // Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN QVERIFY2(m_localConfigTempDir.isValid(), qPrintable(m_localConfigTempDir.errorString())); QVERIFY2(m_globalConfigTempDir.isValid(), qPrintable(m_globalConfigTempDir.errorString())); QVERIFY2(m_localAppTempDir.isValid(), qPrintable(m_localAppTempDir.errorString())); @@ -308,9 +308,9 @@ void tst_qstandardpaths::testDataLocation() { // On all platforms, DataLocation should be GenericDataLocation / organization name / app name // This allows one app to access the data of another app. - // Android and WinRT are an exception to this case, owing to the fact that + // Android is an exception to this case, owing to the fact that // applications are sandboxed. -#if !defined(Q_OS_ANDROID) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_ANDROID) const QString base = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation), base + "/tst_qstandardpaths"); QCoreApplication::instance()->setOrganizationName("Qt"); @@ -339,7 +339,7 @@ void tst_qstandardpaths::testAppConfigLocation() { // On all platforms where applications are not sandboxed, // AppConfigLocation should be GenericConfigLocation / organization name / app name -#if !defined(Q_OS_ANDROID) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_ANDROID) const QString base = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation), base + "/tst_qstandardpaths"); QCoreApplication::setOrganizationName("Qt"); @@ -381,7 +381,6 @@ void tst_qstandardpaths::testFindExecutable_data() QTest::addColumn("needle"); QTest::addColumn("expected"); #ifdef Q_OS_WIN -# ifndef Q_OS_WINRT const QFileInfo cmdFi = QFileInfo(QDir::cleanPath(QString::fromLocal8Bit(qgetenv("COMSPEC")))); const QString cmdPath = cmdFi.absoluteFilePath(); @@ -406,7 +405,6 @@ void tst_qstandardpaths::testFindExecutable_data() QTest::newRow("win8-logo-nosuffix") << QString() << logo << logoPath; } -# endif // Q_OS_WINRT #else const QFileInfo shFi = findSh(); Q_ASSERT(shFi.exists()); @@ -448,8 +446,6 @@ void tst_qstandardpaths::testFindExecutable() void tst_qstandardpaths::testFindExecutableLinkToDirectory() { - // WinRT has no link support -#ifndef Q_OS_WINRT // link to directory const QString target = QDir::tempPath() + QDir::separator() + QLatin1String("link.lnk"); QFile::remove(target); @@ -457,7 +453,6 @@ void tst_qstandardpaths::testFindExecutableLinkToDirectory() QVERIFY(appFile.link(target)); QVERIFY(QStandardPaths::findExecutable(target).isEmpty()); QFile::remove(target); -#endif } void tst_qstandardpaths::testRuntimeDirectory() diff --git a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp index fe63cecccd..7dd76a2be1 100644 --- a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp +++ b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp @@ -40,14 +40,12 @@ private slots: void defaultValues(); void dump(); void operatorEqual(); -#ifndef Q_OS_WINRT void operatorNotEqual(); void root(); void currentStorage(); void storageList(); void tempFile(); void caching(); -#endif }; void tst_QStorageInfo::defaultValues() @@ -113,7 +111,6 @@ void tst_QStorageInfo::operatorEqual() } } -#ifndef Q_OS_WINRT void tst_QStorageInfo::operatorNotEqual() { QStorageInfo storage1 = QStorageInfo::root(); @@ -230,7 +227,6 @@ void tst_QStorageInfo::caching() } QVERIFY(free != storage2.bytesFree()); } -#endif QTEST_MAIN(tst_QStorageInfo) diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp index b4fa0b41fe..40582eba1b 100644 --- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp +++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp @@ -332,7 +332,7 @@ void tst_QTemporaryDir::nonWritableCurrentDir() void tst_QTemporaryDir::openOnRootDrives() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) unsigned int lastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); #endif // If it's possible to create a file in the root directory, it @@ -346,7 +346,7 @@ void tst_QTemporaryDir::openOnRootDrives() QVERIFY(dir.isValid()); } } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) SetErrorMode(lastErrorMode); #endif } diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index bfa9f1d744..59ded3b0c4 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -504,7 +504,7 @@ void tst_QTemporaryFile::resize() void tst_QTemporaryFile::openOnRootDrives() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) unsigned int lastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); #endif // If it's possible to create a file in the root directory, it @@ -521,7 +521,7 @@ void tst_QTemporaryFile::openOnRootDrives() QCOMPARE(fi.absoluteDir(), driveInfo.filePath()); } } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) SetErrorMode(lastErrorMode); #endif } diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 5a04d194a5..26b740ae20 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -3169,12 +3169,10 @@ void tst_QUrl::fromUserInputWithCwd_data() QTest::newRow(QByteArray(fileName) + "-in-dot") << fileName << QStringLiteral(".") << url << url; } -#ifndef Q_OS_WINRT // WinRT cannot cd outside current / sandbox QDir parent(base); QVERIFY(parent.cdUp()); QUrl parentUrl = QUrl::fromLocalFile(parent.path()); QTest::newRow("dotdot") << ".." << base << parentUrl << parentUrl; -#endif QTest::newRow("nonexisting") << "nonexisting" << base << QUrl("http://nonexisting") << QUrl::fromLocalFile(base + "/nonexisting"); QTest::newRow("short-url") << "example.org" << base << QUrl("http://example.org") << QUrl::fromLocalFile(base + "/example.org"); diff --git a/tests/auto/corelib/kernel/.prev_CMakeLists.txt b/tests/auto/corelib/kernel/.prev_CMakeLists.txt index 515720e282..39438deb5b 100644 --- a/tests/auto/corelib/kernel/.prev_CMakeLists.txt +++ b/tests/auto/corelib/kernel/.prev_CMakeLists.txt @@ -4,9 +4,6 @@ add_subdirectory(qcoreapplication) add_subdirectory(qdeadlinetimer) add_subdirectory(qelapsedtimer) add_subdirectory(qeventdispatcher) -if(TARGET Qt::Network) - add_subdirectory(qeventloop) -endif() add_subdirectory(qmath) add_subdirectory(qmetaobject) add_subdirectory(qmetaobjectbuilder) @@ -14,27 +11,33 @@ add_subdirectory(qmetamethod) add_subdirectory(qmetaproperty) add_subdirectory(qmetatype) add_subdirectory(qmetaenum) +add_subdirectory(qpointer) +add_subdirectory(qsignalblocker) +add_subdirectory(qsignalmapper) +add_subdirectory(qtimer) +add_subdirectory(qtranslator) +add_subdirectory(qvariant) +if(TARGET Qt::Network) + add_subdirectory(qeventloop) +endif() if(TARGET Qt::Gui) add_subdirectory(qmimedata) endif() if(TARGET Qt::Network AND NOT ANDROID AND NOT UIKIT) add_subdirectory(qobject) endif() -add_subdirectory(qpointer) if(QT_FEATURE_private_tests AND NOT ANDROID AND NOT UIKIT) add_subdirectory(qsharedmemory) endif() -add_subdirectory(qsignalblocker) -add_subdirectory(qsignalmapper) if(QT_FEATURE_private_tests AND TARGET Qt::Network) add_subdirectory(qsocketnotifier) endif() if(QT_FEATURE_systemsemaphore AND NOT ANDROID AND NOT UIKIT) add_subdirectory(qsystemsemaphore) endif() -add_subdirectory(qtimer) -add_subdirectory(qtranslator) -add_subdirectory(qvariant) -if(win32_x_ AND NOT WINRT) +if(win32_x_) add_subdirectory(qwineventnotifier) endif() +if(QT_FEATURE_private_tests) + add_subdirectory(qproperty) +endif() diff --git a/tests/auto/corelib/kernel/CMakeLists.txt b/tests/auto/corelib/kernel/CMakeLists.txt index f4f7b32bf3..b6a301a618 100644 --- a/tests/auto/corelib/kernel/CMakeLists.txt +++ b/tests/auto/corelib/kernel/CMakeLists.txt @@ -4,9 +4,6 @@ add_subdirectory(qdeadlinetimer) add_subdirectory(qelapsedtimer) add_subdirectory(qeventdispatcher) -if(TARGET Qt::Network) - add_subdirectory(qeventloop) -endif() add_subdirectory(qmath) add_subdirectory(qmetaobject) add_subdirectory(qmetaobjectbuilder) @@ -14,28 +11,31 @@ add_subdirectory(qmetamethod) add_subdirectory(qmetaproperty) add_subdirectory(qmetatype) add_subdirectory(qmetaenum) +add_subdirectory(qpointer) +add_subdirectory(qsignalblocker) +add_subdirectory(qsignalmapper) +# add_subdirectory(qtimer) # special case +add_subdirectory(qtranslator) +add_subdirectory(qvariant) +if(TARGET Qt::Network) + add_subdirectory(qeventloop) +endif() if(TARGET Qt::Gui) add_subdirectory(qmimedata) endif() if(TARGET Qt::Network AND NOT ANDROID AND NOT UIKIT) # add_subdirectory(qobject) # special case endif() -add_subdirectory(qpointer) if(QT_FEATURE_private_tests AND NOT ANDROID AND NOT UIKIT) add_subdirectory(qsharedmemory) endif() -add_subdirectory(qsignalblocker) -add_subdirectory(qsignalmapper) if(QT_FEATURE_private_tests AND TARGET Qt::Network) add_subdirectory(qsocketnotifier) endif() if(QT_FEATURE_systemsemaphore AND NOT ANDROID AND NOT UIKIT) add_subdirectory(qsystemsemaphore) endif() -# add_subdirectory(qtimer) # special case -add_subdirectory(qtranslator) -add_subdirectory(qvariant) -if(win32_x_ AND NOT WINRT) +if(win32_x_) add_subdirectory(qwineventnotifier) endif() if(QT_FEATURE_private_tests) diff --git a/tests/auto/corelib/kernel/kernel.pro b/tests/auto/corelib/kernel/kernel.pro index 26cc00ea40..7c4fd2ec3d 100644 --- a/tests/auto/corelib/kernel/kernel.pro +++ b/tests/auto/corelib/kernel/kernel.pro @@ -40,7 +40,7 @@ SUBDIRS=\ qproperty # This test is only applicable on Windows -!win32*|winrt: SUBDIRS -= qwineventnotifier +!win32*: SUBDIRS -= qwineventnotifier android|uikit: SUBDIRS -= qobject qsharedmemory qsystemsemaphore diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp index 39c90f69b4..2e755351ee 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp @@ -155,9 +155,7 @@ void tst_QCoreApplication::qAppName() void tst_QCoreApplication::qAppVersion() { -#if defined(Q_OS_WINRT) - const char appVersion[] = "1.0.0.0"; -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) const char appVersion[] = "1.2.3.4"; #elif defined(Q_OS_DARWIN) || defined(Q_OS_ANDROID) const char appVersion[] = "1.2.3"; @@ -192,9 +190,6 @@ void tst_QCoreApplication::qAppVersion() void tst_QCoreApplication::argc() { -#if defined(Q_OS_WINRT) - QSKIP("QCoreApplication::arguments() parses arguments from actual command line on this platform."); -#endif { int argc = 1; char *argv[] = { const_cast(QTest::currentAppName()) }; diff --git a/tests/auto/corelib/kernel/qeventloop/CMakeLists.txt b/tests/auto/corelib/kernel/qeventloop/CMakeLists.txt index ac952f64f7..1b2e058a3d 100644 --- a/tests/auto/corelib/kernel/qeventloop/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qeventloop/CMakeLists.txt @@ -15,7 +15,7 @@ add_qt_test(tst_qeventloop ## Scopes: ##################################################################### -extend_target(tst_qeventloop CONDITION WIN32 AND NOT WINRT +extend_target(tst_qeventloop CONDITION WIN32 PUBLIC_LIBRARIES user32 ) diff --git a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro index 159761c0c6..827ecec883 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:!winrt: QMAKE_USE += user32 +win32: QMAKE_USE += user32 qtConfig(glib): DEFINES += HAVE_GLIB diff --git a/tests/auto/corelib/kernel/qmetatype/.prev_CMakeLists.txt b/tests/auto/corelib/kernel/qmetatype/.prev_CMakeLists.txt index 9a0bbc189c..397dbdf850 100644 --- a/tests/auto/corelib/kernel/qmetatype/.prev_CMakeLists.txt +++ b/tests/auto/corelib/kernel/qmetatype/.prev_CMakeLists.txt @@ -22,16 +22,12 @@ add_qt_test(tst_qmetatype ## Scopes: ##################################################################### -extend_target(tst_qmetatype CONDITION MSVC OR WINRT +extend_target(tst_qmetatype CONDITION MSVC COMPILE_OPTIONS /bigobj ) -#### Keys ignored in scope 3:.:.:qmetatype.pro:WINRT: -# QMAKE_CFLAGS_RELEASE = "--O2" -# QMAKE_CXXFLAGS_RELEASE = "--O2" - -#### Keys ignored in scope 4:.:.:qmetatype.pro:CLANG: +#### Keys ignored in scope 3:.:.:qmetatype.pro:CLANG: # QMAKE_CFLAGS_RELEASE = "--O2" "--g" # QMAKE_CXXFLAGS_RELEASE = "--O2" "--g" diff --git a/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt b/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt index 8f72ce51f3..0188d83e59 100644 --- a/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt @@ -23,16 +23,12 @@ add_qt_test(tst_qmetatype ## Scopes: ##################################################################### -extend_target(tst_qmetatype CONDITION MSVC OR WINRT +extend_target(tst_qmetatype CONDITION MSVC COMPILE_OPTIONS /bigobj ) -#### Keys ignored in scope 3:.:.:qmetatype.pro:WINRT: -# QMAKE_CFLAGS_RELEASE = "--O2" -# QMAKE_CXXFLAGS_RELEASE = "--O2" - -#### Keys ignored in scope 4:.:.:qmetatype.pro:CLANG: +#### Keys ignored in scope 3:.:.:qmetatype.pro:CLANG: # QMAKE_CFLAGS_RELEASE = "--O2" "--g" # QMAKE_CXXFLAGS_RELEASE = "--O2" "--g" diff --git a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro index 56b8c071c3..ae36fb07f9 100644 --- a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro +++ b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro @@ -6,14 +6,9 @@ SOURCES = tst_qmetatype.cpp TESTDATA=./typeFlags.bin DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -msvc|winrt { +msvc { # Prevents "fatal error C1128: number of sections exceeded object file format limit". QMAKE_CXXFLAGS += /bigobj - # Reduce compile time - winrt { - QMAKE_CXXFLAGS_RELEASE -= -O2 - QMAKE_CFLAGS_RELEASE -= -O2 - } } clang { diff --git a/tests/auto/corelib/kernel/qobject/CMakeLists.txt b/tests/auto/corelib/kernel/qobject/CMakeLists.txt index 3be3287532..ba8c67bd99 100644 --- a/tests/auto/corelib/kernel/qobject/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qobject/CMakeLists.txt @@ -9,21 +9,11 @@ add_qt_test(tst_qobject tst_qobject.cpp DEFINES QT_DISABLE_DEPRECATED_BEFORE=0 - LIBRARIES - Qt::CorePrivate PUBLIC_LIBRARIES + Qt::CorePrivate Qt::Network ) -#### Keys ignored in scope 3:.:.:test.pro:: -# CONFIG = "testcase" "console" - ## Scopes: ##################################################################### - -#### Keys ignored in scope 4:.:.:test.pro:QT_CONFIG___contains___c++1z: -# CONFIG = "c++1z" - -if(NOT WINRT) - add_subdirectory(signalbug) -endif() +add_subdirectory(signalbug) diff --git a/tests/auto/corelib/kernel/qobject/qobject.pro b/tests/auto/corelib/kernel/qobject/qobject.pro index 75ad7b5f14..bdbec1e9f8 100644 --- a/tests/auto/corelib/kernel/qobject/qobject.pro +++ b/tests/auto/corelib/kernel/qobject/qobject.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -SUBDIRS += test.pro -!winrt: SUBDIRS += signalbug +SUBDIRS += test.pro \ + signalbug diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 917c4e639f..b2dc3c7297 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -1862,8 +1862,6 @@ void tst_QObject::moveToThread() thread.wait(); } - // WinRT does not allow connection to localhost -#ifndef Q_OS_WINRT { // make sure socket notifiers are moved with the object MoveToThreadThread thread; @@ -1899,7 +1897,6 @@ void tst_QObject::moveToThread() QMetaObject::invokeMethod(socket, "deleteLater", Qt::QueuedConnection); thread.wait(); } -#endif } diff --git a/tests/auto/corelib/kernel/qsharedmemory/.prev_CMakeLists.txt b/tests/auto/corelib/kernel/qsharedmemory/.prev_CMakeLists.txt new file mode 100644 index 0000000000..7cd08cd377 --- /dev/null +++ b/tests/auto/corelib/kernel/qsharedmemory/.prev_CMakeLists.txt @@ -0,0 +1,23 @@ +# Generated from qsharedmemory.pro. + + ##################################################################### + ## tst_qsharedmemory Test: + ##################################################################### + + add_qt_test(tst_qsharedmemory + SOURCES + tst_qsharedmemory.cpp + PUBLIC_LIBRARIES + Qt::CorePrivate + ) + + ## Scopes: + ##################################################################### + + extend_target(tst_qsharedmemory CONDITION LINUX + PUBLIC_LIBRARIES + rt + ) +if(QT_FEATURE_sharedmemory) + add_subdirectory(producerconsumer) +endif() diff --git a/tests/auto/corelib/kernel/qsharedmemory/CMakeLists.txt b/tests/auto/corelib/kernel/qsharedmemory/CMakeLists.txt index 366e76d034..c96e6a8825 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qsharedmemory/CMakeLists.txt @@ -1,7 +1,6 @@ # Generated from qsharedmemory.pro. - -if(QT_FEATURE_sharedmemory) +if(QT_FEATURE_sharedmemory) # special case ##################################################################### ## tst_qsharedmemory Test: ##################################################################### @@ -9,13 +8,10 @@ if(QT_FEATURE_sharedmemory) add_qt_test(tst_qsharedmemory SOURCES tst_qsharedmemory.cpp - LIBRARIES + PUBLIC_LIBRARIES Qt::CorePrivate ) -#### Keys ignored in scope 4:.:.:test.pro:: - # CONFIG = "testcase" - ## Scopes: ##################################################################### @@ -23,8 +19,6 @@ if(QT_FEATURE_sharedmemory) PUBLIC_LIBRARIES rt ) - - if(NOT WINRT) - add_subdirectory(producerconsumer) - endif() +# if(QT_FEATURE_sharedmemory) # special case + add_subdirectory(producerconsumer) endif() diff --git a/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro b/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro index 323d5bbd37..91ac28fe0d 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro +++ b/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro @@ -1,6 +1,6 @@ TEMPLATE = subdirs qtConfig(sharedmemory) { - !winrt: SUBDIRS = producerconsumer - SUBDIRS += test.pro + SUBDIRS = producerconsumer \ + test.pro } diff --git a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp index 8ba3505d8b..9ab540cdf2 100644 --- a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp +++ b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp @@ -36,11 +36,7 @@ #include #include #include -#ifndef Q_OS_WINRT #include -#else -#include -#endif #define NATIVESOCKETENGINE QNativeSocketEngine #ifdef Q_OS_UNIX #include @@ -130,10 +126,6 @@ signals: void tst_QSocketNotifier::unexpectedDisconnection() { -#ifdef Q_OS_WINRT - // WinRT does not allow a connection to the localhost - QSKIP("Local connection not allowed", SkipAll); -#else /* Given two sockets and two QSocketNotifiers registered on each their socket. If both sockets receive data, and the first slot @@ -199,7 +191,6 @@ void tst_QSocketNotifier::unexpectedDisconnection() writeEnd1->close(); writeEnd2->close(); server.close(); -#endif // !Q_OS_WINRT } class MixingWithTimersHelper : public QObject @@ -238,9 +229,6 @@ void MixingWithTimersHelper::socketFired() void tst_QSocketNotifier::mixingWithTimers() { -#ifdef Q_OS_WINRT - QSKIP("WinRT does not allow connection to localhost", SkipAll); -#else QTimer timer; timer.setInterval(0); timer.start(); @@ -265,7 +253,6 @@ void tst_QSocketNotifier::mixingWithTimers() QCOMPARE(helper.timerActivated, true); QTRY_COMPARE(helper.socketActivated, true); -#endif // !Q_OS_WINRT } #ifdef Q_OS_UNIX @@ -354,9 +341,6 @@ void tst_QSocketNotifier::async_writeDatagramSlot() void tst_QSocketNotifier::asyncMultipleDatagram() { -#ifdef Q_OS_WINRT - QSKIP("WinRT does not allow connection to localhost", SkipAll); -#else m_asyncSender = new QUdpSocket; m_asyncReceiver = new QUdpSocket; @@ -386,7 +370,6 @@ void tst_QSocketNotifier::asyncMultipleDatagram() delete m_asyncSender; delete m_asyncReceiver; - #endif // !Q_OS_WINRT } void tst_QSocketNotifier::activationReason_data() diff --git a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp index 9fde7da816..a2fb035557 100644 --- a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp +++ b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp @@ -86,15 +86,15 @@ void tst_QTranslator::initTestCase() // chdir into the directory containing our testdata, // to make the code simpler (load testdata via relative paths) -#ifdef Q_OS_WINRT +#if 0 // ### TODO: Use this for all platforms in 5.7 dataDir = QEXTRACTTESTDATA(QStringLiteral("/")); QVERIFY2(!dataDir.isNull(), qPrintable("Could not extract test data")); QVERIFY2(QDir::setCurrent(dataDir->path()), qPrintable("Could not chdir to " + dataDir->path())); -#else // !Q_OS_WINRT +#else QString testdata_dir = QFileInfo(QFINDTESTDATA("hellotr_la.qm")).absolutePath(); QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir)); -#endif // !Q_OS_WINRT +#endif } diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin1/CMakeLists.txt b/tests/auto/corelib/plugin/qfactoryloader/plugin1/CMakeLists.txt index 940dcc2b09..fe5670da88 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/plugin1/CMakeLists.txt +++ b/tests/auto/corelib/plugin/qfactoryloader/plugin1/CMakeLists.txt @@ -22,12 +22,6 @@ add_cmake_library(plugin1 ## Scopes: ##################################################################### -#### Keys ignored in scope 6:.:..:../winrt.pri:(CMAKE_BUILD_TYPE STREQUAL Debug): -# DESTDIR = "../debug/bin" - -#### Keys ignored in scope 7:.:..:../winrt.pri:else: -# DESTDIR = "../release/bin" - extend_target(plugin1 CONDITION NOT QT_FEATURE_library DEFINES QT_STATICPLUGIN diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro index 44ef12db29..964e466228 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro +++ b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro @@ -5,7 +5,6 @@ HEADERS = plugin1.h SOURCES = plugin1.cpp TARGET = $$qtLibraryTarget(plugin1) DESTDIR = ../bin -winrt:include(../winrt.pri) !qtConfig(library): DEFINES += QT_STATICPLUGIN diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin2/CMakeLists.txt b/tests/auto/corelib/plugin/qfactoryloader/plugin2/CMakeLists.txt index 2df999c292..fe616f7cb2 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/plugin2/CMakeLists.txt +++ b/tests/auto/corelib/plugin/qfactoryloader/plugin2/CMakeLists.txt @@ -22,12 +22,6 @@ add_cmake_library(plugin2 ## Scopes: ##################################################################### -#### Keys ignored in scope 6:.:..:../winrt.pri:(CMAKE_BUILD_TYPE STREQUAL Debug): -# DESTDIR = "../debug/bin" - -#### Keys ignored in scope 7:.:..:../winrt.pri:else: -# DESTDIR = "../release/bin" - extend_target(plugin2 CONDITION NOT QT_FEATURE_library DEFINES QT_STATICPLUGIN diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro index 5689919108..cc888f1d10 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro +++ b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro @@ -5,7 +5,6 @@ HEADERS = plugin2.h SOURCES = plugin2.cpp TARGET = $$qtLibraryTarget(plugin2) DESTDIR = ../bin -winrt:include(../winrt.pri) !qtConfig(library): DEFINES += QT_STATICPLUGIN diff --git a/tests/auto/corelib/plugin/qfactoryloader/winrt.pri b/tests/auto/corelib/plugin/qfactoryloader/winrt.pri deleted file mode 100644 index 31602634b2..0000000000 --- a/tests/auto/corelib/plugin/qfactoryloader/winrt.pri +++ /dev/null @@ -1,9 +0,0 @@ -# We cannot use TESTDATA as plugins have to reside physically -# inside the package directory -winrt { - CONFIG(debug, debug|release) { - DESTDIR = ../debug/bin - } else { - DESTDIR = ../release/bin - } -} diff --git a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp index 50c4d9b467..0898817240 100644 --- a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp +++ b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp @@ -159,13 +159,11 @@ void tst_QLibrary::initTestCase() } directory = tempDir->path(); temporaryDir = std::move(tempDir); -#elif !defined(Q_OS_WINRT) +#else // chdir to our testdata directory, and use relative paths in some tests. QString testdatadir = QFileInfo(QFINDTESTDATA("library_path")).absolutePath(); QVERIFY2(QDir::setCurrent(testdatadir), qPrintable("Could not chdir to " + testdatadir)); directory = QCoreApplication::applicationDirPath(); -#elif defined(Q_OS_WINRT) - directory = QCoreApplication::applicationDirPath(); #endif } @@ -434,7 +432,7 @@ void tst_QLibrary::loadHints_data() QString appDir = directory; lh |= QLibrary::ResolveAllSymbolsHint; -# if defined(Q_OS_WIN32) || defined(Q_OS_WINRT) +# if defined(Q_OS_WIN32) 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; @@ -486,7 +484,7 @@ 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) +#if defined(Q_OS_WIN) QTest::newRow( "ok03" ) << "user32" << "USER32.dll"; #endif diff --git a/tests/auto/corelib/plugin/qpluginloader/lib/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/lib/.prev_CMakeLists.txt index 74945fc6d8..dddd7cb953 100644 --- a/tests/auto/corelib/plugin/qpluginloader/lib/.prev_CMakeLists.txt +++ b/tests/auto/corelib/plugin/qpluginloader/lib/.prev_CMakeLists.txt @@ -22,12 +22,6 @@ add_cmake_library(tst_qpluginloaderlib ## Scopes: ##################################################################### -#### Keys ignored in scope 6:.:..:../winrt.pri:(CMAKE_BUILD_TYPE STREQUAL Debug): -# DESTDIR = "../debug/bin" - -#### Keys ignored in scope 7:.:..:../winrt.pri:else: -# DESTDIR = "../release/bin" - extend_target(tst_qpluginloaderlib CONDITION MSVC DEFINES WIN32_MSVC diff --git a/tests/auto/corelib/plugin/qpluginloader/lib/CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/lib/CMakeLists.txt index 8d723cf3ce..aa980eabaa 100644 --- a/tests/auto/corelib/plugin/qpluginloader/lib/CMakeLists.txt +++ b/tests/auto/corelib/plugin/qpluginloader/lib/CMakeLists.txt @@ -22,12 +22,6 @@ add_cmake_library(tst_qpluginloaderlib ## Scopes: ##################################################################### -#### Keys ignored in scope 6:.:..:../winrt.pri:(CMAKE_BUILD_TYPE STREQUAL Debug): -# DESTDIR = "../debug/bin" - -#### Keys ignored in scope 7:.:..:../winrt.pri:else: -# DESTDIR = "../release/bin" - extend_target(tst_qpluginloaderlib CONDITION MSVC DEFINES WIN32_MSVC diff --git a/tests/auto/corelib/plugin/qpluginloader/lib/lib.pro b/tests/auto/corelib/plugin/qpluginloader/lib/lib.pro index 9fc76a4201..aa72a80559 100644 --- a/tests/auto/corelib/plugin/qpluginloader/lib/lib.pro +++ b/tests/auto/corelib/plugin/qpluginloader/lib/lib.pro @@ -4,7 +4,6 @@ CONFIG -= staticlib SOURCES = mylib.c TARGET = tst_qpluginloaderlib DESTDIR = ../bin -winrt:include(../winrt.pri) QT = core msvc: DEFINES += WIN32_MSVC diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/theplugin/CMakeLists.txt index 5389790fba..83f5f0605e 100644 --- a/tests/auto/corelib/plugin/qpluginloader/theplugin/CMakeLists.txt +++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/CMakeLists.txt @@ -19,13 +19,4 @@ add_cmake_library(theplugin # TEMPLATE = "lib" # target.path = "$$[QT_INSTALL_TESTS]/tst_qpluginloader/bin" -## Scopes: -##################################################################### - -#### Keys ignored in scope 5:.:..:../winrt.pri:(CMAKE_BUILD_TYPE STREQUAL Debug): -# DESTDIR = "../debug/bin" - -#### Keys ignored in scope 6:.:..:../winrt.pri:else: -# DESTDIR = "../release/bin" - qt_autogen_tools_initial_setup(theplugin) diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro index 6aa8161699..6ec4a8de05 100644 --- a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro +++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro @@ -6,7 +6,6 @@ SOURCES = theplugin.cpp #TARGET = $$qtLibraryTarget(theplugin) TARGET = theplugin DESTDIR = ../bin -winrt:include(../winrt.pri) QT = core # This is testdata for the tst_qpluginloader test. diff --git a/tests/auto/corelib/plugin/qpluginloader/winrt.pri b/tests/auto/corelib/plugin/qpluginloader/winrt.pri deleted file mode 100644 index 31602634b2..0000000000 --- a/tests/auto/corelib/plugin/qpluginloader/winrt.pri +++ /dev/null @@ -1,9 +0,0 @@ -# We cannot use TESTDATA as plugins have to reside physically -# inside the package directory -winrt { - CONFIG(debug, debug|release) { - DESTDIR = ../debug/bin - } else { - DESTDIR = ../release/bin - } -} diff --git a/tests/auto/corelib/serialization/qtextstream/BLACKLIST b/tests/auto/corelib/serialization/qtextstream/BLACKLIST index 674569e204..eb50b6f59c 100644 --- a/tests/auto/corelib/serialization/qtextstream/BLACKLIST +++ b/tests/auto/corelib/serialization/qtextstream/BLACKLIST @@ -1,3 +1,2 @@ [stillOpenWhenAtEnd] windows-7sp1 -winrt diff --git a/tests/auto/corelib/text/qlocale/CMakeLists.txt b/tests/auto/corelib/text/qlocale/CMakeLists.txt index 0f5a98ccce..363baa8d52 100644 --- a/tests/auto/corelib/text/qlocale/CMakeLists.txt +++ b/tests/auto/corelib/text/qlocale/CMakeLists.txt @@ -1,6 +1,4 @@ # Generated from qlocale.pro. add_subdirectory(test) -if(NOT WINRT) - add_subdirectory(syslocaleapp) -endif() +add_subdirectory(syslocaleapp) diff --git a/tests/auto/corelib/text/qlocale/qlocale.pro b/tests/auto/corelib/text/qlocale/qlocale.pro index 5161200260..abbe31d1ef 100644 --- a/tests/auto/corelib/text/qlocale/qlocale.pro +++ b/tests/auto/corelib/text/qlocale/qlocale.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -SUBDIRS += test -!winrt: SUBDIRS+=syslocaleapp +SUBDIRS += test \ + syslocaleapp diff --git a/tests/auto/corelib/text/qlocale/test/CMakeLists.txt b/tests/auto/corelib/text/qlocale/test/CMakeLists.txt index 19d454d530..399b22327e 100644 --- a/tests/auto/corelib/text/qlocale/test/CMakeLists.txt +++ b/tests/auto/corelib/text/qlocale/test/CMakeLists.txt @@ -25,5 +25,5 @@ qt_extend_target(tst_qlocale CONDITION NOT QT_FEATURE_doubleconversion AND NOT Q QT_NO_DOUBLECONVERSION ) -#### Keys ignored in scope 7:.:.:test.pro:NOT ANDROID AND NOT WINRT: +#### Keys ignored in scope 7:.:.:test.pro:NOT ANDROID: # TEST_HELPER_INSTALLS = "../syslocaleapp/syslocaleapp" diff --git a/tests/auto/corelib/text/qlocale/test/test.pro b/tests/auto/corelib/text/qlocale/test/test.pro index f7243e99a7..7f38528f5f 100644 --- a/tests/auto/corelib/text/qlocale/test/test.pro +++ b/tests/auto/corelib/text/qlocale/test/test.pro @@ -16,4 +16,4 @@ win32 { } } -!android:!winrt: TEST_HELPER_INSTALLS = ../syslocaleapp/syslocaleapp +!android: TEST_HELPER_INSTALLS = ../syslocaleapp/syslocaleapp diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp index b46f9aa567..4078805221 100644 --- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -70,7 +70,7 @@ public: private slots: void initTestCase(); void cleanupTestCase(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) void windowsDefaultLocale(); #endif #ifdef Q_OS_MAC @@ -2016,7 +2016,7 @@ void tst_QLocale::macDefaultLocale() } #endif // Q_OS_MAC -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) #include static QString getWinLocaleInfo(LCTYPE type) @@ -2126,7 +2126,7 @@ void tst_QLocale::windowsDefaultLocale() QCOMPARE(locale.toString(QDateTime(QDate(1974, 12, 1), QTime(1,2,3)), QLocale::LongFormat), QStringLiteral("1@12@1974 ") + expectedFormattedLongTime); } -#endif // Q_OS_WIN but !Q_OS_WINRT +#endif // Q_OS_WIN void tst_QLocale::numberOptions() { diff --git a/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp index 48f6628be1..ad973f73fc 100644 --- a/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp +++ b/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp @@ -2105,16 +2105,12 @@ void tst_QRegularExpression::threadSafety_data() QTest::addRow("pattern%d", ++i) << "ab.*cd" << subject; } - // pcre2 does not support JIT for winrt. As this test row takes a long time without JIT we skip - // it for winrt as it might time out in COIN. -#ifndef Q_OS_WINRT { QString subject = "ab"; subject.append(QString(512*1024, QLatin1Char('x'))); subject.append("c"); QTest::addRow("pattern%d", ++i) << "ab.*cd" << subject; } -#endif // Q_OS_WINRT { QString subject = "ab"; diff --git a/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp b/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp index 47bae585a1..0fe6a5294d 100644 --- a/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp +++ b/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp @@ -39,11 +39,7 @@ #endif #if defined(Q_OS_WIN) # include -# ifndef Q_OS_WINRT -# define sleep(X) Sleep(X) -# else -# define sleep(X) WaitForSingleObjectEx(GetCurrentThread(), X, FALSE); -# endif +# define sleep(X) Sleep(X) #endif //on solaris, threads that loop on the release bool variable diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index 7be2f48758..b5520ac9bb 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -471,8 +471,8 @@ void tst_QThread::start() void tst_QThread::terminate() { -#if defined(Q_OS_WINRT) || defined(Q_OS_ANDROID) - QSKIP("Thread termination is not supported on WinRT or Android."); +#if defined(Q_OS_ANDROID) + QSKIP("Thread termination is not supported on Android."); #endif Terminate_Thread thread; { @@ -537,8 +537,8 @@ void tst_QThread::finished() void tst_QThread::terminated() { -#if defined(Q_OS_WINRT) || defined(Q_OS_ANDROID) - QSKIP("Thread termination is not supported on WinRT or Android."); +#if defined(Q_OS_ANDROID) + QSKIP("Thread termination is not supported on Android."); #endif SignalRecorder recorder; Terminate_Thread thread; @@ -674,8 +674,6 @@ 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_WINRT) - nativeThreadHandle = CreateThread(NULL, 0 , (LPTHREAD_START_ROUTINE)NativeThreadWrapper::runWin , this, 0, NULL); #elif defined Q_OS_WIN unsigned thrdid = 0; nativeThreadHandle = (Qt::HANDLE) _beginthreadex(NULL, 0, NativeThreadWrapper::runWin, this, 0, &thrdid); diff --git a/tests/auto/corelib/thread/qthreadstorage/CMakeLists.txt b/tests/auto/corelib/thread/qthreadstorage/CMakeLists.txt index 52a928863c..11ebf34799 100644 --- a/tests/auto/corelib/thread/qthreadstorage/CMakeLists.txt +++ b/tests/auto/corelib/thread/qthreadstorage/CMakeLists.txt @@ -16,6 +16,6 @@ add_qt_test(tst_qthreadstorage ## Scopes: ##################################################################### -if(NOT ANDROID AND NOT WINRT) +if(NOT ANDROID) add_subdirectory(crashonexit) endif() diff --git a/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro b/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro index 432c564ba1..c3eae5f7e1 100644 --- a/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro +++ b/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro @@ -1,6 +1,6 @@ TEMPLATE = subdirs -!android:!winrt { +!android { test.depends = crashonexit SUBDIRS += crashonexit } diff --git a/tests/auto/corelib/thread/qthreadstorage/test/test.pro b/tests/auto/corelib/thread/qthreadstorage/test/test.pro index d2f21f48f0..e0725d038e 100644 --- a/tests/auto/corelib/thread/qthreadstorage/test/test.pro +++ b/tests/auto/corelib/thread/qthreadstorage/test/test.pro @@ -2,14 +2,14 @@ CONFIG += testcase debug_and_release { CONFIG(debug, debug|release) { TARGET = ../../debug/tst_qthreadstorage - !android:!winrt: TEST_HELPER_INSTALLS = ../../debug/crashonexit_helper + !android: TEST_HELPER_INSTALLS = ../../debug/crashonexit_helper } else { TARGET = ../../release/tst_qthreadstorage - !android:!winrt: TEST_HELPER_INSTALLS = ../../release/crashonexit_helper + !android: TEST_HELPER_INSTALLS = ../../release/crashonexit_helper } } else { TARGET = ../tst_qthreadstorage - !android:!winrt: TEST_HELPER_INSTALLS = ../crashonexit_helper + !android: TEST_HELPER_INSTALLS = ../crashonexit_helper } CONFIG += console QT = core testlib diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp index 3538d90803..737cb86c01 100644 --- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp +++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp @@ -180,13 +180,6 @@ void testAdoptedThreadStorageWin(void *p) } QObject::connect(QThread::currentThread(), SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); } -#ifdef Q_OS_WINRT -unsigned __stdcall testAdoptedThreadStorageWinRT(void *p) -{ - testAdoptedThreadStorageWin(p); - return 0; -} -#endif void *testAdoptedThreadStorageUnix(void *pointers) { testAdoptedThreadStorageWin(pointers); @@ -204,11 +197,6 @@ void tst_QThreadStorage::adoptedThreads() const int state = pthread_create(&thread, 0, testAdoptedThreadStorageUnix, &pointers); QCOMPARE(state, 0); pthread_join(thread, 0); -#elif defined Q_OS_WINRT - HANDLE thread; - thread = (HANDLE) _beginthreadex(NULL, 0, testAdoptedThreadStorageWinRT, &pointers, 0, 0); - QVERIFY(thread); - WaitForSingleObjectEx(thread, INFINITE, FALSE); #elif defined Q_OS_WIN HANDLE thread; thread = (HANDLE)_beginthread(testAdoptedThreadStorageWin, 0, &pointers); diff --git a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp index ac22d32503..7a653e16eb 100644 --- a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp @@ -3697,9 +3697,6 @@ void tst_QDateTime::timeZones() const void tst_QDateTime::systemTimeZoneChange() const { -#ifdef Q_OS_WINRT - QSKIP("UWP applications cannot change the system`s time zone (sandboxing)"); -#endif // Set the timezone to Brisbane time TimeZoneRollback useZone(QByteArray("AEST-10:00")); diff --git a/tests/auto/gui/.prev_CMakeLists.txt b/tests/auto/gui/.prev_CMakeLists.txt index e7317e932c..ad6bb07001 100644 --- a/tests/auto/gui/.prev_CMakeLists.txt +++ b/tests/auto/gui/.prev_CMakeLists.txt @@ -10,7 +10,7 @@ if(NOT UIKIT) add_subdirectory(itemmodels) add_subdirectory(rhi) endif() -if(QT_FEATURE_opengl AND NOT UIKIT AND NOT WINRT) +if(QT_FEATURE_opengl AND NOT UIKIT) add_subdirectory(qopenglconfig) add_subdirectory(qopengl) endif() diff --git a/tests/auto/gui/CMakeLists.txt b/tests/auto/gui/CMakeLists.txt index e9c9ffe9fe..ad6bb07001 100644 --- a/tests/auto/gui/CMakeLists.txt +++ b/tests/auto/gui/CMakeLists.txt @@ -10,9 +10,9 @@ if(NOT UIKIT) add_subdirectory(itemmodels) add_subdirectory(rhi) endif() -if(QT_FEATURE_opengl AND NOT UIKIT AND NOT WINRT) - add_subdirectory(qopenglconfig) - add_subdirectory(qopengl) +if(QT_FEATURE_opengl AND NOT UIKIT) + add_subdirectory(qopenglconfig) + add_subdirectory(qopengl) endif() if(QT_FEATURE_vulkan AND NOT UIKIT) add_subdirectory(qvulkan) diff --git a/tests/auto/gui/gui.pro b/tests/auto/gui/gui.pro index c90fc48251..30c404be57 100644 --- a/tests/auto/gui/gui.pro +++ b/tests/auto/gui/gui.pro @@ -15,6 +15,6 @@ SUBDIRS = \ itemmodels \ rhi -!qtConfig(opengl)|winrt: SUBDIRS -= qopengl qopenglconfig +!qtConfig(opengl): SUBDIRS -= qopengl qopenglconfig !qtConfig(vulkan): SUBDIRS -= qvulkan diff --git a/tests/auto/gui/image/qimage/CMakeLists.txt b/tests/auto/gui/image/qimage/CMakeLists.txt index 865f1124b9..f6125d0fe9 100644 --- a/tests/auto/gui/image/qimage/CMakeLists.txt +++ b/tests/auto/gui/image/qimage/CMakeLists.txt @@ -54,7 +54,7 @@ if(ANDROID AND NOT ANDROID_EMBEDDED) ) endif() -extend_target(tst_qimage CONDITION WIN32 AND NOT WINRT +extend_target(tst_qimage CONDITION WIN32 PUBLIC_LIBRARIES gdi32 user32 diff --git a/tests/auto/gui/image/qimage/qimage.pro b/tests/auto/gui/image/qimage/qimage.pro index 0593cfbc23..c8aa16732e 100644 --- a/tests/auto/gui/image/qimage/qimage.pro +++ b/tests/auto/gui/image/qimage/qimage.pro @@ -7,7 +7,7 @@ qtConfig(c++11): CONFIG += c++11 android:!android-embedded: RESOURCES += qimage.qrc -win32:!winrt: QMAKE_USE += user32 gdi32 +win32: QMAKE_USE += user32 gdi32 darwin: LIBS += -framework CoreGraphics TESTDATA += images/* diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 9455e2b6e8..38b3d28901 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -44,7 +44,7 @@ #include #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) # include #endif @@ -238,11 +238,11 @@ private slots: void wideImage(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) void toWinHBITMAP_data(); void toWinHBITMAP(); void fromMonoHBITMAP(); -#endif // Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN private: const QString m_prefix; @@ -3776,7 +3776,7 @@ void tst_QImage::wideImage() // Qt6: Test that it actually works on 64bit architectures. } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) QT_BEGIN_NAMESPACE Q_GUI_EXPORT HBITMAP qt_imageToWinHBITMAP(const QImage &p, int hbitmapFormat = 0); Q_GUI_EXPORT QImage qt_imageFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat = 0); @@ -3890,7 +3890,7 @@ void tst_QImage::fromMonoHBITMAP() // QTBUG-72343, corruption for mono bitmaps DeleteObject(hbitmap); } -#endif // Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN QTEST_GUILESS_MAIN(tst_QImage) #include "tst_qimage.moc" diff --git a/tests/auto/gui/image/qpixmap/CMakeLists.txt b/tests/auto/gui/image/qpixmap/CMakeLists.txt index f6a83aa0da..efdfb3b98e 100644 --- a/tests/auto/gui/image/qpixmap/CMakeLists.txt +++ b/tests/auto/gui/image/qpixmap/CMakeLists.txt @@ -100,7 +100,7 @@ extend_target(tst_qpixmap CONDITION TARGET Qt::Widgets Qt::WidgetsPrivate ) -extend_target(tst_qpixmap CONDITION WIN32 AND NOT WINRT +extend_target(tst_qpixmap CONDITION WIN32 PUBLIC_LIBRARIES gdi32 user32 diff --git a/tests/auto/gui/image/qpixmap/qpixmap.pro b/tests/auto/gui/image/qpixmap/qpixmap.pro index c9219dad1d..65294c6aeb 100644 --- a/tests/auto/gui/image/qpixmap/qpixmap.pro +++ b/tests/auto/gui/image/qpixmap/qpixmap.pro @@ -5,7 +5,7 @@ QT += core-private gui-private testlib qtHaveModule(widgets): QT += widgets widgets-private SOURCES += tst_qpixmap.cpp -win32:!winrt: QMAKE_USE += user32 gdi32 +win32: QMAKE_USE += user32 gdi32 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 1d77f70919..87d513bacb 100644 --- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp @@ -103,7 +103,7 @@ private slots: void convertFromImageDetach(); void convertFromImageCacheKey(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) void toWinHBITMAP_data(); void toWinHBITMAP(); void fromWinHBITMAP_data(); @@ -841,7 +841,7 @@ void tst_QPixmap::convertFromImageCacheKey() QCOMPARE(copy.cacheKey(), pix.cacheKey()); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) QT_BEGIN_NAMESPACE Q_GUI_EXPORT HBITMAP qt_createIconMask(const QBitmap &bitmap); @@ -1057,7 +1057,7 @@ void tst_QPixmap::fromWinHICON() QVERIFY(compareImages(imageFromHICON, imageFromFile)); } -#endif // Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN void tst_QPixmap::onlyNullPixmapsOutsideGuiThread() { diff --git a/tests/auto/gui/kernel/CMakeLists.txt b/tests/auto/gui/kernel/CMakeLists.txt index 1cb38a7c9e..10cfe0e628 100644 --- a/tests/auto/gui/kernel/CMakeLists.txt +++ b/tests/auto/gui/kernel/CMakeLists.txt @@ -44,6 +44,6 @@ endif() if(QT_FEATURE_opengl) add_subdirectory(qopenglwindow) endif() -if(TARGET Qt::Network AND WIN32 AND NOT WINRT) +if(TARGET Qt::Network AND WIN32) add_subdirectory(noqteventloop) endif() diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro index 85bebbddc9..cc57a0cd92 100644 --- a/tests/auto/gui/kernel/kernel.pro +++ b/tests/auto/gui/kernel/kernel.pro @@ -31,7 +31,7 @@ SUBDIRS=\ qrasterwindow \ qaddpostroutine -win32:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop +win32:qtHaveModule(network): SUBDIRS += noqteventloop !qtConfig(shortcut): SUBDIRS -= \ qkeysequence \ diff --git a/tests/auto/gui/kernel/noqteventloop/CMakeLists.txt b/tests/auto/gui/kernel/noqteventloop/CMakeLists.txt index 82de116f8d..4a6ea22d13 100644 --- a/tests/auto/gui/kernel/noqteventloop/CMakeLists.txt +++ b/tests/auto/gui/kernel/noqteventloop/CMakeLists.txt @@ -17,7 +17,7 @@ add_qt_test(tst_noqteventloop ## Scopes: ##################################################################### -extend_target(tst_noqteventloop CONDITION QT_FEATURE_dynamicgl AND WIN32 AND NOT WINRT +extend_target(tst_noqteventloop CONDITION QT_FEATURE_dynamicgl AND WIN32 PUBLIC_LIBRARIES user32 ) diff --git a/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro b/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro index 293a6a8581..7394c6b6ac 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 -qtConfig(dynamicgl):win32:!winrt: QMAKE_USE += user32 +qtConfig(dynamicgl):win32: QMAKE_USE += user32 diff --git a/tests/auto/gui/kernel/qclipboard/CMakeLists.txt b/tests/auto/gui/kernel/qclipboard/CMakeLists.txt index b795d32520..05eba972d6 100644 --- a/tests/auto/gui/kernel/qclipboard/CMakeLists.txt +++ b/tests/auto/gui/kernel/qclipboard/CMakeLists.txt @@ -1,7 +1,5 @@ # Generated from qclipboard.pro. +add_subdirectory(copier) +add_subdirectory(paster) add_subdirectory(test) -if(NOT WINRT) - add_subdirectory(copier) - add_subdirectory(paster) -endif() diff --git a/tests/auto/gui/kernel/qclipboard/qclipboard.pro b/tests/auto/gui/kernel/qclipboard/qclipboard.pro index b9fd2080e7..d97c58dea0 100644 --- a/tests/auto/gui/kernel/qclipboard/qclipboard.pro +++ b/tests/auto/gui/kernel/qclipboard/qclipboard.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -!winrt: SUBDIRS = copier paster +SUBDIRS = copier paster test.depends += $$SUBDIRS SUBDIRS += test diff --git a/tests/auto/gui/kernel/qclipboard/test/.prev_CMakeLists.txt b/tests/auto/gui/kernel/qclipboard/test/.prev_CMakeLists.txt index 36d9f7b00c..e7c1313c7b 100644 --- a/tests/auto/gui/kernel/qclipboard/test/.prev_CMakeLists.txt +++ b/tests/auto/gui/kernel/qclipboard/test/.prev_CMakeLists.txt @@ -20,5 +20,5 @@ extend_target(tst_qclipboard CONDITION MACOS ${FWAppKit} ) -#### Keys ignored in scope 6:.:.:test.pro:NOT ANDROID AND NOT WINRT: +#### Keys ignored in scope 6:.:.:test.pro:NOT ANDROID: # TEST_HELPER_INSTALLS = "../copier/copier" "../paster/paster" diff --git a/tests/auto/gui/kernel/qclipboard/test/CMakeLists.txt b/tests/auto/gui/kernel/qclipboard/test/CMakeLists.txt index 36d9f7b00c..e7c1313c7b 100644 --- a/tests/auto/gui/kernel/qclipboard/test/CMakeLists.txt +++ b/tests/auto/gui/kernel/qclipboard/test/CMakeLists.txt @@ -20,5 +20,5 @@ extend_target(tst_qclipboard CONDITION MACOS ${FWAppKit} ) -#### Keys ignored in scope 6:.:.:test.pro:NOT ANDROID AND NOT WINRT: +#### Keys ignored in scope 6:.:.:test.pro:NOT ANDROID: # TEST_HELPER_INSTALLS = "../copier/copier" "../paster/paster" diff --git a/tests/auto/gui/kernel/qclipboard/test/test.pro b/tests/auto/gui/kernel/qclipboard/test/test.pro index 84e80d62e6..3a4ed3a7bc 100644 --- a/tests/auto/gui/kernel/qclipboard/test/test.pro +++ b/tests/auto/gui/kernel/qclipboard/test/test.pro @@ -13,6 +13,6 @@ win32 { } } -!android:!winrt: TEST_HELPER_INSTALLS = \ +!android: TEST_HELPER_INSTALLS = \ ../copier/copier \ ../paster/paster diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index 3dbff8f435..d3cfeb204a 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -374,9 +374,6 @@ public: void tst_QGuiApplication::changeFocusWindow() { -#ifdef Q_OS_WINRT - QSKIP("WinRt does not support multiple native windows."); -#endif int argc = 0; QGuiApplication app(argc, nullptr); @@ -635,9 +632,6 @@ public: void tst_QGuiApplication::modalWindow() { -#ifdef Q_OS_WINRT - QSKIP("WinRt does not support multiple native windows."); -#endif int argc = 0; QGuiApplication app(argc, nullptr); const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry(); diff --git a/tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST b/tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST deleted file mode 100644 index d2c51922a8..0000000000 --- a/tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST +++ /dev/null @@ -1,3 +0,0 @@ -[registerTimer] -winrt - diff --git a/tests/auto/gui/kernel/qguieventloop/.prev_CMakeLists.txt b/tests/auto/gui/kernel/qguieventloop/.prev_CMakeLists.txt index c4daa5a310..7fb82219a9 100644 --- a/tests/auto/gui/kernel/qguieventloop/.prev_CMakeLists.txt +++ b/tests/auto/gui/kernel/qguieventloop/.prev_CMakeLists.txt @@ -17,7 +17,7 @@ add_qt_test(tst_qguieventloop ## Scopes: ##################################################################### -extend_target(tst_qguieventloop CONDITION WIN32 AND NOT WINRT +extend_target(tst_qguieventloop CONDITION WIN32 PUBLIC_LIBRARIES user32 ) diff --git a/tests/auto/gui/kernel/qguieventloop/CMakeLists.txt b/tests/auto/gui/kernel/qguieventloop/CMakeLists.txt index de9a876e9d..3fd943c83c 100644 --- a/tests/auto/gui/kernel/qguieventloop/CMakeLists.txt +++ b/tests/auto/gui/kernel/qguieventloop/CMakeLists.txt @@ -16,7 +16,7 @@ add_qt_test(tst_qguieventloop ## Scopes: ##################################################################### -extend_target(tst_qguieventloop CONDITION WIN32 AND NOT WINRT +extend_target(tst_qguieventloop CONDITION WIN32 PUBLIC_LIBRARIES user32 ) diff --git a/tests/auto/gui/kernel/qopenglwindow/BLACKLIST b/tests/auto/gui/kernel/qopenglwindow/BLACKLIST deleted file mode 100644 index 3ce78abee8..0000000000 --- a/tests/auto/gui/kernel/qopenglwindow/BLACKLIST +++ /dev/null @@ -1,6 +0,0 @@ -[basic] -winrt -[resize] -winrt -[painter] -winrt diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST index 44a55316ab..17fe1f62a6 100644 --- a/tests/auto/gui/kernel/qwindow/BLACKLIST +++ b/tests/auto/gui/kernel/qwindow/BLACKLIST @@ -3,7 +3,6 @@ opensuse-leap [positioning:default] linux macos ci -winrt [positioning:fake] macos ci [modalWithChildWindow] diff --git a/tests/auto/gui/kernel/qwindow/CMakeLists.txt b/tests/auto/gui/kernel/qwindow/CMakeLists.txt index cfd17219bd..60603a219b 100644 --- a/tests/auto/gui/kernel/qwindow/CMakeLists.txt +++ b/tests/auto/gui/kernel/qwindow/CMakeLists.txt @@ -16,7 +16,7 @@ add_qt_test(tst_qwindow ## Scopes: ##################################################################### -extend_target(tst_qwindow CONDITION QT_FEATURE_dynamicgl AND WIN32 AND NOT WINRT +extend_target(tst_qwindow CONDITION QT_FEATURE_dynamicgl AND WIN32 PUBLIC_LIBRARIES user32 ) diff --git a/tests/auto/gui/kernel/qwindow/qwindow.pro b/tests/auto/gui/kernel/qwindow/qwindow.pro index e7931ca773..f97d4ef789 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 -qtConfig(dynamicgl):win32:!winrt: QMAKE_USE += user32 +qtConfig(dynamicgl):win32: QMAKE_USE += user32 diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 1db7e9a9c7..5843516d85 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -41,16 +41,10 @@ #if defined(Q_OS_QNX) #include -#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#elif defined(Q_OS_WIN) # include #endif -static bool isPlatformWinRT() -{ - static const bool isWinRT = !QGuiApplication::platformName().compare(QLatin1String("winrt"), Qt::CaseInsensitive); - return isWinRT; -} - class tst_QWindow: public QObject { Q_OBJECT @@ -239,8 +233,6 @@ void tst_QWindow::setVisible() QVERIFY(h.handle()); i.setParent(&h); QVERIFY2(i.handle(), "Making a visible but not created child window child of a created window should create it"); - if (isPlatformWinRT()) - QEXPECT_FAIL("", "Child windows are unsupported on winrt", Continue); QVERIFY(QTest::qWaitForWindowExposed(&i)); } @@ -407,15 +399,11 @@ void tst_QWindow::resizeEventAfterResize() // Make sure we get a resizeEvent after calling resize window.resize(m_testWindowSize); - if (isPlatformWinRT()) - QEXPECT_FAIL("", "Winrt windows are fullscreen by default.", Continue); QTRY_COMPARE(window.received(QEvent::Resize), 2); } void tst_QWindow::exposeEventOnShrink_QTBUG54040() { - if (isPlatformWinRT()) - QSKIP("", "WinRT does not support non-maximized/non-fullscreen top level windows. QTBUG-54528", Continue); Window window; window.setGeometry(QRect(m_availableTopLeft + QPoint(80, 80), m_testWindowSize)); window.setTitle(QTest::currentTestFunction()); @@ -603,8 +591,6 @@ void tst_QWindow::childWindowPositioning() { if (isPlatformWayland()) QSKIP("Wayland: This is flaky (protocol errors for xdg-shell v6). See QTBUG-67648."); - else if (isPlatformWinRT()) - QSKIP("WinRT does not support child windows."); const QPoint topLeftOrigin(0, 0); @@ -796,8 +782,6 @@ void tst_QWindow::isExposed() QCoreApplication::processEvents(); QTRY_VERIFY(window.received(QEvent::Expose) > 1); - if (isPlatformWinRT()) - QEXPECT_FAIL("", "WinRT does not destroy the window. Figure out why. QTBUG-68297", Continue); QTRY_VERIFY(!window.isExposed()); } @@ -832,8 +816,6 @@ void tst_QWindow::isActive() child.setGeometry(10, 10, 20, 20); child.show(); - if (isPlatformWinRT()) - QEXPECT_FAIL("", "WinRT does not support native child windows.", Abort); QTRY_VERIFY(child.isExposed()); child.requestActivate(); @@ -1894,8 +1876,6 @@ void tst_QWindow::initialSize() w.setTitle(QLatin1String(QTest::currentTestFunction())); w.setWidth(m_testWindowSize.width()); w.showNormal(); - if (isPlatformWinRT()) - QEXPECT_FAIL("", "WinRT shows windows as fullscreen by default.", Continue); QTRY_COMPARE(w.width(), m_testWindowSize.width()); QTRY_VERIFY(w.height() > 0); } @@ -1907,8 +1887,6 @@ void tst_QWindow::initialSize() w.showNormal(); const QSize expectedSize = testSize; - if (isPlatformWinRT()) - QEXPECT_FAIL("", "WinRT shows windows as fullscreen by default.", Continue); QTRY_COMPARE(w.size(), expectedSize); } } @@ -1953,8 +1931,6 @@ void tst_QWindow::modalDialog() return; } - if (isPlatformWinRT()) - QEXPECT_FAIL("", "WinRT only support one native window.", Continue); QTRY_COMPARE(QGuiApplication::focusWindow(), &dialog); } @@ -2001,8 +1977,6 @@ void tst_QWindow::modalDialogClosingOneOfTwoModal() return; } - if (isPlatformWinRT()) - QEXPECT_FAIL("", "WinRT only support one native window.", Continue); QTRY_COMPARE(QGuiApplication::focusWindow(), &first_dialog); } @@ -2031,8 +2005,6 @@ void tst_QWindow::modalWithChildWindow() tlw_dialog.show(); QVERIFY(QTest::qWaitForWindowExposed(&tlw_dialog)); - if (isPlatformWinRT()) - QEXPECT_FAIL("", "WinRT only support one native window.", Abort); QVERIFY(QTest::qWaitForWindowExposed(&sub_window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &tlw_dialog); @@ -2087,8 +2059,6 @@ void tst_QWindow::modalWindowPosition() window.setModality(Qt::WindowModal); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - if (isPlatformWinRT()) - QEXPECT_FAIL("", "WinRT windows are fullscreen by default.", Continue); QCOMPARE(window.geometry(), origGeo); } @@ -2149,9 +2119,6 @@ void tst_QWindow::modalWindowEnterEventOnHide_QTBUG35109() root.resetCounters(); modal.close(); - if (isPlatformWinRT()) - QEXPECT_FAIL("", "WinRT does not trigger the enter event correctly" - "- QTBUG-68297.", Abort); // Check for the enter event QTRY_COMPARE(root.enterEventCount, 1); } @@ -2282,8 +2249,6 @@ void tst_QWindow::spuriousMouseMove() const QString &platformName = QGuiApplication::platformName(); if (platformName == QLatin1String("offscreen") || platformName == QLatin1String("cocoa")) QSKIP("No enter events sent"); - if (isPlatformWayland() || isPlatformWinRT()) - QSKIP("QCursor::setPos() is not supported on this platform"); const QRect screenGeometry = QGuiApplication::primaryScreen()->geometry(); const QPoint center = screenGeometry.center(); QCursor::setPos(center); @@ -2321,7 +2286,7 @@ void tst_QWindow::spuriousMouseMove() static bool isNativeWindowVisible(const QWindow *window) { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) return IsWindowVisible(reinterpret_cast(window->winId())); #else Q_UNIMPLEMENTED(); diff --git a/tests/auto/gui/rhi/qrhi/data/buildshaders.bat b/tests/auto/gui/rhi/qrhi/data/buildshaders.bat index 0cfeaaaff3..f4ebae070b 100644 --- a/tests/auto/gui/rhi/qrhi/data/buildshaders.bat +++ b/tests/auto/gui/rhi/qrhi/data/buildshaders.bat @@ -37,9 +37,6 @@ :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: Note the -c argument: we do not want runtime HLSL compilation since that is -:: not an option on UWP (WinRT). This means that running qsb must happen on Windows. - qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o simple.vert.qsb simple.vert qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o simple.frag.qsb simple.frag qsb --glsl "150,120,100 es" --hlsl 50 -c --msl 12 -o simpletextured.vert.qsb simpletextured.vert diff --git a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp index f1e11c4b23..553a6ae7a9 100644 --- a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp +++ b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp @@ -2116,11 +2116,6 @@ void tst_QRhi::renderToWindowSimple() QFETCH(QRhi::Implementation, impl); QFETCH(QRhiInitParams *, initParams); -#ifdef Q_OS_WINRT - if (impl == QRhi::D3D11) - QSKIP("Skipping window-based QRhi rendering on WinRT as the platform and the D3D11 backend are not prepared for this yet"); -#endif - QScopedPointer rhi(QRhi::create(impl, initParams, QRhi::Flags(), nullptr)); if (!rhi) QSKIP("QRhi could not be created, skipping testing rendering"); @@ -2256,11 +2251,6 @@ void tst_QRhi::finishWithinSwapchainFrame() QFETCH(QRhi::Implementation, impl); QFETCH(QRhiInitParams *, initParams); -#ifdef Q_OS_WINRT - if (impl == QRhi::D3D11) - QSKIP("Skipping window-based QRhi rendering on WinRT as the platform and the D3D11 backend are not prepared for this yet"); -#endif - QScopedPointer rhi(QRhi::create(impl, initParams, QRhi::Flags(), nullptr)); if (!rhi) QSKIP("QRhi could not be created, skipping testing rendering"); diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp index 7764a716ca..1e2bb72ddd 100644 --- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp @@ -87,7 +87,7 @@ void tst_QCssParser::scanner_data() QTest::addColumn("input"); QTest::addColumn("output"); -#if defined(Q_OS_ANDROID) || defined(Q_OS_WINRT) +#if defined(Q_OS_ANDROID) QDir d(":/"); #else QDir d(SRCDIR); diff --git a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp index 1429e4cb7f..344fa2c981 100644 --- a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp +++ b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp @@ -727,9 +727,6 @@ void tst_QGlyphRun::mixedScripts() layout.endLayout(); QList glyphRuns = layout.glyphRuns(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Hangul character not rendered on winrt", Continue); -#endif QCOMPARE(glyphRuns.size(), 2); } diff --git a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp index 2f5936cf74..8a12057527 100644 --- a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp +++ b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp @@ -1709,9 +1709,6 @@ void tst_QTextDocumentFragment::html_bodyBackground() const char html[] = "Foo"; doc->setHtml(html); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on winrt. Investigate - QTBUG-68297", Continue); -#endif QCOMPARE(doc->rootFrame()->frameFormat().background().style(), Qt::TexturePattern); } @@ -1726,9 +1723,6 @@ void tst_QTextDocumentFragment::html_tableCellBackground() QVERIFY(table); QTextTableCell cell = table->cellAt(0, 0); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on winrt. Investigate - QTBUG-68297", Continue); -#endif QCOMPARE(cell.format().background().style(), Qt::TexturePattern); } @@ -1737,9 +1731,6 @@ void tst_QTextDocumentFragment::css_bodyBackground() const char html[] = "Foo"; doc->setHtml(html); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on winrt. Investigate - QTBUG-68297", Continue); -#endif QCOMPARE(doc->rootFrame()->frameFormat().background().style(), Qt::TexturePattern); } @@ -1754,9 +1745,6 @@ void tst_QTextDocumentFragment::css_tableCellBackground() QVERIFY(table); QTextTableCell cell = table->cellAt(0, 0); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on winrt. Investigate - QTBUG-68297", Continue); -#endif QCOMPARE(cell.format().background().style(), Qt::TexturePattern); } diff --git a/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp b/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp index 4ed02ca658..d1495a2067 100644 --- a/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp +++ b/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp @@ -302,10 +302,6 @@ void tst_QTextDocumentLayout::imageAtRightAlignedTab() cursor.insertImage(imgFormat); // Everything should fit into the 300 pixels -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on winrt. Figure out why - QTBUG-68297", Continue); -#endif - qreal bearing = QFontMetricsF(doc->defaultFont()).rightBearing(QLatin1Char('t')); QCOMPARE(doc->idealWidth(), std::max(300.0, 300.0 - bearing)); } diff --git a/tests/auto/gui/text/qtextmarkdownwriter/BLACKLIST b/tests/auto/gui/text/qtextmarkdownwriter/BLACKLIST index a35e0f303e..c266b4037a 100644 --- a/tests/auto/gui/text/qtextmarkdownwriter/BLACKLIST +++ b/tests/auto/gui/text/qtextmarkdownwriter/BLACKLIST @@ -1,3 +1,2 @@ [rewriteDocument] -winrt ci b2qt diff --git a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp index 7c864a078c..ba4a035767 100644 --- a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp +++ b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp @@ -44,7 +44,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_WINRT) +#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/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST index a2c6224ce0..915c30bfb3 100644 --- a/tests/auto/network/access/qnetworkreply/BLACKLIST +++ b/tests/auto/network/access/qnetworkreply/BLACKLIST @@ -14,7 +14,7 @@ osx linux # QTBUG-71953 [getFromHttp] -* !android !winrt +* !android [getFromHttpIntoBuffer] osx [getFromHttpIntoBuffer2] diff --git a/tests/auto/network/access/qnetworkreply/CMakeLists.txt b/tests/auto/network/access/qnetworkreply/CMakeLists.txt index f7efa8f7f3..3b138b3918 100644 --- a/tests/auto/network/access/qnetworkreply/CMakeLists.txt +++ b/tests/auto/network/access/qnetworkreply/CMakeLists.txt @@ -1,7 +1,4 @@ # Generated from qnetworkreply.pro. +add_subdirectory(echo) add_subdirectory(test) - -if(NOT WINRT) - add_subdirectory(echo) -endif() diff --git a/tests/auto/network/access/qnetworkreply/qnetworkreply.pro b/tests/auto/network/access/qnetworkreply/qnetworkreply.pro index d3a92436ac..ec6f35a8b1 100644 --- a/tests/auto/network/access/qnetworkreply/qnetworkreply.pro +++ b/tests/auto/network/access/qnetworkreply/qnetworkreply.pro @@ -1,5 +1,5 @@ TEMPLATE = subdirs -!winrt:SUBDIRS += echo +SUBDIRS += echo test.depends += $$SUBDIRS SUBDIRS += test diff --git a/tests/auto/network/access/qnetworkreply/test/.prev_CMakeLists.txt b/tests/auto/network/access/qnetworkreply/test/.prev_CMakeLists.txt index 48759572de..9350c9afbf 100644 --- a/tests/auto/network/access/qnetworkreply/test/.prev_CMakeLists.txt +++ b/tests/auto/network/access/qnetworkreply/test/.prev_CMakeLists.txt @@ -55,5 +55,5 @@ add_qt_resource(tst_qnetworkreply "qnetworkreply" ## Scopes: ##################################################################### -#### Keys ignored in scope 2:.:.:test.pro:NOT ANDROID AND NOT WINRT: +#### Keys ignored in scope 2:.:.:test.pro:NOT ANDROID: # TEST_HELPER_INSTALLS = "../echo/echo" diff --git a/tests/auto/network/access/qnetworkreply/test/CMakeLists.txt b/tests/auto/network/access/qnetworkreply/test/CMakeLists.txt index ef017edf58..50572444a1 100644 --- a/tests/auto/network/access/qnetworkreply/test/CMakeLists.txt +++ b/tests/auto/network/access/qnetworkreply/test/CMakeLists.txt @@ -56,5 +56,5 @@ add_qt_resource(tst_qnetworkreply "qnetworkreply" ## Scopes: ##################################################################### -#### Keys ignored in scope 2:.:.:test.pro:NOT ANDROID AND NOT WINRT: +#### Keys ignored in scope 2:.:.:test.pro:NOT ANDROID: # TEST_HELPER_INSTALLS = "../echo/echo" diff --git a/tests/auto/network/access/qnetworkreply/test/test.pro b/tests/auto/network/access/qnetworkreply/test/test.pro index d3385c1929..bf09a99d27 100644 --- a/tests/auto/network/access/qnetworkreply/test/test.pro +++ b/tests/auto/network/access/qnetworkreply/test/test.pro @@ -13,7 +13,7 @@ RESOURCES += ../qnetworkreply.qrc TESTDATA += ../empty ../rfc3252.txt ../resource ../bigfile ../*.jpg ../certs \ ../index.html ../smb-file.txt -!android:!winrt: TEST_HELPER_INSTALLS = ../echo/echo +!android: TEST_HELPER_INSTALLS = ../echo/echo CONFIG += unsupported/testserver QT_TEST_SERVER_LIST = vsftpd apache2 ftp-proxy danted squid diff --git a/tests/auto/network/kernel/CMakeLists.txt b/tests/auto/network/kernel/CMakeLists.txt index 6ce3fcdf32..0b25020694 100644 --- a/tests/auto/network/kernel/CMakeLists.txt +++ b/tests/auto/network/kernel/CMakeLists.txt @@ -5,11 +5,6 @@ add_subdirectory(qnetworkdatagram) add_subdirectory(qnetworkaddressentry) add_subdirectory(qhostaddress) -if(NOT WINRT) - add_subdirectory(qnetworkproxy) - add_subdirectory(qnetworkproxyfactory) -endif() - if(QT_FEATURE_private_tests) add_subdirectory(qauthenticator) diff --git a/tests/auto/network/kernel/kernel.pro b/tests/auto/network/kernel/kernel.pro index 42df80dfa1..c13378cc02 100644 --- a/tests/auto/network/kernel/kernel.pro +++ b/tests/auto/network/kernel/kernel.pro @@ -11,10 +11,6 @@ SUBDIRS=\ qnetworkaddressentry \ qhostaddress \ -winrt: SUBDIRS -= \ - qnetworkproxy \ - qnetworkproxyfactory \ - osx: SUBDIRS -= \ # QTBUG-41847 qhostinfo \ diff --git a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp index 48f05a4604..ad8c4a8d1c 100644 --- a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp +++ b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp @@ -38,9 +38,6 @@ #include #ifdef Q_OS_WIN # include -# if defined(Q_OS_WINRT) -# include -# endif #endif #ifdef Q_OS_ANDROID @@ -384,15 +381,12 @@ void tst_QHostAddress::assignment() QCOMPARE(address, QHostAddress("::1")); #endif - // WinRT does not support sockaddr_in -#ifndef Q_OS_WINRT QHostAddress addr("4.2.2.1"); sockaddr_in sockAddr; sockAddr.sin_family = AF_INET; sockAddr.sin_addr.s_addr = htonl(addr.toIPv4Address()); address.setAddress((sockaddr *)&sockAddr); QCOMPARE(address, addr); -#endif // !Q_OS_WINRT } QT_WARNING_POP diff --git a/tests/auto/network/kernel/qhostinfo/CMakeLists.txt b/tests/auto/network/kernel/qhostinfo/CMakeLists.txt index 19eae0611d..891312ae5e 100644 --- a/tests/auto/network/kernel/qhostinfo/CMakeLists.txt +++ b/tests/auto/network/kernel/qhostinfo/CMakeLists.txt @@ -26,6 +26,3 @@ extend_target(tst_qhostinfo CONDITION WIN32 PUBLIC_LIBRARIES ws2_32 ) - -#### Keys ignored in scope 3:.:.:qhostinfo.pro:WINRT: -# WINRT_MANIFEST.capabilities = "internetClientServer" diff --git a/tests/auto/network/kernel/qhostinfo/qhostinfo.pro b/tests/auto/network/kernel/qhostinfo/qhostinfo.pro index d358cdf52c..e084f28229 100644 --- a/tests/auto/network/kernel/qhostinfo/qhostinfo.pro +++ b/tests/auto/network/kernel/qhostinfo/qhostinfo.pro @@ -7,5 +7,3 @@ requires(qtConfig(private_tests)) QT = core-private network-private testlib win32: QMAKE_USE += ws2_32 - -winrt: WINRT_MANIFEST.capabilities += internetClientServer diff --git a/tests/auto/network/socket/.prev_CMakeLists.txt b/tests/auto/network/socket/.prev_CMakeLists.txt new file mode 100644 index 0000000000..7e72b4be29 --- /dev/null +++ b/tests/auto/network/socket/.prev_CMakeLists.txt @@ -0,0 +1,15 @@ +# Generated from socket.pro. + +if(QT_FEATURE_private_tests) + add_subdirectory(qhttpsocketengine) + add_subdirectory(qtcpsocket) + add_subdirectory(qsocks5socketengine) + add_subdirectory(platformsocketengine) +endif() +add_subdirectory(qudpsocket) +add_subdirectory(qlocalsocket) +add_subdirectory(qtcpserver) +add_subdirectory(qabstractsocket) +if(QT_FEATURE_sctp) + add_subdirectory(qsctpsocket) +endif() diff --git a/tests/auto/network/socket/CMakeLists.txt b/tests/auto/network/socket/CMakeLists.txt index 5019e47140..a4b19ac1d6 100644 --- a/tests/auto/network/socket/CMakeLists.txt +++ b/tests/auto/network/socket/CMakeLists.txt @@ -1,20 +1,15 @@ # Generated from socket.pro. +if(QT_FEATURE_private_tests) + add_subdirectory(qhttpsocketengine) + add_subdirectory(qtcpsocket) + add_subdirectory(qsocks5socketengine) + add_subdirectory(platformsocketengine) +endif() add_subdirectory(qudpsocket) -### add_subdirectory(qlocalsocket) +### add_subdirectory(qlocalsocket) # special case add_subdirectory(qtcpserver) add_subdirectory(qabstractsocket) - -if(QT_FEATURE_private_tests) - add_subdirectory(platformsocketengine) - add_subdirectory(qtcpsocket) - - if(NOT WINRT) - add_subdirectory(qhttpsocketengine) - add_subdirectory(qsocks5socketengine) - endif() -endif() - if(QT_FEATURE_sctp) add_subdirectory(qsctpsocket) endif() diff --git a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp index 68c913ecfc..88a39eea93 100644 --- a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp +++ b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp @@ -48,11 +48,7 @@ #define PLATFORMSOCKETENGINE QNativeSocketEngine #define PLATFORMSOCKETENGINESTRING "QNativeSocketEngine" -#ifndef Q_OS_WINRT -# include -#else -# include -#endif +#include #include @@ -79,9 +75,7 @@ private slots: void networkError(); void setSocketDescriptor(); void invalidSend(); -#ifndef Q_OS_WINRT void receiveUrgentData(); -#endif void tooManySockets(); }; @@ -582,9 +576,7 @@ void tst_PlatformSocketEngine::networkError() QCOMPARE(client.state(), QAbstractSocket::ConnectedState); // An unexpected network error! -#ifdef Q_OS_WINRT - client.close(); -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) // could use shutdown to produce different errors ::closesocket(client.socketDescriptor()); #else @@ -617,7 +609,6 @@ void tst_PlatformSocketEngine::invalidSend() } //--------------------------------------------------------------------------- -#ifndef Q_OS_WINRT void tst_PlatformSocketEngine::receiveUrgentData() { PLATFORMSOCKETENGINE server; @@ -680,7 +671,6 @@ void tst_PlatformSocketEngine::receiveUrgentData() QCOMPARE(response.at(0), msg); #endif } -#endif // !Q_OS_WINRT QTEST_MAIN(tst_PlatformSocketEngine) #include "tst_platformsocketengine.moc" diff --git a/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp b/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp index 5c66ef6520..7cb65cd1a3 100644 --- a/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp +++ b/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp @@ -29,14 +29,14 @@ #include #include -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && defined(Q_CC_MSVC) +#if defined(Q_OS_WIN) && defined(Q_CC_MSVC) # include #endif int main(int argc, char *argv[]) { // Windows: Suppress crash notification dialog. -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && defined(Q_CC_MSVC) +#if defined(Q_OS_WIN) && defined(Q_CC_MSVC) _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG); #endif QCoreApplication app(argc, argv); diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index 094e28149c..927dc5cf9a 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -88,9 +88,7 @@ private slots: void maxPendingConnections(); void listenError(); void waitForConnectionTest(); -#ifndef Q_OS_WINRT void setSocketDescriptor(); -#endif void listenWhileListening(); void addressReusable(); void setNewSocketDescriptorBlocking(); @@ -527,7 +525,6 @@ void tst_QTcpServer::waitForConnectionTest() } //---------------------------------------------------------------------------------- -#ifndef Q_OS_WINRT void tst_QTcpServer::setSocketDescriptor() { QTcpServer server; @@ -557,7 +554,6 @@ void tst_QTcpServer::setSocketDescriptor() WSACleanup(); #endif } -#endif // !Q_OS_WINRT //---------------------------------------------------------------------------------- void tst_QTcpServer::listenWhileListening() @@ -579,7 +575,6 @@ public: bool ok; protected: -#ifndef Q_OS_WINRT void incomingConnection(qintptr socketDescriptor) { // how a user woulddo it (qabstractsocketengine is not public) @@ -592,7 +587,6 @@ protected: ::close(socketDescriptor); #endif } -#endif // !Q_OS_WINRT }; void tst_QTcpServer::addressReusable() diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index 88d2c46f3d..3c4728afec 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -126,9 +126,7 @@ private slots: void bindThenResolveHost_data(); void bindThenResolveHost(); void setInvalidSocketDescriptor(); -#ifndef Q_OS_WINRT void setSocketDescriptor(); -#endif void socketDescriptor(); void blockingIMAP(); void nonBlockingIMAP(); @@ -738,7 +736,6 @@ void tst_QTcpSocket::setInvalidSocketDescriptor() //---------------------------------------------------------------------------------- -#ifndef Q_OS_WINRT void tst_QTcpSocket::setSocketDescriptor() { QFETCH_GLOBAL(bool, setProxy); @@ -782,7 +779,6 @@ void tst_QTcpSocket::setSocketDescriptor() delete dummy; #endif } -#endif // !Q_OS_WINRT //---------------------------------------------------------------------------------- diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index b69bfb106c..425d61127a 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -1276,9 +1276,6 @@ void tst_QUdpSocket::multicastTtlOption_data() void tst_QUdpSocket::multicastTtlOption() { -#ifdef Q_OS_WINRT - QSKIP("WinRT does not support multicast."); -#endif QFETCH_GLOBAL(bool, setProxy); QFETCH(QHostAddress, bindAddress); QFETCH(int, ttl); @@ -1326,9 +1323,6 @@ void tst_QUdpSocket::multicastLoopbackOption_data() void tst_QUdpSocket::multicastLoopbackOption() { -#ifdef Q_OS_WINRT - QSKIP("WinRT does not support multicast."); -#endif QFETCH_GLOBAL(bool, setProxy); QFETCH(QHostAddress, bindAddress); QFETCH(int, loopback); @@ -1365,9 +1359,6 @@ void tst_QUdpSocket::multicastJoinBeforeBind_data() void tst_QUdpSocket::multicastJoinBeforeBind() { -#ifdef Q_OS_WINRT - QSKIP("WinRT does not support multicast."); -#endif QFETCH(QHostAddress, groupAddress); QUdpSocket udpSocket; @@ -1387,9 +1378,6 @@ void tst_QUdpSocket::multicastLeaveAfterClose_data() void tst_QUdpSocket::multicastLeaveAfterClose() { -#ifdef Q_OS_WINRT - QSKIP("WinRT does not support multicast."); -#endif QFETCH_GLOBAL(bool, setProxy); QFETCH(QHostAddress, groupAddress); if (setProxy) @@ -1434,9 +1422,6 @@ void tst_QUdpSocket::setMulticastInterface_data() void tst_QUdpSocket::setMulticastInterface() { -#ifdef Q_OS_WINRT - QSKIP("WinRT does not support multicast."); -#endif QFETCH_GLOBAL(bool, setProxy); QFETCH(QNetworkInterface, iface); QFETCH(QHostAddress, address); @@ -1494,9 +1479,6 @@ void tst_QUdpSocket::multicast_data() void tst_QUdpSocket::multicast() { -#ifdef Q_OS_WINRT - QSKIP("WinRT does not support multicast."); -#endif QFETCH_GLOBAL(bool, setProxy); QFETCH(QHostAddress, bindAddress); QFETCH(bool, bindResult); diff --git a/tests/auto/network/socket/socket.pro b/tests/auto/network/socket/socket.pro index 06fe356a5a..1248d71172 100644 --- a/tests/auto/network/socket/socket.pro +++ b/tests/auto/network/socket/socket.pro @@ -20,7 +20,3 @@ SUBDIRS=\ !qtConfig(sctp): SUBDIRS -= \ qsctpsocket \ - -winrt: SUBDIRS -= \ - qhttpsocketengine \ - qsocks5socketengine \ diff --git a/tests/auto/network/ssl/CMakeLists.txt b/tests/auto/network/ssl/CMakeLists.txt index c10cfabbf4..6d4dc15cc8 100644 --- a/tests/auto/network/ssl/CMakeLists.txt +++ b/tests/auto/network/ssl/CMakeLists.txt @@ -6,31 +6,17 @@ add_subdirectory(qsslcipher) add_subdirectory(qsslellipticcurve) add_subdirectory(qsslerror) add_subdirectory(qsslkey) - -if(QT_FEATURE_ssl) - - if(QT_FEATURE_private_tests) - add_subdirectory(qsslsocket) - if(NOT WINRT) - add_subdirectory(qsslsocket_onDemandCertificates_member) - add_subdirectory(qsslsocket_onDemandCertificates_static) - endif() - - if(QT_FEATURE_dtls) - add_subdirectory(qdtlscookie) - add_subdirectory(qdtls) - endif() - - if(QT_FEATURE_ocsp) - add_subdirectory(qocsp) - endif() - endif() +if(QT_FEATURE_private_tests AND QT_FEATURE_ssl) + add_subdirectory(qsslsocket) + add_subdirectory(qsslsocket_onDemandCertificates_member) + add_subdirectory(qsslsocket_onDemandCertificates_static) + add_subdirectory(qasn1element) + add_subdirectory(qssldiffiehellmanparameters) endif() - -if(QT_FEATURE_ssl) - - if(QT_FEATURE_private_tests) - add_subdirectory(qasn1element) - add_subdirectory(qssldiffiehellmanparameters) - endif() +if(QT_FEATURE_dtls AND QT_FEATURE_private_tests AND QT_FEATURE_ssl) + add_subdirectory(qdtlscookie) + add_subdirectory(qdtls) +endif() +if(QT_FEATURE_ocsp AND QT_FEATURE_private_tests AND QT_FEATURE_ssl) + add_subdirectory(qocsp) endif() diff --git a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp index 0611deb184..69a90c9c83 100644 --- a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp @@ -819,7 +819,7 @@ void tst_QSslCertificate::task256066toPem() void tst_QSslCertificate::nulInCN() { -#if QT_CONFIG(securetransport) || defined(Q_OS_WINRT) || QT_CONFIG(schannel) +#if QT_CONFIG(securetransport) || QT_CONFIG(schannel) QSKIP("Generic QSslCertificatePrivate fails this test"); #endif QList certList = @@ -838,7 +838,7 @@ void tst_QSslCertificate::nulInCN() void tst_QSslCertificate::nulInSan() { -#if QT_CONFIG(securetransport) || defined(Q_OS_WINRT) || QT_CONFIG(schannel) +#if QT_CONFIG(securetransport) || QT_CONFIG(schannel) QSKIP("Generic QSslCertificatePrivate fails this test"); #endif QList certList = @@ -934,7 +934,7 @@ void tst_QSslCertificate::toText() QString txtcert = cert.toText(); #ifdef QT_NO_OPENSSL - QEXPECT_FAIL("", "QTBUG-40884: QSslCertificate::toText is not implemented on WinRT", Continue); + QEXPECT_FAIL("", "QSslCertificate::toText is not implemented on platforms which do not use openssl", Continue); #endif QVERIFY(QString::fromLatin1(txt098) == txtcert || QString::fromLatin1(txt100) == txtcert || @@ -990,7 +990,7 @@ void tst_QSslCertificate::verify() ) #ifdef QT_NO_OPENSSL - QEXPECT_FAIL("", "QTBUG-40884: WinRT API does not yet support verifying a chain", Abort); + QEXPECT_FAIL("", "Verifying a chain is not supported without openssl", Abort); // TODO? #endif // Empty chain is unspecified error errors = QSslCertificate::verify(toVerify); @@ -1323,7 +1323,7 @@ void tst_QSslCertificate::pkcs12() QList caCerts; #ifdef QT_NO_OPENSSL - QEXPECT_FAIL("", "QTBUG-40884: WinRT API does not support pkcs12 imports", Abort); + QEXPECT_FAIL("", "pkcs12 imports are only supported when openssl is used", Abort); // TODO? #endif ok = QSslCertificate::importPkcs12(&f, &key, &cert, &caCerts); QVERIFY(ok); diff --git a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp index 1807315061..ce223a53ef 100644 --- a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp +++ b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp @@ -167,9 +167,9 @@ void tst_QSslKey::createPlainTestRows(bool pemOnly) foreach (KeyInfo keyInfo, keyInfoList) { if (pemOnly && keyInfo.format != QSsl::EncodingFormat::Pem) continue; -#if defined(Q_OS_WINRT) || QT_CONFIG(schannel) +#if QT_CONFIG(schannel) if (keyInfo.fileInfo.fileName().contains("RC2-64")) - continue; // WinRT/Schannel treats RC2 as 128 bit + continue; // Schannel treats RC2 as 128 bit #endif #if !defined(QT_NO_SSL) && defined(QT_NO_OPENSSL) // generic backend if (keyInfo.fileInfo.fileName().contains(QRegularExpression("-aes\\d\\d\\d-"))) @@ -702,11 +702,11 @@ void tst_QSslKey::encrypt() QFETCH(QByteArray, cipherText); QFETCH(QByteArray, iv); -#if defined(Q_OS_WINRT) || QT_CONFIG(schannel) - QEXPECT_FAIL("RC2-40-CBC, length 0", "WinRT/Schannel treats RC2 as 128-bit", Abort); - QEXPECT_FAIL("RC2-40-CBC, length 8", "WinRT/Schannel treats RC2 as 128-bit", Abort); - QEXPECT_FAIL("RC2-64-CBC, length 0", "WinRT/Schannel treats RC2 as 128-bit", Abort); - QEXPECT_FAIL("RC2-64-CBC, length 8", "WinRT/Schannel treats RC2 as 128-bit", Abort); +#if QT_CONFIG(schannel) + QEXPECT_FAIL("RC2-40-CBC, length 0", "Schannel treats RC2 as 128-bit", Abort); + QEXPECT_FAIL("RC2-40-CBC, length 8", "Schannel treats RC2 as 128-bit", Abort); + QEXPECT_FAIL("RC2-64-CBC, length 0", "Schannel treats RC2 as 128-bit", Abort); + QEXPECT_FAIL("RC2-64-CBC, length 8", "Schannel treats RC2 as 128-bit", Abort); #endif QByteArray encrypted = QSslKeyPrivate::encrypt(cipher, plainText, key, iv); QCOMPARE(encrypted, cipherText); diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index 0ac87a9cb1..538864db6c 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -1307,9 +1307,6 @@ protected slots: void tst_QSslSocket::protocolServerSide_data() { -#ifdef Q_OS_WINRT - QSKIP("Server-side encryption is not implemented on WinRT."); -#endif QTest::addColumn("serverProtocol"); QTest::addColumn("clientProtocol"); QTest::addColumn("works"); @@ -1413,9 +1410,6 @@ void tst_QSslSocket::protocolServerSide() void tst_QSslSocket::serverCipherPreferences() { -#ifdef Q_OS_WINRT - QSKIP("Server-side encryption is not implemented on WinRT."); -#endif if (!QSslSocket::supportsSsl()) { qWarning("SSL not supported, skipping test"); return; @@ -1542,9 +1536,6 @@ void tst_QSslSocket::localCertificateChain() void tst_QSslSocket::setLocalCertificateChain() { -#ifdef Q_OS_WINRT - QSKIP("Server-side encryption is not implemented on WinRT."); -#endif if (!QSslSocket::supportsSsl()) return; @@ -1587,9 +1578,6 @@ void tst_QSslSocket::setPrivateKey() void tst_QSslSocket::setSocketDescriptor() { -#ifdef Q_OS_WINRT - QSKIP("Server-side encryption is not implemented on WinRT."); -#endif if (!QSslSocket::supportsSsl()) return; @@ -1995,9 +1983,6 @@ protected: void tst_QSslSocket::setEmptyKey() { -#ifdef Q_OS_WINRT - QSKIP("Server-side encryption is not implemented on WinRT."); -#endif if (!QSslSocket::supportsSsl()) return; @@ -2019,9 +2004,6 @@ void tst_QSslSocket::setEmptyKey() void tst_QSslSocket::spontaneousWrite() { -#ifdef Q_OS_WINRT - QSKIP("Server-side encryption is not implemented on WinRT."); -#endif QFETCH_GLOBAL(bool, setProxy); if (setProxy) return; @@ -2067,9 +2049,6 @@ void tst_QSslSocket::spontaneousWrite() void tst_QSslSocket::setReadBufferSize() { -#ifdef Q_OS_WINRT - QSKIP("Server-side encryption is not implemented on WinRT."); -#endif QFETCH_GLOBAL(bool, setProxy); if (setProxy) return; @@ -2330,9 +2309,6 @@ void tst_QSslSocket::waitForMinusOne() { #ifdef Q_OS_WIN QSKIP("QTBUG-24451 - indefinite wait may hang"); -#endif -#ifdef Q_OS_WINRT // This can stay in case the one above goes away - QSKIP("Server-side encryption is not implemented on WinRT."); #endif QFETCH_GLOBAL(bool, setProxy); if (setProxy) @@ -2412,9 +2388,6 @@ protected: void tst_QSslSocket::verifyMode() { -#ifdef Q_OS_WINRT - QSKIP("Server-side encryption is not implemented on WinRT."); -#endif QFETCH_GLOBAL(bool, setProxy); if (setProxy) return; @@ -2698,9 +2671,6 @@ void tst_QSslSocket::ignoreSslErrorsListWithSlot() void tst_QSslSocket::abortOnSslErrors() { -#ifdef Q_OS_WINRT - QSKIP("Server-side encryption is not implemented on WinRT."); -#endif QFETCH_GLOBAL(bool, setProxy); if (setProxy) return; @@ -2800,9 +2770,6 @@ void tst_QSslSocket::writeBigChunk() void tst_QSslSocket::blacklistedCertificates() { -#ifdef Q_OS_WINRT - QSKIP("Server-side encryption is not implemented on WinRT."); -#endif QFETCH_GLOBAL(bool, setProxy); if (setProxy) return; @@ -3064,9 +3031,6 @@ protected: void tst_QSslSocket::qtbug18498_peek() { -#ifdef Q_OS_WINRT - QSKIP("Server-side encryption is not implemented on WinRT."); -#endif QFETCH_GLOBAL(bool, setProxy); if (setProxy) return; @@ -3140,9 +3104,6 @@ protected: void tst_QSslSocket::qtbug18498_peek2() { -#ifdef Q_OS_WINRT - QSKIP("Server-side encryption is not implemented on WinRT."); -#endif QFETCH_GLOBAL(bool, setProxy); if (setProxy) return; @@ -3246,9 +3207,6 @@ void tst_QSslSocket::qtbug18498_peek2() void tst_QSslSocket::dhServer() { -#ifdef Q_OS_WINRT - QSKIP("Server-side encryption is not implemented on WinRT."); -#endif if (!QSslSocket::supportsSsl()) QSKIP("No SSL support"); @@ -3358,9 +3316,6 @@ void tst_QSslSocket::dhServerCustomParams() void tst_QSslSocket::ecdhServer() { -#ifdef Q_OS_WINRT - QSKIP("Server-side encryption is not implemented on WinRT."); -#endif if (!QSslSocket::supportsSsl()) { qWarning("SSL not supported, skipping test"); return; @@ -3467,9 +3422,6 @@ void tst_QSslSocket::verifyClientCertificate() // success instead of failure etc.). QSKIP("This test can not work with Secure Transport"); #endif // QT_CONFIG(securetransport) -#ifdef Q_OS_WINRT - QSKIP("Server-side encryption is not implemented on WinRT."); -#endif if (!QSslSocket::supportsSsl()) { qWarning("SSL not supported, skipping test"); return; @@ -4049,9 +4001,6 @@ void tst_QSslSocket::simplePskConnect() void tst_QSslSocket::ephemeralServerKey_data() { -#ifdef Q_OS_WINRT - QSKIP("Server-side encryption is not implemented on WinRT."); -#endif QTest::addColumn("cipher"); QTest::addColumn("emptyKey"); @@ -4084,9 +4033,6 @@ void tst_QSslSocket::ephemeralServerKey() void tst_QSslSocket::pskServer() { -#ifdef Q_OS_WINRT - QSKIP("Server-side encryption is not implemented on WinRT."); -#endif #if QT_CONFIG(schannel) QSKIP("Schannel does not have PSK support implemented."); #endif diff --git a/tests/auto/network/ssl/ssl.pro b/tests/auto/network/ssl/ssl.pro index 169e9bce83..014ff34064 100644 --- a/tests/auto/network/ssl/ssl.pro +++ b/tests/auto/network/ssl/ssl.pro @@ -26,10 +26,6 @@ qtConfig(ssl) { } } -winrt: SUBDIRS -= \ - qsslsocket_onDemandCertificates_member \ - qsslsocket_onDemandCertificates_static \ - qtConfig(ssl) { qtConfig(private_tests) { SUBDIRS += qasn1element \ diff --git a/tests/auto/other/.prev_CMakeLists.txt b/tests/auto/other/.prev_CMakeLists.txt index 74ea69ee0e..d89e950690 100644 --- a/tests/auto/other/.prev_CMakeLists.txt +++ b/tests/auto/other/.prev_CMakeLists.txt @@ -11,7 +11,7 @@ if(TARGET Qt::Widgets) add_subdirectory(qsharedpointer_and_qwidget) add_subdirectory(windowsmobile) endif() -if(TARGET Qt::Network AND TARGET Qt::Widgets AND NOT WINRT) +if(TARGET Qt::Network AND TARGET Qt::Widgets) add_subdirectory(lancelot) add_subdirectory(qnetworkaccessmanager_and_qprogressdialog) endif() @@ -26,13 +26,13 @@ endif() if(QT_FEATURE_process AND TARGET Qt::Gui) add_subdirectory(qprocess_and_guieventloop) endif() -if(QT_FEATURE_accessibility AND TARGET Qt::Gui AND TARGET Qt::Widgets AND NOT WINRT) +if(QT_FEATURE_accessibility AND TARGET Qt::Gui AND TARGET Qt::Widgets) add_subdirectory(qaccessibility) endif() if(QT_FEATURE_accessibility_atspi_bridge AND TARGET Qt::Gui AND TARGET Qt::Widgets) add_subdirectory(qaccessibilitylinux) endif() -if(TARGET Qt::Network AND NOT WINRT) +if(TARGET Qt::Network) add_subdirectory(networkselftest) endif() if(MACOS AND TARGET Qt::Gui) diff --git a/tests/auto/other/CMakeLists.txt b/tests/auto/other/CMakeLists.txt index 808afeff35..6a9569332d 100644 --- a/tests/auto/other/CMakeLists.txt +++ b/tests/auto/other/CMakeLists.txt @@ -11,7 +11,7 @@ if(TARGET Qt::Widgets) add_subdirectory(qsharedpointer_and_qwidget) # add_subdirectory(windowsmobile) <- does not exist # special case endif() -if(TARGET Qt::Network AND TARGET Qt::Widgets AND NOT WINRT) +if(TARGET Qt::Network AND TARGET Qt::Widgets) add_subdirectory(lancelot) add_subdirectory(qnetworkaccessmanager_and_qprogressdialog) endif() @@ -26,13 +26,13 @@ endif() if(QT_FEATURE_process AND TARGET Qt::Gui) add_subdirectory(qprocess_and_guieventloop) endif() -if(QT_FEATURE_accessibility AND TARGET Qt::Gui AND TARGET Qt::Widgets AND NOT WINRT) +if(QT_FEATURE_accessibility AND TARGET Qt::Gui AND TARGET Qt::Widgets) add_subdirectory(qaccessibility) endif() if(QT_FEATURE_accessibility_atspi_bridge AND TARGET Qt::Gui AND TARGET Qt::Widgets) #add_subdirectory(qaccessibilitylinux) # special case # This test is broken endif() -if(TARGET Qt::Network AND NOT WINRT) +if(TARGET Qt::Network) add_subdirectory(networkselftest) endif() if(MACOS AND TARGET Qt::Gui) diff --git a/tests/auto/other/languagechange/tst_languagechange.cpp b/tests/auto/other/languagechange/tst_languagechange.cpp index 14ede33500..fc3d0f1c06 100644 --- a/tests/auto/other/languagechange/tst_languagechange.cpp +++ b/tests/auto/other/languagechange/tst_languagechange.cpp @@ -197,7 +197,7 @@ void tst_languageChange::retranslatability_data() << "QFileDialog::Back" << "QFileDialog::Create New Folder" << "QFileDialog::Detail View" -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_MAC) << "QFileDialog::File" #endif << "QFileDialog::Files of type:" diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro index 8a99d0eef6..8d72957ac7 100644 --- a/tests/auto/other/other.pro +++ b/tests/auto/other/other.pro @@ -40,7 +40,7 @@ SUBDIRS=\ qaccessibilitylinux \ qaccessibilitymac \ -winrt|!qtHaveModule(network): SUBDIRS -= \ +!qtHaveModule(network): SUBDIRS -= \ lancelot \ networkselftest \ qnetworkaccessmanager_and_qprogressdialog \ @@ -49,7 +49,7 @@ cross_compile: SUBDIRS -= \ atwrapper \ compiler -winrt|!qtHaveModule(gui)|!qtConfig(accessibility): SUBDIRS -= qaccessibility +!qtHaveModule(gui)|!qtConfig(accessibility): SUBDIRS -= qaccessibility !qtHaveModule(gui)|!qtConfig(accessibility-atspi-bridge): SUBDIRS -= qaccessibilitylinux diff --git a/tests/auto/other/qaccessibility/.prev_CMakeLists.txt b/tests/auto/other/qaccessibility/.prev_CMakeLists.txt index 8663e412c4..7dea6c37e6 100644 --- a/tests/auto/other/qaccessibility/.prev_CMakeLists.txt +++ b/tests/auto/other/qaccessibility/.prev_CMakeLists.txt @@ -33,13 +33,9 @@ extend_target(tst_qaccessibility CONDITION UNIX AND NOT APPLE AND NOT HAIKU AND extend_target(tst_qaccessibility CONDITION WIN32 PUBLIC_LIBRARIES + Qt::WindowsUIAutomationSupportPrivate ole32 oleacc oleaut32 uuid ) - -extend_target(tst_qaccessibility CONDITION WIN32 AND NOT WINRT - PUBLIC_LIBRARIES - Qt::WindowsUIAutomationSupportPrivate -) diff --git a/tests/auto/other/qaccessibility/CMakeLists.txt b/tests/auto/other/qaccessibility/CMakeLists.txt index f5f74bbafc..8a27fc25cc 100644 --- a/tests/auto/other/qaccessibility/CMakeLists.txt +++ b/tests/auto/other/qaccessibility/CMakeLists.txt @@ -39,13 +39,9 @@ extend_target(tst_qaccessibility CONDITION UNIX AND NOT APPLE AND NOT HAIKU AND extend_target(tst_qaccessibility CONDITION WIN32 PUBLIC_LIBRARIES + Qt::WindowsUIAutomationSupportPrivate ole32 oleacc oleaut32 uuid ) - -extend_target(tst_qaccessibility CONDITION WIN32 AND NOT WINRT - PUBLIC_LIBRARIES - Qt::WindowsUIAutomationSupportPrivate -) diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 339e7ad20d..07cccde0c8 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -30,10 +30,8 @@ #include #ifdef Q_OS_WIN # include -#ifndef Q_OS_WINRT # include # include -#endif # include # include #endif @@ -3774,7 +3772,7 @@ void tst_QAccessibility::bridgeTest() { // For now this is a simple test to see if the bridge is working at all. // Ideally it should be extended to test all aspects of the bridge. -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) QWidget window; QVBoxLayout *lay = new QVBoxLayout(&window); diff --git a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp index 9285d5b5da..0242f8a36e 100644 --- a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp +++ b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp @@ -357,10 +357,9 @@ void tst_QFocusEvent::checkReason_ActiveWindow() d->hide(); if (!QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive) - || !QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive) - || !QGuiApplication::platformName().compare(QLatin1String("winrt"), Qt::CaseInsensitive)) { + || !QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive)) { // Activate window of testFocusWidget, focus in that window goes to childFocusWidgetOne - QWARN("Platforms offscreen, minimal, and winrt require explicit activateWindow()"); + QWARN("Platforms offscreen and minimal require explicit activateWindow()"); testFocusWidget->activateWindow(); } diff --git a/tests/auto/testlib/selftests/CMakeLists.txt b/tests/auto/testlib/selftests/CMakeLists.txt index 9dc85e556a..bce68a37d8 100644 --- a/tests/auto/testlib/selftests/CMakeLists.txt +++ b/tests/auto/testlib/selftests/CMakeLists.txt @@ -52,7 +52,7 @@ qt_add_resource(tst_selftests "qmake_expected_files" ## Scopes: ##################################################################### -#### Keys ignored in scope 5:.:.:test.pro:NOT ANDROID AND NOT WINRT AND for(file,SUBPROGRAMS): +#### Keys ignored in scope 5:.:.:test.pro:NOT ANDROID AND for(file,SUBPROGRAMS): # TEST_HELPER_INSTALLS = "../$${file}/$${file}" #### Keys ignored in scope 7:.:..:../selftests.pri:TARGET Qt::Gui: @@ -63,71 +63,69 @@ qt_apply_testlib_coverage_options(tst_selftests) # ------------- Sub tests ------------- # special case begin -if(NOT WINRT) - set(subprograms - assert - badxml - benchlibcallgrind - benchlibcounting - benchlibeventcounter - benchliboptions - benchlibtickcounter - benchlibwalltime - blacklisted - cmptest - commandlinedata - counting - crashes - datatable - datetime - deleteLater - deleteLater_noApp - differentexec - exceptionthrow - expectfail - failcleanup - faildatatype - failfetchtype - failinit - failinitdata - fetchbogus - findtestdata - float - globaldata - longstring - maxwarnings - multiexec - pass - pairdiagnostics - printdatatags - printdatatagswithglobaltags - qexecstringlist - silent - signaldumper - singleskip - skip - skipcleanup - skipinit - skipinitdata - sleep - strcmp - subtest - testlib - tuplediagnostics - verbose1 - verbose2 - verifyexceptionthrown - warnings - watchdog - xunit - ) +set(subprograms + assert + badxml + benchlibcallgrind + benchlibcounting + benchlibeventcounter + benchliboptions + benchlibtickcounter + benchlibwalltime + blacklisted + cmptest + commandlinedata + counting + crashes + datatable + datetime + deleteLater + deleteLater_noApp + differentexec + exceptionthrow + expectfail + failcleanup + faildatatype + failfetchtype + failinit + failinitdata + fetchbogus + findtestdata + float + globaldata + longstring + maxwarnings + multiexec + pass + pairdiagnostics + printdatatags + printdatatagswithglobaltags + qexecstringlist + silent + signaldumper + singleskip + skip + skipcleanup + skipinit + skipinitdata + sleep + strcmp + subtest + testlib + tuplediagnostics + verbose1 + verbose2 + verifyexceptionthrown + warnings + watchdog + xunit +) - if(TARGET Qt::Gui) - list(APPEND subprograms - keyboard - mouse - ) - endif() +if(TARGET Qt::Gui) + list(APPEND subprograms + keyboard + mouse + ) endif() foreach(subprogram IN LISTS subprograms) @@ -149,6 +147,6 @@ qt_extend_target(tst_selftests ## Scopes: ##################################################################### -#### Keys ignored in scope 5:.:.:test.pro:NOT ANDROID AND NOT WINRT AND for(file,SUBPROGRAMS): +#### Keys ignored in scope 5:.:.:test.pro:NOT ANDROID AND for(file,SUBPROGRAMS): # TEST_HELPER_INSTALLS = "../$${file}/$${file}" # special case end diff --git a/tests/auto/testlib/selftests/catch_p_p.h b/tests/auto/testlib/selftests/catch_p_p.h index ffc10559aa..97ce7a24fd 100644 --- a/tests/auto/testlib/selftests/catch_p_p.h +++ b/tests/auto/testlib/selftests/catch_p_p.h @@ -235,13 +235,7 @@ namespace Catch { # define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS # endif -// Universal Windows platform does not support SEH -// Or console colours (or console at all...) -# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) -# define CATCH_CONFIG_COLOUR_NONE -# else -# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH -# endif +# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH // MSVC traditional preprocessor needs some workaround for __VA_ARGS__ // _MSVC_TRADITIONAL == 0 means new conformant preprocessor diff --git a/tests/auto/testlib/selftests/crashes/tst_crashes.cpp b/tests/auto/testlib/selftests/crashes/tst_crashes.cpp index 87b241f5e5..4c418cc78f 100644 --- a/tests/auto/testlib/selftests/crashes/tst_crashes.cpp +++ b/tests/auto/testlib/selftests/crashes/tst_crashes.cpp @@ -44,7 +44,7 @@ private slots: void tst_Crashes::crash() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) //we avoid the error dialogbox to appear on windows SetErrorMode( SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); #endif diff --git a/tests/auto/testlib/selftests/selftest.pro b/tests/auto/testlib/selftests/selftest.pro index bcf96c9cb3..4d926d3572 100644 --- a/tests/auto/testlib/selftests/selftest.pro +++ b/tests/auto/testlib/selftests/selftest.pro @@ -18,6 +18,6 @@ RESOURCES += expected_files include(selftests.pri) DEFINES += SUBPROGRAMS=$$shell_quote($$SUBPROGRAMS) -!android:!winrt: for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "$${file}/$${file}" +!android: for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "$${file}/$${file}" include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/selftests.pro b/tests/auto/testlib/selftests/selftests.pro index 235967ebe9..cb71ff4833 100644 --- a/tests/auto/testlib/selftests/selftests.pro +++ b/tests/auto/testlib/selftests/selftests.pro @@ -1,6 +1,6 @@ TEMPLATE = subdirs -!winrt: include(selftests.pri) +include(selftests.pri) selftest.file = selftest.pro selftest.makefile = Makefile.selftest diff --git a/tests/auto/widgets/dialogs/CMakeLists.txt b/tests/auto/widgets/dialogs/CMakeLists.txt index 508093e7ad..0c52076efe 100644 --- a/tests/auto/widgets/dialogs/CMakeLists.txt +++ b/tests/auto/widgets/dialogs/CMakeLists.txt @@ -1,19 +1,18 @@ +# Generated from dialogs.pro. + add_subdirectory(qcolordialog) add_subdirectory(qdialog) add_subdirectory(qerrormessage) -if (NOT WINRT) - add_subdirectory(qfiledialog) - add_subdirectory(qfiledialog2) - add_subdirectory(qmessagebox) -endif() -if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR NOT WIN32) - add_subdirectory(qfilesystemmodel) -endif() +add_subdirectory(qfiledialog) +add_subdirectory(qfiledialog2) add_subdirectory(qfontdialog) add_subdirectory(qinputdialog) +add_subdirectory(qmessagebox) add_subdirectory(qprogressdialog) -if (QT_FEATURE_private_tests) +add_subdirectory(qwizard) +if(NOT MINGW) + add_subdirectory(qfilesystemmodel) +endif() +if(QT_FEATURE_private_tests) add_subdirectory(qsidebar) endif() -add_subdirectory(qwizard) - diff --git a/tests/auto/widgets/dialogs/dialogs.pro b/tests/auto/widgets/dialogs/dialogs.pro index e0ebe78f33..cf548f2dea 100644 --- a/tests/auto/widgets/dialogs/dialogs.pro +++ b/tests/auto/widgets/dialogs/dialogs.pro @@ -18,4 +18,3 @@ SUBDIRS=\ mac:qinputdialog.CONFIG += no_check_target # QTBUG-25496 mingw: SUBDIRS -= qfilesystemmodel # QTBUG-29403 -winrt: SUBDIRS -= qfiledialog qfiledialog2 qmessagebox # QTBUG-68297 diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp index 94915d0e40..d469b0f9bd 100644 --- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp +++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp @@ -307,10 +307,6 @@ void tst_QDialog::showAsTool() testWidget.activateWindow(); QVERIFY(QTest::qWaitForWindowActive(&testWidget)); dialog.exec(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "As winrt does not support child widgets, the dialog is being activated" - "together with the main widget.", Continue); -#endif if (testWidget.style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, &testWidget)) { QCOMPARE(dialog.wasActive(), true); } else { @@ -468,8 +464,7 @@ void tst_QDialog::snapToDefaultButton() #ifdef QT_NO_CURSOR QSKIP("Test relies on there being a cursor"); #else - if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive) - || !QGuiApplication::platformName().compare(QLatin1String("winrt"), Qt::CaseInsensitive)) + if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive)) QSKIP("This platform does not support setting the cursor position."); const QRect dialogGeometry(QGuiApplication::primaryScreen()->availableGeometry().topLeft() diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp index d3b7f53bb4..4e2699889f 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp @@ -276,7 +276,7 @@ void tst_QFileDialog2::showNameFilterDetails() void tst_QFileDialog2::unc() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) // Only test UNC on Windows./ QString dir("\\\\" + QtNetworkSettings::winServerName() + "\\testsharewritable"); #else diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST b/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST index d9d7786314..4119afce84 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST @@ -1,12 +1,5 @@ -winrt -[sort] -winrt [sort:QFileDialog usage] ubuntu b2qt [specialFiles] b2qt -[dirsBeforeFiles] -winrt -[drives] -winrt diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp index 63bf103725..e814e79dbe 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -340,14 +340,7 @@ bool tst_QFileSystemModel::createFiles(QFileSystemModel *model, const QString &t if (initial_file[0] == '.') { const QString hiddenFile = QDir::toNativeSeparators(file.fileName()); const auto nativeHiddenFile = reinterpret_cast(hiddenFile.utf16()); -#ifndef Q_OS_WINRT DWORD currentAttributes = ::GetFileAttributes(nativeHiddenFile); -#else // !Q_OS_WINRT - WIN32_FILE_ATTRIBUTE_DATA attributeData; - if (!::GetFileAttributesEx(nativeHiddenFile, GetFileExInfoStandard, &attributeData)) - attributeData.dwFileAttributes = 0xFFFFFFFF; - DWORD currentAttributes = attributeData.dwFileAttributes; -#endif // Q_OS_WINRT if (currentAttributes == 0xFFFFFFFF) { qErrnoWarning("failed to get file attributes: %s", qPrintable(hiddenFile)); return false; diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp index 543128915e..6985c37cb6 100644 --- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp @@ -150,8 +150,6 @@ void tst_QMessageBox::sanityTest() QSKIP("Test hangs on macOS 10.12 -- QTQAINFRA-1362"); return; } -#elif defined(Q_OS_WINRT) - QSKIP("Test hangs on winrt -- QTBUG-68297"); #endif QMessageBox msgBox; msgBox.setText("This is insane"); diff --git a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp index 8276d3ea9d..146a9e262d 100644 --- a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp +++ b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp @@ -55,9 +55,6 @@ void tst_QSidebar::setUrls() QCOMPARE(model->rowCount(), 0); qsidebar.setUrls(urls); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "One of the URLs is not seen as valid on WinRT - QTBUG-68297", Abort); -#endif QCOMPARE(qsidebar.urls(), urls); QCOMPARE(model->rowCount(), urls.count()); qsidebar.setUrls(urls); @@ -102,9 +99,6 @@ void tst_QSidebar::addUrls() // test < 0 qsidebar.addUrls(urls, -1); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "One of the URLs is not seen as valid on WinRT - QTBUG-68297", Abort); -#endif QCOMPARE(model->rowCount(), 2); // test = 0 @@ -192,9 +186,6 @@ void tst_QSidebar::goToUrl() QSignalSpy spy(&qsidebar, SIGNAL(goToUrl(QUrl))); QTest::mousePress(qsidebar.viewport(), Qt::LeftButton, {}, qsidebar.visualRect(qsidebar.model()->index(0, 0)).center()); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort); -#endif QCOMPARE(spy.count(), 1); QCOMPARE((spy.value(0)).at(0).toUrl(), urls.first()); } diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index 5b7ded0ecb..a522dc4122 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -2596,9 +2596,6 @@ void tst_QWizard::task161658_alignments() void tst_QWizard::task177022_setFixedSize() { -#ifdef Q_OS_WINRT - QSKIP("Widgets cannot have a fixed size on WinRT."); -#endif int width = 300; int height = 200; QWizard wiz; diff --git a/tests/auto/widgets/graphicsview/.prev_CMakeLists.txt b/tests/auto/widgets/graphicsview/.prev_CMakeLists.txt new file mode 100644 index 0000000000..28a641ac61 --- /dev/null +++ b/tests/auto/widgets/graphicsview/.prev_CMakeLists.txt @@ -0,0 +1,24 @@ +# Generated from graphicsview.pro. + +if(QT_FEATURE_private_tests) + add_subdirectory(qgraphicsanchorlayout) + add_subdirectory(qgraphicsanchorlayout1) + add_subdirectory(qgraphicsitem) + add_subdirectory(qgraphicsscene) + add_subdirectory(qgraphicssceneindex) +endif() +add_subdirectory(qgraphicseffectsource) +add_subdirectory(qgraphicsgridlayout) +add_subdirectory(qgraphicsitemanimation) +add_subdirectory(qgraphicslayout) +add_subdirectory(qgraphicslayoutitem) +add_subdirectory(qgraphicslinearlayout) +add_subdirectory(qgraphicsobject) +add_subdirectory(qgraphicspixmapitem) +add_subdirectory(qgraphicspolygonitem) +add_subdirectory(qgraphicstransform) +add_subdirectory(qgraphicsview) +if(QT_FEATURE_style_fusion) + add_subdirectory(qgraphicsproxywidget) + add_subdirectory(qgraphicswidget) +endif() diff --git a/tests/auto/widgets/graphicsview/CMakeLists.txt b/tests/auto/widgets/graphicsview/CMakeLists.txt index be1ae7253a..d995d3c1e0 100644 --- a/tests/auto/widgets/graphicsview/CMakeLists.txt +++ b/tests/auto/widgets/graphicsview/CMakeLists.txt @@ -17,6 +17,7 @@ add_subdirectory(qgraphicsobject) add_subdirectory(qgraphicspixmapitem) add_subdirectory(qgraphicspolygonitem) add_subdirectory(qgraphicstransform) +add_subdirectory(qgraphicsview) if(QT_FEATURE_style_fusion) # special case begin # These tests are never run in coin with qmake since the statement @@ -30,6 +31,3 @@ if(QT_FEATURE_style_fusion) #add_subdirectory(qgraphicswidget) # special case end endif() -if(NOT WINRT) - add_subdirectory(qgraphicsview) -endif() diff --git a/tests/auto/widgets/graphicsview/graphicsview.pro b/tests/auto/widgets/graphicsview/graphicsview.pro index 0f4c1721e3..e99897a4f6 100644 --- a/tests/auto/widgets/graphicsview/graphicsview.pro +++ b/tests/auto/widgets/graphicsview/graphicsview.pro @@ -30,5 +30,3 @@ SUBDIRS=\ !contains(styles, fusion):SUBDIRS -= \ qgraphicsproxywidget \ qgraphicswidget \ - -winrt: SUBDIRS -= qgraphicsview # QTBUG-68297 diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/CMakeLists.txt b/tests/auto/widgets/graphicsview/qgraphicsitem/CMakeLists.txt index 1be66372b6..81cdeeb84a 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/CMakeLists.txt +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/CMakeLists.txt @@ -21,7 +21,7 @@ add_qt_test(tst_qgraphicsitem ## Scopes: ##################################################################### -extend_target(tst_qgraphicsitem CONDITION WIN32 AND NOT WINRT +extend_target(tst_qgraphicsitem CONDITION WIN32 PUBLIC_LIBRARIES user32 ) diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro index 16818a98f9..7c95972222 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro @@ -5,4 +5,4 @@ QT += core-private gui-private SOURCES += tst_qgraphicsitem.cpp DEFINES += QT_NO_CAST_TO_ASCII -win32:!winrt: QMAKE_USE += user32 +win32: QMAKE_USE += user32 diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 1cc793503a..e7a79d017b 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -71,7 +71,7 @@ Q_DECLARE_METATYPE(QPainterPath) Q_DECLARE_METATYPE(QSizeF) Q_DECLARE_METATYPE(QTransform) -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) #include #define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ @@ -6959,9 +6959,6 @@ void tst_QGraphicsItem::opacityZeroUpdates() QRegion expectedRegion = parentDeviceBoundingRect.adjusted(-2, -2, 2, 2); expectedRegion += childDeviceBoundingRect.adjusted(-2, -2, 2, 2); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT. Figure out why - QTBUG-68297", Abort); -#endif COMPARE_REGIONS(view.paintedRegion, expectedRegion); } @@ -8196,9 +8193,6 @@ void tst_QGraphicsItem::moveLineItem() // Make sure the calculated region is correct. item->update(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT. Figure out why - QTBUG-68297", Abort); -#endif QTRY_COMPARE(view.paintedRegion, expectedRegion); view.reset(); @@ -11483,10 +11477,6 @@ void tst_QGraphicsItem::QTBUG_7714_fullUpdateDiscardingOpacityUpdate2() childYellow->setOpacity(1.0); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT. Figure out why - QTBUG-68297", Abort); -#endif - QTRY_VERIFY(origView.repaints > 0); QTRY_VERIFY(view.repaints > 0); } diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/CMakeLists.txt b/tests/auto/widgets/graphicsview/qgraphicsscene/CMakeLists.txt index c566b6c1bf..efcb4598e5 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/CMakeLists.txt +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/CMakeLists.txt @@ -71,7 +71,7 @@ add_qt_resource(tst_qgraphicsscene "testdata" ## Scopes: ##################################################################### -extend_target(tst_qgraphicsscene CONDITION WIN32 AND NOT WINRT +extend_target(tst_qgraphicsscene CONDITION WIN32 PUBLIC_LIBRARIES user32 ) diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro index 2f648a2212..fe8e83ee0a 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro @@ -4,7 +4,7 @@ QT += widgets widgets-private testlib QT += core-private gui-private SOURCES += tst_qgraphicsscene.cpp RESOURCES += images.qrc -win32:!winrt: QMAKE_USE += user32 +win32: QMAKE_USE += user32 DEFINES += SRCDIR=\\\"$$PWD\\\" DEFINES += QT_NO_CAST_TO_ASCII diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 7e5d94da22..f0a276b9e7 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -52,7 +52,7 @@ #include "../../../shared/platforminputcontext.h" #include -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) #include #define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ @@ -2693,7 +2693,7 @@ void tst_QGraphicsScene::render() void tst_QGraphicsScene::renderItemsWithNegativeWidthOrHeight() { -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) || defined(Q_OS_WINRT) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("Test only works on platforms with resizable windows"); #endif QGraphicsScene scene(0, 0, m_testSize.width(), m_testSize.height()); diff --git a/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index ff01810938..daf339168c 100644 --- a/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -356,9 +356,6 @@ void tst_QGraphicsSceneIndex::clear() MyItem *item = new MyItem; scene.addItem(item); qApp->processEvents(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "There is one additional paint event on WinRT - QTBUG-68297", Abort); -#endif QTRY_COMPARE(item->numPaints, 1); } diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index ba4c1473e8..42cbad14c0 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -1278,9 +1278,6 @@ void tst_QAbstractItemView::task250754_fontChange() font.setPixelSize(60); tree.setFont(font); -#ifdef Q_OS_WINRT - QSKIP("Resizing the widget does not work as expected for WinRT, so the scroll bar might not be visible"); -#endif //now with the huge items, the scrollbar must be visible QTRY_VERIFY(tree.verticalScrollBar()->isVisible()); @@ -1602,9 +1599,6 @@ void tst_QAbstractItemView::testClickedSignal() QSignalSpy clickedSpy(&view, &QTableWidget::clicked); QTest::mouseClick(view.viewport(), Qt::LeftButton, {}, p); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort); -#endif QCOMPARE(clickedSpy.count(), 1); QTest::mouseClick(view.viewport(), Qt::RightButton, {}, p); @@ -2311,9 +2305,6 @@ void tst_QAbstractItemView::QTBUG46785_mouseout_hover_state() QTest::mouseMove(table.viewport(), QPoint(-50, 0)); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "QTest::mouseMove does not work on WinRT", Abort); -#endif QTRY_VERIFY(delegate.m_paintedWithoutHover); } diff --git a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp index 5ac144340d..cca791fe5a 100644 --- a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp +++ b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp @@ -924,10 +924,9 @@ void tst_QColumnView::parentCurrentIndex() QTRY_COMPARE(view.createdColumns[0]->currentIndex(), first); QTRY_COMPARE(view.createdColumns[1]->currentIndex(), second); -#ifndef Q_OS_WINRT // The next two lines should be removed when QTBUG-22707 is resolved. QEXPECT_FAIL("", "QTBUG-22707", Abort); -#endif + QVERIFY(view.createdColumns[2]); QTRY_COMPARE(view.createdColumns[2]->currentIndex(), third); diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index bb098f32c2..1553b6e982 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -706,8 +706,6 @@ void tst_QHeaderView::sectionSize() { #if defined Q_OS_QNX QSKIP("The section size is dpi dependent on QNX"); -#elif defined Q_OS_WINRT - QSKIP("Fails on WinRT - QTBUG-68297"); #endif QFETCH(const IntList, boundsCheck); QFETCH(const IntList, defaultSizes); @@ -809,8 +807,6 @@ void tst_QHeaderView::visualIndexAt() { #if defined Q_OS_QNX QSKIP("The section size is dpi dependent on QNX"); -#elif defined Q_OS_WINRT - QSKIP("Fails on WinRT - QTBUG-68297"); #endif QFETCH(const IntList, hidden); QFETCH(const IntList, from); @@ -1843,10 +1839,6 @@ void tst_QHeaderView::restoreBeforeSetModel() void tst_QHeaderView::defaultSectionSizeTest() { -#if defined Q_OS_WINRT - QSKIP("Fails on WinRT - QTBUG-73309"); -#endif - // Setup QTableView qtv; QHeaderView *hv = qtv.verticalHeader(); @@ -2169,9 +2161,6 @@ void tst_QHeaderView::preserveHiddenSectionWidth() void tst_QHeaderView::invisibleStretchLastSection() { -#ifdef Q_OS_WINRT - QSKIP("Fails on WinRT - QTBUG-68297"); -#endif int count = 6; QStandardItemModel model(1, count); QHeaderView view(Qt::Horizontal); diff --git a/tests/auto/widgets/itemviews/qitemdelegate/CMakeLists.txt b/tests/auto/widgets/itemviews/qitemdelegate/CMakeLists.txt index af1bac9ff0..dfdf263431 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/CMakeLists.txt +++ b/tests/auto/widgets/itemviews/qitemdelegate/CMakeLists.txt @@ -16,7 +16,7 @@ add_qt_test(tst_qitemdelegate ## Scopes: ##################################################################### -extend_target(tst_qitemdelegate CONDITION WIN32 AND NOT WINRT +extend_target(tst_qitemdelegate CONDITION WIN32 PUBLIC_LIBRARIES user32 ) diff --git a/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro b/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro index 916694fd0f..fc617b0e5d 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro +++ b/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro @@ -3,4 +3,4 @@ TARGET = tst_qitemdelegate QT += widgets widgets-private testlib SOURCES += tst_qitemdelegate.cpp -win32:!winrt: QMAKE_USE += user32 +win32: QMAKE_USE += user32 diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp index a9d2b413f0..36ab1a64a6 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp @@ -58,7 +58,7 @@ Q_DECLARE_METATYPE(QAbstractItemDelegate::EndEditHint) -#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) #include #define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ diff --git a/tests/auto/widgets/itemviews/qitemview/BLACKLIST b/tests/auto/widgets/itemviews/qitemview/BLACKLIST deleted file mode 100644 index d5fc89f204..0000000000 --- a/tests/auto/widgets/itemviews/qitemview/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[scrollTo] -winrt diff --git a/tests/auto/widgets/itemviews/qlistview/CMakeLists.txt b/tests/auto/widgets/itemviews/qlistview/CMakeLists.txt index 07c290128e..6e14ba5c99 100644 --- a/tests/auto/widgets/itemviews/qlistview/CMakeLists.txt +++ b/tests/auto/widgets/itemviews/qlistview/CMakeLists.txt @@ -19,7 +19,7 @@ add_qt_test(tst_qlistview ## Scopes: ##################################################################### -extend_target(tst_qlistview CONDITION WIN32 AND NOT WINRT +extend_target(tst_qlistview CONDITION WIN32 PUBLIC_LIBRARIES user32 ) diff --git a/tests/auto/widgets/itemviews/qlistview/qlistview.pro b/tests/auto/widgets/itemviews/qlistview/qlistview.pro index c3e19adc81..7e2062e86e 100644 --- a/tests/auto/widgets/itemviews/qlistview/qlistview.pro +++ b/tests/auto/widgets/itemviews/qlistview/qlistview.pro @@ -2,4 +2,4 @@ CONFIG += testcase TARGET = tst_qlistview QT += widgets gui-private widgets-private core-private testlib testlib-private SOURCES += tst_qlistview.cpp -win32:!winrt: QMAKE_USE += user32 +win32: QMAKE_USE += user32 diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 8c1cff79ec..79ce1e970e 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -125,7 +125,7 @@ private slots: void scrollBarAsNeeded(); void moveItems(); void wordWrap(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) void setCurrentIndexAfterAppendRowCrash(); #endif void emptyItemSize(); @@ -1415,13 +1415,10 @@ void tst_QListView::wordWrap() lv.showNormal(); QTRY_COMPARE(lv.horizontalScrollBar()->isVisible(), false); -#ifdef Q_OS_WINRT -QSKIP("setFixedSize does not work on WinRT. Vertical scroll bar will not be visible."); -#endif QTRY_COMPARE(lv.verticalScrollBar()->isVisible(), true); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) class SetCurrentIndexAfterAppendRowCrashDialog : public QDialog { Q_OBJECT @@ -1473,7 +1470,7 @@ void tst_QListView::setCurrentIndexAfterAppendRowCrash() SetCurrentIndexAfterAppendRowCrashDialog w; w.exec(); } -#endif // Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN void tst_QListView::emptyItemSize() { @@ -2058,9 +2055,6 @@ void tst_QListView::taskQTBUG_21115_scrollToAndHiddenItems_data() void tst_QListView::taskQTBUG_21115_scrollToAndHiddenItems() { QFETCH(QListView::Flow, flow); -#ifdef Q_OS_WINRT - QSKIP("Fails on WinRT - QTBUG-68297"); -#endif ScrollPerItemListView lv; lv.setUniformItemSizes(true); @@ -2253,9 +2247,6 @@ void tst_QListView::testScrollToWithHidden() lv.scrollTo(model.index(26, 0)); int expectedScrollBarValue = lv.verticalScrollBar()->value(); -#ifdef Q_OS_WINRT - QSKIP("Might fail on WinRT - QTBUG-68297"); -#endif QVERIFY(expectedScrollBarValue != 0); lv.scrollTo(model.index(25, 0)); diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index ccc6997f26..aa5a05f9dc 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -2329,14 +2329,6 @@ void tst_QTableView::rowViewportPosition() view.setVerticalScrollMode(verticalScrollMode); view.verticalScrollBar()->setValue(verticalScrollValue); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("row 1, scroll per item, 1", "Fails on WinRT - QTBUG-68297", Abort); - QEXPECT_FAIL("row 5, scroll per item, 5", "Fails on WinRT - QTBUG-68297", Abort); - QEXPECT_FAIL("row 9, scroll per item, 5", "Fails on WinRT - QTBUG-68297", Abort); - QEXPECT_FAIL("row 1, scroll per pixel, 1", "Fails on WinRT - QTBUG-68297", Abort); - QEXPECT_FAIL("row 5, scroll per pixel, 5", "Fails on WinRT - QTBUG-68297", Abort); - QEXPECT_FAIL("row 9, scroll per pixel, 5", "Fails on WinRT - QTBUG-68297", Abort); -#endif QCOMPARE(view.rowViewportPosition(row), rowViewportPosition); } @@ -2500,13 +2492,6 @@ void tst_QTableView::columnViewportPosition() view.setHorizontalScrollMode(horizontalScrollMode); view.horizontalScrollBar()->setValue(horizontalScrollValue); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("column 5, scroll per item, 5", "Fails on WinRT - QTBUG-68297", Abort); - QEXPECT_FAIL("column 9, scroll per item, 5", "Fails on WinRT - QTBUG-68297", Abort); - QEXPECT_FAIL("column 1, scroll per pixel 1", "Fails on WinRT - QTBUG-68297", Abort); - QEXPECT_FAIL("column 5, scroll per pixel 5", "Fails on WinRT - QTBUG-68297", Abort); - QEXPECT_FAIL("column 9, scroll per pixel 5", "Fails on WinRT - QTBUG-68297", Abort); -#endif QCOMPARE(view.columnViewportPosition(column), columnViewportPosition); } diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 760dcac608..f85b885b34 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -893,9 +893,6 @@ void tst_QTreeView::horizontalScrollMode() QCOMPARE(view.horizontalScrollMode(), QAbstractItemView::ScrollPerPixel); QCOMPARE(view.horizontalScrollBar()->minimum(), 0); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "setFixedSize does not work on WinRT - QTBUG-68297", Abort); -#endif QVERIFY(view.horizontalScrollBar()->maximum() > 2); view.setHorizontalScrollMode(QAbstractItemView::ScrollPerItem); @@ -2068,10 +2065,6 @@ void tst_QTreeView::setSelection() QVERIFY(selectionModel); const QModelIndexList selectedIndexes = selectionModel->selectedIndexes(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("(0,-20,20,50),rows", "Fails on WinRT - QTBUG-68297", Abort); - QEXPECT_FAIL("(0,-50,20,90),rows", "Fails on WinRT - QTBUG-68297", Abort); -#endif QCOMPARE(selectedIndexes.count(), expectedItems.count()); for (const QModelIndex &idx : selectedIndexes) QVERIFY(expectedItems.contains(QPoint(idx.column(), idx.row()))); diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index 17617e0734..009086eebd 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -3487,9 +3487,8 @@ void tst_QTreeWidget::taskQTBUG_34717_collapseAtBottom() void tst_QTreeWidget::task20345_sortChildren() { - if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive) - || !QGuiApplication::platformName().compare(QLatin1String("winrt"), Qt::CaseInsensitive)) - QSKIP("Wayland/WinRT: This causes a crash triggered by setVisible(false)"); + if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive)) + QSKIP("Wayland: This causes a crash triggered by setVisible(false)"); // This test case is considered successful if it is executed (no crash in sorting) QTreeWidget tw; diff --git a/tests/auto/widgets/kernel/qapplication/CMakeLists.txt b/tests/auto/widgets/kernel/qapplication/CMakeLists.txt index 8e68089f5e..3bb7e31691 100644 --- a/tests/auto/widgets/kernel/qapplication/CMakeLists.txt +++ b/tests/auto/widgets/kernel/qapplication/CMakeLists.txt @@ -1,7 +1,5 @@ # Generated from qapplication.pro. +add_subdirectory(desktopsettingsaware) +add_subdirectory(modal) add_subdirectory(test) -if(NOT WINRT) - add_subdirectory(desktopsettingsaware) - add_subdirectory(modal) -endif() diff --git a/tests/auto/widgets/kernel/qapplication/qapplication.pro b/tests/auto/widgets/kernel/qapplication/qapplication.pro index 21bfb50aee..5154c915cd 100644 --- a/tests/auto/widgets/kernel/qapplication/qapplication.pro +++ b/tests/auto/widgets/kernel/qapplication/qapplication.pro @@ -1,6 +1,6 @@ TEMPLATE = subdirs -!winrt: SUBDIRS = desktopsettingsaware modal +SUBDIRS = desktopsettingsaware modal test.depends += $$SUBDIRS SUBDIRS += test diff --git a/tests/auto/widgets/kernel/qapplication/test/.prev_CMakeLists.txt b/tests/auto/widgets/kernel/qapplication/test/.prev_CMakeLists.txt index 40e612f0de..7f92e1cee8 100644 --- a/tests/auto/widgets/kernel/qapplication/test/.prev_CMakeLists.txt +++ b/tests/auto/widgets/kernel/qapplication/test/.prev_CMakeLists.txt @@ -29,14 +29,14 @@ extend_target(test CONDITION builtin_testdata BUILTIN_TESTDATA ) -#### Keys ignored in scope 3:.:.:test.pro:NOT ANDROID AND NOT WINRT: +#### Keys ignored in scope 3:.:.:test.pro:NOT ANDROID: # SUBPROGRAMS = "desktopsettingsaware" "modal" -#### Keys ignored in scope 6:.:.:test.pro:NOT ANDROID AND NOT WINRT: +#### Keys ignored in scope 6:.:.:test.pro:NOT ANDROID: # TEST_HELPER_INSTALLS = "../debug/helper" -#### Keys ignored in scope 8:.:.:test.pro:NOT ANDROID AND NOT WINRT: +#### Keys ignored in scope 8:.:.:test.pro:NOT ANDROID: # TEST_HELPER_INSTALLS = "../release/helper" -#### Keys ignored in scope 10:.:.:test.pro:NOT ANDROID AND NOT WINRT: +#### Keys ignored in scope 10:.:.:test.pro:NOT ANDROID: # TEST_HELPER_INSTALLS = "../helper" diff --git a/tests/auto/widgets/kernel/qapplication/test/CMakeLists.txt b/tests/auto/widgets/kernel/qapplication/test/CMakeLists.txt index 171ee1b273..304480f509 100644 --- a/tests/auto/widgets/kernel/qapplication/test/CMakeLists.txt +++ b/tests/auto/widgets/kernel/qapplication/test/CMakeLists.txt @@ -30,14 +30,14 @@ extend_target(tst_qapplication CONDITION builtin_testdata # special case BUILTIN_TESTDATA ) -#### Keys ignored in scope 3:.:.:test.pro:NOT ANDROID AND NOT WINRT: +#### Keys ignored in scope 3:.:.:test.pro:NOT ANDROID: # SUBPROGRAMS = "desktopsettingsaware" "modal" -#### Keys ignored in scope 6:.:.:test.pro:NOT ANDROID AND NOT WINRT: +#### Keys ignored in scope 6:.:.:test.pro:NOT ANDROID: # TEST_HELPER_INSTALLS = "../debug/helper" -#### Keys ignored in scope 8:.:.:test.pro:NOT ANDROID AND NOT WINRT: +#### Keys ignored in scope 8:.:.:test.pro:NOT ANDROID: # TEST_HELPER_INSTALLS = "../release/helper" -#### Keys ignored in scope 10:.:.:test.pro:NOT ANDROID AND NOT WINRT: +#### Keys ignored in scope 10:.:.:test.pro:NOT ANDROID: # TEST_HELPER_INSTALLS = "../helper" diff --git a/tests/auto/widgets/kernel/qapplication/test/test.pro b/tests/auto/widgets/kernel/qapplication/test/test.pro index 8ade4d8364..39b099261a 100644 --- a/tests/auto/widgets/kernel/qapplication/test/test.pro +++ b/tests/auto/widgets/kernel/qapplication/test/test.pro @@ -9,20 +9,20 @@ builtin_testdata: DEFINES += BUILTIN_TESTDATA TESTDATA = ../test/test.pro ../tmp/README ../modal -!android:!winrt: SUBPROGRAMS = desktopsettingsaware modal +!android: SUBPROGRAMS = desktopsettingsaware modal debug_and_release { CONFIG(debug, debug|release) { TARGET = ../../debug/tst_qapplication - !android:!winrt: TEST_HELPER_INSTALLS = ../debug/helper + !android: TEST_HELPER_INSTALLS = ../debug/helper for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../debug/$${file}" } else { TARGET = ../../release/tst_qapplication - !android:!winrt: TEST_HELPER_INSTALLS = ../release/helper + !android: TEST_HELPER_INSTALLS = ../release/helper for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../release/$${file}" } } else { TARGET = ../tst_qapplication - !android:!winrt: TEST_HELPER_INSTALLS = ../helper + !android: TEST_HELPER_INSTALLS = ../helper for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../$${file}" } diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index c9857b4379..b0689f5c16 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -241,9 +241,6 @@ public: void tst_QApplication::alert() { -#ifdef Q_OS_WINRT - QSKIP("WinRT does not support more than 1 native widget at the same time"); -#endif int argc = 0; QApplication app(argc, nullptr); QApplication::alert(nullptr, 0); @@ -811,9 +808,6 @@ public: void tst_QApplication::closeAllWindows() { -#ifdef Q_OS_WINRT - QSKIP("PromptOnCloseWidget does not work on WinRT - QTBUG-68297"); -#endif int argc = 0; QApplication app(argc, nullptr); @@ -922,9 +916,6 @@ void tst_QApplication::libraryPaths() expected = QSet(expected.constBegin(), expected.constEnd()).values(); expected.sort(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "On WinRT PluginsPath is outside of sandbox. QTBUG-68297", Abort); -#endif QVERIFY2(isPathListIncluded(actual, expected), qPrintable("actual:\n - " + actual.join("\n - ") + "\nexpected:\n - " + expected.join("\n - "))); @@ -1032,9 +1023,6 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2() << QDir(QCoreApplication::applicationDirPath()).canonicalPath() << QDir(QDir::fromNativeSeparators(QString::fromLatin1(validPath))).canonicalPath(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "On WinRT PluginsPath is outside of sandbox. QTBUG-68297", Abort); -#endif QVERIFY2(isPathListIncluded(QCoreApplication::libraryPaths(), expected), qPrintable("actual:\n - " + QCoreApplication::libraryPaths().join("\n - ") + "\nexpected:\n - " + expected.join("\n - "))); @@ -1753,9 +1741,6 @@ void tst_QApplication::focusMouseClick() QSpontaneKeyEvent::setSpontaneous(&ev); QVERIFY(ev.spontaneous()); qApp->notify(&w2, &ev); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort); -#endif QTRY_COMPARE(QApplication::focusWidget(), &w2); // now back to tab focus and click again (it already had focus) -> focus should stay diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp index 45a35fe4f1..fd4ce89b56 100644 --- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp @@ -282,9 +282,6 @@ void tst_QFormLayout::wrapping() w.setWindowTitle(QTest::currentTestFunction()); w.show(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "setFixedWidth does not work on WinRT", Abort); -#endif QCOMPARE(le->geometry().y() > lbl->geometry().y(), true); //TODO: additional tests covering different wrapping cases diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp index c8fe1841c8..55116fe8c0 100644 --- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp +++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp @@ -337,7 +337,7 @@ void tst_QLayout::adjustSizeShouldMakeSureLayoutIsActivated() void tst_QLayout::testRetainSizeWhenHidden() { -#if (defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)) || defined(Q_OS_WINRT) +#if (defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)) QSKIP("Test does not work on platforms which default to showMaximized()"); #endif diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 55738ca036..9df4e4c1ab 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -39,9 +39,6 @@ rhel-7.6 centos opensuse-leap ubuntu -[windowState] -# QTBUG-75270 -winrt [syntheticEnterLeave] macos # Can't move cursor (QTBUG-76312) diff --git a/tests/auto/widgets/kernel/qwidget/CMakeLists.txt b/tests/auto/widgets/kernel/qwidget/CMakeLists.txt index dc47e7d9d9..bf7544c393 100644 --- a/tests/auto/widgets/kernel/qwidget/CMakeLists.txt +++ b/tests/auto/widgets/kernel/qwidget/CMakeLists.txt @@ -51,7 +51,7 @@ extend_target(tst_qwidget CONDITION APPLE ${FWSecurity} ) -extend_target(tst_qwidget CONDITION WIN32 AND NOT WINRT +extend_target(tst_qwidget CONDITION WIN32 PUBLIC_LIBRARIES gdi32 user32 diff --git a/tests/auto/widgets/kernel/qwidget/qwidget.pro b/tests/auto/widgets/kernel/qwidget/qwidget.pro index d3fbd6d0d9..98c0102d9f 100644 --- a/tests/auto/widgets/kernel/qwidget/qwidget.pro +++ b/tests/auto/widgets/kernel/qwidget/qwidget.pro @@ -16,4 +16,4 @@ mac { OBJECTIVE_SOURCES += tst_qwidget_mac_helpers.mm } -win32:!winrt: QMAKE_USE += user32 gdi32 +win32: QMAKE_USE += user32 gdi32 diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 365f64014a..a999ea05df 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -84,7 +84,7 @@ using namespace QTestPrivate; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) # include # include #include @@ -106,7 +106,7 @@ static HWND winHandleOf(const QWidget *w) if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ QSKIP("desktop is not visible, this test would fail"); -#else // Q_OS_WIN && !Q_OS_WINRT +#else // Q_OS_WIN # define Q_CHECK_PAINTEVENTS #endif @@ -121,7 +121,7 @@ bool macHasAccessToWindowsServer() } #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) static inline void setWindowsAnimationsEnabled(bool enabled) { ANIMATIONINFO animation = { sizeof(ANIMATIONINFO), enabled }; @@ -134,10 +134,10 @@ static inline bool windowsAnimationsEnabled() SystemParametersInfo(SPI_GETANIMATION, 0, &animation, 0); return animation.iMinAnimate; } -#else // Q_OS_WIN && !Q_OS_WINRT +#else // Q_OS_WIN inline void setWindowsAnimationsEnabled(bool) {} static inline bool windowsAnimationsEnabled() { return false; } -#endif // !Q_OS_WIN || Q_OS_WINRT +#endif // !Q_OS_WIN template static QByteArray msgComparisonFailed(T v1, const char *op, T v2) @@ -192,7 +192,7 @@ private slots: void appFocusWidgetWithFocusProxyLater(); void appFocusWidgetWhenLosingFocusProxy(); void explicitTabOrderWithComplexWidget(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) void activation(); #endif void reparent(); @@ -269,7 +269,7 @@ private slots: void subtractOpaqueSiblings(); -#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) void setGeometry_win(); #endif @@ -339,7 +339,7 @@ private slots: void quitOnCloseAttribute(); void moveRect(); -#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) void gdiPainting(); void paintOnScreenPossible(); #endif @@ -577,7 +577,7 @@ void tst_QWidget::getSetCheck() QCOMPARE(true, obj1.autoFillBackground()); var1.reset(); -#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) obj1.setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint); const HWND handle = reinterpret_cast(obj1.winId()); // explicitly create window handle QVERIFY(GetWindowLong(handle, GWL_STYLE) & LONG(WS_POPUP)); @@ -1384,7 +1384,7 @@ void tst_QWidget::visible_setWindowOpacity() QVERIFY( !testWidget->isVisible() ); testWidget->setWindowOpacity(0.5); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) QVERIFY(!::IsWindowVisible(winHandleOf(testWidget.data()))); #endif testWidget->setWindowOpacity(1.0); @@ -1574,7 +1574,7 @@ void tst_QWidget::mapFromAndTo() subWindow2->setGeometry(75, 75, 100, 100); subSubWindow->setGeometry(10, 10, 10, 10); -#if !defined(Q_OS_QNX) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_QNX) //update visibility if (windowMinimized) { if (!windowHidden) { @@ -2276,7 +2276,7 @@ void tst_QWidget::explicitTabOrderWithComplexWidget() QTRY_COMPARE(QApplication::focusWidget(), lineEditOne); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) void tst_QWidget::activation() { Q_CHECK_PAINTEVENTS @@ -2321,8 +2321,7 @@ void tst_QWidget::windowState() QPoint pos; QSize size = m_testWidgetSize; if (QGuiApplicationPrivate::platformIntegration()->defaultWindowState(Qt::Widget) - == Qt::WindowFullScreen - || m_platform == QStringLiteral("winrt")) { + == Qt::WindowFullScreen) { size = QGuiApplication::primaryScreen()->size(); } else { pos = QPoint(10, 10); @@ -2526,8 +2525,6 @@ void tst_QWidget::showFullScreen() QSKIP("QTBUG-52974"); #endif - if (m_platform == QStringLiteral("winrt")) - QSKIP("WinRT: This fails. QTBUG-68297"); QWidget plain; QHBoxLayout *layout; QWidget layouted; @@ -2651,8 +2648,6 @@ void tst_QWidget::resizeEvent() wTopLevel.resize(m_testWidgetSize); wTopLevel.show(); QVERIFY(QTest::qWaitForWindowExposed(&wTopLevel)); - if (m_platform == QStringLiteral("winrt")) - QEXPECT_FAIL("", "WinRT does not support resize", Abort); QCOMPARE (wTopLevel.m_resizeEventCount, 1); // initial resize event before paint for toplevels wTopLevel.hide(); QSize safeSize(640,480); @@ -2683,9 +2678,6 @@ void tst_QWidget::showMinimized() plain.showMinimized(); QVERIFY(plain.isMinimized()); QVERIFY(plain.isVisible()); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Winrt does not support move and resize", Abort); -#endif QVERIFY2(HighDpi::fuzzyCompare(plain.pos(), pos, m_fuzz), qPrintable(HighDpi::msgPointMismatch(plain.pos(), pos))); @@ -2845,15 +2837,11 @@ void tst_QWidget::showMinimizedKeepsFocus() #ifdef Q_OS_MACOS if (!macHasAccessToWindowsServer()) QEXPECT_FAIL("", "When not having WindowServer access, we lose focus.", Continue); -#elif defined(Q_OS_WINRT) - QEXPECT_FAIL("", "Winrt fails here - QTBUG-68297", Continue); #endif QTRY_COMPARE(window.focusWidget(), firstchild); #ifdef Q_OS_MACOS if (!macHasAccessToWindowsServer()) QEXPECT_FAIL("", "When not having WindowServer access, we lose focus.", Continue); -#elif defined(Q_OS_WINRT) - QEXPECT_FAIL("", "Winrt fails here - QTBUG-68297", Continue); #endif QTRY_COMPARE(QApplication::focusWidget(), firstchild); } @@ -2884,9 +2872,6 @@ void tst_QWidget::reparent() parent.show(); childTLW.show(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "WinRT does not support more than 1 top level widget", Abort); -#endif QVERIFY(QTest::qWaitForWindowExposed(&parent)); parent.move(parentPosition); @@ -2984,8 +2969,6 @@ void tst_QWidget::normalGeometry() if (m_platform == QStringLiteral("wayland")) QSKIP("Wayland: This fails. Figure out why."); - else if (m_platform == QStringLiteral("winrt")) - QSKIP("WinRT: This fails. Figure out why - QTBUG-68297."); QWidget parent; parent.setWindowTitle("NormalGeometry parent"); QWidget *child = new QWidget(&parent); @@ -3098,8 +3081,6 @@ void tst_QWidget::setGeometry() tlw.setGeometry(tr); child.setGeometry(cr); tlw.showNormal(); - if (m_platform == QStringLiteral("winrt")) - QEXPECT_FAIL("", "WinRT does not support setGeometry", Abort); QTRY_COMPARE(tlw.geometry().size(), tr.size()); QCOMPARE(child.geometry(), cr); @@ -3606,8 +3587,6 @@ void tst_QWidget::saveRestoreGeometry() QVERIFY(QTest::qWaitForWindowExposed(&widget)); QApplication::processEvents(); - if (m_platform == QStringLiteral("winrt")) - QEXPECT_FAIL("", "WinRT does not support move/resize", Abort); QTRY_VERIFY2(HighDpi::fuzzyCompare(widget.pos(), position, m_fuzz), qPrintable(HighDpi::msgPointMismatch(widget.pos(), position))); QCOMPARE(widget.size(), size); @@ -3785,9 +3764,6 @@ void tst_QWidget::restoreVersion1Geometry() QVERIFY(QTest::qWaitForWindowExposed(&widget)); QTest::qWait(100); - if (m_platform == QStringLiteral("winrt")) - QEXPECT_FAIL("", "WinRT does not support restoreGeometry", Abort); - if (expectedWindowState == Qt::WindowNoState) { QTRY_COMPARE(widget.size(), expectedSize); QCOMPARE(widget.geometry(), expectedNormalGeometry); @@ -3833,8 +3809,6 @@ void tst_QWidget::widgetAt() QSKIP("Wayland: This fails. Figure out why."); if (m_platform == QStringLiteral("offscreen")) QSKIP("Platform offscreen does not support lower()/raise() or WindowMasks"); - if (m_platform == QStringLiteral("winrt")) - QSKIP("WinRT does not support more than 1 top level widget"); Q_CHECK_PAINTEVENTS @@ -4136,8 +4110,6 @@ void tst_QWidget::optimizedResizeMove() staticWidget.gotPaintEvent = false; staticWidget.move(staticWidget.pos() + QPoint(10, 10)); QTest::qWait(20); - if (m_platform == QStringLiteral("winrt")) - QEXPECT_FAIL("", "WinRT does not support move/resize", Abort); QCOMPARE(staticWidget.gotPaintEvent, false); staticWidget.gotPaintEvent = false; @@ -4241,8 +4213,6 @@ void tst_QWidget::optimizedResize_topLevel() QTRY_VERIFY(topLevel.gotPaintEvent); if (m_platform == QStringLiteral("xcb") || m_platform == QStringLiteral("offscreen")) QSKIP("QTBUG-26424"); - else if (m_platform == QStringLiteral("winrt")) - QEXPECT_FAIL("", "WinRT does not support move/resize", Abort); QCOMPARE(topLevel.partial, true); QCOMPARE(topLevel.paintedRegion, expectedUpdateRegion); } @@ -4349,8 +4319,6 @@ void tst_QWidget::setFixedSize() QVERIFY(QTest::qWaitForWindowActive(&w)); if (m_platform == QStringLiteral("xcb")) QSKIP("QTBUG-26424"); - else if (m_platform == QStringLiteral("winrt")) - QEXPECT_FAIL("", "WinRT does not support move/resize", Abort); QCOMPARE(w.size(), defaultSize + QSize(150,150)); } @@ -4600,8 +4568,6 @@ void tst_QWidget::transientParent() void tst_QWidget::showNativeChild() { - if (m_platform == QStringLiteral("winrt")) - QSKIP("WinRT does not support setGeometry"); QWidget topLevel; topLevel.setGeometry(QRect(m_availableTopLeft + QPoint(100, 100), m_testWidgetSize)); topLevel.setWindowTitle(__FUNCTION__); @@ -4780,8 +4746,6 @@ void tst_QWidget::update() // widgets are transparent by default, so both should get repaints { - if (m_platform == QStringLiteral("winrt")) - QEXPECT_FAIL("", "WinRT does not support setGeometry", Abort); QApplication::processEvents(); QApplication::processEvents(); QCOMPARE(child.numPaintEvents, 1); @@ -5023,8 +4987,6 @@ void tst_QWidget::scroll() QCoreApplication::processEvents(); QRegion dirty(QRect(0, 0, w, 10)); dirty += QRegion(QRect(0, 10, 10, h - 10)); - if (m_platform == QStringLiteral("winrt")) - QEXPECT_FAIL("", "WinRT does not support move/resize", Abort); QTRY_COMPARE(updateWidget.paintedRegion, dirty); } @@ -5186,8 +5148,6 @@ void tst_QWidget::setWindowGeometry() { if (m_platform == QStringLiteral("xcb")) QSKIP("X11: Skip this test due to Window manager positioning issues."); - else if (m_platform == QStringLiteral("winrt")) - QSKIP("WinRT does not support setWindowGeometry"); QFETCH(Rects, rects); QFETCH(int, windowFlags); @@ -5319,7 +5279,7 @@ void tst_QWidget::setWindowGeometry() } } -#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) void tst_QWidget::setGeometry_win() { QWidget widget; @@ -5340,7 +5300,7 @@ void tst_QWidget::setGeometry_win() QVERIFY2(rt.top <= m_availableTopLeft.y(), msgComparisonFailed(int(rt.top), "<=", m_availableTopLeft.y())); } -#endif // defined (Q_OS_WIN) && !defined(Q_OS_WINRT) +#endif // defined (Q_OS_WIN) // Since X11 WindowManager operation are all async, and we have no way to know if the window // manager has finished playing with the window geometry, this test can't be reliable on X11. @@ -5356,8 +5316,6 @@ void tst_QWidget::windowMoveResize() QSKIP("X11: Skip this test due to Window manager positioning issues."); if (m_platform == QStringLiteral("wayland")) QSKIP("Wayland: This fails. Figure out why."); - if (m_platform == QStringLiteral("winrt")) - QSKIP("WinRT does not support move/resize"); QFETCH(Rects, rects); QFETCH(int, windowFlags); @@ -5681,8 +5639,6 @@ void tst_QWidget::moveChild() QTRY_COMPARE(parent.r, QRegion(parent.rect()) - child.geometry()); QTRY_COMPARE(child.r, QRegion(child.rect())); - if (m_platform == QStringLiteral("winrt")) - QSKIP("WinRT does not support setGeometry (and we cannot use QEXPECT_FAIL because of VERIFY_COLOR)"); VERIFY_COLOR(child, child.rect(), child.color); VERIFY_COLOR(parent, QRegion(parent.rect()) - child.geometry(), parent.color); @@ -5739,8 +5695,6 @@ void tst_QWidget::showAndMoveChild() child.move(desktopDimensions.width()/2, desktopDimensions.height()/2); QCoreApplication::processEvents(); - if (m_platform == QStringLiteral("winrt")) - QSKIP("WinRT does not support setGeometry (and we cannot use QEXPECT_FAIL because of VERIFY_COLOR)"); VERIFY_COLOR(child, child.rect(), Qt::blue); VERIFY_COLOR(parent, QRegion(parent.rect()) - child.geometry(), Qt::red); } @@ -5831,8 +5785,6 @@ void tst_QWidget::multipleToplevelFocusCheck() if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) QSKIP("Window activation is not supported"); - else if (m_platform == QStringLiteral("winrt")) - QSKIP("Winrt: Sometimes crashes in QTextLayout. - QTBUG-68297"); TopLevelFocusCheck w1; TopLevelFocusCheck w2; @@ -5991,8 +5943,6 @@ void tst_QWidget::setFocus() testWidget->clearFocus(); child1.setFocus(); - if (m_platform == QStringLiteral("winrt")) - QEXPECT_FAIL("", "WinRT fails here - QTBUG-68297", Abort); QVERIFY(!child1.hasFocus()); QCOMPARE(window.focusWidget(), &child1); QCOMPARE(QApplication::focusWidget(), nullptr); @@ -6692,8 +6642,6 @@ QByteArray EventRecorder::msgEventListMismatch(const EventList &expected, const void tst_QWidget::childEvents() { - if (m_platform == QStringLiteral("winrt")) - QSKIP("WinRT: This fails. QTBUG-68297."); EventRecorder::EventList expected; // Move away the cursor; otherwise it might result in an enter event if it's @@ -7092,8 +7040,6 @@ void tst_QWidget::renderInvisible() { if (m_platform == QStringLiteral("xcb")) QSKIP("QTBUG-26424"); - if (m_platform == QStringLiteral("winrt")) - QSKIP("WinRT: This fails. QTBUG-68297."); QScopedPointer calendar(new QCalendarWidget); calendar->move(m_availableTopLeft + QPoint(100, 100)); @@ -8042,8 +7988,6 @@ void tst_QWidget::hideOpaqueChildWhileHidden() child.hide(); child2.hide(); - if (m_platform == QStringLiteral("winrt")) - QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort); QTRY_COMPARE(w.r, QRegion(child.geometry())); child.show(); @@ -8082,8 +8026,6 @@ void tst_QWidget::updateWhileMinimized() // Make sure update requests are discarded until the widget is shown again. widget.update(0, 0, 50, 50); QTest::qWait(10); - if (m_platform == QStringLiteral("winrt")) - QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort); int count = 0; // mutter/GNOME Shell doesn't unmap when minimizing window. // More details at https://gitlab.gnome.org/GNOME/mutter/issues/185 @@ -8655,8 +8597,6 @@ void tst_QWidget::doubleRepaint() #if defined(Q_OS_QNX) QEXPECT_FAIL("", "Platform does not support showMinimized()", Continue); #endif - if (m_platform == QStringLiteral("winrt")) - QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort); QCOMPARE(widget.numPaintEvents, 0); widget.numPaintEvents = 0; @@ -8781,8 +8721,6 @@ void tst_QWidget::setMaskInResizeEvent() QRegion expectedParentUpdate(0, 0, 100, 10); // Old testWidget area. expectedParentUpdate += testWidget.geometry(); // New testWidget area. - if (m_platform == QStringLiteral("winrt")) - QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort); QTRY_COMPARE(w.paintedRegion, expectedParentUpdate); QTRY_COMPARE(testWidget.paintedRegion, testWidget.mask()); @@ -9015,7 +8953,7 @@ void tst_QWidget::moveRect() child.move(10, 10); // Don't crash. } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) class GDIWidget : public QDialog { Q_OBJECT @@ -9082,7 +9020,7 @@ void tst_QWidget::paintOnScreenPossible() w2.setAttribute(Qt::WA_PaintOnScreen); QVERIFY(w2.testAttribute(Qt::WA_PaintOnScreen)); } -#endif // Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN void tst_QWidget::reparentStaticWidget() { @@ -9240,8 +9178,6 @@ void tst_QWidget::translucentWidget() const QImage actual = widgetSnapshot.toImage().convertToFormat(QImage::Format_RGB32); QImage expected = pm.toImage().scaled(label.devicePixelRatioF() * pm.size()); expected.setDevicePixelRatio(label.devicePixelRatioF()); - if (m_platform == QStringLiteral("winrt")) - QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort); QCOMPARE(actual.size(),expected.size()); QCOMPARE(actual,expected); @@ -9963,8 +9899,6 @@ void tst_QWidget::rectOutsideCoordinatesLimit_task144779() correct.fill(Qt::green); const QPixmap mainPixmap = grabFromWidget(&main, QRect(QPoint(0, 0), QSize(-1, -1))); - if (m_platform == QStringLiteral("winrt")) - QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort); QTRY_COMPARE(mainPixmap.toImage().convertToFormat(QImage::Format_RGB32), correct.toImage().convertToFormat(QImage::Format_RGB32)); #ifndef QT_NO_CURSOR @@ -10058,8 +9992,6 @@ void tst_QWidget::activateWindow() QCoreApplication::processEvents(); QTRY_VERIFY(mainwindow->isActiveWindow()); - if (m_platform == QStringLiteral("winrt")) - QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort); QTRY_VERIFY(!mainwindow2->isActiveWindow()); } @@ -11363,8 +11295,6 @@ void tst_QWidget::resizeStaticContentsChildWidget_QTBUG35282() widget.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); - if (m_platform == QStringLiteral("winrt")) - QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort); QCOMPARE(childWidget.numPaintEvents, 0); childWidget.reset(); diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp index 72fa32a1b1..ee40fc56c9 100644 --- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp @@ -192,9 +192,6 @@ void tst_QWidget_window::tst_move_show() const QPoint pos(100, 100); w.move(pos); w.show(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Winrt does not support move", Abort); -#endif QVERIFY2(qFuzzyCompareWindowPosition(w.pos(), pos, m_fuzz), qPrintable(msgPointMismatch(w.pos(), pos))); } @@ -226,9 +223,6 @@ void tst_QWidget_window::tst_resize_show() QWidget w; w.resize(m_testWidgetSize); w.show(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Winrt does not support resize", Abort); -#endif QCOMPARE(w.size(), m_testWidgetSize); } @@ -418,8 +412,7 @@ void tst_QWidget_window::tst_exposeObscuredMapped_QTBUG39220() const auto integration = QGuiApplicationPrivate::platformIntegration(); if (!integration->hasCapability(QPlatformIntegration::MultipleWindows) - || !integration->hasCapability(QPlatformIntegration::NonFullScreenWindows) - || QGuiApplication::platformName() == QLatin1String("winrt")) { + || !integration->hasCapability(QPlatformIntegration::NonFullScreenWindows)) { QSKIP("The platform does not have the required capabilities"); } // QTBUG-39220: Fully obscured parent widgets may not receive expose @@ -631,9 +624,6 @@ void tst_QWidget_window::tst_dnd() QWidget *dropsAcceptingWidget3 = new DnDEventLoggerWidget(&log, &dndTestWidget, true); dropsAcceptingWidget3->setAcceptDrops(true); dropsAcceptingWidget3->setObjectName(QLatin1String("acceptingDropsWidget3")); - // 260 + 40 = 300 = widget size, must not be more than that. - // otherwise it will break WinRT because there the tlw is maximized every time - // and this window will receive one more event dropsAcceptingWidget3->resize(180, 40); dropsAcceptingWidget3->move(10, 260); @@ -994,9 +984,6 @@ void tst_QWidget_window::tst_resize_count() resize.setWindowFlags(Qt::X11BypassWindowManagerHint); resize.show(); QVERIFY(QTest::qWaitForWindowExposed(&resize)); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Winrt does not support resize", Abort); -#endif QCOMPARE(resize.resizeCount, 1); resize.resizeCount = 0; QSize size = resize.size(); @@ -1274,11 +1261,6 @@ void tst_QWidget_window::setWindowState() w.setWindowState(state); QCOMPARE(w.windowState(), state); w.show(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("0", "Winrt windows are maximized by default", Abort); - QEXPECT_FAIL("Qt::WindowMinimized", "Winrt windows are maximized by default", Abort); - QEXPECT_FAIL("Qt::WindowFullScreen", "Winrt windows are maximized by default", Abort); -#endif QCOMPARE(w.windowState(), state); QCOMPARE(w.windowHandle()->windowStates(), state); if (!(state & Qt::WindowMinimized)) diff --git a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp index 98aebfe975..2a8edaf1a2 100644 --- a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp +++ b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp @@ -107,9 +107,6 @@ void tst_QWindowContainer::testShow() root.show(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort); -#endif QVERIFY(QTest::qWaitForWindowExposed(window)); } @@ -149,9 +146,6 @@ void tst_QWindowContainer::testExposeObscure() container->show(); QVERIFY(QTest::qWaitForWindowExposed(container.data())); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort); -#endif QVERIFY(QTest::qWaitForWindowExposed(window)); QVERIFY(window->numberOfExposes > 0); @@ -273,9 +267,6 @@ void tst_QWindowContainer::testUnparentReparent() QTRY_VERIFY(!window->isVisible()); container->show(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort); -#endif QVERIFY(QTest::qWaitForWindowExposed(window)); QTRY_VERIFY(window->isVisible()); @@ -383,9 +374,6 @@ void tst_QWindowContainer::testNativeContainerParent() root.show(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort); -#endif QVERIFY(QTest::qWaitForWindowExposed(window)); QTRY_COMPARE(window->parent(), container->windowHandle()); } diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp index 58dbfeb118..3b7495fda8 100644 --- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp +++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp @@ -75,7 +75,7 @@ private slots: void testFusionStyle(); #endif void testWindowsStyle(); -#if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSVISTA) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSVISTA) void testWindowsVistaStyle(); #endif #ifdef Q_OS_MAC @@ -183,9 +183,6 @@ void tst_QStyle::drawItemPixmap() QVERIFY(image.reinterpretAsFormat(QImage::Format_RGB32)); const QRgb *bits = reinterpret_cast(image.constBits()); const QRgb *end = bits + image.sizeInBytes() / sizeof(QRgb); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "QWidget::resize does not work on WinRT", Continue); -#endif QVERIFY(std::all_of(bits, end, [green] (QRgb r) { return r == green; })); } @@ -319,7 +316,7 @@ void tst_QStyle::testWindowsStyle() wstyle->drawControl(QStyle::CE_ProgressBar, &pb, &painter, nullptr); } -#if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSVISTA) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSVISTA) void tst_QStyle::testWindowsVistaStyle() { QScopedPointer vistastyle(QStyleFactory::create("WindowsVista")); @@ -515,9 +512,6 @@ void tst_QStyle::testFrameOnlyAroundContents() area.verticalScrollBar()->setStyle(&frameStyle); area.setStyle(&frameStyle); // Test that we reserve space for scrollbar spacing -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "QWidget::setGeometry does not work on WinRT", Continue); -#endif QCOMPARE(viewPortWidth, area.viewport()->width() + SCROLLBAR_SPACING); } diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp index dcc3837d0d..5b7ba0dbb8 100644 --- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp @@ -625,9 +625,6 @@ void tst_QCompleter::fileSystemModel_data() void tst_QCompleter::fileSystemModel() { -#ifdef Q_OS_WINRT - QSKIP("WinRT cannot access directories outside of the application's sandbox"); -#endif //QFileSystemModel is assync. filter(true); } @@ -1665,9 +1662,6 @@ void tst_QCompleter::QTBUG_14292_filesystem() // Wait for all file system model slots/timers to trigger // until the model sees the subdirectories. -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort); -#endif QTRY_VERIFY(testFileSystemReady(model)); // But this should not cause the combo to pop up. QVERIFY(!comp.popup()->isVisible()); diff --git a/tests/auto/widgets/widgets/CMakeLists.txt b/tests/auto/widgets/widgets/CMakeLists.txt index 60776f5da2..5421fdf378 100644 --- a/tests/auto/widgets/widgets/CMakeLists.txt +++ b/tests/auto/widgets/widgets/CMakeLists.txt @@ -16,7 +16,6 @@ add_subdirectory(qfocusframe) add_subdirectory(qfontcombobox) add_subdirectory(qframe) add_subdirectory(qgroupbox) -add_subdirectory(qkeysequenceedit) add_subdirectory(qlabel) add_subdirectory(qlcdnumber) add_subdirectory(qlineedit) @@ -41,7 +40,6 @@ add_subdirectory(qtabwidget) add_subdirectory(qtextbrowser) add_subdirectory(qtoolbox) add_subdirectory(qtoolbutton) - if(QT_FEATURE_private_tests) add_subdirectory(qabstractspinbox) add_subdirectory(qcombobox) @@ -49,7 +47,9 @@ if(QT_FEATURE_private_tests) add_subdirectory(qtextedit) add_subdirectory(qtoolbar) endif() - -if(NOT WINRT AND QT_FEATURE_opengl) +if(QT_FEATURE_shortcut) + add_subdirectory(qkeysequenceedit) +endif() +if(QT_FEATURE_opengl) add_subdirectory(qopenglwidget) endif() diff --git a/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp b/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp index 01ecfb2ca9..fd1e5c267d 100644 --- a/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp +++ b/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp @@ -340,10 +340,6 @@ void tst_QAbstractScrollArea::task214488_layoutDirection() int refValue = hbar->value(); qApp->sendEvent(&scrollArea, new QKeyEvent(QEvent::KeyPress, key, Qt::NoModifier)); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "WinRT: Scrollbar is not guaranteed to be visible, as QWidget::resize does not" - "work", Abort); -#endif QVERIFY(lessThan ? (hbar->value() < refValue) : (hbar->value() > refValue)); } diff --git a/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp b/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp index c3ae2ea541..ecea005535 100644 --- a/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp +++ b/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp @@ -153,9 +153,6 @@ void tst_QCalendarWidget::getSetCheck() void tst_QCalendarWidget::buttonClickCheck() { -#ifdef Q_OS_WINRT - QSKIP("Fails on WinRT - QTBUG-68297"); -#endif if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) QSKIP("Wayland: This fails. Figure out why."); @@ -289,10 +286,6 @@ void tst_QCalendarWidget::showPrevNext() QFETCH(QDate, dateOrigin); QFETCH(QDate, expectedDate); -#ifdef Q_OS_WINRT - QSKIP("Fails on WinRT - QTBUG-68297"); -#endif - QCalendarWidget calWidget; calWidget.show(); QVERIFY(QTest::qWaitForWindowExposed(&calWidget)); diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index a4b2066087..da010ac357 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -1694,9 +1694,6 @@ void tst_QComboBox::setCustomModelAndView() QTest::qWait(QApplication::doubleClickInterval()); QTest::mouseClick(window->windowHandle(), Qt::LeftButton, {}, view->mapTo(window, subItemRect.center())); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort); -#endif QTRY_COMPARE(combo.currentText(), subItem21Text); } @@ -2406,9 +2403,6 @@ void tst_QComboBox::task190205_setModelAdjustToContents() correctBox.addItems(finalContent); correctBox.showNormal(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "WinRT does not support more than 1 native top level widget", Abort); -#endif QVERIFY(QTest::qWaitForWindowExposed(&box)); QVERIFY(QTest::qWaitForWindowExposed(&correctBox)); @@ -3353,9 +3347,6 @@ void tst_QComboBox::task_QTBUG_56693_itemFontFromModel() QVERIFY(container); QVERIFY(QTest::qWaitForWindowExposed(container)); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort); -#endif QCOMPARE(proxyStyle->italicItemsNo, 5); box.hidePopup(); diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp index 6efac708b9..a1dd1197a3 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp @@ -450,7 +450,7 @@ void tst_QDateTimeEdit::cleanupTestCase() void tst_QDateTimeEdit::init() { QLocale::setDefault(QLocale(QLocale::C)); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); #endif testWidget->setDisplayFormat("dd/MM/yyyy"); // Nice default to have diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp index 8ece03983b..55be152e40 100644 --- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp @@ -890,9 +890,6 @@ void tst_QDockWidget::task169808_setFloating() mw.show(); QVERIFY(QTest::qWaitForWindowExposed(&mw)); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Widgets are maximized on WinRT by default", Abort); -#endif QCOMPARE(dw->widget()->size(), dw->widget()->sizeHint()); //and now we try to test if the contents margin is taken into account @@ -935,9 +932,6 @@ void tst_QDockWidget::task248604_infiniteResize() d.setContentsMargins(2, 2, 2, 2); d.setMinimumSize(320, 240); d.showNormal(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Widgets are maximized on WinRT by default", Abort); -#endif QTRY_COMPARE(d.size(), QSize(320, 240)); } diff --git a/tests/auto/widgets/widgets/qlineedit/BLACKLIST b/tests/auto/widgets/widgets/qlineedit/BLACKLIST deleted file mode 100644 index 537c81413e..0000000000 --- a/tests/auto/widgets/widgets/qlineedit/BLACKLIST +++ /dev/null @@ -1,31 +0,0 @@ -# QTBUG-69111 -[undo_keypressevents:Inserts,moving,selection, delete and undo] -android - -# QTBUG-69112 -[inlineCompletion] -android - -# QTBUG-69116 -[leftKeyOnSelectedText] -android - -# QTBUG-69113 -[textMargin] -android - -# QTBUG-69119 -[task174640_editingFinished] -android - -# QTBUG-69118 -[task210502_caseInsensitiveInlineCompletion] -android - -# QTBUG-69114 -[QTBUG697_paletteCurrentColorGroup] -android - -# QTBUG-69115 -[testQuickSelectionWithMouse] -android diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 6b0beb614a..2367d56dad 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -4851,9 +4851,6 @@ void tst_QLineEdit::testQuickSelectionWithMouse() QTest::mousePress(lineEdit.windowHandle(), Qt::LeftButton, Qt::NoModifier, center); QTest::mouseMove(lineEdit.windowHandle(), center + QPoint(20, 0)); qCDebug(lcTests) << "Selected text:" << lineEdit.selectedText(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "WinRT does not support QTest::mousePress/-Move", Abort); -#endif QVERIFY(!lineEdit.selectedText().isEmpty()); QVERIFY(!lineEdit.selectedText().endsWith(suffix)); diff --git a/tests/auto/widgets/widgets/qmainwindow/BLACKLIST b/tests/auto/widgets/widgets/qmainwindow/BLACKLIST deleted file mode 100644 index a03ea11f40..0000000000 --- a/tests/auto/widgets/widgets/qmainwindow/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[resizeDocks] -winrt diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index 01d625d091..5c595e99c7 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -1787,9 +1787,6 @@ void tst_QMainWindow::centralWidgetSize() mainWindow.setCentralWidget(&widget); mainWindow.show(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Widgets are maximized by default on WinRT - QTBUG-68297", Abort); -#endif QTRY_COMPARE(widget.size(), widget.sizeHint()); } @@ -1834,9 +1831,6 @@ void tst_QMainWindow::fixedSizeCentralWidget() // finally verify that we get the space back when we resize to the old size mainWindow.resize(mwSize); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "QMainWindow::resize does not work on WinRT", Continue); -#endif QTRY_COMPARE(child->height(), childHeight); } diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index 068742f33f..f8a91e6ec6 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -358,9 +358,6 @@ void tst_QMdiArea::subWindowActivated() QMdiSubWindow *window = windows.at(i); window->showNormal(); qApp->processEvents(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("data2", "Broken on WinRT - QTBUG-68297", Abort); -#endif QVERIFY( window == activeWindow ); QVERIFY( activeWindow == workspace->activeSubWindow() ); } @@ -521,9 +518,6 @@ void tst_QMdiArea::subWindowActivated2() mdiArea.showNormal(); mdiArea.activateWindow(); QVERIFY(QTest::qWaitForWindowActive(&mdiArea)); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Broken on WinRT - QTBUG-68297", Abort); -#endif QTRY_COMPARE(spy.count(), 1); QCOMPARE(mdiArea.activeSubWindow(), activeSubWindow); spy.clear(); @@ -1201,9 +1195,6 @@ void tst_QMdiArea::addAndRemoveWindows() // Don't occupy space. QMdiSubWindow *window3 = workspace.addSubWindow(new QWidget); window3->show(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Windows are maximized by default on WinRT", Abort); -#endif QCOMPARE(window3->geometry().topLeft(), QPoint(window2RestoreGeometry.right() + 1, 0)); } @@ -1467,9 +1458,6 @@ void tst_QMdiArea::subWindowList() QList widgets = workspace.subWindowList(windowOrder); QCOMPARE(widgets.count(), windowCount); if (windowOrder == QMdiArea::StackingOrder) { -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Broken on WinRT - QTBUG-68297", Abort); -#endif QCOMPARE(widgets.at(widgets.count() - 1), windows[staysOnTop2]); QCOMPARE(widgets.at(widgets.count() - 2), windows[staysOnTop1]); QCOMPARE(widgets.at(widgets.count() - 3), windows[activeSubWindow]); @@ -1688,9 +1676,6 @@ void tst_QMdiArea::tileSubWindows() // Re-tile. workspace.tileSubWindows(); workspace.setActiveSubWindow(0); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Broken on WinRT - QTBUG-68297", Abort); -#endif QCOMPARE(workspace.viewport()->childrenRect(), workspace.viewport()->rect()); // Cascade and verify that the views are not tiled anymore. @@ -1999,9 +1984,6 @@ void tst_QMdiArea::dontMaximizeSubWindowOnActivation() // Verify that new windows are not maximized. mdiArea.addSubWindow(new QWidget)->show(); QVERIFY(mdiArea.activeSubWindow()); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Broken on WinRT - QTBUG-68297", Abort); -#endif QVERIFY(!mdiArea.activeSubWindow()->isMaximized()); } @@ -2023,9 +2005,6 @@ void tst_QMdiArea::delayedPlacement() QVERIFY(QTest::qWaitForWindowExposed(&mdiArea)); QCOMPARE(window1->geometry().topLeft(), QPoint(0, 0)); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Broken on WinRT - QTBUG-68297", Abort); -#endif QCOMPARE(window2->geometry().topLeft(), window1->geometry().topRight() + QPoint(1, 0)); QCOMPARE(window3->geometry().topLeft(), window2->geometry().topRight() + QPoint(1, 0)); } @@ -2160,10 +2139,6 @@ void tst_QMdiArea::updateScrollBars() subWindow1->showNormal(); qApp->processEvents(); QVERIFY(!subWindow1->isMaximized()); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Widgets are maximized by default on WinRT, so scroll bars might not be" - "visible", Abort); -#endif QVERIFY(hbar->style()->styleHint(QStyle::SH_ScrollBar_Transient) || hbar->isVisible()); QVERIFY(vbar->style()->styleHint(QStyle::SH_ScrollBar_Transient) || vbar->isVisible()); if (i == 0) { @@ -2365,10 +2340,6 @@ void tst_QMdiArea::setViewMode() QList subWindows = mdiArea.subWindowList(); // Default. -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Widgets are maximized by default on WinRT, so scroll bars might not be" - "visible", Abort); -#endif QVERIFY(!activeSubWindow->isMaximized()); QTabBar *tabBar = mdiArea.findChild(); QVERIFY(!tabBar); diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index dfba506cf9..b2320cb93f 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -569,9 +569,6 @@ void tst_QMdiSubWindow::emittingOfSignals() } } } -#ifdef Q_OS_WINRT - QEXPECT_FAIL("windowMaximized", "Broken on WinRT - QTBUG-68297", Abort); -#endif QCOMPARE(count, 1); window->setParent(nullptr); @@ -598,9 +595,6 @@ void tst_QMdiSubWindow::showShaded() QVERIFY(QTest::qWaitForWindowExposed(&workspace)); QVERIFY(!window->isShaded()); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Windows are maximized per default on WinRt ", Abort); -#endif QVERIFY(!window->isMaximized()); QCOMPARE(window->size(), QSize(300, 300)); @@ -694,10 +688,6 @@ void tst_QMdiSubWindow::showNormal() QCoreApplication::processEvents(); window->showNormal(); QCoreApplication::processEvents(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("showMinimized", "Windows are maximized per default on WinRt ", Abort); - QEXPECT_FAIL("showMaximized", "Windows are maximized per default on WinRt ", Abort); -#endif QCOMPARE(window->geometry(), originalGeometry); } @@ -808,9 +798,6 @@ void tst_QMdiSubWindow::setOpaqueResizeAndMove() // Leave resize mode sendMouseRelease(mouseReceiver, mousePosition); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort); -#endif QCOMPARE(resizeSpy.count(), expectedGeometryCount); QCOMPARE(window->size(), windowSize + QSize(geometryCount, geometryCount)); } @@ -977,9 +964,6 @@ void tst_QMdiSubWindow::mouseDoubleClick() workspace.show(); window->show(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Windows are maximized per default on WinRt ", Abort); -#endif QVERIFY(!window->isMaximized()); QVERIFY(!window->isShaded()); @@ -1053,9 +1037,6 @@ void tst_QMdiSubWindow::setSystemMenu() QVERIFY(!QApplication::activePopupWidget()); subWindow->showSystemMenu(); QTRY_COMPARE(QApplication::activePopupWidget(), qobject_cast(systemMenu)); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Broken on WinRT - QTBUG-68297", Abort); -#endif QTRY_COMPARE(systemMenu->mapToGlobal(QPoint(0, 0)), (globalPopupPos = subWindow->mapToGlobal(subWindow->contentsRect().topLeft())) ); @@ -1279,9 +1260,6 @@ void tst_QMdiSubWindow::restoreFocusOverCreation() QTRY_COMPARE(QApplication::focusWidget(), subWidget2->m_lineEdit1); mdiArea.setActiveSubWindow(subWindow1); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Broken on WinRt - QTBUG-68297", Abort); -#endif QTRY_COMPARE(QApplication::focusWidget(), subWidget1->m_lineEdit2); } @@ -1494,9 +1472,6 @@ void tst_QMdiSubWindow::resizeEvents() QCOMPARE(window->widget()->windowState(), windowState); // Make sure we got as many resize events as expected. -#ifdef Q_OS_WINRT - QEXPECT_FAIL("maximized", "Broken on WinRT - QTBUG-68297", Abort); -#endif QCOMPARE(windowResizeEventSpy.count(), expectedWindowResizeEvents); QCOMPARE(widgetResizeEventSpy.count(), expectedWidgetResizeEvents); windowResizeEventSpy.clear(); @@ -1506,10 +1481,6 @@ void tst_QMdiSubWindow::resizeEvents() window->showNormal(); // Check that the window state is correct. -#ifdef Q_OS_WINRT - QEXPECT_FAIL("minimized", "Broken on WinRT - QTBUG-68297", Abort); - QEXPECT_FAIL("shaded", "Broken on WinRT - QTBUG-68297", Abort); -#endif QCOMPARE(window->windowState(), Qt::WindowNoState | Qt::WindowActive); QCOMPARE(window->widget()->windowState(), Qt::WindowNoState); @@ -1776,9 +1747,6 @@ void tst_QMdiSubWindow::fixedMinMaxSize() QCOMPARE(subWindow->maximumSize(), maximumSize); mdiArea.addSubWindow(subWindow); subWindow->show(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Windows are maximized per default on WinRt ", Abort); -#endif QCOMPARE(subWindow->size(), minimumSize); // Calculate the size of a minimized sub window. @@ -2178,9 +2146,6 @@ void tst_QMdiSubWindow::testFullScreenState() subWindow->showFullScreen(); // QMdiSubWindow does not support the fullscreen state. This call // should be equivalent to setVisible(true) (and not showNormal()) QVERIFY(QTest::qWaitForWindowExposed(&mdiArea)); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Windows are maximized per default on WinRt ", Abort); -#endif QCOMPARE(subWindow->size(), QSize(300, 300)); } diff --git a/tests/auto/widgets/widgets/qmenu/BLACKLIST b/tests/auto/widgets/widgets/qmenu/BLACKLIST index 5677172f8e..d4ebf69e82 100644 --- a/tests/auto/widgets/widgets/qmenu/BLACKLIST +++ b/tests/auto/widgets/widgets/qmenu/BLACKLIST @@ -7,7 +7,5 @@ macos macos [tearOff] macos -[activeSubMenuPosition] -winrt [submenuTearOffDontClose] macos # Can't move cursor (QTBUG-76312) diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index 9ee239aceb..8ce0ea2184 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -859,9 +859,6 @@ private: void tst_QMenu::activeSubMenuPositionExec() { -#ifdef Q_OS_WINRT - QSKIP("Broken on WinRT - QTBUG-68297"); -#endif SubMenuPositionExecMenu menu; menu.exec(QGuiApplication::primaryScreen()->availableGeometry().center()); } @@ -1099,9 +1096,6 @@ void tst_QMenu::pushButtonPopulateOnAboutToShow() QTimer::singleShot(300, buttonMenu, SLOT(hide())); QTest::mouseClick(&b, Qt::LeftButton, Qt::NoModifier, b.rect().center()); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "WinRT does not support QTest::mouseClick", Abort); -#endif QVERIFY2(!buttonMenu->geometry().intersects(b.geometry()), msgGeometryIntersects(buttonMenu->geometry(), b.geometry())); // note: we're assuming that, if we previously got the desired geometry, we'll get it here too @@ -1211,9 +1205,6 @@ void tst_QMenu::click_while_dismissing_submenu() //this opens the submenu, move two times to emulate user interaction (d->motions > 0 in QMenu) QTest::mouseMove(menuWindow, menu.rect().center() + QPoint(0,2)); QTest::mouseMove(menuWindow, menu.rect().center() + QPoint(1,3), 60); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "WinRT does not support QTest::mouseMove", Abort); -#endif QVERIFY(menuShownSpy.wait()); QVERIFY(sub.isVisible()); QVERIFY(QTest::qWaitForWindowExposed(&sub)); @@ -1312,9 +1303,6 @@ void tst_QMenu::QTBUG47515_widgetActionEnterLeave() QTest::mouseMove(topLevelWindow, w1Center); QVERIFY(w1->isVisible()); QTRY_COMPARE(w1->leave, 0); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "WinRT does not support QTest::mouseMove", Abort); -#endif QTRY_COMPARE(w1->enter, 1); // Check whether leave event is not delivered on mouse move @@ -1360,9 +1348,6 @@ void tst_QMenu::QTBUG8122_widgetActionCrashOnClose() QSKIP("Window activation is not supported"); if (QGuiApplication::platformName() == QLatin1String("cocoa")) QSKIP("See QTBUG-63031"); -#ifdef Q_OS_WINRT - QSKIP("WinRT does not support QTest::mouseMove"); -#endif const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry(); QRect geometry(QPoint(), availableGeometry.size() / 3); @@ -1572,9 +1557,6 @@ void tst_QMenu::QTBUG_56917_wideMenuSize() menu.popup(QPoint()); QVERIFY(QTest::qWaitForWindowExposed(&menu)); QVERIFY(menu.isVisible()); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Broken on WinRT - QTBUG-68297", Abort); -#endif QVERIFY(menu.height() <= menuSizeHint.height()); } @@ -1711,9 +1693,6 @@ void tst_QMenu::menuSize_Scrolling() const QMargins cm = contentsMargins(); QRect lastItem = actionGeometry(actions().at(actions().length() - 1)); QSize s = size(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Broken on WinRT - QTBUG-68297", Abort); -#endif if (!QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive) || !QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive)) { QWARN("Skipping test on minimal/offscreen platforms - QTBUG-73522"); @@ -1789,12 +1768,6 @@ void tst_QMenu::menuSize_Scrolling() return; QTest::keyClick(&menu, Qt::Key_End); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("data8", "Broken on WinRT - QTBUG-68297", Abort); - QEXPECT_FAIL("data9", "Broken on WinRT - QTBUG-68297", Abort); - QEXPECT_FAIL("data10", "Broken on WinRT - QTBUG-68297", Abort); - QEXPECT_FAIL("data11", "Broken on WinRT - QTBUG-68297", Abort); -#endif QTRY_COMPARE(menu.actionGeometry(actions.last()).right(), menu.width() - mm.fw - mm.hmargin - leftMargin - 1); QCOMPARE(menu.actionGeometry(actions.last()).bottom(), diff --git a/tests/auto/widgets/widgets/qmenubar/BLACKLIST b/tests/auto/widgets/widgets/qmenubar/BLACKLIST index c9e15e531c..41b440d3d6 100644 --- a/tests/auto/widgets/widgets/qmenubar/BLACKLIST +++ b/tests/auto/widgets/widgets/qmenubar/BLACKLIST @@ -4,5 +4,3 @@ ubuntu-16.04 ubuntu-18.04 [activatedCount] opensuse-42.3 -[QTBUG_65488_hiddenActionTriggered] -winrt diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index 1638ac846f..39ab5f6ebf 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -1226,9 +1226,6 @@ void tst_QMenuBar::check_menuPosition() mbItemRect.moveTo(w.menuBar()->mapToGlobal(mbItemRect.topLeft())); QTest::keyClick(&w, Qt::Key_M, Qt::AltModifier ); QVERIFY(menu.isActiveWindow()); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "QTest::keyClick does not work on WinRT.", Abort); -#endif QCOMPARE(menu.pos(), QPoint(mbItemRect.x(), mbItemRect.top() - menu.height())); menu.close(); } @@ -1565,9 +1562,6 @@ void tst_QMenuBar::cornerWidgets() case Qt::TopLeftCorner: QVERIFY2(fileMenuGeometry.left() >= cornerWidgetWidth, msgComparison(fileMenuGeometry.left(), ">=", cornerWidgetWidth)); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Broken on WinRT - QTBUG-68297", Abort); -#endif QVERIFY2(menuBarWidth - editMenuGeometry.right() < cornerWidgetWidth, msgComparison(menuBarWidth - editMenuGeometry.right(), "<", cornerWidgetWidth)); break; diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp index fa702f8661..2f69518663 100644 --- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp +++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp @@ -1369,9 +1369,6 @@ void tst_QPlainTextEdit::adjustScrollbars() QLatin1String txt("\nabc def ghi jkl mno pqr stu vwx"); ed->setPlainText(txt + txt + txt + txt); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "WinRT does not support setMinimum/MaximumSize", Abort); -#endif QVERIFY(ed->verticalScrollBar()->maximum() > 0); ed->moveCursor(QTextCursor::End); diff --git a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp index c491bbb4f6..a1097fa433 100644 --- a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp +++ b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp @@ -255,9 +255,6 @@ void tst_QProgressBar::setMinMaxRepaint() pbar.repainted = false; pbar.setMinimum(0); QTest::qWait(50); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Broken on WinRT - QTBUG-68297", Abort); -#endif QTRY_VERIFY(!pbar.repainted); // No repaint when setting maximum to the current maximum diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp index d0ed68c0c8..51eb7d2020 100644 --- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp +++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp @@ -520,7 +520,7 @@ void tst_QPushButton::sizeHint_data() #if !defined(QT_NO_STYLE_FUSION) QTest::newRow("fusion") << QString::fromLatin1("fusion"); #endif -#if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSVISTA) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSVISTA) QTest::newRow("windowsvista") << QString::fromLatin1("windowsvista"); #endif } diff --git a/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp b/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp index f4b91265a4..e4a8552365 100644 --- a/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp +++ b/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp @@ -97,9 +97,6 @@ void tst_QSizeGrip::hideAndShowOnWindowStateChange_data() void tst_QSizeGrip::hideAndShowOnWindowStateChange() { QFETCH(Qt::WindowType, windowType); -#ifdef Q_OS_WINRT - QSKIP("Broken on WinRT - QTBUG-68297"); -#endif QScopedPointer parentWidget; if (windowType != Qt::Window) @@ -144,9 +141,6 @@ void tst_QSizeGrip::hideAndShowOnWindowStateChange() void tst_QSizeGrip::orientation() { -#ifdef Q_OS_WINRT - QSKIP("Broken on WinRT - QTBUG-68297"); -#endif TestWidget widget; widget.setLayout(new QVBoxLayout); @@ -194,9 +188,6 @@ void tst_QSizeGrip::dontCrashOnTLWChange() // the above setup causes a change of TLW for the size grip, // and it must not crash. -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Broken on WinRT - QTBUG-68297", Abort); -#endif QVERIFY(QTest::qWaitForWindowExposed(&mdiArea)); QVERIFY(QTest::qWaitForWindowExposed(mw.data())); } diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp index a8b47ffc46..9f109ab96c 100644 --- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp @@ -524,17 +524,13 @@ void tst_QSpinBox::setReadOnly() QTest::keyClick(&spin, Qt::Key_Up); QCOMPARE(spin.value(), 1); spin.setReadOnly(true); -#ifndef Q_OS_WINRT // QTBUG-68297 QCOMPARE(spin.readOnlyChangeEventCount, 1); -#endif QTest::keyClick(&spin, Qt::Key_Up); QCOMPARE(spin.value(), 1); spin.stepBy(1); QCOMPARE(spin.value(), 2); spin.setReadOnly(false); -#ifndef Q_OS_WINRT // QTBUG-68297 QCOMPARE(spin.readOnlyChangeEventCount, 2); -#endif QTest::keyClick(&spin, Qt::Key_Up); QCOMPARE(spin.value(), 3); } diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp index 332aa7c6d3..aca795ff61 100644 --- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp +++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp @@ -783,16 +783,12 @@ void tst_QSplitter::replaceWidget() const int expectedResizeCount = visible ? 1 : 0; // new widget only const int expectedPaintCount = visible && !collapsed ? 2 : 0; // splitter and new widget QTRY_COMPARE(ef.resizeCount, expectedResizeCount); -#ifndef Q_OS_WINRT // QTBUG-68297 QTRY_COMPARE(ef.paintCount, expectedPaintCount); -#endif QCOMPARE(newWidget->parentWidget(), &sp); QCOMPARE(newWidget->isVisible(), visible); if (visible && !collapsed) QCOMPARE(newWidget->geometry(), oldGeom); -#ifndef Q_OS_WINRT // QTBUG-68297 QCOMPARE(newWidget->size().isEmpty(), !visible || collapsed); -#endif delete res; } QCOMPARE(sp.count(), count); @@ -844,9 +840,7 @@ void tst_QSplitter::replaceWidgetWithSplitterChild() QTRY_VERIFY(ef.resizeCount > 0); QTRY_VERIFY(ef.paintCount > 0); QCOMPARE(sp.count(), count + 1); -#ifndef Q_OS_WINRT // QTBUG-68297 QCOMPARE(sp.sizes().mid(0, count), sizes); -#endif QCOMPARE(sp.sizes().last(), sibling->width()); } else { // No-op for the rest diff --git a/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp b/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp index 256906080e..30fff4e0be 100644 --- a/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp +++ b/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp @@ -144,9 +144,6 @@ void tst_QStatusBar::setSizeGripEnabled() QTRY_VERIFY(statusBar->isVisible()); QPointer sizeGrip = statusBar->findChild(); QVERIFY(sizeGrip); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort); -#endif QVERIFY(sizeGrip->isVisible()); statusBar->setSizeGripEnabled(true); diff --git a/tests/auto/widgets/widgets/qtabwidget/CMakeLists.txt b/tests/auto/widgets/widgets/qtabwidget/CMakeLists.txt index 9bd0018082..130cf2422a 100644 --- a/tests/auto/widgets/widgets/qtabwidget/CMakeLists.txt +++ b/tests/auto/widgets/widgets/qtabwidget/CMakeLists.txt @@ -18,7 +18,7 @@ add_qt_test(tst_qtabwidget ## Scopes: ##################################################################### -extend_target(tst_qtabwidget CONDITION WIN32 AND NOT WINRT +extend_target(tst_qtabwidget CONDITION WIN32 PUBLIC_LIBRARIES user32 ) diff --git a/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro b/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro index b61cc8fa13..95c81b952f 100644 --- a/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro +++ b/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro @@ -8,4 +8,4 @@ INCLUDEPATH += ../ HEADERS += SOURCES += tst_qtabwidget.cpp -win32:!winrt: QMAKE_USE += user32 +win32: QMAKE_USE += user32 diff --git a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp index 28b8bfc6b3..25f61ec7ac 100644 --- a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp +++ b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp @@ -35,7 +35,7 @@ #include #include -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) # include #define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ diff --git a/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp b/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp index 2496d446d8..7e99177dec 100644 --- a/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp +++ b/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp @@ -211,9 +211,6 @@ void tst_QTextBrowser::forwardButton() browser->setSource(QUrl(QFINDTESTDATA("pagewithoutbg.html"))); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort); -#endif QVERIFY(!forwardEmissions.isEmpty()); val = forwardEmissions.takeLast()[0]; QCOMPARE(val.type(), QVariant::Bool); @@ -438,9 +435,6 @@ void tst_QTextBrowser::clearHistory() void tst_QTextBrowser::sourceInsideLoadResource() { -#ifdef Q_OS_WINRT - QSKIP("Paths cannot be compared if applications are sandboxed."); -#endif QUrl url = QUrl::fromLocalFile("pagewithimage.html"); // "file://pagewithimage.html" browser->setSource(url); QCOMPARE(browser->lastResource, QUrl::fromLocalFile(QDir::current().filePath("foobar.png"))); diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index 716e7da490..eaa7251684 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -1716,9 +1716,6 @@ void tst_QTextEdit::adjustScrollbars() QLatin1String txt("\nabc def ghi jkl mno pqr stu vwx"); ed->setText(txt + txt + txt + txt); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "setMinimum/MaximumSize does not work on WinRT", Abort); -#endif QVERIFY(ed->verticalScrollBar()->maximum() > 0); ed->moveCursor(QTextCursor::End); @@ -1902,9 +1899,6 @@ void tst_QTextEdit::copyPasteBackgroundImage() QBrush ba = a->cellAt(0, 0).format().background(); QBrush bb = b->cellAt(0, 0).format().background(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort); -#endif QCOMPARE(ba.style(), Qt::TexturePattern); QCOMPARE(ba.style(), bb.style()); diff --git a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp index ed4df2fc23..6111d5b0dd 100644 --- a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp +++ b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp @@ -278,9 +278,6 @@ void tst_QToolButton::qtbug_34759_sizeHintResetWhenSettingMenu() button1.show(); button2.show(); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "Winrt does not support more than 1 native top level widget.", Abort); -#endif QVERIFY(QTest::qWaitForWindowExposed(&button1)); QVERIFY(QTest::qWaitForWindowExposed(&button2)); diff --git a/tests/auto/widgets/widgets/widgets.pro b/tests/auto/widgets/widgets/widgets.pro index 66950fa85a..f67fe86606 100644 --- a/tests/auto/widgets/widgets/widgets.pro +++ b/tests/auto/widgets/widgets/widgets.pro @@ -58,4 +58,4 @@ SUBDIRS=\ qtextedit \ qtoolbar \ -!winrt:qtConfig(opengl): SUBDIRS += qopenglwidget +qtConfig(opengl): SUBDIRS += qopenglwidget diff --git a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp index df158cae0f..6375a44983 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp +++ b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp @@ -562,9 +562,6 @@ void tst_QXmlSimpleReader::inputFromSocket_data() void tst_QXmlSimpleReader::inputFromSocket() { QFETCH(QString, file_name); -#ifdef Q_OS_WINRT - QSKIP("WinRT does not support connecting to localhost"); -#endif if (!server->threadStarted.tryAcquire(1, 15000)) { // If something is wrong with QThreads, it's not a reason to fail diff --git a/tests/baselineserver/shared/baselineprotocol.cpp b/tests/baselineserver/shared/baselineprotocol.cpp index b7da47de34..c481bf7639 100644 --- a/tests/baselineserver/shared/baselineprotocol.cpp +++ b/tests/baselineserver/shared/baselineprotocol.cpp @@ -66,11 +66,7 @@ const QString PI_PulseTestrBranch(QLS("PulseTestrBranch")); void BaselineProtocol::sysSleep(int ms) { #if defined(Q_OS_WIN) -# ifndef Q_OS_WINRT Sleep(DWORD(ms)); -# else - WaitForSingleObjectEx(GetCurrentThread(), ms, false); -# endif #else struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 }; nanosleep(&ts, NULL); diff --git a/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp b/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp index 0b831f6625..d1aba9fa5f 100644 --- a/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp +++ b/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp @@ -163,12 +163,7 @@ private slots: wcscat(appendedPath, L"\\*"); WIN32_FIND_DATA fd; -#ifndef Q_OS_WINRT HANDLE hSearch = FindFirstFileW(appendedPath, &fd); -#else - HANDLE hSearch = FindFirstFileEx(appendedPath, FindExInfoStandard, &fd, - FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH); -#endif QVERIFY(hSearch != INVALID_HANDLE_VALUE); QBENCHMARK { diff --git a/tests/benchmarks/corelib/io/qdiriterator/main.cpp b/tests/benchmarks/corelib/io/qdiriterator/main.cpp index 5b10a4a689..367913338f 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/main.cpp +++ b/tests/benchmarks/corelib/io/qdiriterator/main.cpp @@ -95,12 +95,7 @@ static int posix_helper(const wchar_t *dirpath, size_t length) Q_ASSERT(MAX_PATH > length + 3); wcsncpy(appendedPath, dirpath, length); wcscpy(appendedPath + length, L"\\*"); -#ifndef Q_OS_WINRT hSearch = FindFirstFile(appendedPath, &fd); -#else - hSearch = FindFirstFileEx(appendedPath, FindExInfoStandard, &fd, - FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH); -#endif if (hSearch == INVALID_HANDLE_VALUE) { qWarning("FindFirstFile failed"); diff --git a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp index 6ee8b4e93b..21018920f7 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp +++ b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp @@ -221,12 +221,7 @@ void QFileSystemIteratorPrivate::pushSubDirectory(const QByteArray &path) const int end = QString::fromLatin1(path + "\\*").toWCharArray(szSearchPath); Q_ASSERT(end < MAX_PATH); szSearchPath[end] = L'\0'; -#ifndef Q_OS_WINRT HANDLE dir = FindFirstFile(szSearchPath, &m_fileSearchResult); -#else - HANDLE dir = FindFirstFileEx(szSearchPath, FindExInfoStandard, &m_fileSearchResult, - FindExSearchLimitToDirectories, NULL, FIND_FIRST_EX_LARGE_FETCH); -#endif m_bFirstSearchResult = true; #else DIR *dir = ::opendir(path.constData()); diff --git a/tests/benchmarks/corelib/io/qfile/main.cpp b/tests/benchmarks/corelib/io/qfile/main.cpp index 1966b30773..73b3ba8c48 100644 --- a/tests/benchmarks/corelib/io/qfile/main.cpp +++ b/tests/benchmarks/corelib/io/qfile/main.cpp @@ -297,11 +297,7 @@ void tst_qfile::readBigFile() // ensure we don't account string conversion wchar_t* cfilename = (wchar_t*)filename.utf16(); -#ifndef Q_OS_WINRT hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); -#else - hndl = CreateFile2(cfilename, GENERIC_READ, 0, OPEN_EXISTING, 0); -#endif Q_ASSERT(hndl); wchar_t* nativeBuffer = new wchar_t[BUFSIZE]; DWORD numberOfBytesRead; @@ -310,12 +306,7 @@ void tst_qfile::readBigFile() do { ReadFile(hndl, nativeBuffer, blockSize, &numberOfBytesRead, NULL); } while(numberOfBytesRead != 0); -#ifndef Q_OS_WINRT SetFilePointer(hndl, 0, NULL, FILE_BEGIN); -#else - LARGE_INTEGER offset = { 0 }; - SetFilePointerEx(hndl, offset, NULL, FILE_BEGIN); -#endif } delete[] nativeBuffer; CloseHandle(hndl); @@ -396,20 +387,11 @@ void tst_qfile::seek() // ensure we don't account string conversion wchar_t* cfilename = (wchar_t*)filename.utf16(); -#ifndef Q_OS_WINRT hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); -#else - hndl = CreateFile2(cfilename, GENERIC_READ, 0, OPEN_EXISTING, 0); -#endif Q_ASSERT(hndl); QBENCHMARK { i=(i+1)%sp_size; -#ifndef Q_OS_WINRT SetFilePointer(hndl, seekpos[i], NULL, 0); -#else - LARGE_INTEGER offset = { seekpos[i] }; - SetFilePointerEx(hndl, offset, NULL, FILE_BEGIN); -#endif } CloseHandle(hndl); #else @@ -494,11 +476,7 @@ void tst_qfile::open() wchar_t* cfilename = (wchar_t*)filename.utf16(); QBENCHMARK { -#ifndef Q_OS_WINRT hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); -#else - hndl = CreateFile2(cfilename, GENERIC_READ, 0, OPEN_EXISTING, 0); -#endif Q_ASSERT(hndl); CloseHandle(hndl); } @@ -702,11 +680,7 @@ void tst_qfile::readSmallFiles() // ensure we don't account string conversion wchar_t* cfilename = (wchar_t*)filename.utf16(); -#ifndef Q_OS_WINRT hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); -#else - hndl = CreateFile2(cfilename, GENERIC_READ, 0, OPEN_EXISTING, 0); -#endif Q_ASSERT(hndl); wchar_t* nativeBuffer = new wchar_t[BUFSIZE]; DWORD numberOfBytesRead; diff --git a/tests/benchmarks/corelib/io/qfileinfo/main.cpp b/tests/benchmarks/corelib/io/qfileinfo/main.cpp index 6cc96777a1..f4c4f815da 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_WINRT) +#if defined(Q_OS_WIN) void symLinkTargetPerformanceLNK(); void symLinkTargetPerformanceMounpoint(); #endif @@ -71,7 +71,7 @@ void qfileinfo::existsStatic() QBENCHMARK { QFileInfo::exists(appPath); } } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) void qfileinfo::symLinkTargetPerformanceLNK() { QVERIFY(QFile::link("file","link.lnk")); diff --git a/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/.prev_CMakeLists.txt b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/.prev_CMakeLists.txt new file mode 100644 index 0000000000..59806127fe --- /dev/null +++ b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/.prev_CMakeLists.txt @@ -0,0 +1,13 @@ +# Generated from testProcessLoopback.pro. + +##################################################################### +## testProcessLoopback Binary: +##################################################################### + +add_qt_executable(testProcessLoopback + OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" + SOURCES + main.cpp + PUBLIC_LIBRARIES + Qt::Gui +) diff --git a/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/CMakeLists.txt b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/CMakeLists.txt index 44b18a4826..b5a7fe83f5 100644 --- a/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/CMakeLists.txt +++ b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/CMakeLists.txt @@ -4,18 +4,11 @@ ## testProcessLoopback Binary: ##################################################################### -add_qt_benchmark(testProcessLoopback +# add_qt_executable(testProcessLoopback # special case +add_qt_benchmark(testProcessLoopback # special case OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" SOURCES main.cpp PUBLIC_LIBRARIES Qt::Gui ) - -## Scopes: -##################################################################### - -extend_target(testProcessLoopback CONDITION WINRT - LINK_OPTIONS - "/ENTRY:mainCRTStartup" -) diff --git a/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/testProcessLoopback.pro b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/testProcessLoopback.pro index 1f56ad6ee6..a5fe146e80 100644 --- a/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/testProcessLoopback.pro +++ b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/testProcessLoopback.pro @@ -1,7 +1,6 @@ CONFIG += benchmark CONFIG -= qt CONFIG += cmdline -winrt: QMAKE_LFLAGS += /ENTRY:mainCRTStartup SOURCES = main.cpp DESTDIR = ./ diff --git a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp index 751fd9ce7c..b94d6ee619 100644 --- a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp +++ b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp @@ -75,18 +75,12 @@ void NativeMutexUnlock(NativeMutexType *mutex) } #endif #elif defined(Q_OS_WIN) -# ifndef Q_OS_WINRT -# define _WIN32_WINNT 0x0400 -# endif +# define _WIN32_WINNT 0x0400 # include typedef CRITICAL_SECTION NativeMutexType; void NativeMutexInitialize(NativeMutexType *mutex) { -#ifndef Q_OS_WINRT InitializeCriticalSection(mutex); -#else - InitializeCriticalSectionEx(mutex, 0, 0); -#endif } void NativeMutexDestroy(NativeMutexType *mutex) { diff --git a/tests/manual/diaglib/diaglib.pri b/tests/manual/diaglib/diaglib.pri index dd5bfa5330..617e4e72a9 100644 --- a/tests/manual/diaglib/diaglib.pri +++ b/tests/manual/diaglib/diaglib.pri @@ -10,7 +10,7 @@ HEADERS += \ $$PWD/qwindowdump.h \ $$PWD/nativewindowdump.h -win32:!winrt: { +win32: { SOURCES += $$PWD/nativewindowdump_win.cpp QMAKE_USE += user32 } else { diff --git a/tests/manual/embeddedintoforeignwindow/CMakeLists.txt b/tests/manual/embeddedintoforeignwindow/CMakeLists.txt index c07c8dec5d..2de0ff3bfb 100644 --- a/tests/manual/embeddedintoforeignwindow/CMakeLists.txt +++ b/tests/manual/embeddedintoforeignwindow/CMakeLists.txt @@ -28,14 +28,14 @@ add_qt_manual_test(embeddedintoforeignwindow ## Scopes: ##################################################################### -extend_target(embeddedintoforeignwindow CONDITION WIN32 AND NOT WINRT +extend_target(embeddedintoforeignwindow CONDITION WIN32 SOURCES ../diaglib/nativewindowdump_win.cpp PUBLIC_LIBRARIES user32 ) -extend_target(embeddedintoforeignwindow CONDITION UNIX OR WINRT +extend_target(embeddedintoforeignwindow CONDITION UNIX SOURCES ../diaglib/nativewindowdump.cpp ) diff --git a/tests/manual/foreignwindows/CMakeLists.txt b/tests/manual/foreignwindows/CMakeLists.txt index 8fa02ca607..d22636925a 100644 --- a/tests/manual/foreignwindows/CMakeLists.txt +++ b/tests/manual/foreignwindows/CMakeLists.txt @@ -29,14 +29,14 @@ add_qt_manual_test(foreignwindows ## Scopes: ##################################################################### -extend_target(foreignwindows CONDITION WIN32 AND NOT WINRT +extend_target(foreignwindows CONDITION WIN32 SOURCES ../diaglib/nativewindowdump_win.cpp PUBLIC_LIBRARIES user32 ) -extend_target(foreignwindows CONDITION UNIX OR WINRT +extend_target(foreignwindows CONDITION UNIX SOURCES ../diaglib/nativewindowdump.cpp ) diff --git a/tests/shared/filesystem.h b/tests/shared/filesystem.h index 0e7e6ba867..76ebc485ff 100644 --- a/tests/shared/filesystem.h +++ b/tests/shared/filesystem.h @@ -79,7 +79,7 @@ public: return file.isNull() ? qint64(-1) : file->write(relativeFileName.toUtf8()); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) static DWORD createNtfsJunction(QString target, QString linkName, QString *errorMessage) { typedef struct {