Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7

This commit is contained in:
Liang Qi 2016-04-26 11:08:23 +00:00 committed by The Qt Project
commit 75d4742e04
64 changed files with 1211 additions and 457 deletions

View File

@ -77,7 +77,24 @@ test -r Makefile && $MAKE distclean >/dev/null 2>&1
# Make sure output from possible previous tests is gone
rm -f "$EXE" "${EXE}.exe"
set -- "$QMAKE" -qtconf "$QTCONF" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG+=android_app" "CONFIG-=debug_and_release app_bundle lib_bundle" "LIBS+=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CFLAGS*=$CFLAGS" "QMAKE_CFLAGS+=$MAC_ARCH_CFLAGS" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" $QMAKE_ARGS "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile"
set -- \
"$QMAKE" \
-qtconf "$QTCONF" \
-nocache \
-spec "$QMKSPEC" \
"CONFIG+=$QMAKE_CONFIG" \
"CONFIG+=android_app" \
"CONFIG-=debug_and_release app_bundle lib_bundle" \
"LIBS+=$LFLAGS" \
"LIBS+=$MAC_ARCH_LFLAGS" \
"INCLUDEPATH*=$INCLUDEPATH" \
"QMAKE_CFLAGS*=$CFLAGS" \
"QMAKE_CFLAGS+=$MAC_ARCH_CFLAGS" \
"QMAKE_CXXFLAGS*=$CXXFLAGS" \
"QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" \
$QMAKE_ARGS \
"$SRCDIR/$TEST/$EXE.pro" \
-o "$OUTDIR/$TEST/Makefile"
if [ "$VERBOSE" = "yes" ]; then
OUTDIR=$OUTDIR "$@" && $MAKE && SUCCESS=yes
else

2
configure vendored
View File

@ -4412,11 +4412,13 @@ if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
fi
# Detect objcopy support
if [ "$XPLATFORM_MAC" = "no" ]; then
if ! compileTest unix/objcopy "objcopy"; then
echo "ERROR: -separate-debug-info was requested but this binutils does not support it."
echo "Re-run configure with -v for more information"
exit 1
fi
fi
fi
# Detect C++11 & up support

View File

@ -29,6 +29,9 @@ QMAKE_LIBS_DYNLOAD =
QMAKE_LIBS_OPENGL = -framework OpenGL -framework AGL
QMAKE_LIBS_THREAD =
QMAKE_DSYMUTIL = dsymutil
QMAKE_STRIP = strip
QMAKE_AR = ar cq
QMAKE_RANLIB = ranlib -s
QMAKE_NM = nm -P

View File

@ -65,10 +65,10 @@ warnings_are_errors:warning_clean {
# compiler.
clang:!ios {
# Apple clang 4.0-4.2,5.0-5.1,6.0-6.4
# Regular clang 3.3-3.7
# Regular clang 3.3-3.8
apple_ver = $${QT_APPLE_CLANG_MAJOR_VERSION}.$${QT_APPLE_CLANG_MINOR_VERSION}
reg_ver = $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION}
contains(apple_ver, "4\\.[012]|5\\.[01]|6\\.[01234]")|contains(reg_ver, "3\\.[3-7]") {
contains(apple_ver, "4\\.[012]|5\\.[01]|6\\.[01234]")|contains(reg_ver, "3\\.[3-8]") {
QMAKE_CXXFLAGS_WARN_ON += -Werror -Wno-error=\\$${LITERAL_HASH}warnings -Wno-error=deprecated-declarations $$WERROR
}
} else:intel_icc:linux {

View File

@ -28,7 +28,7 @@ win32 {
}
QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${TARGET}$${TARGET_VERSION_EXT}$${TARGET_EXT}
} else {
contains(TEMPLATE, .*lib):LIBPREFIX = lib
contains(TEMPLATE, .*lib):!if(plugin:no_plugin_name_prefix): LIBPREFIX = lib
mac {
equals(TEMPLATE, lib) {

View File

@ -1,5 +1,13 @@
have_target:!static:!isEmpty(QMAKE_OBJCOPY) {
have_target:!static:if(darwin|!isEmpty(QMAKE_OBJCOPY)) {
darwin {
debug_info_copy_bin = $$QMAKE_DSYMUTIL
debug_info_strip_bin = $$QMAKE_STRIP
debug_info_suffix = dSYM
debug_info_out = --flat -o
debug_info_strip = -S
} else {
debug_info_copy_bin = $$QMAKE_OBJCOPY
debug_info_strip_bin = $$QMAKE_OBJCOPY
qnx {
debug_info_suffix = sym
debug_info_keep = --keep-file-symbols
@ -9,21 +17,61 @@ have_target:!static:!isEmpty(QMAKE_OBJCOPY) {
debug_info_keep = --only-keep-debug
debug_info_strip = --strip-debug
}
}
load(resolve_target)
debug_info_target = $$QMAKE_RESOLVED_TARGET
darwin {
!isEmpty(QMAKE_RESOLVED_BUNDLE) {
debug_info_target = $$QMAKE_RESOLVED_BUNDLE
CONFIG += any_bundle
}
debug_info_target_dir = $${debug_info_target}.$$debug_info_suffix/Contents/Resources/DWARF
!isEmpty(QMAKE_RESOLVED_BUNDLE): \
QMAKE_TARGET_DEBUG_INFO = $$debug_info_target_dir/$$TARGET
else: \
QMAKE_TARGET_DEBUG_INFO = $$debug_info_target_dir/$$section(QMAKE_RESOLVED_TARGET, /, -1, -1)
if(any_bundle:!build_pass)|if(!any_bundle:if(build_pass|isEmpty(BUILDS))) {
equals(TEMPLATE, lib):lib_bundle:!isEmpty(QMAKE_FRAMEWORK_BUNDLE_NAME): \
BUNDLEIDENTIFIER = $$replace(QMAKE_FRAMEWORK_BUNDLE_NAME, \\.framework$, )
else: equals(TEMPLATE, app):app_bundle:!isEmpty(QMAKE_APPLICATION_BUNDLE_NAME): \
BUNDLEIDENTIFIER = $$replace(QMAKE_APPLICATION_BUNDLE_NAME, \\.app$, )
else: \
BUNDLEIDENTIFIER = $${TARGET}
!isEmpty(QMAKE_TARGET_BUNDLE_PREFIX): \
BUNDLEIDENTIFIER = $$replace(QMAKE_TARGET_BUNDLE_PREFIX, \\.$, ).$${BUNDLEIDENTIFIER}
else: \
BUNDLEIDENTIFIER = com.yourcompany.$${BUNDLEIDENTIFIER}
BUNDLEIDENTIFIER ~= s,_,-,
debug_info_plist.input = $$QMAKESPEC/Info.plist.dSYM.in
debug_info_plist.output = $${debug_info_target}.$$debug_info_suffix/Contents/Info.plist
QMAKE_SUBSTITUTES += debug_info_plist
}
} else {
QMAKE_TARGET_DEBUG_INFO = $${QMAKE_RESOLVED_TARGET}.$$debug_info_suffix
}
shell_target = $$shell_quote($$relative_path($$QMAKE_RESOLVED_TARGET, $$OUT_PWD))
shell_target_debug_info = $$shell_quote($$relative_path($$QMAKE_TARGET_DEBUG_INFO, $$OUT_PWD))
copy_debug_info = $$QMAKE_OBJCOPY $$debug_info_keep $$shell_target $$shell_target_debug_info
strip_debug_info = $$QMAKE_OBJCOPY $$debug_info_strip $$shell_target
link_debug_info = $$QMAKE_OBJCOPY --add-gnu-debuglink=$$shell_target_debug_info $$shell_target
chmod_debug_info = chmod -x $$shell_target_debug_info
copy_debug_info = $$debug_info_copy_bin $$debug_info_keep $$shell_target $$debug_info_out $$shell_target_debug_info
strip_debug_info = $$debug_info_strip_bin $$debug_info_strip $$shell_target
!isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK
darwin {
mkdir_debug_info = $$QMAKE_MKDIR $$shell_quote($$debug_info_target_dir)
QMAKE_POST_LINK = $$mkdir_debug_info && $$copy_debug_info && $$strip_debug_info $$QMAKE_POST_LINK
} else {
link_debug_info = $$QMAKE_OBJCOPY --add-gnu-debuglink=$$shell_target_debug_info $$shell_target
chmod_debug_info = chmod -x $$shell_target_debug_info
QMAKE_POST_LINK = $$copy_debug_info && $$strip_debug_info && $$link_debug_info && $$chmod_debug_info $$QMAKE_POST_LINK
}
silent:QMAKE_POST_LINK = @echo creating $@.$$debug_info_suffix && $$QMAKE_POST_LINK
target.targets += $$QMAKE_TARGET_DEBUG_INFO
QMAKE_DISTCLEAN += $$QMAKE_TARGET_DEBUG_INFO
}

View File

@ -0,0 +1,18 @@
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
!!IF !isEmpty(VERSION)
<key>CFBundleShortVersionString</key>
<string>$${VER_MAJ}.$${VER_MIN}</string>
<key>CFBundleVersion</key>
<string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
!!ENDIF
</dict>
</plist>

View File

@ -0,0 +1,18 @@
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
!!IF !isEmpty(VERSION)
<key>CFBundleShortVersionString</key>
<string>$${VER_MAJ}.$${VER_MIN}</string>
<key>CFBundleVersion</key>
<string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
!!ENDIF
</dict>
</plist>

View File

@ -0,0 +1,18 @@
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
!!IF !isEmpty(VERSION)
<key>CFBundleShortVersionString</key>
<string>$${VER_MAJ}.$${VER_MIN}</string>
<key>CFBundleVersion</key>
<string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
!!ENDIF
</dict>
</plist>

View File

@ -0,0 +1,18 @@
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
!!IF !isEmpty(VERSION)
<key>CFBundleShortVersionString</key>
<string>$${VER_MAJ}.$${VER_MIN}</string>
<key>CFBundleVersion</key>
<string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
!!ENDIF
</dict>
</plist>

View File

@ -0,0 +1,18 @@
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
!!IF !isEmpty(VERSION)
<key>CFBundleShortVersionString</key>
<string>$${VER_MAJ}.$${VER_MIN}</string>
<key>CFBundleVersion</key>
<string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
!!ENDIF
</dict>
</plist>

View File

@ -0,0 +1,18 @@
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
!!IF !isEmpty(VERSION)
<key>CFBundleShortVersionString</key>
<string>$${VER_MAJ}.$${VER_MIN}</string>
<key>CFBundleVersion</key>
<string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
!!ENDIF
</dict>
</plist>

View File

@ -0,0 +1,18 @@
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
!!IF !isEmpty(VERSION)
<key>CFBundleShortVersionString</key>
<string>$${VER_MAJ}.$${VER_MIN}</string>
<key>CFBundleVersion</key>
<string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
!!ENDIF
</dict>
</plist>

View File

@ -0,0 +1,18 @@
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
!!IF !isEmpty(VERSION)
<key>CFBundleShortVersionString</key>
<string>$${VER_MAJ}.$${VER_MIN}</string>
<key>CFBundleVersion</key>
<string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
!!ENDIF
</dict>
</plist>

View File

@ -0,0 +1,18 @@
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
!!IF !isEmpty(VERSION)
<key>CFBundleShortVersionString</key>
<string>$${VER_MAJ}.$${VER_MIN}</string>
<key>CFBundleVersion</key>
<string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
!!ENDIF
</dict>
</plist>

View File

@ -266,7 +266,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
<< "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("children", grp_it.value(), SettingsAsList, 4) << ";\n"
<< "\t\t\t" << writeSettings("name", grp_it.key().section(Option::dir_sep, -1)) << ";\n"
<< "\t\t\t" << writeSettings("sourceTree", "<Group>") << ";\n"
<< "\t\t\t" << writeSettings("sourceTree", "<group>") << ";\n"
<< "\t\t};\n";
}
@ -694,7 +694,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
<< "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("children", grp_it.value(), SettingsAsList, 4) << ";\n"
<< "\t\t\t" << writeSettings("name", grp_it.key().section(Option::dir_sep, -1)) << ";\n"
<< "\t\t\t" << writeSettings("sourceTree", "<Group>") << ";\n"
<< "\t\t\t" << writeSettings("sourceTree", "<group>") << ";\n"
<< "\t\t};\n";
}
@ -1032,7 +1032,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
<< "\t\t\t" << writeSettings("children", project->values("QMAKE_PBX_LIBRARIES"), SettingsAsList, 4) << ";\n"
<< "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("name", grp) << ";\n"
<< "\t\t\t" << writeSettings("sourceTree", "<Group>") << ";\n"
<< "\t\t\t" << writeSettings("sourceTree", "<group>") << ";\n"
<< "\t\t};\n";
}
}
@ -1146,7 +1146,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
<< "\t\t\t" << writeSettings("children", bundle_file_refs, SettingsAsList, 4) << ";\n"
<< "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("name", "Bundle Data") << ";\n"
<< "\t\t\t" << writeSettings("sourceTree", "<Group>") << ";\n"
<< "\t\t\t" << writeSettings("sourceTree", "<group>") << ";\n"
<< "\t\t};\n";
}
@ -1231,7 +1231,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
<< "\t\t\t" << writeSettings("children", project->values("QMAKE_PBX_PRODUCTS"), SettingsAsList, 4) << ";\n"
<< "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("name", "Products") << ";\n"
<< "\t\t\t" << writeSettings("sourceTree", "<Group>") << ";\n"
<< "\t\t\t" << writeSettings("sourceTree", "<group>") << ";\n"
<< "\t\t};\n";
}
@ -1241,7 +1241,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
<< "\t\t\t" << writeSettings("children", project->values("QMAKE_PBX_GROUPS"), SettingsAsList, 4) << ";\n"
<< "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("name", project->first("QMAKE_ORIG_TARGET")) << ";\n"
<< "\t\t\t" << writeSettings("sourceTree", "<Group>") << ";\n"
<< "\t\t\t" << writeSettings("sourceTree", "<group>") << ";\n"
<< "\t\t};\n";
{

View File

@ -550,7 +550,14 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file)
InCode // after directive, parsing non-#include directive or in actual code
} cpp_state = AtStart;
for(int x = 0; x < buffer_len; ++x) {
int x = 0;
if (buffer_len >= 3) {
const unsigned char *p = (unsigned char *)buffer;
// skip UTF-8 BOM, if present
if (p[0] == 0xEF && p[1] == 0xBB && p[2] == 0xBF)
x += 3;
}
for (; x < buffer_len; ++x) {
bool try_local = true;
char *inc = 0;
if(file->type == QMakeSourceFileInfo::TYPE_UI) {

View File

@ -0,0 +1,86 @@
diff --git a/src/3rdparty/rfc6234/sha384-512.c b/src/3rdparty/rfc6234/sha384-512.c
index 7d9ba3f..b2fcf03 100644
--- a/src/3rdparty/rfc6234/sha384-512.c
+++ b/src/3rdparty/rfc6234/sha384-512.c
@@ -320,14 +320,14 @@ static int SHA384_512ResultN(SHA512Context *context,
/* Initial Hash Values: FIPS 180-3 sections 5.3.4 and 5.3.5 */
static uint64_t SHA384_H0[ ] = {
- 0xCBBB9D5DC1059ED8ll, 0x629A292A367CD507ll, 0x9159015A3070DD17ll,
- 0x152FECD8F70E5939ll, 0x67332667FFC00B31ll, 0x8EB44A8768581511ll,
- 0xDB0C2E0D64F98FA7ll, 0x47B5481DBEFA4FA4ll
+ 0xCBBB9D5DC1059ED8ull, 0x629A292A367CD507ull, 0x9159015A3070DD17ull,
+ 0x152FECD8F70E5939ull, 0x67332667FFC00B31ull, 0x8EB44A8768581511ull,
+ 0xDB0C2E0D64F98FA7ull, 0x47B5481DBEFA4FA4ull
};
static uint64_t SHA512_H0[ ] = {
- 0x6A09E667F3BCC908ll, 0xBB67AE8584CAA73Bll, 0x3C6EF372FE94F82Bll,
- 0xA54FF53A5F1D36F1ll, 0x510E527FADE682D1ll, 0x9B05688C2B3E6C1Fll,
- 0x1F83D9ABFB41BD6Bll, 0x5BE0CD19137E2179ll
+ 0x6A09E667F3BCC908ull, 0xBB67AE8584CAA73Bull, 0x3C6EF372FE94F82Bull,
+ 0xA54FF53A5F1D36F1ull, 0x510E527FADE682D1ull, 0x9B05688C2B3E6C1Full,
+ 0x1F83D9ABFB41BD6Bull, 0x5BE0CD19137E2179ull
};
#endif /* USE_32BIT_ONLY */
@@ -766,33 +766,33 @@ static void SHA384_512ProcessMessageBlock(SHA512Context *context)
#else /* !USE_32BIT_ONLY */
/* Constants defined in FIPS 180-3, section 4.2.3 */
static const uint64_t K[80] = {
- 0x428A2F98D728AE22ll, 0x7137449123EF65CDll, 0xB5C0FBCFEC4D3B2Fll,
- 0xE9B5DBA58189DBBCll, 0x3956C25BF348B538ll, 0x59F111F1B605D019ll,
- 0x923F82A4AF194F9Bll, 0xAB1C5ED5DA6D8118ll, 0xD807AA98A3030242ll,
- 0x12835B0145706FBEll, 0x243185BE4EE4B28Cll, 0x550C7DC3D5FFB4E2ll,
- 0x72BE5D74F27B896Fll, 0x80DEB1FE3B1696B1ll, 0x9BDC06A725C71235ll,
- 0xC19BF174CF692694ll, 0xE49B69C19EF14AD2ll, 0xEFBE4786384F25E3ll,
- 0x0FC19DC68B8CD5B5ll, 0x240CA1CC77AC9C65ll, 0x2DE92C6F592B0275ll,
- 0x4A7484AA6EA6E483ll, 0x5CB0A9DCBD41FBD4ll, 0x76F988DA831153B5ll,
- 0x983E5152EE66DFABll, 0xA831C66D2DB43210ll, 0xB00327C898FB213Fll,
- 0xBF597FC7BEEF0EE4ll, 0xC6E00BF33DA88FC2ll, 0xD5A79147930AA725ll,
- 0x06CA6351E003826Fll, 0x142929670A0E6E70ll, 0x27B70A8546D22FFCll,
- 0x2E1B21385C26C926ll, 0x4D2C6DFC5AC42AEDll, 0x53380D139D95B3DFll,
- 0x650A73548BAF63DEll, 0x766A0ABB3C77B2A8ll, 0x81C2C92E47EDAEE6ll,
- 0x92722C851482353Bll, 0xA2BFE8A14CF10364ll, 0xA81A664BBC423001ll,
- 0xC24B8B70D0F89791ll, 0xC76C51A30654BE30ll, 0xD192E819D6EF5218ll,
- 0xD69906245565A910ll, 0xF40E35855771202All, 0x106AA07032BBD1B8ll,
- 0x19A4C116B8D2D0C8ll, 0x1E376C085141AB53ll, 0x2748774CDF8EEB99ll,
- 0x34B0BCB5E19B48A8ll, 0x391C0CB3C5C95A63ll, 0x4ED8AA4AE3418ACBll,
- 0x5B9CCA4F7763E373ll, 0x682E6FF3D6B2B8A3ll, 0x748F82EE5DEFB2FCll,
- 0x78A5636F43172F60ll, 0x84C87814A1F0AB72ll, 0x8CC702081A6439ECll,
- 0x90BEFFFA23631E28ll, 0xA4506CEBDE82BDE9ll, 0xBEF9A3F7B2C67915ll,
- 0xC67178F2E372532Bll, 0xCA273ECEEA26619Cll, 0xD186B8C721C0C207ll,
- 0xEADA7DD6CDE0EB1Ell, 0xF57D4F7FEE6ED178ll, 0x06F067AA72176FBAll,
- 0x0A637DC5A2C898A6ll, 0x113F9804BEF90DAEll, 0x1B710B35131C471Bll,
- 0x28DB77F523047D84ll, 0x32CAAB7B40C72493ll, 0x3C9EBE0A15C9BEBCll,
- 0x431D67C49C100D4Cll, 0x4CC5D4BECB3E42B6ll, 0x597F299CFC657E2All,
- 0x5FCB6FAB3AD6FAECll, 0x6C44198C4A475817ll
+ 0x428A2F98D728AE22ull, 0x7137449123EF65CDull, 0xB5C0FBCFEC4D3B2Full,
+ 0xE9B5DBA58189DBBCull, 0x3956C25BF348B538ull, 0x59F111F1B605D019ull,
+ 0x923F82A4AF194F9Bull, 0xAB1C5ED5DA6D8118ull, 0xD807AA98A3030242ull,
+ 0x12835B0145706FBEull, 0x243185BE4EE4B28Cull, 0x550C7DC3D5FFB4E2ull,
+ 0x72BE5D74F27B896Full, 0x80DEB1FE3B1696B1ull, 0x9BDC06A725C71235ull,
+ 0xC19BF174CF692694ull, 0xE49B69C19EF14AD2ull, 0xEFBE4786384F25E3ull,
+ 0x0FC19DC68B8CD5B5ull, 0x240CA1CC77AC9C65ull, 0x2DE92C6F592B0275ull,
+ 0x4A7484AA6EA6E483ull, 0x5CB0A9DCBD41FBD4ull, 0x76F988DA831153B5ull,
+ 0x983E5152EE66DFABull, 0xA831C66D2DB43210ull, 0xB00327C898FB213Full,
+ 0xBF597FC7BEEF0EE4ull, 0xC6E00BF33DA88FC2ull, 0xD5A79147930AA725ull,
+ 0x06CA6351E003826Full, 0x142929670A0E6E70ull, 0x27B70A8546D22FFCull,
+ 0x2E1B21385C26C926ull, 0x4D2C6DFC5AC42AEDull, 0x53380D139D95B3DFull,
+ 0x650A73548BAF63DEull, 0x766A0ABB3C77B2A8ull, 0x81C2C92E47EDAEE6ull,
+ 0x92722C851482353Bull, 0xA2BFE8A14CF10364ull, 0xA81A664BBC423001ull,
+ 0xC24B8B70D0F89791ull, 0xC76C51A30654BE30ull, 0xD192E819D6EF5218ull,
+ 0xD69906245565A910ull, 0xF40E35855771202Aull, 0x106AA07032BBD1B8ull,
+ 0x19A4C116B8D2D0C8ull, 0x1E376C085141AB53ull, 0x2748774CDF8EEB99ull,
+ 0x34B0BCB5E19B48A8ull, 0x391C0CB3C5C95A63ull, 0x4ED8AA4AE3418ACBull,
+ 0x5B9CCA4F7763E373ull, 0x682E6FF3D6B2B8A3ull, 0x748F82EE5DEFB2FCull,
+ 0x78A5636F43172F60ull, 0x84C87814A1F0AB72ull, 0x8CC702081A6439ECull,
+ 0x90BEFFFA23631E28ull, 0xA4506CEBDE82BDE9ull, 0xBEF9A3F7B2C67915ull,
+ 0xC67178F2E372532Bull, 0xCA273ECEEA26619Cull, 0xD186B8C721C0C207ull,
+ 0xEADA7DD6CDE0EB1Eull, 0xF57D4F7FEE6ED178ull, 0x06F067AA72176FBAull,
+ 0x0A637DC5A2C898A6ull, 0x113F9804BEF90DAEull, 0x1B710B35131C471Bull,
+ 0x28DB77F523047D84ull, 0x32CAAB7B40C72493ull, 0x3C9EBE0A15C9BEBCull,
+ 0x431D67C49C100D4Cull, 0x4CC5D4BECB3E42B6ull, 0x597F299CFC657E2Aull,
+ 0x5FCB6FAB3AD6FAECull, 0x6C44198C4A475817ull
};
int t, t8; /* Loop counter */
uint64_t temp1, temp2; /* Temporary word value */

View File

@ -320,14 +320,14 @@ static int SHA384_512ResultN(SHA512Context *context,
/* Initial Hash Values: FIPS 180-3 sections 5.3.4 and 5.3.5 */
static uint64_t SHA384_H0[ ] = {
0xCBBB9D5DC1059ED8ll, 0x629A292A367CD507ll, 0x9159015A3070DD17ll,
0x152FECD8F70E5939ll, 0x67332667FFC00B31ll, 0x8EB44A8768581511ll,
0xDB0C2E0D64F98FA7ll, 0x47B5481DBEFA4FA4ll
0xCBBB9D5DC1059ED8ull, 0x629A292A367CD507ull, 0x9159015A3070DD17ull,
0x152FECD8F70E5939ull, 0x67332667FFC00B31ull, 0x8EB44A8768581511ull,
0xDB0C2E0D64F98FA7ull, 0x47B5481DBEFA4FA4ull
};
static uint64_t SHA512_H0[ ] = {
0x6A09E667F3BCC908ll, 0xBB67AE8584CAA73Bll, 0x3C6EF372FE94F82Bll,
0xA54FF53A5F1D36F1ll, 0x510E527FADE682D1ll, 0x9B05688C2B3E6C1Fll,
0x1F83D9ABFB41BD6Bll, 0x5BE0CD19137E2179ll
0x6A09E667F3BCC908ull, 0xBB67AE8584CAA73Bull, 0x3C6EF372FE94F82Bull,
0xA54FF53A5F1D36F1ull, 0x510E527FADE682D1ull, 0x9B05688C2B3E6C1Full,
0x1F83D9ABFB41BD6Bull, 0x5BE0CD19137E2179ull
};
#endif /* USE_32BIT_ONLY */
@ -766,33 +766,33 @@ static void SHA384_512ProcessMessageBlock(SHA512Context *context)
#else /* !USE_32BIT_ONLY */
/* Constants defined in FIPS 180-3, section 4.2.3 */
static const uint64_t K[80] = {
0x428A2F98D728AE22ll, 0x7137449123EF65CDll, 0xB5C0FBCFEC4D3B2Fll,
0xE9B5DBA58189DBBCll, 0x3956C25BF348B538ll, 0x59F111F1B605D019ll,
0x923F82A4AF194F9Bll, 0xAB1C5ED5DA6D8118ll, 0xD807AA98A3030242ll,
0x12835B0145706FBEll, 0x243185BE4EE4B28Cll, 0x550C7DC3D5FFB4E2ll,
0x72BE5D74F27B896Fll, 0x80DEB1FE3B1696B1ll, 0x9BDC06A725C71235ll,
0xC19BF174CF692694ll, 0xE49B69C19EF14AD2ll, 0xEFBE4786384F25E3ll,
0x0FC19DC68B8CD5B5ll, 0x240CA1CC77AC9C65ll, 0x2DE92C6F592B0275ll,
0x4A7484AA6EA6E483ll, 0x5CB0A9DCBD41FBD4ll, 0x76F988DA831153B5ll,
0x983E5152EE66DFABll, 0xA831C66D2DB43210ll, 0xB00327C898FB213Fll,
0xBF597FC7BEEF0EE4ll, 0xC6E00BF33DA88FC2ll, 0xD5A79147930AA725ll,
0x06CA6351E003826Fll, 0x142929670A0E6E70ll, 0x27B70A8546D22FFCll,
0x2E1B21385C26C926ll, 0x4D2C6DFC5AC42AEDll, 0x53380D139D95B3DFll,
0x650A73548BAF63DEll, 0x766A0ABB3C77B2A8ll, 0x81C2C92E47EDAEE6ll,
0x92722C851482353Bll, 0xA2BFE8A14CF10364ll, 0xA81A664BBC423001ll,
0xC24B8B70D0F89791ll, 0xC76C51A30654BE30ll, 0xD192E819D6EF5218ll,
0xD69906245565A910ll, 0xF40E35855771202All, 0x106AA07032BBD1B8ll,
0x19A4C116B8D2D0C8ll, 0x1E376C085141AB53ll, 0x2748774CDF8EEB99ll,
0x34B0BCB5E19B48A8ll, 0x391C0CB3C5C95A63ll, 0x4ED8AA4AE3418ACBll,
0x5B9CCA4F7763E373ll, 0x682E6FF3D6B2B8A3ll, 0x748F82EE5DEFB2FCll,
0x78A5636F43172F60ll, 0x84C87814A1F0AB72ll, 0x8CC702081A6439ECll,
0x90BEFFFA23631E28ll, 0xA4506CEBDE82BDE9ll, 0xBEF9A3F7B2C67915ll,
0xC67178F2E372532Bll, 0xCA273ECEEA26619Cll, 0xD186B8C721C0C207ll,
0xEADA7DD6CDE0EB1Ell, 0xF57D4F7FEE6ED178ll, 0x06F067AA72176FBAll,
0x0A637DC5A2C898A6ll, 0x113F9804BEF90DAEll, 0x1B710B35131C471Bll,
0x28DB77F523047D84ll, 0x32CAAB7B40C72493ll, 0x3C9EBE0A15C9BEBCll,
0x431D67C49C100D4Cll, 0x4CC5D4BECB3E42B6ll, 0x597F299CFC657E2All,
0x5FCB6FAB3AD6FAECll, 0x6C44198C4A475817ll
0x428A2F98D728AE22ull, 0x7137449123EF65CDull, 0xB5C0FBCFEC4D3B2Full,
0xE9B5DBA58189DBBCull, 0x3956C25BF348B538ull, 0x59F111F1B605D019ull,
0x923F82A4AF194F9Bull, 0xAB1C5ED5DA6D8118ull, 0xD807AA98A3030242ull,
0x12835B0145706FBEull, 0x243185BE4EE4B28Cull, 0x550C7DC3D5FFB4E2ull,
0x72BE5D74F27B896Full, 0x80DEB1FE3B1696B1ull, 0x9BDC06A725C71235ull,
0xC19BF174CF692694ull, 0xE49B69C19EF14AD2ull, 0xEFBE4786384F25E3ull,
0x0FC19DC68B8CD5B5ull, 0x240CA1CC77AC9C65ull, 0x2DE92C6F592B0275ull,
0x4A7484AA6EA6E483ull, 0x5CB0A9DCBD41FBD4ull, 0x76F988DA831153B5ull,
0x983E5152EE66DFABull, 0xA831C66D2DB43210ull, 0xB00327C898FB213Full,
0xBF597FC7BEEF0EE4ull, 0xC6E00BF33DA88FC2ull, 0xD5A79147930AA725ull,
0x06CA6351E003826Full, 0x142929670A0E6E70ull, 0x27B70A8546D22FFCull,
0x2E1B21385C26C926ull, 0x4D2C6DFC5AC42AEDull, 0x53380D139D95B3DFull,
0x650A73548BAF63DEull, 0x766A0ABB3C77B2A8ull, 0x81C2C92E47EDAEE6ull,
0x92722C851482353Bull, 0xA2BFE8A14CF10364ull, 0xA81A664BBC423001ull,
0xC24B8B70D0F89791ull, 0xC76C51A30654BE30ull, 0xD192E819D6EF5218ull,
0xD69906245565A910ull, 0xF40E35855771202Aull, 0x106AA07032BBD1B8ull,
0x19A4C116B8D2D0C8ull, 0x1E376C085141AB53ull, 0x2748774CDF8EEB99ull,
0x34B0BCB5E19B48A8ull, 0x391C0CB3C5C95A63ull, 0x4ED8AA4AE3418ACBull,
0x5B9CCA4F7763E373ull, 0x682E6FF3D6B2B8A3ull, 0x748F82EE5DEFB2FCull,
0x78A5636F43172F60ull, 0x84C87814A1F0AB72ull, 0x8CC702081A6439ECull,
0x90BEFFFA23631E28ull, 0xA4506CEBDE82BDE9ull, 0xBEF9A3F7B2C67915ull,
0xC67178F2E372532Bull, 0xCA273ECEEA26619Cull, 0xD186B8C721C0C207ull,
0xEADA7DD6CDE0EB1Eull, 0xF57D4F7FEE6ED178ull, 0x06F067AA72176FBAull,
0x0A637DC5A2C898A6ull, 0x113F9804BEF90DAEull, 0x1B710B35131C471Bull,
0x28DB77F523047D84ull, 0x32CAAB7B40C72493ull, 0x3C9EBE0A15C9BEBCull,
0x431D67C49C100D4Cull, 0x4CC5D4BECB3E42B6ull, 0x597F299CFC657E2Aull,
0x5FCB6FAB3AD6FAECull, 0x6C44198C4A475817ull
};
int t, t8; /* Loop counter */
uint64_t temp1, temp2; /* Temporary word value */

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 BogDan Vatra <bogdan@kde.org>
** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Android port of the Qt Toolkit.
@ -176,30 +176,6 @@ public class QtMessageDialogHelper
m_buttonsList.add(new ButtonStruct(this, id, text));
}
private void setTextAppearance(TextView view, String attr, String style)
{
try {
int[] attrs = (int[]) Class.forName("android.R$styleable").getDeclaredField("TextAppearance").get(null);
final TypedArray a = m_theme.obtainStyledAttributes(null,
attrs,
Class.forName("android.R$attr").getDeclaredField(attr).getInt(null),
Class.forName("android.R$style").getDeclaredField(style).getInt(null));
final int textSize = a.getDimensionPixelSize(
Class.forName("android.R$styleable").getDeclaredField("TextAppearance_textSize").getInt(null), 0);
if (textSize != 0)
view.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
final int textColor = a.getColor(
Class.forName("android.R$styleable").getDeclaredField("TextAppearance_textColor").getInt(null), 0x3138);
if (textColor != 0x3138)
view.setTextColor(textColor);
a.recycle();
} catch (Exception e) {
e.printStackTrace();
}
}
private Drawable getStyledDrawable(String drawable) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException
{
int[] attrs = {Class.forName("android.R$attr").getDeclaredField(drawable).getInt(null)};
@ -256,7 +232,7 @@ public class QtMessageDialogHelper
view.setLongClickable(true);
view.setText(m_text);
setTextAppearance(view, "textAppearanceMedium", "TextAppearance_Medium");
view.setTextAppearance(m_activity, android.R.style.TextAppearance_Medium);
RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layout.setMargins(16, 8, 16, 8);
@ -273,7 +249,7 @@ public class QtMessageDialogHelper
view.setLongClickable(true);
view.setText(m_informativeText);
setTextAppearance(view, "textAppearanceMedium", "TextAppearance_Medium");
view.setTextAppearance(m_activity, android.R.style.TextAppearance_Medium);
RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layout.setMargins(16, 8, 16, 8);
@ -293,7 +269,7 @@ public class QtMessageDialogHelper
view.setLongClickable(true);
view.setText(m_detailedText);
setTextAppearance(view, "textAppearanceSmall", "TextAppearance_Small");
view.setTextAppearance(m_activity, android.R.style.TextAppearance_Small);
RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layout.setMargins(16, 8, 16, 8);

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<array name="qt_sources">
<item>https://download.qt-project.org/ministro/android/qt5/qt-5.4</item>
<item>https://download.qt.io/ministro/android/qt5/qt-5.6</item>
</array>
<!-- The following is handled automatically by the deployment tool. It should

View File

@ -214,10 +214,12 @@ QByteArray QWindowsLocalCodec::convertFromUnicode(const QChar *ch, int uclen, Co
0, 0, 0, &used_def));
// and try again...
} else {
// Fail. Probably can't happen in fact (dwFlags is 0).
#ifndef QT_NO_DEBUG
// Fail.
qWarning("WideCharToMultiByte: Cannot convert multibyte text (error %d): %s (UTF-8)",
r, QString(ch, uclen).toLocal8Bit().data());
// Can't use qWarning(), as it'll recurse to handle %ls
fprintf(stderr,
"WideCharToMultiByte: Cannot convert multibyte text (error %d): %ls\n",
r, reinterpret_cast<const wchar_t*>(QString(ch, uclen).utf16()));
#endif
break;
}

View File

@ -1998,6 +1998,7 @@ static inline OSVERSIONINFOEX determineWinOsVersion()
#define pGetModuleHandle GetModuleHandleW
#endif
#ifndef Q_OS_WINCE
HMODULE ntdll = pGetModuleHandle(L"ntdll.dll");
if (Q_UNLIKELY(!ntdll))
return result;
@ -2017,6 +2018,9 @@ static inline OSVERSIONINFOEX determineWinOsVersion()
// GetVersionEx() has been deprecated in Windows 8.1 and will return
// only Windows 8 from that version on, so use the kernel API function.
pRtlGetVersion((LPOSVERSIONINFO) &result); // always returns STATUS_SUCCESS
#else // !Q_OS_WINCE
GetVersionEx(&result);
#endif
return result;
}

View File

@ -585,10 +585,6 @@ Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max
# define QT_OSX_DEPLOYMENT_TARGET_BELOW(osx) \
QT_MAC_DEPLOYMENT_TARGET_BELOW(osx, __IPHONE_NA)
QT_END_NAMESPACE
Q_FORWARD_DECLARE_OBJC_CLASS(NSAutoreleasePool);
QT_BEGIN_NAMESPACE
// Implemented in qcore_mac_objc.mm
class Q_CORE_EXPORT QMacAutoReleasePool
{
@ -597,7 +593,7 @@ public:
~QMacAutoReleasePool();
private:
Q_DISABLE_COPY(QMacAutoReleasePool)
NSAutoreleasePool *pool;
void *pool;
};
#endif // Q_OS_MAC

View File

@ -64,9 +64,9 @@ QT_BEGIN_NAMESPACE
// don't make tags in QtCore, bootstrapped systems or if the user asked not to
#elif defined(Q_CC_GNU) && !defined(Q_OS_ANDROID)
# if defined(Q_PROCESSOR_X86) && (defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD_KERNEL))
# if defined(Q_PROCESSOR_X86_64) // x86-64 or x32
# if defined(Q_PROCESSOR_X86_64) && QT_POINTER_SIZE == 8 // x86-64 64-bit
# define QT_VERSION_TAG_RELOC(sym) ".quad " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOT\n"
# else // x86
# else // x86 or x86-64 32-bit (x32)
# define QT_VERSION_TAG_RELOC(sym) ".long " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOT\n"
# endif
# define QT_VERSION_TAG(sym) \

View File

@ -112,11 +112,13 @@ QT_BEGIN_NAMESPACE
\macro QT_NO_PROCESS_COMBINED_ARGUMENT_START
\relates QProcess
Disables the QProcess::start() overload taking a single string.
Disables the
\l {QProcess::start(const QString &, OpenMode)}{QProcess::start()}
overload taking a single string.
In most cases where it is used, the user intends for the first argument
to be treated atomically as per the other overload.
\sa QProcess::start()
\sa QProcess::start(const QString &command, OpenMode mode)
*/
/*!
@ -2543,7 +2545,7 @@ bool QProcess::startDetached(const QString &program,
After the \a command string has been split and unquoted, this function
behaves like the overload which takes the arguments as a string list.
\sa start()
\sa start(const QString &command, OpenMode mode)
*/
bool QProcess::startDetached(const QString &command)
{

View File

@ -1052,7 +1052,7 @@ inline void QUrlPrivate::setAuthority(const QString &auth, int from, int end, QU
if (colonIndex == end - 1) {
// found a colon but no digits after it
setError(PortEmptyError, auth, colonIndex + 1);
port = -1;
} else if (uint(colonIndex) < uint(end)) {
unsigned long x = 0;
for (int i = colonIndex + 1; i < end; ++i) {
@ -1182,7 +1182,7 @@ inline void QUrlPrivate::appendHost(QString &appendTo, QUrl::FormattingOptions o
} else {
// this is either an IPv4Address or a reg-name
// if it is a reg-name, it is already stored in Unicode form
if (options == QUrl::EncodeUnicode)
if (options & QUrl::EncodeUnicode && !(options & 0x4000000))
appendTo += qt_ACE_do(host, ToAceOnly, AllowLeadingDot);
else
appendTo += host;

View File

@ -156,7 +156,7 @@ QMacAutoReleasePool::~QMacAutoReleasePool()
// Drain behaves the same as release, with the advantage that
// if we're ever used in a garbage-collected environment, the
// drain acts as a hint to the garbage collector to collect.
[pool drain];
[static_cast<NSAutoreleasePool*>(pool) drain];
}
// -------------------------------------------------------------------------

View File

@ -316,7 +316,10 @@ static void resolveTimerAPI()
QEventDispatcherWin32Private::QEventDispatcherWin32Private()
: threadId(GetCurrentThreadId()), interrupt(false), closingDown(false), internalHwnd(0),
getMessageHook(0), serialNumber(0), lastSerialNumber(0), sendPostedEventsWindowsTimerId(0),
wakeUps(0), activateNotifiersPosted(false)
wakeUps(0)
#ifndef Q_OS_WINCE
, activateNotifiersPosted(false)
#endif
{
resolveTimerAPI();
}
@ -398,9 +401,11 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
QSockNot *sn = dict ? dict->value(wp) : 0;
if (sn) {
#ifndef Q_OS_WINCE
d->doWsaAsyncSelect(sn->fd, 0);
d->active_fd[sn->fd].selected = false;
d->postActivateSocketNotifiers();
#endif
if (type < 3) {
QEvent event(QEvent::SockAct);
QCoreApplication::sendEvent(sn->obj, &event);
@ -411,6 +416,7 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
}
}
return 0;
#ifndef Q_OS_WINCE
} else if (message == WM_QT_ACTIVATENOTIFIERS) {
Q_ASSERT(d != 0);
@ -425,6 +431,7 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
}
d->activateNotifiersPosted = false;
return 0;
#endif // !Q_OS_WINCE
} else if (message == WM_QT_SENDPOSTEDEVENTS
// we also use a Windows timer to send posted events when the message queue is full
|| (message == WM_TIMER
@ -665,11 +672,13 @@ void QEventDispatcherWin32Private::doWsaAsyncSelect(int socket, long event)
WSAAsyncSelect(socket, internalHwnd, event ? int(WM_QT_SOCKETNOTIFIER) : 0, event);
}
#ifndef Q_OS_WINCE
void QEventDispatcherWin32Private::postActivateSocketNotifiers()
{
if (!activateNotifiersPosted)
activateNotifiersPosted = PostMessage(internalHwnd, WM_QT_ACTIVATENOTIFIERS, 0, 0);
}
#endif // !Q_OS_WINCE
void QEventDispatcherWin32::createInternalHwnd()
{
@ -927,16 +936,22 @@ void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier)
QSFDict::iterator it = d->active_fd.find(sockfd);
if (it != d->active_fd.end()) {
QSockFd &sd = it.value();
#ifndef Q_OS_WINCE
if (sd.selected) {
d->doWsaAsyncSelect(sockfd, 0);
sd.selected = false;
}
#endif // !Q_OS_WINCE
sd.event |= event;
} else {
d->active_fd.insert(sockfd, QSockFd(event));
}
#ifndef Q_OS_WINCE
d->postActivateSocketNotifiers();
#else
d->doWsaAsyncSelect(sockfd, event);
#endif
}
void QEventDispatcherWin32::unregisterSocketNotifier(QSocketNotifier *notifier)
@ -965,6 +980,7 @@ void QEventDispatcherWin32::doUnregisterSocketNotifier(QSocketNotifier *notifier
QSFDict::iterator it = d->active_fd.find(sockfd);
if (it != d->active_fd.end()) {
QSockFd &sd = it.value();
#ifndef Q_OS_WINCE
if (sd.selected)
d->doWsaAsyncSelect(sockfd, 0);
const long event[3] = { FD_READ | FD_CLOSE | FD_ACCEPT, FD_WRITE | FD_CONNECT, FD_OOB };
@ -975,6 +991,13 @@ void QEventDispatcherWin32::doUnregisterSocketNotifier(QSocketNotifier *notifier
sd.selected = false;
d->postActivateSocketNotifiers();
}
#else
const long event[3] = { FD_READ | FD_CLOSE | FD_ACCEPT, FD_WRITE | FD_CONNECT, FD_OOB };
sd.event ^= event[type];
d->doWsaAsyncSelect(sockfd, sd.event);
if (sd.event == 0)
d->active_fd.erase(it);
#endif // !Q_OS_WINCE
}
QSNDict *sn_vec[3] = { &d->sn_read, &d->sn_write, &d->sn_except };

View File

@ -185,9 +185,11 @@ public:
QSNDict sn_write;
QSNDict sn_except;
QSFDict active_fd;
#ifndef Q_OS_WINCE
bool activateNotifiersPosted;
void doWsaAsyncSelect(int socket, long event);
void postActivateSocketNotifiers();
#endif
void doWsaAsyncSelect(int socket, long event);
QList<QWinEventNotifier *> winEventNotifierList;
void activateEventNotifier(QWinEventNotifier * wen);

View File

@ -56,6 +56,7 @@ 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;
@ -185,8 +186,34 @@ HRESULT QEventDispatcherWinRT::runOnXamlThread(const std::function<HRESULT ()> &
ComPtr<ICoreWindow> 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<IVectorView<CoreApplicationView*>> 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;
}
}
Q_ASSERT(dispatcher);
} else {
hr = window->get_Dispatcher(&dispatcher);
Q_ASSERT_SUCCEEDED(hr);
}
}
HRESULT hr;

View File

@ -497,7 +497,7 @@ namespace QtPrivate {
template <typename, typename, typename, typename> struct FunctorCall;
template <int... II, typename... SignalArgs, typename R, typename Function>
struct FunctorCall<IndexesList<II...>, List<SignalArgs...>, R, Function> {
static void call(Function f, void **arg) {
static void call(Function &f, void **arg) {
f((*reinterpret_cast<typename RemoveRef<SignalArgs>::Type *>(arg[II+1]))...), ApplyReturnValue<R>(arg[0]);
}
};

View File

@ -54,8 +54,8 @@ class Q_CORE_EXPORT QWinEventNotifier : public QObject
typedef Qt::HANDLE HANDLE;
public:
explicit QWinEventNotifier(QObject *parent = 0);
explicit QWinEventNotifier(HANDLE hEvent, QObject *parent = 0);
explicit QWinEventNotifier(QObject *parent = Q_NULLPTR);
explicit QWinEventNotifier(HANDLE hEvent, QObject *parent = Q_NULLPTR);
~QWinEventNotifier();
void setHandle(HANDLE hEvent);

View File

@ -1289,7 +1289,7 @@
/*!
\fn T *QAtomicPointer::loadAcquire() const
Atomically loads the value of this QAtomicPointerusing the "Acquire" memory
Atomically loads the value of this QAtomicPointer using the "Acquire" memory
ordering. The value is not modified in any way, but note that there's no
guarantee that it remains so.

View File

@ -640,6 +640,8 @@ Q_INLINE_TEMPLATE void QMap<Key, T>::clear()
*this = QMap<Key, T>();
}
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wreturn-stack-address")
template <class Key, class T>
Q_INLINE_TEMPLATE const T QMap<Key, T>::value(const Key &akey, const T &adefaultValue) const
@ -648,6 +650,8 @@ Q_INLINE_TEMPLATE const T QMap<Key, T>::value(const Key &akey, const T &adefault
return n ? n->value : adefaultValue;
}
QT_WARNING_POP
template <class Key, class T>
Q_INLINE_TEMPLATE const T QMap<Key, T>::operator[](const Key &akey) const
{

View File

@ -103,7 +103,7 @@ public:
Q_DECL_RELAXED_CONSTEXPR static
QRgba64 fromArgb32(uint rgb)
{
return fromRgba(rgb >> 16, rgb >> 8, rgb, rgb >> 24);
return fromRgba(quint8(rgb >> 16), quint8(rgb >> 8), quint8(rgb), quint8(rgb >> 24));
}
Q_DECL_CONSTEXPR bool isOpaque() const
@ -115,10 +115,10 @@ public:
return (rgba & alphaMask()) == 0;
}
Q_DECL_CONSTEXPR quint16 red() const { return rgba >> RedShift; }
Q_DECL_CONSTEXPR quint16 green() const { return rgba >> GreenShift; }
Q_DECL_CONSTEXPR quint16 blue() const { return rgba >> BlueShift; }
Q_DECL_CONSTEXPR quint16 alpha() const { return rgba >> AlphaShift; }
Q_DECL_CONSTEXPR quint16 red() const { return quint16(rgba >> RedShift); }
Q_DECL_CONSTEXPR quint16 green() const { return quint16(rgba >> GreenShift); }
Q_DECL_CONSTEXPR quint16 blue() const { return quint16(rgba >> BlueShift); }
Q_DECL_CONSTEXPR quint16 alpha() const { return quint16(rgba >> AlphaShift); }
void setRed(quint16 _red) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << RedShift)) | (quint64(_red) << RedShift); }
void setGreen(quint16 _green) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << GreenShift)) | (quint64(_green) << GreenShift); }
void setBlue(quint16 _blue) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << BlueShift)) | (quint64(_blue) << BlueShift); }
@ -130,11 +130,11 @@ public:
Q_DECL_CONSTEXPR quint8 alpha8() const { return div_257(alpha()); }
Q_DECL_CONSTEXPR uint toArgb32() const
{
return (alpha8() << 24) | (red8() << 16) | (green8() << 8) | blue8();
return uint((alpha8() << 24) | (red8() << 16) | (green8() << 8) | blue8());
}
Q_DECL_CONSTEXPR ushort toRgb16() const
{
return (red() & 0xf800) | ((green() >> 10) << 5) | (blue() >> 11);
return ushort((red() & 0xf800) | ((green() >> 10) << 5) | (blue() >> 11));
}
Q_DECL_RELAXED_CONSTEXPR QRgba64 premultiplied() const
@ -143,7 +143,7 @@ public:
const quint16 r = div_65535(red() * a);
const quint16 g = div_65535(green() * a);
const quint16 b = div_65535(blue() * a);
return fromRgba64(r, g, b, a);
return fromRgba64(r, g, b, quint16(a));
}
Q_DECL_RELAXED_CONSTEXPR QRgba64 unpremultiplied() const
@ -169,18 +169,18 @@ public:
private:
static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE quint64 alphaMask() { return Q_UINT64_C(0xffff) << AlphaShift; }
static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint div_257_floor(uint x) { return (x - (x >> 8)) >> 8; }
static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint div_257(uint x) { return div_257_floor(x + 128); }
static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint div_65535(uint x) { return (x + (x>>16) + 0x8000U) >> 16; }
static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE quint8 div_257_floor(uint x) { return quint8((x - (x >> 8)) >> 8); }
static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE quint8 div_257(quint16 x) { return div_257_floor(x + 128U); }
static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE quint16 div_65535(uint x) { return quint16((x + (x>>16) + 0x8000U) >> 16); }
Q_DECL_RELAXED_CONSTEXPR Q_ALWAYS_INLINE QRgba64 unpremultiplied_32bit() const
{
if (isOpaque() || isTransparent())
return *this;
const quint32 a = alpha();
const quint16 r = (quint32(red()) * 0xffff + a/2) / a;
const quint16 g = (quint32(green()) * 0xffff + a/2) / a;
const quint16 b = (quint32(blue()) * 0xffff + a/2) / a;
return fromRgba64(r, g, b, a);
const quint16 r = quint16((red() * 0xffff + a/2) / a);
const quint16 g = quint16((green() * 0xffff + a/2) / a);
const quint16 b = quint16((blue() * 0xffff + a/2) / a);
return fromRgba64(r, g, b, quint16(a));
}
Q_DECL_RELAXED_CONSTEXPR Q_ALWAYS_INLINE QRgba64 unpremultiplied_64bit() const
{
@ -188,10 +188,10 @@ private:
return *this;
const quint64 a = alpha();
const quint64 fa = (Q_UINT64_C(0xffff00008000) + a/2) / a;
const quint16 r = (red() * fa + 0x80000000) >> 32;
const quint16 g = (green() * fa + 0x80000000) >> 32;
const quint16 b = (blue() * fa + 0x80000000) >> 32;
return fromRgba64(r, g, b, a);
const quint16 r = quint16((red() * fa + 0x80000000) >> 32);
const quint16 g = quint16((green() * fa + 0x80000000) >> 32);
const quint16 b = quint16((blue() * fa + 0x80000000) >> 32);
return fromRgba64(r, g, b, quint16(a));
}
};

View File

@ -1110,21 +1110,17 @@ bool QNetworkReplyImplPrivate::migrateBackend()
return true;
// Backend does not support resuming download.
if (!backend->canResume())
if (backend && !backend->canResume())
return false;
state = QNetworkReplyPrivate::Reconnecting;
if (backend) {
delete backend;
backend = 0;
}
cookedHeaders.clear();
rawHeaders.clear();
preMigrationDownloaded = bytesDownloaded;
delete backend;
backend = manager->d_func()->findBackend(operation, request);
if (backend) {

View File

@ -245,7 +245,8 @@ bool QNativeSocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket::
close();
// Currently, only TCP sockets are initialized this way.
d->socketDescriptor = qintptr(gSocketHandler->pendingTcpSockets.take(socketDescriptor));
IStreamSocket *socket = gSocketHandler->pendingTcpSockets.take(socketDescriptor);
d->socketDescriptor = qintptr(socket);
d->socketType = QAbstractSocket::TcpSocket;
if (!d->socketDescriptor || !d->fetchConnectionParameters()) {
@ -255,6 +256,36 @@ bool QNativeSocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket::
return false;
}
// Start processing incoming data
if (d->socketType == QAbstractSocket::TcpSocket) {
HRESULT hr;
hr = QEventDispatcherWinRT::runOnXamlThread([d, socket, this]() {
ComPtr<IBuffer> buffer;
HRESULT hr = g->bufferFactory->Create(READ_BUFFER_SIZE, &buffer);
RETURN_HR_IF_FAILED("initialize(): Could not create buffer");
ComPtr<IInputStream> stream;
hr = socket->get_InputStream(&stream);
RETURN_HR_IF_FAILED("initialize(): Could not obtain input stream");
hr = stream->ReadAsync(buffer.Get(), READ_BUFFER_SIZE, InputStreamOptions_Partial, d->readOp.GetAddressOf());
if (FAILED(hr)) {
qErrnoWarning(hr, "initialize(): Failed to read from the socket buffer (%s).",
socketDescription(this).constData());
return E_FAIL;
}
hr = d->readOp->put_Completed(Callback<SocketReadCompletedHandler>(d, &QNativeSocketEnginePrivate::handleReadyRead).Get());
if (FAILED(hr)) {
qErrnoWarning(hr, "initialize(): Failed to set socket read callback (%s).",
socketDescription(this).constData());
return E_FAIL;
}
return S_OK;
});
if (hr == E_FAIL)
return false;
Q_ASSERT_SUCCEEDED(hr);
}
d->socketState = socketState;
return true;
}
@ -358,8 +389,6 @@ bool QNativeSocketEngine::bind(const QHostAddress &address, quint16 port)
}
RETURN_HR_IF_FAILED("QNativeSocketEngine::bind: Unable to bind socket");
hr = op->put_Completed(Callback<IAsyncActionCompletedHandler>(d, &QNativeSocketEnginePrivate::handleBindCompleted).Get());
RETURN_HR_IF_FAILED("QNativeSocketEngine::bind: Could not register bind callback");
hr = QWinRTFunctions::await(op);
RETURN_HR_IF_FAILED("QNativeSocketEngine::bind: Could not wait for bind to finish");
return S_OK;
@ -396,35 +425,9 @@ int QNativeSocketEngine::accept()
return -1;
}
// Start processing incoming data
if (d->socketType == QAbstractSocket::TcpSocket) {
IStreamSocket *socket = d->pendingConnections.takeFirst();
HRESULT hr;
ComPtr<IBuffer> buffer;
hr = g->bufferFactory->Create(READ_BUFFER_SIZE, &buffer);
Q_ASSERT_SUCCEEDED(hr);
ComPtr<IInputStream> stream;
hr = socket->get_InputStream(&stream);
Q_ASSERT_SUCCEEDED(hr);
ComPtr<IAsyncBufferOperation> op;
hr = stream->ReadAsync(buffer.Get(), READ_BUFFER_SIZE, InputStreamOptions_Partial, &op);
if (FAILED(hr)) {
qErrnoWarning(hr, "accept(): Failed to read from the socket buffer (%s).",
socketDescription(this).constData());
return -1;
}
hr = QEventDispatcherWinRT::runOnXamlThread([d, op]() {
return op->put_Completed(Callback<SocketReadCompletedHandler>(d, &QNativeSocketEnginePrivate::handleReadyRead).Get());
});
if (FAILED(hr)) {
qErrnoWarning(hr, "accept(): Failed to set socket read callback (%s).",
socketDescription(this).constData());
return -1;
}
d->currentConnections.append(socket);
SocketHandler *handler = gSocketHandler();
handler->pendingTcpSockets.insert(++handler->socketCount, socket);
return handler->socketCount;
@ -460,6 +463,32 @@ void QNativeSocketEngine::close()
}
}
#if _MSC_VER >= 1900
// 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<IStreamSocket3> socket3;
hr = d->tcpSocket()->QueryInterface(IID_PPV_ARGS(&socket3));
Q_ASSERT_SUCCEEDED(hr);
ComPtr<IAsyncAction> action;
hr = socket3->CancelIOAsync(&action);
Q_ASSERT_SUCCEEDED(hr);
hr = QWinRTFunctions::await(action);
Q_ASSERT_SUCCEEDED(hr);
#endif // _MSC_VER >= 1900
if (d->readOp) {
ComPtr<IAsyncInfo> info;
hr = d->readOp.As(&info);
Q_ASSERT_SUCCEEDED(hr);
if (info) {
hr = info->Cancel();
Q_ASSERT_SUCCEEDED(hr);
hr = info->Close();
Q_ASSERT_SUCCEEDED(hr);
}
}
if (d->socketDescriptor != -1) {
ComPtr<IClosable> socket;
if (d->socketType == QAbstractSocket::TcpSocket) {
@ -477,7 +506,6 @@ void QNativeSocketEngine::close()
if (socket) {
hr = socket->Close();
Q_ASSERT_SUCCEEDED(hr);
d->socketDescriptor = -1;
}
d->socketDescriptor = -1;
}
@ -791,17 +819,16 @@ void QNativeSocketEngine::establishRead()
hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
ComPtr<IInputStream> stream;
HRESULT hr = d->tcpSocket()->get_InputStream(&stream);
RETURN_HR_IF_FAILED("QNativeSocketEngine::establishRead: Failed to get socket input stream");
RETURN_HR_IF_FAILED("establishRead(): Failed to get socket input stream");
ComPtr<IBuffer> buffer;
hr = g->bufferFactory->Create(READ_BUFFER_SIZE, &buffer);
RETURN_HR_IF_FAILED("QNativeSocketEngine::establishRead: Failed to create buffer");
RETURN_HR_IF_FAILED("establishRead(): Failed to create buffer");
ComPtr<IAsyncBufferOperation> op;
hr = stream->ReadAsync(buffer.Get(), READ_BUFFER_SIZE, InputStreamOptions_Partial, &op);
RETURN_HR_IF_FAILED("QNativeSocketEngine::establishRead: Failed to initiate socket read");
hr = op->put_Completed(Callback<SocketReadCompletedHandler>(d, &QNativeSocketEnginePrivate::handleReadyRead).Get());
RETURN_HR_IF_FAILED("QNativeSocketEngine::establishRead: Failed to register read callback");
hr = stream->ReadAsync(buffer.Get(), READ_BUFFER_SIZE, InputStreamOptions_Partial, &d->readOp);
RETURN_HR_IF_FAILED("establishRead(): Failed to initiate socket read");
hr = d->readOp->put_Completed(Callback<SocketReadCompletedHandler>(d, &QNativeSocketEnginePrivate::handleReadyRead).Get());
RETURN_HR_IF_FAILED("establishRead(): Failed to register read callback");
return S_OK;
});
Q_ASSERT_SUCCEEDED(hr);
@ -1167,11 +1194,6 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters()
return true;
}
HRESULT QNativeSocketEnginePrivate::handleBindCompleted(IAsyncAction *, AsyncStatus)
{
return S_OK;
}
HRESULT QNativeSocketEnginePrivate::handleClientConnection(IStreamSocketListener *listener, IStreamSocketListenerConnectionReceivedEventArgs *args)
{
Q_Q(QNativeSocketEngine);
@ -1180,6 +1202,7 @@ HRESULT QNativeSocketEnginePrivate::handleClientConnection(IStreamSocketListener
args->get_Socket(&socket);
pendingConnections.append(socket);
emit q->connectionReady();
if (notifyOnRead)
emit q->readReady();
return S_OK;
}
@ -1304,32 +1327,34 @@ HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *async
if (notifyOnRead)
emit q->readReady();
hr = QEventDispatcherWinRT::runOnXamlThread([buffer, q, this]() {
UINT32 readBufferLength;
ComPtr<IInputStream> stream;
hr = tcpSocket()->get_InputStream(&stream);
Q_ASSERT_SUCCEEDED(hr);
HRESULT hr = tcpSocket()->get_InputStream(&stream);
RETURN_HR_IF_FAILED("handleReadyRead(): Could not obtain input stream");
// Reuse the stream buffer
hr = buffer->get_Capacity(&bufferLength);
Q_ASSERT_SUCCEEDED(hr);
hr = buffer->get_Capacity(&readBufferLength);
RETURN_HR_IF_FAILED("handleReadyRead(): Could not obtain buffer capacity");
hr = buffer->put_Length(0);
Q_ASSERT_SUCCEEDED(hr);
RETURN_HR_IF_FAILED("handleReadyRead(): Could not set buffer length");
ComPtr<IAsyncBufferOperation> op;
hr = stream->ReadAsync(buffer.Get(), bufferLength, InputStreamOptions_Partial, &op);
hr = stream->ReadAsync(buffer.Get(), readBufferLength, InputStreamOptions_Partial, &readOp);
if (FAILED(hr)) {
qErrnoWarning(hr, "handleReadyRead(): Could not read into socket stream buffer (%s).",
socketDescription(q).constData());
return S_OK;
}
hr = QEventDispatcherWinRT::runOnXamlThread([op, this]() {
return op->put_Completed(Callback<SocketReadCompletedHandler>(this, &QNativeSocketEnginePrivate::handleReadyRead).Get());
});
hr = readOp->put_Completed(Callback<SocketReadCompletedHandler>(this, &QNativeSocketEnginePrivate::handleReadyRead).Get());
if (FAILED(hr)) {
qErrnoWarning(hr, "handleReadyRead(): Failed to set socket read callback (%s).",
socketDescription(q).constData());
return S_OK;
}
return S_OK;
});
Q_ASSERT_SUCCEEDED(hr);
return S_OK;
}
HRESULT QNativeSocketEnginePrivate::handleNewDatagram(IDatagramSocket *socket, IDatagramSocketMessageReceivedEventArgs *args)
@ -1362,6 +1387,7 @@ HRESULT QNativeSocketEnginePrivate::handleNewDatagram(IDatagramSocket *socket, I
hr = reader->ReadBytes(length, reinterpret_cast<BYTE *>(datagram.data.data()));
RETURN_OK_IF_FAILED("Could not read datagram");
pendingDatagrams.append(datagram);
if (notifyOnRead)
emit q->readReady();
return S_OK;

View File

@ -205,6 +205,7 @@ private:
{ return reinterpret_cast<ABI::Windows::Networking::Sockets::IDatagramSocket *>(socketDescriptor); }
Microsoft::WRL::ComPtr<ABI::Windows::Networking::Sockets::IStreamSocketListener> tcpListener;
Microsoft::WRL::ComPtr<ABI::Windows::Foundation::IAsyncAction> connectOp;
Microsoft::WRL::ComPtr<ABI::Windows::Foundation::IAsyncOperationWithProgress<ABI::Windows::Storage::Streams::IBuffer *, UINT32>> readOp;
QBuffer readBytes;
QMutex readMutex;
@ -215,7 +216,6 @@ private:
QAbstractSocket *sslSocket;
EventRegistrationToken connectionToken;
HRESULT handleBindCompleted(ABI::Windows::Foundation::IAsyncAction *, ABI::Windows::Foundation::AsyncStatus);
HRESULT handleNewDatagram(ABI::Windows::Networking::Sockets::IDatagramSocket *socket,
ABI::Windows::Networking::Sockets::IDatagramSocketMessageReceivedEventArgs *args);
HRESULT handleClientConnection(ABI::Windows::Networking::Sockets::IStreamSocketListener *tcpListener,

View File

@ -337,6 +337,15 @@ QCocoaIntegration::QCocoaIntegration(const QStringList &paramList)
[newDelegate setMenuLoader:qtMenuLoader];
}
// The presentation options such as whether or not the dock and/or menu bar is
// hidden (automatically by the system) affects the main screen's available
// geometry. Since we're initializing the screens synchronously at application
// startup we need to ensure that the presentation options have been propagated
// to the screen before we read out its properties. Normally OS X does this in
// an asynchronous callback, but that's too late for us. We force the propagation
// by explicitly setting the presentation option to the magic 'default value',
// which will resolve to an actual value and result in screen invalidation.
cocoaApplication.presentationOptions = NSApplicationPresentationDefault;
updateScreens();
QMacInternalPasteboardMime::initializeMimeTypes();

View File

@ -52,6 +52,7 @@
#include <qpa/qwindowsysteminterface.h>
#include <QtGui/QTextFormat>
#include <QtCore/QDebug>
#include <QtCore/qsysinfo.h>
#include <private/qguiapplication_p.h>
#include "qcocoabackingstore.h"
#ifndef QT_NO_OPENGL
@ -1351,8 +1352,29 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
}
#ifndef QT_NO_GESTURES
- (bool)handleGestureAsBeginEnd:(NSEvent *)event
{
if (QSysInfo::QSysInfo::MacintoshVersion < QSysInfo::MV_10_11)
return false;
if ([event phase] == NSEventPhaseBegan) {
[self beginGestureWithEvent:event];
return true;
}
if ([event phase] == NSEventPhaseEnded) {
[self endGestureWithEvent:event];
return true;
}
return false;
}
- (void)magnifyWithEvent:(NSEvent *)event
{
if ([self handleGestureAsBeginEnd:event])
return;
qCDebug(lcQpaGestures) << "magnifyWithEvent" << [event magnification];
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
@ -1379,7 +1401,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)rotateWithEvent:(NSEvent *)event
{
qCDebug(lcQpaGestures) << "rotateWithEvent" << [event rotation];
if ([self handleGestureAsBeginEnd:event])
return;
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
QPointF screenPoint;

View File

@ -509,11 +509,8 @@ static QPixmap loadIconFromShell32(int resourceId, QSizeF size)
return QPixmap();
}
QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const
QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &pixmapSize) const
{
const QScreen *primaryScreen = QGuiApplication::primaryScreen();
const int scaleFactor = primaryScreen ? qRound(QHighDpiScaling::factor(primaryScreen)) : 1;
const QSizeF pixmapSize = size * scaleFactor;
int resourceId = -1;
int stockId = SIID_INVALID;
UINT stockFlags = 0;
@ -615,7 +612,6 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) con
stockFlags |= (pixmapSize.width() > 16 ? SHGFI_LARGEICON : SHGFI_SMALLICON);
if (QWindowsContext::shell32dll.sHGetStockIconInfo(stockId, SHGFI_ICON | stockFlags, &iconInfo) == S_OK) {
pixmap = qt_pixmapFromWinHICON(iconInfo.hIcon);
pixmap.setDevicePixelRatio(scaleFactor);
DestroyIcon(iconInfo.hIcon);
return pixmap;
}
@ -631,7 +627,6 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) con
QPixmap link = loadIconFromShell32(30, pixmapSize);
painter.drawPixmap(0, 0, int(pixmapSize.width()), int(pixmapSize.height()), link);
}
pixmap.setDevicePixelRatio(scaleFactor);
return pixmap;
}
}
@ -639,13 +634,12 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) con
if (iconName) {
HICON iconHandle = LoadIcon(NULL, iconName);
QPixmap pixmap = qt_pixmapFromWinHICON(iconHandle);
pixmap.setDevicePixelRatio(scaleFactor);
DestroyIcon(iconHandle);
if (!pixmap.isNull())
return pixmap;
}
return QPlatformTheme::standardPixmap(sp, size);
return QPlatformTheme::standardPixmap(sp, pixmapSize);
}
enum { // Shell image list ids

View File

@ -494,6 +494,8 @@ static inline void fixTopLevelWindowFlags(Qt::WindowFlags &flags)
default:
break;
}
if ((flags & Qt::WindowType_Mask) == Qt::SplashScreen)
flags |= Qt::FramelessWindowHint;
}
void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flagsIn,

View File

@ -88,9 +88,9 @@ typedef ITypedEventHandler<CoreWindow*, PointerEventArgs*> PointerHandler;
typedef ITypedEventHandler<CoreWindow*, WindowSizeChangedEventArgs*> SizeChangedHandler;
typedef ITypedEventHandler<CoreWindow*, VisibilityChangedEventArgs*> VisibilityChangedHandler;
typedef ITypedEventHandler<DisplayInformation*, IInspectable*> DisplayInformationHandler;
#ifdef Q_OS_WINPHONE
typedef ITypedEventHandler<StatusBar*, IInspectable*> StatusBarHandler;
#endif
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
typedef ITypedEventHandler<ApplicationView*, IInspectable*> VisibleBoundsChangedHandler;
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
QT_BEGIN_NAMESPACE
@ -451,10 +451,10 @@ typedef HRESULT (__stdcall ICoreWindow::*CoreWindowCallbackRemover)(EventRegistr
uint qHash(CoreWindowCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
typedef HRESULT (__stdcall IDisplayInformation::*DisplayCallbackRemover)(EventRegistrationToken);
uint qHash(DisplayCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
#ifdef Q_OS_WINPHONE
typedef HRESULT (__stdcall IStatusBar::*StatusBarCallbackRemover)(EventRegistrationToken);
uint qHash(StatusBarCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
#endif
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
typedef HRESULT (__stdcall IApplicationView2::*ApplicationView2CallbackRemover)(EventRegistrationToken);
uint qHash(ApplicationView2CallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
class QWinRTScreenPrivate
{
@ -464,13 +464,11 @@ public:
ComPtr<Xaml::IDependencyObject> canvas;
ComPtr<IApplicationView> view;
ComPtr<IDisplayInformation> displayInformation;
#ifdef Q_OS_WINPHONE
ComPtr<IStatusBar> statusBar;
#endif
QScopedPointer<QWinRTCursor> cursor;
QHash<quint32, QWindowSystemInterface::TouchPoint> touchPoints;
QSizeF logicalSize;
QRectF logicalRect;
QRectF visibleRect;
QSurfaceFormat surfaceFormat;
qreal logicalDpi;
QDpi physicalDpi;
@ -481,9 +479,10 @@ public:
QHash<Qt::Key, KeyInfo> activeKeys;
QHash<CoreWindowCallbackRemover, EventRegistrationToken> windowTokens;
QHash<DisplayCallbackRemover, EventRegistrationToken> displayTokens;
#ifdef Q_OS_WINPHONE
QHash<StatusBarCallbackRemover, EventRegistrationToken> statusBarTokens;
#endif
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
QHash<ApplicationView2CallbackRemover, EventRegistrationToken> view2Tokens;
ComPtr<IApplicationView2> view2;
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
};
// To be called from the XAML thread
@ -514,7 +513,8 @@ QWinRTScreen::QWinRTScreen()
Rect rect;
hr = d->coreWindow->get_Bounds(&rect);
Q_ASSERT_SUCCEEDED(hr);
d->logicalSize = QSizeF(rect.Width, rect.Height);
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<IDisplayInformationStatics> displayInformationStatics;
@ -549,9 +549,9 @@ QWinRTScreen::QWinRTScreen()
ComPtr<Xaml::IFrameworkElement> frameworkElement;
hr = canvas.As(&frameworkElement);
Q_ASSERT_SUCCEEDED(hr);
hr = frameworkElement->put_Width(d->logicalSize.width());
hr = frameworkElement->put_Width(d->logicalRect.width());
Q_ASSERT_SUCCEEDED(hr);
hr = frameworkElement->put_Height(d->logicalSize.height());
hr = frameworkElement->put_Height(d->logicalRect.height());
Q_ASSERT_SUCCEEDED(hr);
ComPtr<Xaml::IUIElement> uiElement;
hr = canvas.As(&uiElement);
@ -563,14 +563,10 @@ QWinRTScreen::QWinRTScreen()
d->cursor.reset(new QWinRTCursor);
#ifdef Q_OS_WINPHONE
ComPtr<IStatusBarStatics> statusBarStatics;
hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_StatusBar).Get(),
IID_PPV_ARGS(&statusBarStatics));
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
hr = d->view.As(&d->view2);
Q_ASSERT_SUCCEEDED(hr);
hr = statusBarStatics->GetForCurrentView(&d->statusBar);
Q_ASSERT_SUCCEEDED(hr);
#endif // Q_OS_WINPHONE
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
}
QWinRTScreen::~QWinRTScreen()
@ -590,12 +586,12 @@ QWinRTScreen::~QWinRTScreen()
hr = (d->displayInformation.Get()->*i.key())(i.value());
Q_ASSERT_SUCCEEDED(hr);
}
#ifdef Q_OS_WINPHONE
for (QHash<StatusBarCallbackRemover, EventRegistrationToken>::const_iterator i = d->statusBarTokens.begin(); i != d->statusBarTokens.end(); ++i) {
hr = (d->statusBar.Get()->*i.key())(i.value());
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
for (QHash<ApplicationView2CallbackRemover, EventRegistrationToken>::const_iterator i = d->view2Tokens.begin(); i != d->view2Tokens.end(); ++i) {
hr = (d->view2.Get()->*i.key())(i.value());
Q_ASSERT_SUCCEEDED(hr);
}
#endif //Q_OS_WINPHONE
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
return hr;
});
RETURN_VOID_IF_FAILED("Failed to unregister screen event callbacks");
@ -604,33 +600,17 @@ QWinRTScreen::~QWinRTScreen()
QRect QWinRTScreen::geometry() const
{
Q_D(const QWinRTScreen);
return QRect(QPoint(), (d->logicalSize * d->scaleFactor).toSize());
return QRect(QPoint(), QSizeF(d->logicalRect.size() * d->scaleFactor).toSize());
}
#ifdef Q_OS_WINPHONE
QRect QWinRTScreen::availableGeometry() const
{
Q_D(const QWinRTScreen);
QRect statusBar;
QEventDispatcherWinRT::runOnXamlThread([d, &statusBar]() {
HRESULT hr;
Rect rect;
hr = d->statusBar->get_OccludedRect(&rect);
Q_ASSERT_SUCCEEDED(hr);
statusBar.setRect(qRound(rect.X * d->scaleFactor),
qRound(rect.Y * d->scaleFactor),
qRound(rect.Width * d->scaleFactor),
qRound(rect.Height * d->scaleFactor));
return S_OK;
});
return geometry().adjusted(
d->orientation == Qt::LandscapeOrientation ? statusBar.width() : 0,
d->orientation == Qt::PortraitOrientation ? statusBar.height() : 0,
d->orientation == Qt::InvertedLandscapeOrientation ? -statusBar.width() : 0,
0);
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();
}
#endif //Q_OS_WINPHONE
int QWinRTScreen::depth() const
{
@ -645,8 +625,8 @@ QImage::Format QWinRTScreen::format() const
QSizeF QWinRTScreen::physicalSize() const
{
Q_D(const QWinRTScreen);
return QSizeF(d->logicalSize.width() * d->scaleFactor / d->physicalDpi.first * qreal(25.4),
d->logicalSize.height() * d->scaleFactor / d->physicalDpi.second * qreal(25.4));
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
@ -723,29 +703,6 @@ Xaml::IDependencyObject *QWinRTScreen::canvas() const
return d->canvas.Get();
}
#ifdef Q_OS_WINPHONE
void QWinRTScreen::setStatusBarVisibility(bool visible, QWindow *window)
{
Q_D(QWinRTScreen);
qCDebug(lcQpaWindows) << __FUNCTION__ << window << visible;
const Qt::WindowFlags windowType = window->flags() & Qt::WindowType_Mask;
if (!window || (windowType != Qt::Window && windowType != Qt::Dialog))
return;
QEventDispatcherWinRT::runOnXamlThread([d, visible]() {
HRESULT hr;
ComPtr<IAsyncAction> op;
if (visible)
hr = d->statusBar->ShowAsync(&op);
else
hr = d->statusBar->HideAsync(&op);
Q_ASSERT_SUCCEEDED(hr);
return S_OK;
});
}
#endif //Q_OS_WINPHONE
void QWinRTScreen::initialize()
{
Q_D(QWinRTScreen);
@ -768,15 +725,14 @@ void QWinRTScreen::initialize()
Q_ASSERT_SUCCEEDED(hr);
hr = d->coreWindow->add_PointerWheelChanged(Callback<PointerHandler>(this, &QWinRTScreen::onPointerUpdated).Get(), &d->windowTokens[&ICoreWindow::remove_PointerWheelChanged]);
Q_ASSERT_SUCCEEDED(hr);
#ifndef Q_OS_WINPHONE
hr = d->coreWindow->add_SizeChanged(Callback<SizeChangedHandler>(this, &QWinRTScreen::onSizeChanged).Get(), &d->windowTokens[&ICoreWindow::remove_SizeChanged]);
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
hr = d->view2->add_VisibleBoundsChanged(Callback<VisibleBoundsChangedHandler>(this, &QWinRTScreen::onWindowSizeChanged).Get(), &d->view2Tokens[&IApplicationView2::remove_VisibleBoundsChanged]);
Q_ASSERT_SUCCEEDED(hr);
#else
hr = d->statusBar->add_Showing(Callback<StatusBarHandler>(this, &QWinRTScreen::onStatusBarShowing).Get(), &d->statusBarTokens[&IStatusBar::remove_Showing]);
Q_ASSERT_SUCCEEDED(hr);
hr = d->statusBar->add_Hiding(Callback<StatusBarHandler>(this, &QWinRTScreen::onStatusBarHiding).Get(), &d->statusBarTokens[&IStatusBar::remove_Hiding]);
Q_ASSERT_SUCCEEDED(hr);
#endif
hr = d->coreWindow->add_SizeChanged(Callback<SizeChangedHandler>(this, &QWinRTScreen::onWindowSizeChanged).Get(), &d->windowTokens[&ICoreWindow::remove_SizeChanged]);
Q_ASSERT_SUCCEEDED(hr)
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
hr = d->coreWindow->add_Activated(Callback<ActivatedHandler>(this, &QWinRTScreen::onActivated).Get(), &d->windowTokens[&ICoreWindow::remove_Activated]);
Q_ASSERT_SUCCEEDED(hr);
hr = d->coreWindow->add_Closed(Callback<ClosedHandler>(this, &QWinRTScreen::onClosed).Get(), &d->windowTokens[&ICoreWindow::remove_Closed]);
@ -804,11 +760,6 @@ void QWinRTScreen::addWindow(QWindow *window)
if (window == topWindow())
return;
#ifdef Q_OS_WINPHONE
if (window->visibility() != QWindow::Maximized && window->visibility() != QWindow::Windowed)
setStatusBarVisibility(false, window);
#endif
d->visibleWindows.prepend(window);
QWindowSystemInterface::handleWindowActivated(window, Qt::OtherFocusReason);
handleExpose();
@ -820,11 +771,6 @@ void QWinRTScreen::removeWindow(QWindow *window)
Q_D(QWinRTScreen);
qCDebug(lcQpaWindows) << __FUNCTION__ << window;
#ifdef Q_OS_WINPHONE
if (window->visibility() == QWindow::Minimized)
setStatusBarVisibility(false, window);
#endif
const bool wasTopWindow = window == topWindow();
if (!d->visibleWindows.removeAll(window))
return;
@ -1128,7 +1074,7 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args)
}
it.value().area = QRectF(area.X * d->scaleFactor, area.Y * d->scaleFactor,
area.Width * d->scaleFactor, area.Height * d->scaleFactor);
it.value().normalPosition = QPointF(point.X/d->logicalSize.width(), point.Y/d->logicalSize.height());
it.value().normalPosition = QPointF(point.X/d->logicalRect.width(), point.Y/d->logicalRect.height());
it.value().pressure = pressure;
QWindowSystemInterface::handleTouchEvent(topWindow(), d->touchDevice, d->touchPoints.values(), mods);
@ -1177,22 +1123,6 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args)
return S_OK;
}
HRESULT QWinRTScreen::onSizeChanged(ICoreWindow *, IWindowSizeChangedEventArgs *)
{
Q_D(QWinRTScreen);
Rect size;
HRESULT hr;
hr = d->coreWindow->get_Bounds(&size);
RETURN_OK_IF_FAILED("Failed to get window bounds");
d->logicalSize = QSizeF(size.Width, size.Height);
qCDebug(lcQpaWindows) << __FUNCTION__ << d->logicalSize;
QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), availableGeometry());
QPlatformScreen::resizeMaximizedWindows();
handleExpose();
return S_OK;
}
HRESULT QWinRTScreen::onActivated(ICoreWindow *, IWindowActivatedEventArgs *args)
{
Q_D(QWinRTScreen);
@ -1231,8 +1161,10 @@ HRESULT QWinRTScreen::onVisibilityChanged(ICoreWindow *, IVisibilityChangedEvent
RETURN_OK_IF_FAILED("Failed to get visibility.");
qCDebug(lcQpaWindows) << __FUNCTION__ << visible;
QWindowSystemInterface::handleApplicationStateChanged(visible ? Qt::ApplicationActive : Qt::ApplicationHidden);
if (visible)
if (visible) {
handleExpose();
onWindowSizeChanged(nullptr, nullptr);
}
return S_OK;
}
@ -1248,9 +1180,7 @@ HRESULT QWinRTScreen::onOrientationChanged(IDisplayInformation *, IInspectable *
if (d->orientation != newOrientation) {
d->orientation = newOrientation;
qCDebug(lcQpaWindows) << " New orientation:" << newOrientation;
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
onSizeChanged(nullptr, nullptr);
#endif
onWindowSizeChanged(nullptr, nullptr);
QWindowSystemInterface::handleScreenOrientationChange(screen(), d->orientation);
handleExpose(); // Clean broken frames caused by race between Qt and ANGLE
}
@ -1294,20 +1224,35 @@ HRESULT QWinRTScreen::onDpiChanged(IDisplayInformation *, IInspectable *)
return S_OK;
}
#ifdef Q_OS_WINPHONE
HRESULT QWinRTScreen::onStatusBarShowing(IStatusBar *, IInspectable *)
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
HRESULT QWinRTScreen::onWindowSizeChanged(IApplicationView *, IInspectable *)
#else
HRESULT QWinRTScreen::onWindowSizeChanged(ICoreWindow *, IWindowSizeChangedEventArgs *)
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
{
qCDebug(lcQpaWindows) << __FUNCTION__;
onSizeChanged(nullptr, nullptr);
return S_OK;
}
Q_D(QWinRTScreen);
HRESULT QWinRTScreen::onStatusBarHiding(IStatusBar *, IInspectable *)
{
qCDebug(lcQpaWindows) << __FUNCTION__;
onSizeChanged(nullptr, nullptr);
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);
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
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);
#else
d->visibleRect = QRectF(windowSize.X, windowSize.Y, windowSize.Width, windowSize.Height);
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
qCDebug(lcQpaWindows) << __FUNCTION__ << d->logicalRect;
QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), availableGeometry());
QPlatformScreen::resizeMaximizedWindows();
handleExpose();
return S_OK;
}
#endif //Q_OS_WINPHONE
QT_END_NAMESPACE

View File

@ -65,7 +65,7 @@ namespace ABI {
struct IWindow;
}
namespace ViewManagement {
struct IStatusBar;
struct IApplicationView;
}
}
namespace Graphics {
@ -88,10 +88,9 @@ class QWinRTScreen : public QPlatformScreen
public:
explicit QWinRTScreen();
~QWinRTScreen();
QRect geometry() const Q_DECL_OVERRIDE;
#ifdef Q_OS_WINPHONE
QRect availableGeometry() const Q_DECL_OVERRIDE;
#endif
int depth() const Q_DECL_OVERRIDE;
QImage::Format format() const Q_DECL_OVERRIDE;
QSizeF physicalSize() const Q_DECL_OVERRIDE;
@ -115,10 +114,6 @@ public:
ABI::Windows::UI::Core::ICoreWindow *coreWindow() const;
ABI::Windows::UI::Xaml::IDependencyObject *canvas() const;
#ifdef Q_OS_WINPHONE
void setStatusBarVisibility(bool visible, QWindow *window);
#endif
void initialize();
private:
@ -130,7 +125,6 @@ private:
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 onSizeChanged(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IWindowSizeChangedEventArgs *);
HRESULT onActivated(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IWindowActivatedEventArgs *);
@ -139,10 +133,10 @@ private:
HRESULT onOrientationChanged(ABI::Windows::Graphics::Display::IDisplayInformation *, IInspectable *);
HRESULT onDpiChanged(ABI::Windows::Graphics::Display::IDisplayInformation *, IInspectable *);
#ifdef Q_OS_WINPHONE
HRESULT onStatusBarShowing(ABI::Windows::UI::ViewManagement::IStatusBar *, IInspectable *);
HRESULT onStatusBarHiding(ABI::Windows::UI::ViewManagement::IStatusBar *, IInspectable *);
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
HRESULT onWindowSizeChanged(ABI::Windows::UI::ViewManagement::IApplicationView *, IInspectable *);
#else
HRESULT onWindowSizeChanged(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IWindowSizeChangedEventArgs *);
#endif
QScopedPointer<QWinRTScreenPrivate> d_ptr;

View File

@ -321,10 +321,6 @@ void QWinRTWindow::setWindowState(Qt::WindowState state)
if (d->state == state)
return;
#ifdef Q_OS_WINPHONE
d->screen->setStatusBarVisibility(state == Qt::WindowMaximized || state == Qt::WindowNoState, window());
#endif
if (state == Qt::WindowMinimized)
setUIElementVisibility(d->uiElement.Get(), false);

View File

@ -215,6 +215,9 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event)
// CRTC with node mode could mean that output has been disabled, and we'll
// get RRNotifyOutputChange notification for that.
if (screen && crtc.mode) {
if (crtc.rotation == XCB_RANDR_ROTATION_ROTATE_90 ||
crtc.rotation == XCB_RANDR_ROTATION_ROTATE_270)
std::swap(crtc.width, crtc.height);
screen->updateGeometry(QRect(crtc.x, crtc.y, crtc.width, crtc.height), crtc.rotation);
if (screen->mode() != crtc.mode)
screen->updateRefreshRate(crtc.mode);

View File

@ -2350,7 +2350,7 @@ void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource
conn->setButton(conn->translateMouseButton(i), XIMaskIsSet(buttonMask, i));
}
const char *sourceName = nullptr;
const char *sourceName = 0;
if (lcQpaXInput().isDebugEnabled()) {
const QMetaObject *metaObject = qt_getEnumMetaObject(source);
const QMetaEnum me = metaObject->enumerator(metaObject->indexOfEnumerator(qt_getEnumName(source)));

View File

@ -2677,8 +2677,17 @@ QPixmap QMessageBoxPrivate::standardIcon(QMessageBox::Icon icon, QMessageBox *mb
default:
break;
}
if (!tmpIcon.isNull())
return tmpIcon.pixmap(iconSize, iconSize);
if (!tmpIcon.isNull()) {
QWindow *window = Q_NULLPTR;
if (mb) {
window = mb->windowHandle();
if (!window) {
if (const QWidget *nativeParent = mb->nativeParentWidget())
window = nativeParent->windowHandle();
}
}
return tmpIcon.pixmap(window, QSize(iconSize, iconSize));
}
return QPixmap();
}

View File

@ -469,6 +469,9 @@ QDesktopWidget *qt_desktopWidget = 0; // root window widgets
*/
void QApplicationPrivate::process_cmdline()
{
if (styleOverride.isEmpty() && qEnvironmentVariableIsSet("QT_STYLE_OVERRIDE"))
styleOverride = QString::fromLocal8Bit(qgetenv("QT_STYLE_OVERRIDE"));
if (!styleOverride.isEmpty()) {
if (app_style) {
delete app_style;
@ -1125,11 +1128,8 @@ QStyle *QApplication::style()
// Compile-time search for default style
//
QString style;
QString envStyle = QString::fromLocal8Bit(qgetenv("QT_STYLE_OVERRIDE"));
if (!QApplicationPrivate::styleOverride.isEmpty()) {
style = QApplicationPrivate::styleOverride.toLower();
} else if (!envStyle.isEmpty()) {
style = envStyle;
} else {
style = QApplicationPrivate::desktopStyleKey();
}

View File

@ -121,7 +121,8 @@ QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e
case Qt::ZoomNativeGesture:
g->setLastScaleFactor(g->scaleFactor());
g->setLastRotationAngle(g->rotationAngle());
g->setScaleFactor(g->scaleFactor() * (1 + ev->value()));
g->setScaleFactor(1 + ev->value());
g->setTotalScaleFactor(g->totalScaleFactor() * g->scaleFactor());
g->setChangeFlags(QPinchGesture::ScaleFactorChanged);
g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
g->setHotSpot(ev->screenPos());

View File

@ -426,9 +426,9 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
case PE_IndicatorBranch:
{
XPThemeData theme(widget, painter, QWindowsXPStylePrivate::TreeViewTheme);
XPThemeData theme(widget, painter, QWindowsXPStylePrivate::VistaTreeViewTheme);
static int decoration_size = 0;
if (!decoration_size && d->initTreeViewTheming() && theme.isValid()) {
if (!decoration_size && theme.isValid()) {
XPThemeData themeSize = theme;
themeSize.partId = TVP_HOTGLYPH;
themeSize.stateId = GLPS_OPENED;
@ -728,9 +728,9 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
QPainter pixmapPainter(&pixmap);
XPThemeData theme(widget, &pixmapPainter,
QWindowsXPStylePrivate::TreeViewTheme,
QWindowsXPStylePrivate::VistaTreeViewTheme,
LVP_LISTITEM, state, QRect(0, 0, sectionSize.width(), sectionSize.height()));
if (d->initTreeViewTheming() && theme.isValid()) {
if (theme.isValid()) {
d->drawBackground(theme);
} else {
QWindowsXPStyle::drawPrimitive(PE_PanelItemViewItem, option, painter, widget);
@ -2357,10 +2357,6 @@ void QWindowsVistaStyle::unpolish(QWidget *widget)
QWindowsXPStyle::unpolish(widget);
QWindowsVistaStylePrivate *d = d_func();
// Delete the tree view helper in case the XP style cleaned the
// theme handle map due to a theme or QStyle change (QProxyStyle).
if (!QWindowsXPStylePrivate::hasTheme(QWindowsXPStylePrivate::TreeViewTheme))
d->cleanupTreeViewTheming();
d->stopAnimation(widget);
@ -2426,15 +2422,10 @@ QPixmap QWindowsVistaStyle::standardPixmap(StandardPixmap standardPixmap, const
}
QWindowsVistaStylePrivate::QWindowsVistaStylePrivate() :
QWindowsXPStylePrivate(), m_treeViewHelper(0)
QWindowsXPStylePrivate()
{
}
QWindowsVistaStylePrivate::~QWindowsVistaStylePrivate()
{
cleanupTreeViewTheming();
}
bool QWindowsVistaStylePrivate::transitionsEnabled() const
{
BOOL animEnabled = false;
@ -2446,58 +2437,6 @@ bool QWindowsVistaStylePrivate::transitionsEnabled() const
return false;
}
/*
* We need to set the windows "explorer" theme explicitly on a native
* window and open the "TREEVIEW" theme handle passing its window handle
* in order to get Vista-style item view themes (particulary drawBackground()
* for selected items needs this).
* We invoke a service of the native Windows interface to create
* a non-visible window handle, open the theme on it and insert it into
* the cache so that it is found by XPThemeData::handle() first.
*/
static inline HWND createTreeViewHelperWindow()
{
if (QPlatformNativeInterface *ni = QGuiApplication::platformNativeInterface()) {
void *hwnd = 0;
void *wndProc = reinterpret_cast<void *>(DefWindowProc);
if (QMetaObject::invokeMethod(ni, "createMessageWindow", Qt::DirectConnection,
Q_RETURN_ARG(void *, hwnd),
Q_ARG(QString, QStringLiteral("QTreeViewThemeHelperWindowClass")),
Q_ARG(QString, QStringLiteral("QTreeViewThemeHelperWindow")),
Q_ARG(void *, wndProc)) && hwnd) {
return reinterpret_cast<HWND>(hwnd);
}
}
return 0;
}
bool QWindowsVistaStylePrivate::initTreeViewTheming()
{
if (m_treeViewHelper)
return true;
m_treeViewHelper = createTreeViewHelperWindow();
if (Q_UNLIKELY(!m_treeViewHelper)) {
qWarning("Unable to create the treeview helper window.");
return false;
}
const HRESULT hr = QWindowsXPStylePrivate::pSetWindowTheme(m_treeViewHelper, L"explorer", NULL);
if (Q_UNLIKELY(hr != S_OK)) {
qErrnoWarning("SetWindowTheme() failed.");
return false;
}
return QWindowsXPStylePrivate::createTheme(QWindowsXPStylePrivate::TreeViewTheme, m_treeViewHelper);
}
void QWindowsVistaStylePrivate::cleanupTreeViewTheming()
{
if (m_treeViewHelper) {
DestroyWindow(m_treeViewHelper);
m_treeViewHelper = 0;
}
}
/*!
\reimp
*/

View File

@ -168,16 +168,10 @@ class QWindowsVistaStylePrivate : public QWindowsXPStylePrivate
public:
QWindowsVistaStylePrivate();
~QWindowsVistaStylePrivate();
static int fixedPixelMetric(QStyle::PixelMetric pm);
static inline bool useVista();
bool transitionsEnabled() const;
private:
bool initTreeViewTheming();
void cleanupTreeViewTheming();
HWND m_treeViewHelper;
};
QT_END_NAMESPACE

View File

@ -54,6 +54,8 @@
#include <qbackingstore.h>
#include <qapplication.h>
#include <qpixmapcache.h>
#include <private/qapplication_p.h>
#include <qpa/qplatformnativeinterface.h>
#include <qdesktopwidget.h>
#include <qtoolbutton.h>
@ -163,7 +165,7 @@ static const wchar_t *themeNames[QWindowsXPStylePrivate::NThemes] =
L"BUTTON", L"COMBOBOX", L"EDIT", L"HEADER", L"LISTVIEW",
L"MENU", L"PROGRESS", L"REBAR", L"SCROLLBAR", L"SPIN",
L"TAB", L"TASKDIALOG", L"TOOLBAR", L"TOOLTIP", L"TRACKBAR",
L"TREEVIEW", L"WINDOW", L"STATUS"
L"TREEVIEW", L"WINDOW", L"STATUS", L"TREEVIEW"
};
static inline QBackingStore *backingStoreForWidget(const QWidget *widget)
@ -244,6 +246,7 @@ HRGN XPThemeData::mask(QWidget *widget)
// QWindowsXPStylePrivate -------------------------------------------------------------------------
// Static initializations
QPixmap *QWindowsXPStylePrivate::tabbody = 0;
HWND QWindowsXPStylePrivate::m_vistaTreeViewHelper = 0;
HTHEME QWindowsXPStylePrivate::m_themes[NThemes];
bool QWindowsXPStylePrivate::use_xp = false;
QBasicAtomicInt QWindowsXPStylePrivate::ref = Q_BASIC_ATOMIC_INITIALIZER(-1); // -1 based refcounting
@ -327,6 +330,58 @@ void QWindowsXPStylePrivate::cleanup(bool force)
tabbody = 0;
}
/* In order to obtain the correct VistaTreeViewTheme (arrows for PE_IndicatorBranch),
* we need to set the windows "explorer" theme explicitly on a native
* window and open the "TREEVIEW" theme handle passing its window handle
* in order to get Vista-style item view themes (particulary drawBackground()
* for selected items needs this).
* We invoke a service of the native Windows interface to create
* a non-visible window handle, open the theme on it and insert it into
* the cache so that it is found by XPThemeData::handle() first.
*/
static inline HWND createTreeViewHelperWindow()
{
if (QPlatformNativeInterface *ni = QGuiApplication::platformNativeInterface()) {
void *hwnd = 0;
void *wndProc = reinterpret_cast<void *>(DefWindowProc);
if (QMetaObject::invokeMethod(ni, "createMessageWindow", Qt::DirectConnection,
Q_RETURN_ARG(void *, hwnd),
Q_ARG(QString, QStringLiteral("QTreeViewThemeHelperWindowClass")),
Q_ARG(QString, QStringLiteral("QTreeViewThemeHelperWindow")),
Q_ARG(void *, wndProc)) && hwnd) {
return reinterpret_cast<HWND>(hwnd);
}
}
return 0;
}
bool QWindowsXPStylePrivate::initVistaTreeViewTheming()
{
if (m_vistaTreeViewHelper)
return true;
m_vistaTreeViewHelper = createTreeViewHelperWindow();
if (!m_vistaTreeViewHelper) {
qWarning("Unable to create the treeview helper window.");
return false;
}
if (FAILED(QWindowsXPStylePrivate::pSetWindowTheme(m_vistaTreeViewHelper, L"explorer", NULL))) {
qErrnoWarning("SetWindowTheme() failed.");
cleanupVistaTreeViewTheming();
return false;
}
return true;
}
void QWindowsXPStylePrivate::cleanupVistaTreeViewTheming()
{
if (m_vistaTreeViewHelper) {
DestroyWindow(m_vistaTreeViewHelper);
m_vistaTreeViewHelper = 0;
}
}
/* \internal
Closes all open theme data handles to ensure that we don't leak
resources, and that we don't refere to old handles when for
@ -339,6 +394,7 @@ void QWindowsXPStylePrivate::cleanupHandleMap()
pCloseThemeData(m_themes[i]);
m_themes[i] = 0;
}
QWindowsXPStylePrivate::cleanupVistaTreeViewTheming();
}
HTHEME QWindowsXPStylePrivate::createTheme(int theme, HWND hwnd)
@ -349,6 +405,8 @@ HTHEME QWindowsXPStylePrivate::createTheme(int theme, HWND hwnd)
}
if (!m_themes[theme]) {
const wchar_t *name = themeNames[theme];
if (theme == VistaTreeViewTheme && QWindowsXPStylePrivate::initVistaTreeViewTheming())
hwnd = QWindowsXPStylePrivate::m_vistaTreeViewHelper;
m_themes[theme] = pOpenThemeData(hwnd, name);
if (Q_UNLIKELY(!m_themes[theme]))
qErrnoWarning("OpenThemeData() failed for theme %d (%s).",
@ -1955,7 +2013,7 @@ case PE_Frame:
bef_v -= delta;
aft_h += delta;
aft_v += delta;
XPThemeData theme(0, p, QWindowsXPStylePrivate::TreeViewTheme);
XPThemeData theme(0, p, QWindowsXPStylePrivate::XpTreeViewTheme);
theme.rect = QRect(bef_h, bef_v, decoration_size, decoration_size);
theme.partId = TVP_GLYPH;
theme.stateId = flags & QStyle::State_Open ? GLPS_OPENED : GLPS_CLOSED;
@ -3743,10 +3801,12 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt
{
XPThemeData buttontheme(widget, 0, QWindowsXPStylePrivate::ButtonTheme, BP_PUSHBUTTON, PBS_NORMAL);
if (buttontheme.isValid()) {
const QMarginsF borderSize = buttontheme.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget);
const qreal devicePixelRatio = QWindowsXPStylePrivate::devicePixelRatio(widget);
const QMarginsF borderSize = buttontheme.margins() / devicePixelRatio;
if (!borderSize.isNull()) {
sz.rwidth() += qRound(borderSize.left() + borderSize.right() - 2);
sz.rheight() += qRound(borderSize.bottom() + borderSize.top() - 2);
const qreal margin = qreal(2) / devicePixelRatio;
sz.rwidth() += qRound(borderSize.left() + borderSize.right() - margin);
sz.rheight() += int(borderSize.bottom() + borderSize.top() - margin + devicePixelRatio - 1);
}
const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1);
sz += QSize(qMax(pixelMetric(QStyle::PM_ScrollBarExtent, option, widget)

View File

@ -356,9 +356,10 @@ public:
ToolBarTheme,
ToolTipTheme,
TrackBarTheme,
TreeViewTheme,
XpTreeViewTheme, // '+'/'-' shape treeview indicators (XP)
WindowTheme,
StatusTheme,
VistaTreeViewTheme, // arrow shape treeview indicators (Vista) obtained from "explorer" theme.
NThemes
};
@ -419,6 +420,9 @@ private:
void showProperties(XPThemeData &themeData);
#endif
static bool initVistaTreeViewTheming();
static void cleanupVistaTreeViewTheming();
static QBasicAtomicInt ref;
static bool use_xp;
static QPixmap *tabbody;
@ -430,6 +434,7 @@ private:
uchar *bufferPixels;
int bufferW, bufferH;
static HWND m_vistaTreeViewHelper;
static HTHEME m_themes[NThemes];
};

View File

@ -971,6 +971,9 @@ void QTabBar::removeTab(int index)
{
Q_D(QTabBar);
if (d->validIndex(index)) {
if (d->dragInProgress)
d->moveTabFinished(d->pressedIndex);
#ifndef QT_NO_SHORTCUT
releaseShortcut(d->tabList.at(index).shortcutId);
#endif

View File

@ -197,12 +197,43 @@ public:
}
private:
HRESULT activatedLaunch(IInspectable *activateArgs) {
QCoreApplication *app = QCoreApplication::instance();
// Check whether the app already runs
if (!app) {
#if _MSC_VER >= 1900
// 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());
#endif _MSC_VER >= 1900
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) Q_DECL_OVERRIDE
{
QAbstractEventDispatcher *dispatcher = QCoreApplication::eventDispatcher();
if (dispatcher)
QCoreApplication::postEvent(dispatcher, new QActivationEvent(args));
return S_OK;
return activatedLaunch(args);
}
HRESULT __stdcall OnLaunched(ILaunchActivatedEventArgs *launchArgs) Q_DECL_OVERRIDE
@ -300,8 +331,7 @@ private:
HRESULT __stdcall OnFileActivated(IFileActivatedEventArgs *args) Q_DECL_OVERRIDE
{
Q_UNUSED(args);
return S_OK;
return activatedLaunch(args);
}
HRESULT __stdcall OnSearchActivated(ISearchActivatedEventArgs *args) Q_DECL_OVERRIDE
@ -312,8 +342,7 @@ private:
HRESULT __stdcall OnShareTargetActivated(IShareTargetActivatedEventArgs *args) Q_DECL_OVERRIDE
{
Q_UNUSED(args);
return S_OK;
return activatedLaunch(args);
}
HRESULT __stdcall OnFileOpenPickerActivated(IFileOpenPickerActivatedEventArgs *args) Q_DECL_OVERRIDE
@ -344,7 +373,7 @@ private:
ComPtr<Xaml::IApplication> core;
QByteArray commandLine;
QVarLengthArray<char *> args;
HANDLE mainThread;
HANDLE mainThread{0};
HANDLE pidFile;
};

View File

@ -143,6 +143,8 @@ private slots:
void hostFlags_data();
void hostFlags();
void setPort();
void port_data();
void port();
void toEncoded_data();
void toEncoded();
void setAuthority_data();
@ -1742,6 +1744,9 @@ void tst_QUrl::symmetry()
QUrl url(QString::fromUtf8("http://www.räksmörgås.se/pub?a=b&a=dø&a=f#vræl"));
QCOMPARE(url.scheme(), QString::fromLatin1("http"));
QCOMPARE(url.host(), QString::fromUtf8("www.räksmörgås.se"));
QCOMPARE(url.host(QUrl::EncodeSpaces), QString::fromUtf8("www.räksmörgås.se"));
QCOMPARE(url.host(QUrl::EncodeUnicode), QString::fromUtf8("www.xn--rksmrgs-5wao1o.se"));
QCOMPARE(url.host(QUrl::EncodeUnicode | QUrl::EncodeSpaces), QString::fromUtf8("www.xn--rksmrgs-5wao1o.se"));
QCOMPARE(url.path(), QString::fromLatin1("/pub"));
// this will be encoded ...
QCOMPARE(url.encodedQuery().constData(), QString::fromLatin1("a=b&a=d%C3%B8&a=f").toLatin1().constData());
@ -2200,8 +2205,6 @@ void tst_QUrl::strictParser_data()
// FIXME: add some tests for prohibited BiDi (RFC 3454 section 6)
// port errors happen in TolerantMode too
QTest::newRow("empty-port-1") << "http://example.com:" << "Port field was empty";
QTest::newRow("empty-port-2") << "http://example.com:/" << "Port field was empty";
QTest::newRow("invalid-port-1") << "http://example.com:-1" << "Invalid port";
QTest::newRow("invalid-port-2") << "http://example.com:abc" << "Invalid port";
QTest::newRow("invalid-port-3") << "http://example.com:9a" << "Invalid port";
@ -2778,6 +2781,31 @@ void tst_QUrl::setPort()
}
}
void tst_QUrl::port_data()
{
QTest::addColumn<QString>("input");
QTest::addColumn<int>("port");
QTest::newRow("no-port-1") << "http://example.com" << -1;
QTest::newRow("no-port-2") << "http://example.com/" << -1;
QTest::newRow("empty-port-1") << "http://example.com:" << -1;
QTest::newRow("empty-port-2") << "http://example.com:/" << -1;
QTest::newRow("zero-port-1") << "http://example.com:0" << 0;
QTest::newRow("zero-port-2") << "http://example.com:0/" << 0;
QTest::newRow("set-port-1") << "http://example.com:80" << 80;
QTest::newRow("set-port-2") << "http://example.com:80/" << 80;
}
void tst_QUrl::port()
{
QFETCH(QString, input);
QFETCH(int, port);
QUrl url(input);
QVERIFY(url.isValid());
QCOMPARE(url.port(), port);
}
void tst_QUrl::toEncoded_data()
{
QTest::addColumn<QByteArray>("url");

View File

@ -143,6 +143,7 @@ private slots:
void exceptions();
void noDeclarativeParentChangedOnDestruction();
void deleteLaterInAboutToBlockHandler();
void mutableFunctor();
};
struct QObjectCreatedOnShutdown
@ -6512,6 +6513,24 @@ void tst_QObject::noDeclarativeParentChangedOnDestruction()
#endif
}
struct MutableFunctor {
int count;
MutableFunctor() : count(0) {}
int operator()() { return ++count; }
};
void tst_QObject::mutableFunctor()
{
ReturnValue o;
MutableFunctor functor;
QCOMPARE(functor.count, 0);
connect(&o, &ReturnValue::returnInt, functor);
QCOMPARE(emit o.returnInt(0), 1);
QCOMPARE(emit o.returnInt(0), 2); // each emit should increase the internal count
QCOMPARE(functor.count, 0); // but the original object should have been copied at connect time
}
// Test for QtPrivate::HasQ_OBJECT_Macro
Q_STATIC_ASSERT(QtPrivate::HasQ_OBJECT_Macro<tst_QObject>::Value);
Q_STATIC_ASSERT(!QtPrivate::HasQ_OBJECT_Macro<SiblingDeleter>::Value);

View File

@ -39,10 +39,12 @@
#include <QBitmap>
#include <QCursor>
#include <QDrag>
#include <QPainter>
#include <QPixmap>
#include <QDebug>
#include <QMimeData>
#include <QStringList>
#include <QTextStream>
@ -63,6 +65,14 @@
#include <algorithm>
#include <iterator>
#if QT_VERSION < 0x050000
QDebug operator<<(QDebug d, const QPixmap &p)
{
d.nospace() << "QPixmap(" << p.size() << ')';
return d;
}
#endif // Qt 4
// High DPI cursor test for testing cursor sizes in multi-screen setups.
// It creates one widget per screen with a grid of standard cursors,
// pixmap / bitmap cursors and pixmap / bitmap cursors with device pixel ratio 2.
@ -154,6 +164,49 @@ static QCursor bitmapCursorDevicePixelRatio(int size, int dpr)
}
#endif // Qt 5
// A label from which a pixmap can be dragged for testing drag with pixmaps/DPR.
class DraggableLabel : public QLabel {
public:
explicit DraggableLabel(const QPixmap &p, const QString &text, QWidget *parent = Q_NULLPTR)
: QLabel(text, parent), m_pixmap(p)
{
setToolTip(QLatin1String("Click to drag away the pixmap. Press Shift to set a circular mask."));
}
protected:
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
private:
const QPixmap m_pixmap;
};
void DraggableLabel::mousePressEvent(QMouseEvent *)
{
QMimeData *mimeData = new QMimeData;
mimeData->setImageData(qVariantFromValue(m_pixmap));
QDrag *drag = new QDrag(this);
QPixmap pixmap = m_pixmap;
if (QApplication::keyboardModifiers() & Qt::ShiftModifier) {
QBitmap mask(pixmap.width(), pixmap.height());
mask.clear();
QPainter painter(&mask);
painter.setBrush(Qt::color1);
const int hx = pixmap.width() / 2;
const int hy = pixmap.width() / 2;
painter.drawEllipse(QPoint(hx, hy), hx, hy);
pixmap.setMask(mask);
}
drag->setMimeData(mimeData);
drag->setPixmap(pixmap);
QPoint sizeP = QPoint(m_pixmap.width(), m_pixmap.height());
#if QT_VERSION > 0x050000
sizeP /= int(m_pixmap.devicePixelRatio());
#endif // Qt 5
drag->setHotSpot(sizeP / 2);
qDebug() << "Dragging:" << m_pixmap;
drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction);
}
// Vertical ruler widget with 10 px marks
class VerticalRuler : public QWidget {
public:
@ -205,8 +258,15 @@ static QLabel *createCursorLabel(const QCursor &cursor, const QString &additiona
#endif // Qt 5
if (!additionalText.isEmpty())
labelText += ' ' + additionalText;
QLabel *result = new QLabel(labelText);
const QPixmap cursorPixmap = cursor.pixmap();
QLabel *result = Q_NULLPTR;
if (cursorPixmap.size().isEmpty()) {
result = new QLabel(labelText);
result->setFrameShape(QFrame::Box);
} else {
result = new DraggableLabel(cursor.pixmap(), labelText);
result->setFrameShape(QFrame::StyledPanel);
}
result->setCursor(cursor);
return result;
}
@ -299,7 +359,10 @@ int main(int argc, char *argv[])
QDesktopWidget *desktopWidget = app.desktop();
for (int s = desktopWidget->screenCount() - 1; s >= 0; --s) {
const int lastScreen = arguments.contains("-p")
? 0 // Primary screen only
: desktopWidget->screenCount() - 1; // All screens
for (int s = lastScreen; s >= 0; --s) {
MainWindowPtr window(new MainWindow(desktopWidget->screen(s)));
const QPoint pos = desktopWidget->screenGeometry(s).center() - QPoint(200, 100);
window->move(pos);

View File

@ -0,0 +1,232 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** 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 http://www.qt.io/terms-conditions. For further
** information use the contact form at http://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 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QAction>
#include <QApplication>
#include <QDebug>
#include <QGridLayout>
#include <QLabel>
#include <QMainWindow>
#include <QMenu>
#include <QMenuBar>
#include <QPalette>
#include <QPixmap>
#include <QPlainTextEdit>
#include <QStyle>
#include <QTabWidget>
#include <QTextStream>
#include <QVBoxLayout>
#include <QWindow>
#include <QScreen>
// Format enumeration value and strip off the class name
// added by QDebug: "QStyle::StandardPixmap(SP_Icon)" -> "SP_Icon".
template <typename Enum>
static inline QString formatEnumValue(Enum value)
{
QString result;
QDebug(&result) << value;
int index = result.indexOf(QLatin1Char('('));
if (index > 0) { // "QStyle::StandardPixmap(..)".
result.remove(0, index + 1);
index = result.lastIndexOf(QLatin1Char(')'));
if (index > 0)
result.truncate(index);
}
return result;
}
static QString pixmapDescription(QStyle::StandardPixmap sp, const QPixmap &pixmap)
{
QString description = formatEnumValue(sp);
QTextStream str(&description);
str << '(' << int(sp) << ") ";
if (pixmap.isNull()) {
str << "(null)";
} else {
const qreal dpr = pixmap.devicePixelRatioF();
str << ' ' << pixmap.width() << 'x' << pixmap.height();
if (!qFuzzyCompare(dpr, qreal(1)))
str << " DPR=" << dpr;
}
return description;
}
// Display pixmaps returned by QStyle::standardPixmap() in a grid.
static QWidget *createStandardPixmapPage(QWidget *parent)
{
QWidget *result = new QWidget(parent);
QGridLayout *grid = new QGridLayout(result);
int row = 0;
int column = 0;
const int maxColumns = 6;
for (int i = 0; i <= int(QStyle::SP_LineEditClearButton); ++i) {
const QStyle::StandardPixmap sp = static_cast<QStyle::StandardPixmap>(i);
QPixmap pixmap = result->style()->standardPixmap(sp, Q_NULLPTR, result);
QLabel *descriptionLabel = new QLabel(pixmapDescription(sp, pixmap));
grid->addWidget(descriptionLabel, row, column++);
QLabel *displayLabel = new QLabel;
displayLabel->setPixmap(pixmap);
displayLabel->setFrameShape(QFrame::Box);
grid->addWidget(displayLabel, row, column++);
if (column >= maxColumns) {
++row;
column = 0;
}
}
return result;
}
// Display values returned by QStyle::pixelMetric().
static QWidget *createMetricsPage(QWidget *parent)
{
QPlainTextEdit *result = new QPlainTextEdit(parent);
QString text;
QTextStream str(&text);
for (int i = 0; i <= int(QStyle::PM_HeaderDefaultSectionSizeVertical); ++i) {
const QStyle::PixelMetric m = static_cast<QStyle::PixelMetric>(i);
str << formatEnumValue(m) << '(' << int(m) << ")="
<< result->style()->pixelMetric(m, Q_NULLPTR, result) << '\n';
}
result->setPlainText(text);
return result;
}
// Display values returned by QStyle::styleHint()
static QWidget *createHintsPage(QWidget *parent)
{
QPlainTextEdit *result = new QPlainTextEdit(parent);
QString text;
QTextStream str(&text);
for (int i = 0; i <= int(QStyle::SH_Menu_SubMenuDontStartSloppyOnLeave); ++i) {
const QStyle::StyleHint h = static_cast<QStyle::StyleHint>(i);
str << formatEnumValue(h) << '(' << int(h) << ")="
<< result->style()->styleHint(h, Q_NULLPTR, result) << '\n';
}
result->setPlainText(text);
return result;
}
// Display palette colors
static QWidget *createColorsPage(QWidget *parent)
{
QWidget *result = new QWidget(parent);
QGridLayout *grid = new QGridLayout;
const QPalette palette = QGuiApplication::palette();
int row = 0;
for (int r = 0; r < int(QPalette::NColorRoles); ++r) {
const QPalette::ColorRole role = static_cast<QPalette::ColorRole>(r);
const QColor color = palette.color(QPalette::Active, role);
if (color.isValid()) {
const QString description =
formatEnumValue(role) + QLatin1Char('(') + QString::number(r)
+ QLatin1String(") ") + color.name(QColor::HexArgb);
grid->addWidget(new QLabel(description), row, 0);
QLabel *displayLabel = new QLabel;
QPixmap pixmap(20, 20);
pixmap.fill(color);
displayLabel->setPixmap(pixmap);
displayLabel->setFrameShape(QFrame::Box);
grid->addWidget(displayLabel, row, 1);
++row;
}
}
QHBoxLayout *hBox = new QHBoxLayout;
hBox->addLayout(grid);
hBox->addStretch();
QVBoxLayout *vBox = new QVBoxLayout(result);
vBox->addLayout(hBox);
vBox->addStretch();
return result;
}
class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow();
public slots:
void updateDescription();
private:
QTabWidget *m_tabWidget;
QLabel *m_descriptionLabel;
};
MainWindow::MainWindow()
: m_tabWidget(new QTabWidget)
, m_descriptionLabel(new QLabel)
{
QMenu *fileMenu = menuBar()->addMenu("&File");
QAction *a = fileMenu->addAction("Quit", this, &QWidget::close);
a->setShortcut(Qt::CTRL + Qt::Key_Q);
QWidget *central = new QWidget;
QVBoxLayout *mainLayout = new QVBoxLayout(central);
mainLayout->addWidget(m_descriptionLabel);
mainLayout->addWidget(m_tabWidget);
m_tabWidget->addTab(createStandardPixmapPage(m_tabWidget), "Standard Pixmaps");
m_tabWidget->addTab(createHintsPage(m_tabWidget), "Hints");
m_tabWidget->addTab(createMetricsPage(m_tabWidget), "Pixel Metrics");
m_tabWidget->addTab(createColorsPage(m_tabWidget), "Colors");
setCentralWidget(central);
setWindowTitle(QLatin1String("Style Tester (Qt") + QLatin1String(QT_VERSION_STR)
+ QLatin1String(", ") + style()->objectName() + QLatin1Char(')'));
}
void MainWindow::updateDescription()
{
QString text;
QTextStream str(&text);
str << "Qt " << QT_VERSION_STR << ", platform: " << QGuiApplication::platformName()
<< ", Style: \"" << style()->objectName() << "\", DPR=" << devicePixelRatioF()
<< ' ' << logicalDpiX() << ',' << logicalDpiY() << "DPI";
if (const QWindow *w = windowHandle())
str << ", Screen: \"" << w->screen()->name() << '"';
m_descriptionLabel->setText(text);
}
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QApplication app(argc, argv);
MainWindow mw;
mw.show();
mw.updateDescription();
QObject::connect(mw.windowHandle(), &QWindow::screenChanged,
&mw, &MainWindow::updateDescription);
return app.exec();
}
#include "main.moc"

View File

@ -0,0 +1,7 @@
TEMPLATE = app
QT = widgets
CONFIG += console
CONFIG -= app_bundle
CONFIG += c++11
SOURCES += main.cpp

View File

@ -1,3 +1,3 @@
TEMPLATE = subdirs
SUBDIRS = itemviews qgraphicsview kernel
greaterThan(QT_MAJOR_VERSION, 4): SUBDIRS += styles

View File

@ -145,6 +145,7 @@ Configure::Configure(int& argc, char** argv) : verbose(0)
dictionary[ "GUI" ] = "yes";
dictionary[ "RTTI" ] = "yes";
dictionary[ "STRIP" ] = "yes";
dictionary[ "PCH" ] = "yes";
dictionary[ "SEPARATE_DEBUG_INFO" ] = "no";
dictionary[ "SSE2" ] = "auto";
dictionary[ "SSE3" ] = "auto";
@ -807,6 +808,11 @@ void Configure::parseCmdLine()
else if (configCmdLine.at(i) == "-no-strip")
dictionary[ "STRIP" ] = "no";
else if (configCmdLine.at(i) == "-pch")
dictionary[ "PCH" ] = "yes";
else if (configCmdLine.at(i) == "-no-pch")
dictionary[ "PCH" ] = "no";
else if (configCmdLine.at(i) == "-accessibility")
dictionary[ "ACCESSIBILITY" ] = "yes";
else if (configCmdLine.at(i) == "-no-accessibility") {
@ -1852,6 +1858,9 @@ bool Configure::displayHelp()
desc( "-L <librarypath>", "Add an explicit library path.");
desc( "-l <libraryname>", "Add an explicit library name, residing in a librarypath.\n");
desc("PCH", "no", "-no-pch", "Do not use precompiled header support.");
desc("PCH", "yes", "-pch", "Use precopmiled header support.\n");
desc( "-help, -h, -?", "Display this information.\n");
// 3rd party stuff options go below here --------------------------------------------------------------------------------
@ -2661,6 +2670,11 @@ void Configure::generateOutputVars()
if (dictionary[ "RELEASE_TOOLS" ] == "yes")
qtConfig += "release_tools";
if (dictionary[ "PCH" ] == "yes")
qmakeConfig += "precompile_header";
else
qmakeVars += "CONFIG -= precompile_header";
if (dictionary[ "C++STD" ] == "c++11")
qtConfig += "c++11";
else if (dictionary[ "C++STD" ] == "c++14")
@ -3767,6 +3781,7 @@ void Configure::displayConfig()
sout << "Force optimized tools......." << dictionary[ "RELEASE_TOOLS" ] << endl;
sout << "C++ language standard......." << dictionary[ "C++STD" ] << endl;
sout << "Link Time Code Generation..." << dictionary[ "LTCG" ] << endl;
sout << "Using PCH .................." << dictionary[ "PCH" ] << endl;
sout << "Accessibility support......." << dictionary[ "ACCESSIBILITY" ] << endl;
sout << "RTTI support................" << dictionary[ "RTTI" ] << endl;
sout << "SSE support................."