Merge remote-tracking branch 'origin/5.5' into dev

Conflicts:
	src/testlib/qtestblacklist.cpp
	src/widgets/accessible/qaccessiblewidgets.cpp

Change-Id: If032adb9296428f62384ed835dbf41ee7a0b886c
This commit is contained in:
Liang Qi 2015-03-31 18:47:56 +02:00
commit 0e6ee136c9
229 changed files with 23694 additions and 38587 deletions

12
configure vendored
View File

@ -356,7 +356,11 @@ compilerSupportsFlag()
cat >conftest.cpp <<EOF
int main() { return 0; }
EOF
"$@" -o conftest-out.o conftest.cpp
if [ "$OPT_VERBOSE" = "yes" ]; then
"$@" -o conftest-out.o conftest.cpp
else
"$@" -o conftest-out.o conftest.cpp >/dev/null 2>&1
fi
ret=$?
rm -f conftest.cpp conftest-out.o
return $ret
@ -372,7 +376,7 @@ linkerSupportsFlag()
safe_flag=`shellEscape "$flag"`
lflags=$lflags,$safe_flag
done
compilerSupportsFlag $compiler $lflags >/dev/null 2>&1
compilerSupportsFlag $compiler $lflags
}
# $1: newline-separated list of default paths
@ -4010,8 +4014,8 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
(cd "$outpath/qmake"; "$MAKE") || exit 2
else
# Hide the output of make
# Use bash to print dots, if we have it
if $WHICH bash > /dev/null 2>/dev/null; then
# Use bash to print dots, if we have it, and stdout is a tty.
if test -t 1 && $WHICH bash > /dev/null 2>/dev/null; then
bash -c 'set -o pipefail
cd "$0/qmake"; "$1" | while read line; do
builtin echo -n .

View File

@ -49,11 +49,11 @@
\title Qt Quarterly: Plural Form in Translation
*/
/*!
\externalpage http://qt.gitorious.org
\externalpage https://code.qt.io/
\title Public Qt Repository
*/
/*!
\externalpage http://qt.gitorious.org/qt-labs/qtestlib-tools
\externalpage https://code.qt.io/cgit/%7bnon-gerrit%7d/qt-labs/qtestlib-tools.git/
\title qtestlib-tools
*/

View File

@ -53,7 +53,7 @@ QMAKE_CXXFLAGS_STL_OFF =
QMAKE_CXXFLAGS_RTTI_ON = -GR
QMAKE_CXXFLAGS_RTTI_OFF =
QMAKE_CXXFLAGS_EXCEPTIONS_ON = -EHsc
QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -D_HAS_EXCEPTIONS=0
QMAKE_CXXFLAGS_EXCEPTIONS_OFF =
QMAKE_INCDIR =
@ -115,6 +115,7 @@ greaterThan(MSC_VER, 1599) {
greaterThan(MSC_VER, 1699) {
# Visual Studio 2012 (11.0) / Visual C++ 17.0 and up
QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -D_HAS_EXCEPTIONS=0
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE@QMAKE_SUBSYSTEM_SUFFIX@
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS@QMAKE_SUBSYSTEM_SUFFIX@
QT_CONFIG += c++11

View File

@ -59,7 +59,9 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri
module_rundep = "QT.$${MODULE_ID}.run_depends = $$replace(QT_PRIVATE, -private$, _private)"
else: \
module_rundep =
static: \
equals(TEMPLATE, aux): \
module_build_type = no_link
else:static: \
module_build_type = staticlib
else:mac:contains(QT_CONFIG, qt_framework): \
module_build_type = lib_bundle
@ -122,7 +124,7 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri
"" \
"QT_MODULES += $$MODULE"
write_file($$MODULE_PRI, MODULE_PRI_CONT)|error("Aborting.")
!internal_module {
!internal_module:!no_private_module {
module_build_type += internal_module no_link
MODULE_PRIVATE_PRI_CONT = \
"QT.$${MODULE}_private.VERSION = $${VERSION}" \
@ -158,7 +160,7 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri
"QT_MODULE_PLUGIN_BASE = $$val_escape(MODULE_BASE_OUTDIR)/plugins" \
"include($$val_escape(MODULE_PRI))" \
"QT.$${MODULE_ID}.priority = 1"
!internal_module: MODULE_FWD_PRI_CONT += \
!internal_module:!no_private_module: MODULE_FWD_PRI_CONT += \
"include($$val_escape(MODULE_PRIVATE_PRI))" \
"QT.$${MODULE}_private.priority = 1"
MODULE_FWD_PRI_CONT += $$MODULE_FWD_PRI_CONT_SUFFIX

View File

@ -11,7 +11,7 @@ dumpcpp_decl.CONFIG += no_link
QMAKE_EXTRA_COMPILERS += dumpcpp_decl
dumpcpp_impl.commands = $$QMAKE_DUMPCPP -donothing
dumpcpp_impl.commands = $$escape_expand(\\n) # dummy command
dumpcpp_impl.output = ${QMAKE_FILE_BASE}.cpp
dumpcpp_impl.input = TYPELIBS
dumpcpp_impl.variable_out = SOURCES

View File

@ -46,7 +46,8 @@ contains(TEMPLATE, "vc.*") {
QMAKE_POST_LINK += $$quote($$ACTIVEQT_IDL "$${ACTIVEQT_OUTPUT}.idl" /nologo /tlb "$${ACTIVEQT_TLBOUT}"$$ACTIVEQT_NEWLINE)
message("No rc-file linked into project; type library will be a separate file.")
}
QMAKE_POST_LINK += $$quote($$ACTIVEQT_IDC $${ACTIVEQT_TARGET} /regserver)
!qaxserver_no_register: \
QMAKE_POST_LINK += $$quote($$ACTIVEQT_IDC $${ACTIVEQT_TARGET} /regserver)
QMAKE_CLEAN += $${ACTIVEQT_OUTPUT}.idl $${ACTIVEQT_OUTPUT}.tlb
}

View File

@ -0,0 +1,6 @@
equals(TEMPLATE, app) {
load(sdk)
# Make the XCTest framework available. This is normally handled automatically
# by Xcode based on heuristics, but we need to explicitly link to XCTest.
QMAKE_LFLAGS += -F$${QMAKE_MAC_SDK_PLATFORM_PATH}/Developer/Library/Frameworks -weak_framework XCTest
}

View File

@ -43,9 +43,6 @@ equals(TEMPLATE, app) {
QMAKE_EXTRA_COMPILERS =
!build_pass {
# Prefer debug and simulator as default test target
testcase: CONFIG += debug iphonesimulator
CONFIG += debug_and_release
load(resolve_config)

View File

@ -33,19 +33,20 @@ equals(TEMPLATE, app):contains(qt_depends, gui(-private)?) {
# called 'qt_main' now.
macx-xcode {
objects_dir = "${OBJECT_FILE_DIR}-${CURRENT_VARIANT}"
archs = "${ARCHS}"
objects_dir = "\"${OBJECT_FILE_DIR}-${CURRENT_VARIANT}\""
archs = "\"${ARCHS}\""
} else {
objects_dir = $$OBJECTS_DIR
isEmpty(objects_dir): \
isEmpty(OBJECTS_DIR): \
objects_dir = .
archs = "$$QMAKE_IOS_DEVICE_ARCHS $$QMAKE_IOS_SIMULATOR_ARCHS"
else: \
objects_dir = $$shell_quote($$OBJECTS_DIR)
archs = $$shell_quote($$QMAKE_IOS_DEVICE_ARCHS $$QMAKE_IOS_SIMULATOR_ARCHS)
}
!isEmpty(QMAKE_PRE_LINK): \
QMAKE_PRE_LINK += ";"
QMAKE_PRE_LINK += $$QMAKESPEC/rename_main.sh $${objects_dir} \"$${archs}\"
QMAKE_PRE_LINK += $$shell_quote($$QMAKESPEC/rename_main.sh) $$objects_dir $$archs
}
}

View File

@ -38,9 +38,11 @@ if [ $# -ne 2 ]; then
else
arch_paths=""
for a in $2; do
arch_paths="$arch_paths $1/$a"
arch_paths="$arch_paths
$1/$a"
done
for f in $(find $arch_paths -name '*.o'); do
for f in $(IFS="
"; find $arch_paths -name '*.o'); do
# Skip object files without the _main symbol
nm $f 2>/dev/null | grep -q 'T _main$' || continue

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>io.qt.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@ -32,9 +32,9 @@
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "@TARGET_PBX_KEY@"
BuildableName = "@QMAKE_ORIG_TARGET@"
BlueprintName = "@QMAKE_ORIG_TARGET@"
BlueprintIdentifier = "@TEST_BUNDLE_PBX_KEY@"
BuildableName = "Qt Test"
BlueprintName = "Qt Test"
ReferencedContainer = "container:@QMAKE_ORIG_TARGET@.xcodeproj">
</BuildableReference>
</TestableReference>

View File

@ -1318,6 +1318,96 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
if(!project->isEmpty("DESTDIR"))
t << "\t\t\t" << writeSettings("productInstallPath", project->first("DESTDIR")) << ";\n";
t << "\t\t};\n";
// Test target for running Qt unit tests under XCTest
if (project->isActiveConfig("testcase") && project->isActiveConfig("app_bundle")) {
QString devNullFileReferenceKey = keyFor(pbx_dir + "QMAKE_PBX_DEV_NULL_FILE_REFERENCE");
t << "\t\t" << devNullFileReferenceKey << " = {\n"
<< "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("name", "/dev/null") << ";\n"
<< "\t\t\t" << writeSettings("path", "/dev/null") << ";\n"
<< "\t\t\t" << writeSettings("lastKnownFileType", "sourcecode.c.c") << ";\n"
<< "\t\t\t" << writeSettings("sourceTree", "<absolute>") << ";\n"
<< "\t\t};\n";
QString devNullBuildFileKey = keyFor(pbx_dir + "QMAKE_PBX_DEV_NULL_BUILD_FILE");
t << "\t\t" << devNullBuildFileKey << " = {\n"
<< "\t\t\t" << writeSettings("fileRef", devNullFileReferenceKey) << ";\n"
<< "\t\t\t" << writeSettings("isa", "PBXBuildFile", SettingsNoQuote) << ";\n"
<< "\t\t};\n";
QString dummySourceBuildPhaseKey = keyFor(pbx_dir + "QMAKE_PBX_DUMMY_SOURCE_BUILD_PHASE");
t << "\t\t" << dummySourceBuildPhaseKey << " = {\n"
<< "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("files", devNullBuildFileKey, SettingsAsList, 4) << ";\n"
<< "\t\t\t" << writeSettings("isa", "PBXSourcesBuildPhase", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
<< "\t\t};\n";
ProStringList testBundleBuildConfigs;
ProString targetName = project->first("QMAKE_ORIG_TARGET");
ProString testHost = "$(BUILT_PRODUCTS_DIR)/" + targetName + ".app/";
if (!project->isActiveConfig("ios"))
testHost.append("Contents/MacOS/");
testHost.append(targetName);
static const char * const configs[] = { "Debug", "Release", 0 };
for (int i = 0; configs[i]; i++) {
QString testBundleBuildConfig = keyFor(pbx_dir + "QMAKE_PBX_TEST_BUNDLE_BUILDCONFIG_" + configs[i]);
t << "\t\t" << testBundleBuildConfig << " = {\n"
<< "\t\t\t" << writeSettings("isa", "XCBuildConfiguration", SettingsNoQuote) << ";\n"
<< "\t\t\tbuildSettings = {\n"
<< "\t\t\t\t" << writeSettings("INFOPLIST_FILE", project->first("QMAKE_XCODE_SPECDIR") + "/QtTest.plist") << ";\n"
<< "\t\t\t\t" << writeSettings("OTHER_LDFLAGS", "") << ";\n"
<< "\t\t\t\t" << writeSettings("TEST_HOST", testHost) << ";\n"
<< "\t\t\t\t" << writeSettings("DEBUG_INFORMATION_FORMAT", "dwarf-with-dsym") << ";\n"
<< "\t\t\t};\n"
<< "\t\t\t" << writeSettings("name", configs[i], SettingsNoQuote) << ";\n"
<< "\t\t};\n";
testBundleBuildConfigs.append(testBundleBuildConfig);
}
QString testBundleBuildConfigurationListKey = keyFor(pbx_dir + "QMAKE_PBX_TEST_BUNDLE_BUILDCONFIG_LIST");
t << "\t\t" << testBundleBuildConfigurationListKey << " = {\n"
<< "\t\t\t" << writeSettings("isa", "XCConfigurationList", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("buildConfigurations", testBundleBuildConfigs, SettingsAsList, 4) << ";\n"
<< "\t\t\t" << writeSettings("defaultConfigurationIsVisible", "0", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("defaultConfigurationName", "Debug", SettingsNoQuote) << ";\n"
<< "\t\t};\n";
QString primaryTargetDependencyKey = keyFor(pbx_dir + "QMAKE_PBX_PRIMARY_TARGET_DEP");
t << "\t\t" << primaryTargetDependencyKey << " = {\n"
<< "\t\t\t" << writeSettings("isa", "PBXTargetDependency", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("target", keyFor(pbx_dir + "QMAKE_PBX_TARGET")) << ";\n"
<< "\t\t};\n";
QString testBundleReferenceKey = keyFor("QMAKE_TEST_BUNDLE_REFERENCE");
t << "\t\t" << testBundleReferenceKey << " = {\n"
<< "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("explicitFileType", "wrapper.cfbundle") << ";\n"
<< "\t\t\t" << writeSettings("includeInIndex", "0", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("sourceTree", "BUILT_PRODUCTS_DIR", SettingsNoQuote) << ";\n"
<< "\t\t};\n";
QString testTargetKey = keyFor(pbx_dir + "QMAKE_PBX_TEST_TARGET");
project->values("QMAKE_PBX_TARGETS").append(testTargetKey);
t << "\t\t" << testTargetKey << " = {\n"
<< "\t\t\t" << writeSettings("buildPhases", dummySourceBuildPhaseKey, SettingsAsList, 4) << ";\n"
<< "\t\t\t" << writeSettings("dependencies", primaryTargetDependencyKey, SettingsAsList, 4) << ";\n"
<< "\t\t\t" << writeSettings("buildConfigurationList", testBundleBuildConfigurationListKey) << ";\n"
<< "\t\t\t" << writeSettings("productType", "com.apple.product-type.bundle.unit-test") << ";\n"
<< "\t\t\t" << writeSettings("isa", "PBXNativeTarget", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("productReference", testBundleReferenceKey) << ";\n"
<< "\t\t\t" << writeSettings("name", "Qt Test") << ";\n"
<< "\t\t};\n";
QLatin1Literal testTargetID("TestTargetID");
project->values(ProKey("QMAKE_PBX_TARGET_ATTRIBUTES_" + testTargetKey + "_" + testTargetID)).append(keyFor(pbx_dir + "QMAKE_PBX_TARGET"));
project->values(ProKey("QMAKE_PBX_TARGET_ATTRIBUTES_" + testTargetKey)).append(ProKey(testTargetID));
}
//DEBUG/RELEASE
QString defaultConfig;
for(int as_release = 0; as_release < 2; as_release++)
@ -1543,6 +1633,19 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\t\t\t" << writeSettings("projectDirPath", ProStringList()) << ";\n"
<< "\t\t\t" << writeSettings("projectRoot", "") << ";\n"
<< "\t\t\t" << writeSettings("targets", project->values("QMAKE_PBX_TARGETS"), SettingsAsList, 4) << ";\n"
<< "\t\t\t" << "attributes = {\n"
<< "\t\t\t\tTargetAttributes = {\n";
foreach (const ProString &target, project->values("QMAKE_PBX_TARGETS")) {
const ProStringList &attributes = project->values(ProKey("QMAKE_PBX_TARGET_ATTRIBUTES_" + target));
if (attributes.isEmpty())
continue;
t << "\t\t\t\t\t" << target << " = {\n";
foreach (const ProString &attribute, attributes)
t << "\t\t\t\t\t\t" << writeSettings(attribute.toQString(), project->first(ProKey("QMAKE_PBX_TARGET_ATTRIBUTES_" + target + "_" + attribute))) << ";\n";
t << "\t\t\t\t\t};\n";
}
t << "\t\t\t\t};\n"
<< "\t\t\t};\n"
<< "\t\t};\n";
// FIXME: Deal with developmentRegion and knownRegions for QMAKE_PBX_ROOT
@ -1600,6 +1703,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
schemeData.replace("@QMAKE_ORIG_TARGET@", target);
schemeData.replace("@TARGET_PBX_KEY@", keyFor(pbx_dir + "QMAKE_PBX_TARGET"));
schemeData.replace("@TEST_BUNDLE_PBX_KEY@", keyFor("QMAKE_TEST_BUNDLE_REFERENCE"));
QTextStream outputSchemeStream(&outputSchemeFile);
outputSchemeStream << schemeData;

View File

@ -571,6 +571,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
addFilters(tempProj, xmlFilter, "Source Files");
addFilters(tempProj, xmlFilter, "Translation Files");
addFilters(tempProj, xmlFilter, "Deployment Files");
addFilters(tempProj, xmlFilter, "Distribution Files");
for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x)
addFilters(tempProj, xmlFilter, tempProj.ExtraCompilers.at(x));
@ -585,6 +586,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
outputFilter(tempProj, xml, xmlFilter, "Form Files");
outputFilter(tempProj, xml, xmlFilter, "Resource Files");
outputFilter(tempProj, xml, xmlFilter, "Deployment Files");
outputFilter(tempProj, xml, xmlFilter, "Distribution Files");
for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) {
outputFilter(tempProj, xml, xmlFilter, tempProj.ExtraCompilers.at(x));
@ -804,6 +806,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
addFilters(tool, xmlFilter, "Source Files");
addFilters(tool, xmlFilter, "Translation Files");
addFilters(tool, xmlFilter, "Deployment Files");
addFilters(tool, xmlFilter, "Distribution Files");
for (int x = 0; x < tool.ExtraCompilers.count(); ++x)
addFilters(tool, xmlFilter, tool.ExtraCompilers.at(x));
@ -818,6 +821,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
outputFilter(tool, xml, xmlFilter, "Form Files");
outputFilter(tool, xml, xmlFilter, "Resource Files");
outputFilter(tool, xml, xmlFilter, "Deployment Files");
outputFilter(tool, xml, xmlFilter, "Distribution Files");
for (int x = 0; x < tool.ExtraCompilers.count(); ++x) {
outputFilter(tool, xml, xmlFilter, tool.ExtraCompilers.at(x));
}

View File

@ -2449,6 +2449,8 @@ const VCFilter &VCProjectSingleConfig::filterByName(const QString &name) const
return ResourceFiles;
if (name == "Deployment Files")
return DeploymentFiles;
if (name == "Distribution Files")
return DistributionFiles;
return filterForExtraCompiler(name);
}
@ -2531,6 +2533,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
outputFilter(tempProj, xml, "Form Files");
outputFilter(tempProj, xml, "Resource Files");
outputFilter(tempProj, xml, "Deployment Files");
outputFilter(tempProj, xml, "Distribution Files");
QSet<QString> extraCompilersInProject;
for (int i = 0; i < tool.ExtraCompilersFiles.count(); ++i) {
@ -2584,6 +2587,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProject &tool)
outputFilter(tool, xml, "Form Files");
outputFilter(tool, xml, "Resource Files");
outputFilter(tool, xml, "Deployment Files");
outputFilter(tool, xml, "Distribution Files");
for (int x = 0; x < tool.ExtraCompilers.count(); ++x) {
outputFilter(tool, xml, tool.ExtraCompilers.at(x));
}

View File

@ -1010,6 +1010,7 @@ public:
VCFilter FormFiles;
VCFilter ResourceFiles;
VCFilter DeploymentFiles;
VCFilter DistributionFiles;
VCFilterList ExtraCompilersFiles;
bool flat_files;

View File

@ -56,6 +56,7 @@ const char _GUIDTranslationFiles[] = "{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}
const char _GUIDFormFiles[] = "{99349809-55BA-4b9d-BF79-8FDBB0286EB3}";
const char _GUIDExtraCompilerFiles[] = "{E0D8C965-CC5F-43d7-AD63-FAEF0BBC0F85}";
const char _GUIDDeploymentFiles[] = "{D9D6E243-F8AF-46E4-B9FD-80ECBC20BA3E}";
const char _GUIDDistributionFiles[] = "{B83CAF91-C7BF-462F-B76C-EA11631F866C}";
QT_END_NAMESPACE
#ifdef Q_OS_WIN32
@ -943,6 +944,7 @@ void VcprojGenerator::initProject()
initTranslationFiles();
initFormFiles();
initResourceFiles();
initDistributionFiles();
initExtraCompilerOutputs();
// Own elements -----------------------------
@ -1565,6 +1567,17 @@ void VcprojGenerator::initResourceFiles()
vcProject.ResourceFiles.Config = &(vcProject.Configuration);
}
void VcprojGenerator::initDistributionFiles()
{
vcProject.DistributionFiles.Name = "Distribution Files";
vcProject.DistributionFiles.ParseFiles = _False;
vcProject.DistributionFiles.Filter = "*";
vcProject.DistributionFiles.Guid = _GUIDDistributionFiles;
vcProject.DistributionFiles.addFiles(project->values("DISTFILES"));
vcProject.DistributionFiles.Project = this;
vcProject.DistributionFiles.Config = &(vcProject.Configuration);
}
void VcprojGenerator::initExtraCompilerOutputs()
{
ProStringList otherFilters;

View File

@ -108,6 +108,7 @@ protected:
void initFormFiles();
void initResourceFiles();
void initDeploymentFiles();
void initDistributionFiles();
void initLexYaccFiles();
void initExtraCompilerOutputs();

View File

@ -1,69 +0,0 @@
QT_FREETYPE_DIR = $$PWD/freetype
SOURCES += \
$$QT_FREETYPE_DIR/src/autofit/afangles.c \
$$QT_FREETYPE_DIR/src/autofit/afdummy.c \
$$QT_FREETYPE_DIR/src/autofit/afglobal.c \
$$QT_FREETYPE_DIR/src/autofit/afhints.c \
$$QT_FREETYPE_DIR/src/autofit/aflatin.c \
$$QT_FREETYPE_DIR/src/autofit/afloader.c \
$$QT_FREETYPE_DIR/src/autofit/afmodule.c \
$$QT_FREETYPE_DIR/src/autofit/autofit.c \
$$QT_FREETYPE_DIR/src/base/ftbase.c \
$$QT_FREETYPE_DIR/src/base/ftbitmap.c \
$$QT_FREETYPE_DIR/src/base/ftbbox.c \
$$QT_FREETYPE_DIR/src/base/ftdebug.c \
$$QT_FREETYPE_DIR/src/base/ftglyph.c \
$$QT_FREETYPE_DIR/src/base/ftinit.c \
$$QT_FREETYPE_DIR/src/base/ftlcdfil.c \
$$QT_FREETYPE_DIR/src/base/ftmm.c \
$$QT_FREETYPE_DIR/src/base/ftsynth.c \
$$QT_FREETYPE_DIR/src/base/fttype1.c \
$$QT_FREETYPE_DIR/src/bdf/bdf.c \
$$QT_FREETYPE_DIR/src/cache/ftcache.c \
$$QT_FREETYPE_DIR/src/cff/cff.c \
$$QT_FREETYPE_DIR/src/cid/type1cid.c \
$$QT_FREETYPE_DIR/src/gzip/ftgzip.c \
$$QT_FREETYPE_DIR/src/lzw/ftlzw.c \
$$QT_FREETYPE_DIR/src/otvalid/otvalid.c \
$$QT_FREETYPE_DIR/src/otvalid/otvbase.c \
$$QT_FREETYPE_DIR/src/otvalid/otvcommn.c \
$$QT_FREETYPE_DIR/src/otvalid/otvgdef.c \
$$QT_FREETYPE_DIR/src/otvalid/otvgpos.c \
$$QT_FREETYPE_DIR/src/otvalid/otvgsub.c \
$$QT_FREETYPE_DIR/src/otvalid/otvjstf.c \
$$QT_FREETYPE_DIR/src/otvalid/otvmod.c \
$$QT_FREETYPE_DIR/src/pcf/pcf.c \
$$QT_FREETYPE_DIR/src/pfr/pfr.c \
$$QT_FREETYPE_DIR/src/psaux/psaux.c \
$$QT_FREETYPE_DIR/src/pshinter/pshinter.c \
$$QT_FREETYPE_DIR/src/psnames/psmodule.c \
$$QT_FREETYPE_DIR/src/raster/raster.c \
$$QT_FREETYPE_DIR/src/sfnt/sfnt.c \
$$QT_FREETYPE_DIR/src/smooth/smooth.c \
$$QT_FREETYPE_DIR/src/truetype/truetype.c \
$$QT_FREETYPE_DIR/src/type1/type1.c \
$$QT_FREETYPE_DIR/src/type42/type42.c \
$$QT_FREETYPE_DIR/src/winfonts/winfnt.c
win32 {
SOURCES += $$QT_FREETYPE_DIR/src/base/ftsystem.c
} else {
SOURCES += $$QT_FREETYPE_DIR/builds/unix/ftsystem.c
INCLUDEPATH += $$QT_FREETYPE_DIR/builds/unix
}
INCLUDEPATH += $$QT_FREETYPE_DIR/src $$QT_FREETYPE_DIR/include
DEFINES += FT2_BUILD_LIBRARY
contains(QT_CONFIG, system-zlib) {
DEFINES += FT_CONFIG_OPTION_SYSTEM_ZLIB
include($$PWD/zlib_dependency.pri)
}
DEFINES += TT_CONFIG_OPTION_SUBPIXEL_HINTING
# disable warnings about "unsafe" methods in C code
msvc:QMAKE_CFLAGS_WARN_ON += -wd"4996"
TR_EXCLUDE += $$QT_FREETYPE_DIR/*

71
src/3rdparty/freetype/freetype.pro vendored Normal file
View File

@ -0,0 +1,71 @@
TARGET = qtfreetype
CONFIG += \
static \
hide_symbols \
exceptions_off rtti_off warn_off
load(qt_helper_lib)
SOURCES += \
$$PWD/src/autofit/afangles.c \
$$PWD/src/autofit/afdummy.c \
$$PWD/src/autofit/afglobal.c \
$$PWD/src/autofit/afhints.c \
$$PWD/src/autofit/aflatin.c \
$$PWD/src/autofit/afloader.c \
$$PWD/src/autofit/afmodule.c \
$$PWD/src/autofit/autofit.c \
$$PWD/src/base/ftbase.c \
$$PWD/src/base/ftbitmap.c \
$$PWD/src/base/ftbbox.c \
$$PWD/src/base/ftdebug.c \
$$PWD/src/base/ftglyph.c \
$$PWD/src/base/ftinit.c \
$$PWD/src/base/ftlcdfil.c \
$$PWD/src/base/ftmm.c \
$$PWD/src/base/ftsynth.c \
$$PWD/src/base/fttype1.c \
$$PWD/src/bdf/bdf.c \
$$PWD/src/cache/ftcache.c \
$$PWD/src/cff/cff.c \
$$PWD/src/cid/type1cid.c \
$$PWD/src/gzip/ftgzip.c \
$$PWD/src/lzw/ftlzw.c \
$$PWD/src/otvalid/otvalid.c \
$$PWD/src/otvalid/otvbase.c \
$$PWD/src/otvalid/otvcommn.c \
$$PWD/src/otvalid/otvgdef.c \
$$PWD/src/otvalid/otvgpos.c \
$$PWD/src/otvalid/otvgsub.c \
$$PWD/src/otvalid/otvjstf.c \
$$PWD/src/otvalid/otvmod.c \
$$PWD/src/pcf/pcf.c \
$$PWD/src/pfr/pfr.c \
$$PWD/src/psaux/psaux.c \
$$PWD/src/pshinter/pshinter.c \
$$PWD/src/psnames/psmodule.c \
$$PWD/src/raster/raster.c \
$$PWD/src/sfnt/sfnt.c \
$$PWD/src/smooth/smooth.c \
$$PWD/src/truetype/truetype.c \
$$PWD/src/type1/type1.c \
$$PWD/src/type42/type42.c \
$$PWD/src/winfonts/winfnt.c
win32 {
SOURCES += $$PWD/src/base/ftsystem.c
} else {
SOURCES += $$PWD/builds/unix/ftsystem.c
INCLUDEPATH += $$PWD/builds/unix
}
INCLUDEPATH += $$PWD/include
DEFINES += FT2_BUILD_LIBRARY
contains(QT_CONFIG, system-zlib) {
DEFINES += FT_CONFIG_OPTION_SYSTEM_ZLIB
include($$PWD/../zlib_dependency.pri)
}
DEFINES += TT_CONFIG_OPTION_SUBPIXEL_HINTING

7
src/3rdparty/freetype_dependency.pri vendored Normal file
View File

@ -0,0 +1,7 @@
contains(QT_CONFIG, freetype) {
INCLUDEPATH += $$PWD/freetype/include
LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtfreetype$$qtPlatformTargetSuffix()
} else:contains(QT_CONFIG, system-freetype) {
# pull in the proper freetype2 include directory
include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri)
}

View File

@ -1913,6 +1913,7 @@ QByteArray QBig5hkscsCodec::convertFromUnicode(const QChar *uc, int len, Convert
} else {
// Error
*cursor++ = replacement;
++invalid;
}
}
rstr.resize(cursor - (uchar*)rstr.constData());

View File

@ -3130,11 +3130,14 @@ int qEnvironmentVariableIntValue(const char *varName, bool *ok) Q_DECL_NOEXCEPT
return 0;
}
#endif
const qlonglong value = qstrtoll(buffer, Q_NULLPTR, 0, ok);
bool ok_ = true;
const qlonglong value = qstrtoll(buffer, Q_NULLPTR, 0, &ok_);
if (int(value) != value) { // this is the check in QByteArray::toInt(), keep it in sync
if (ok)
*ok = false;
return 0;
} else if (ok) {
*ok = ok_;
}
return int(value);
}

View File

@ -143,9 +143,9 @@ private:
#define QT_MESSAGELOG_LINE __LINE__
#define QT_MESSAGELOG_FUNC Q_FUNC_INFO
#else
#define QT_MESSAGELOG_FILE 0
#define QT_MESSAGELOG_FILE Q_NULLPTR
#define QT_MESSAGELOG_LINE 0
#define QT_MESSAGELOG_FUNC 0
#define QT_MESSAGELOG_FUNC Q_NULLPTR
#endif
#define qDebug QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).debug

View File

@ -287,6 +287,7 @@ public:
WindowTransparentForInput = 0x00080000,
WindowOverridesSystemGestures = 0x00100000,
WindowDoesNotAcceptFocus = 0x00200000,
MaximizeUsingFullscreenGeometryHint = 0x00400000,
CustomizeWindowHint = 0x02000000,
WindowStaysOnBottomHint = 0x04000000,
@ -1695,6 +1696,7 @@ public:
QT_Q_ENUM(TimerType)
QT_Q_ENUM(ScrollPhase)
QT_Q_ENUM(MouseEventSource)
QT_Q_FLAG(MouseEventFlag)
QT_Q_ENUM(TabFocusBehavior)
#endif // Q_DOC

View File

@ -2159,6 +2159,15 @@
\value WindowDoesNotAcceptFocus Informs the window system that this window should
not receive the input focus.
\value MaximizeUsingFullscreenGeometryHint Informs the window system that when
maximizing the window it should use as much of the available screen geometry
as possible, including areas that may be covered by system UI such as status
bars or application launchers. This may result in the window being placed
under these system UIs, but does not guarantee it, depending on whether or
not the platform supports it. When the flag is enabled the user is responsible
for taking QScreen::availableGeometry() into account, so that any UI elements
in the application that require user interaction are not covered by system UI.
\value WindowType_Mask A mask for extracting the window type
part of the window flags.

View File

@ -365,10 +365,10 @@ inline QDebug operator<<(QDebug debug, const QFlags<T> &flags)
QT_END_NAMESPACE
Q_FORWARD_DECLARE_CF_TYPE(CFString);
Q_FORWARD_DECLARE_OBJC_CLASS(NSObject);
QT_FOR_EACH_CORE_FOUNDATION_TYPE(QT_FORWARD_DECLARE_CF_TYPE);
QT_FOR_EACH_MUTABLE_CORE_FOUNDATION_TYPE(QT_FORWARD_DECLARE_MUTABLE_CF_TYPE);
QT_FOR_EACH_CORE_GRAPHICS_TYPE(QT_FORWARD_DECLARE_CG_TYPE);
QT_FOR_EACH_MUTABLE_CORE_GRAPHICS_TYPE(QT_FORWARD_DECLARE_MUTABLE_CG_TYPE);
QT_FOR_EACH_CORE_FOUNDATION_TYPE(QT_FORWARD_DECLARE_CF_TYPE)
QT_FOR_EACH_MUTABLE_CORE_FOUNDATION_TYPE(QT_FORWARD_DECLARE_MUTABLE_CF_TYPE)
QT_FOR_EACH_CORE_GRAPHICS_TYPE(QT_FORWARD_DECLARE_CG_TYPE)
QT_FOR_EACH_MUTABLE_CORE_GRAPHICS_TYPE(QT_FORWARD_DECLARE_MUTABLE_CG_TYPE)
QT_BEGIN_NAMESPACE
#define QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE(CFType) \
@ -391,10 +391,10 @@ QT_BEGIN_NAMESPACE
Q_CORE_EXPORT QDebug operator<<(QDebug, const NSObject *);
Q_CORE_EXPORT QDebug operator<<(QDebug, CFStringRef);
QT_FOR_EACH_CORE_FOUNDATION_TYPE(QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE);
QT_FOR_EACH_MUTABLE_CORE_FOUNDATION_TYPE(QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE);
QT_FOR_EACH_CORE_GRAPHICS_TYPE(QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE);
QT_FOR_EACH_MUTABLE_CORE_GRAPHICS_TYPE(QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE);
QT_FOR_EACH_CORE_FOUNDATION_TYPE(QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE)
QT_FOR_EACH_MUTABLE_CORE_FOUNDATION_TYPE(QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE)
QT_FOR_EACH_CORE_GRAPHICS_TYPE(QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE)
QT_FOR_EACH_MUTABLE_CORE_GRAPHICS_TYPE(QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE)
#undef QT_FORWARD_DECLARE_CF_TYPE
#undef QT_FORWARD_DECLARE_MUTABLE_CF_TYPE

View File

@ -222,10 +222,10 @@ public:
Q_INVOKABLE virtual Qt::ItemFlags flags(const QModelIndex &index) const;
virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
virtual QModelIndex buddy(const QModelIndex &index) const;
virtual QModelIndexList match(const QModelIndex &start, int role,
const QVariant &value, int hits = 1,
Qt::MatchFlags flags =
Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const;
Q_INVOKABLE virtual QModelIndexList match(const QModelIndex &start, int role,
const QVariant &value, int hits = 1,
Qt::MatchFlags flags =
Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const;
virtual QSize span(const QModelIndex &index) const;
virtual QHash<int,QByteArray> roleNames() const;

View File

@ -56,11 +56,11 @@ public:
virtual void setSourceModel(QAbstractItemModel *sourceModel);
QAbstractItemModel *sourceModel() const;
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const = 0;
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const = 0;
Q_INVOKABLE virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const = 0;
Q_INVOKABLE virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const = 0;
virtual QItemSelection mapSelectionToSource(const QItemSelection &selection) const;
virtual QItemSelection mapSelectionFromSource(const QItemSelection &selection) const;
Q_INVOKABLE virtual QItemSelection mapSelectionToSource(const QItemSelection &selection) const;
Q_INVOKABLE virtual QItemSelection mapSelectionFromSource(const QItemSelection &selection) const;
bool submit() Q_DECL_OVERRIDE;
void revert() Q_DECL_OVERRIDE;

View File

@ -1734,6 +1734,11 @@ const QItemSelection QItemSelectionModel::selection() const
/*!
\since 5.5
\property QItemSelectionModel::selectedIndexes
*/
/*!
\since 5.5
\property QItemSelectionModel::model
\internal
*/

View File

@ -147,6 +147,7 @@ class Q_CORE_EXPORT QItemSelectionModel : public QObject
Q_PROPERTY(bool hasSelection READ hasSelection NOTIFY selectionChanged STORED false DESIGNABLE false)
Q_PROPERTY(QModelIndex currentIndex READ currentIndex NOTIFY currentChanged STORED false DESIGNABLE false)
Q_PROPERTY(QItemSelection selection READ selection NOTIFY selectionChanged STORED false DESIGNABLE false)
Q_PROPERTY(QModelIndexList selectedIndexes READ selectedIndexes NOTIFY selectionChanged STORED false DESIGNABLE false)
Q_DECLARE_PRIVATE(QItemSelectionModel)
@ -184,7 +185,7 @@ public:
bool hasSelection() const;
Q_INVOKABLE QModelIndexList selectedIndexes() const;
QModelIndexList selectedIndexes() const;
Q_INVOKABLE QModelIndexList selectedRows(int column = 0) const;
Q_INVOKABLE QModelIndexList selectedColumns(int row = 0) const;
const QItemSelection selection() const;

View File

@ -230,17 +230,18 @@ QJNIEnvironmentPrivate::QJNIEnvironmentPrivate()
: jniEnv(0)
{
JavaVM *vm = QtAndroidPrivate::javaVM();
if (vm->GetEnv((void**)&jniEnv, JNI_VERSION_1_6) == JNI_EDETACHED) {
const jint ret = vm->GetEnv((void**)&jniEnv, JNI_VERSION_1_6);
if (ret == JNI_OK) // Already attached
return;
if (ret == JNI_EDETACHED) { // We need to (re-)attach
JavaVMAttachArgs args = { JNI_VERSION_1_6, qJniThreadName, Q_NULLPTR };
if (vm->AttachCurrentThread(&jniEnv, &args) != JNI_OK)
return;
if (!jniEnvTLS->hasLocalData()) // If we attached the thread we own it.
jniEnvTLS->setLocalData(new QJNIEnvironmentPrivateTLS);
}
if (!jniEnv)
return;
if (!jniEnvTLS->hasLocalData())
jniEnvTLS->setLocalData(new QJNIEnvironmentPrivateTLS);
}
JNIEnv *QJNIEnvironmentPrivate::operator->()

View File

@ -97,9 +97,9 @@ class QString;
#ifndef QT_NO_TRANSLATION
// full set of tr functions
# define QT_TR_FUNCTIONS \
static inline QString tr(const char *s, const char *c = 0, int n = -1) \
static inline QString tr(const char *s, const char *c = Q_NULLPTR, int n = -1) \
{ return staticMetaObject.tr(s, c, n); } \
QT_DEPRECATED static inline QString trUtf8(const char *s, const char *c = 0, int n = -1) \
QT_DEPRECATED static inline QString trUtf8(const char *s, const char *c = Q_NULLPTR, int n = -1) \
{ return staticMetaObject.tr(s, c, n); }
#else
// inherit the ones from QObject

View File

@ -36,6 +36,7 @@
#ifndef QOBJECTDEFS_H
#error Do not include qobjectdefs_impl.h directly
#include <QtCore/qnamespace.h>
#endif
#if 0

View File

@ -377,6 +377,29 @@ QT_BEGIN_NAMESPACE
\value Script_Sharada
\value Script_SoraSompeng
\value Script_Takri
\value Script_CaucasianAlbanian
\value Script_BassaVah
\value Script_Duployan
\value Script_Elbasan
\value Script_Grantha
\value Script_PahawhHmong
\value Script_Khojki
\value Script_LinearA
\value Script_Mahajani
\value Script_Manichaean
\value Script_MendeKikakui
\value Script_Modi
\value Script_Mro
\value Script_OldNorthArabian
\value Script_Nabataean
\value Script_Palmyrene
\value Script_PauCinHau
\value Script_OldPermic
\value Script_PsalterPahlavi
\value Script_Siddham
\value Script_Khudawadi
\value Script_Tirhuta
\value Script_WarangCiti
\omitvalue ScriptCount

View File

@ -250,6 +250,31 @@ public:
Script_SoraSompeng,
Script_Takri,
// Unicode 7.0 additions
Script_CaucasianAlbanian,
Script_BassaVah,
Script_Duployan,
Script_Elbasan,
Script_Grantha,
Script_PahawhHmong,
Script_Khojki,
Script_LinearA,
Script_Mahajani,
Script_Manichaean,
Script_MendeKikakui,
Script_Modi,
Script_Mro,
Script_OldNorthArabian,
Script_Nabataean,
Script_Palmyrene,
Script_PauCinHau,
Script_OldPermic,
Script_PsalterPahlavi,
Script_Siddham,
Script_Khudawadi,
Script_Tirhuta,
Script_WarangCiti,
ScriptCount
};
@ -339,7 +364,8 @@ public:
Unicode_6_0,
Unicode_6_1,
Unicode_6_2,
Unicode_6_3
Unicode_6_3,
Unicode_7_0
};
// ****** WHEN ADDING FUNCTIONS, CONSIDER ADDING TO QCharRef TOO

View File

@ -122,6 +122,8 @@ struct ParsedDate
int year, month, day;
};
// prevent this function from being inlined into all 10 users
Q_NEVER_INLINE
static ParsedDate getDateFromJulianDay(qint64 julianDay)
{
/*
@ -628,16 +630,13 @@ int QDate::weekNumber(int *yearNumber) const
QString QDate::shortMonthName(int month, QDate::MonthNameType type)
{
if (month < 1 || month > 12)
return QString();
switch (type) {
case QDate::DateFormat:
return QLocale::system().monthName(month, QLocale::ShortFormat);
case QDate::StandaloneFormat:
return QLocale::system().standaloneMonthName(month, QLocale::ShortFormat);
default:
break;
if (month >= 1 || month <= 12) {
switch (type) {
case QDate::DateFormat:
return QLocale::system().monthName(month, QLocale::ShortFormat);
case QDate::StandaloneFormat:
return QLocale::system().standaloneMonthName(month, QLocale::ShortFormat);
}
}
return QString();
}
@ -675,16 +674,13 @@ QString QDate::shortMonthName(int month, QDate::MonthNameType type)
QString QDate::longMonthName(int month, MonthNameType type)
{
if (month < 1 || month > 12)
return QString();
switch (type) {
case QDate::DateFormat:
return QLocale::system().monthName(month, QLocale::LongFormat);
case QDate::StandaloneFormat:
return QLocale::system().standaloneMonthName(month, QLocale::LongFormat);
default:
break;
if (month >= 1 && month <= 12) {
switch (type) {
case QDate::DateFormat:
return QLocale::system().monthName(month, QLocale::LongFormat);
case QDate::StandaloneFormat:
return QLocale::system().standaloneMonthName(month, QLocale::LongFormat);
}
}
return QString();
}
@ -717,16 +713,13 @@ QString QDate::longMonthName(int month, MonthNameType type)
QString QDate::shortDayName(int weekday, MonthNameType type)
{
if (weekday < 1 || weekday > 7)
return QString();
switch (type) {
case QDate::DateFormat:
return QLocale::system().dayName(weekday, QLocale::ShortFormat);
case QDate::StandaloneFormat:
return QLocale::system().standaloneDayName(weekday, QLocale::ShortFormat);
default:
break;
if (weekday >= 1 && weekday <= 7) {
switch (type) {
case QDate::DateFormat:
return QLocale::system().dayName(weekday, QLocale::ShortFormat);
case QDate::StandaloneFormat:
return QLocale::system().standaloneDayName(weekday, QLocale::ShortFormat);
}
}
return QString();
}
@ -759,23 +752,41 @@ QString QDate::shortDayName(int weekday, MonthNameType type)
QString QDate::longDayName(int weekday, MonthNameType type)
{
if (weekday < 1 || weekday > 7)
return QString();
switch (type) {
case QDate::DateFormat:
return QLocale::system().dayName(weekday, QLocale::LongFormat);
case QDate::StandaloneFormat:
return QLocale::system().standaloneDayName(weekday, QLocale::LongFormat);
default:
break;
if (weekday >= 1 && weekday <= 7) {
switch (type) {
case QDate::DateFormat:
return QLocale::system().dayName(weekday, QLocale::LongFormat);
case QDate::StandaloneFormat:
return QLocale::system().standaloneDayName(weekday, QLocale::LongFormat);
}
}
return QLocale::system().dayName(weekday, QLocale::LongFormat);
return QString();
}
#endif //QT_NO_TEXTDATE
#ifndef QT_NO_DATESTRING
#ifndef QT_NO_TEXTDATE
static QString toStringTextDate(QDate date)
{
const ParsedDate pd = getDateFromJulianDay(date.toJulianDay());
static const QLatin1Char sp(' ');
return date.shortDayName(date.dayOfWeek()) + sp
+ date.shortMonthName(pd.month) + sp
+ QString::number(pd.day) + sp
+ QString::number(pd.year);
}
#endif // QT_NO_TEXTDATE
static QString toStringIsoDate(qint64 jd)
{
const ParsedDate pd = getDateFromJulianDay(jd);
if (pd.year >= 0 && pd.year <= 9999)
return QString::asprintf("%04d-%02d-%02d", pd.year, pd.month, pd.day);
else
return QString();
}
/*!
\fn QString QDate::toString(Qt::DateFormat format) const
@ -827,8 +838,6 @@ QString QDate::toString(Qt::DateFormat format) const
if (!isValid())
return QString();
ParsedDate pd;
switch (format) {
case Qt::SystemLocaleDate:
case Qt::SystemLocaleShortDate:
@ -845,17 +854,10 @@ QString QDate::toString(Qt::DateFormat format) const
default:
#ifndef QT_NO_TEXTDATE
case Qt::TextDate:
pd = getDateFromJulianDay(jd);
return QString::fromLatin1("%1 %2 %3 %4").arg(shortDayName(dayOfWeek()))
.arg(shortMonthName(pd.month))
.arg(pd.day)
.arg(pd.year);
return toStringTextDate(*this);
#endif
case Qt::ISODate:
pd = getDateFromJulianDay(jd);
if (pd.year < 0 || pd.year > 9999)
return QString();
return QString::asprintf("%04d-%02d-%02d", pd.year, pd.month, pd.day);
return toStringIsoDate(jd);
}
}
@ -1581,9 +1583,7 @@ QString QTime::toString(Qt::DateFormat format) const
case Qt::ISODate:
case Qt::TextDate:
default:
return QString::fromLatin1("%1:%2:%3").arg(hour(), 2, 10, QLatin1Char('0'))
.arg(minute(), 2, 10, QLatin1Char('0'))
.arg(second(), 2, 10, QLatin1Char('0'));
return QString::asprintf("%02d:%02d:%02d", hour(), minute(), second());
}
}
@ -2185,7 +2185,7 @@ static QString qt_tzname(QDateTimePrivate::DaylightStatus daylightStatus)
// then null date/time will be returned, you should adjust the date first if
// you need a guaranteed result.
static qint64 qt_mktime(QDate *date, QTime *time, QDateTimePrivate::DaylightStatus *daylightStatus,
QString *abbreviation, bool *ok)
QString *abbreviation, bool *ok = 0)
{
const qint64 msec = time->msec();
int yy, mm, dd;
@ -2446,7 +2446,7 @@ static bool epochMSecsToLocalTime(qint64 msecs, QDate *localDate, QTime *localTi
static qint64 localMSecsToEpochMSecs(qint64 localMsecs,
QDateTimePrivate::DaylightStatus *daylightStatus,
QDate *localDate = 0, QTime *localTime = 0,
QString *abbreviation = 0, bool *ok = 0)
QString *abbreviation = 0)
{
QDate dt;
QTime tm;
@ -2469,8 +2469,6 @@ static qint64 localMSecsToEpochMSecs(qint64 localMsecs,
*localDate = dt;
if (localTime)
*localTime = tm;
if (ok)
*ok = true;
return utcMsecs;
}
} else {
@ -2485,8 +2483,6 @@ static qint64 localMSecsToEpochMSecs(qint64 localMsecs,
*daylightStatus = QDateTimePrivate::StandardTime;
if (abbreviation)
*abbreviation = qt_tzname(QDateTimePrivate::StandardTime);
if (ok)
*ok = true;
return utcMsecs;
} else if (localMsecs >= msecsMax - MSECS_PER_DAY) {
@ -2505,8 +2501,6 @@ static qint64 localMSecsToEpochMSecs(qint64 localMsecs,
*localDate = dt;
if (localTime)
*localTime = tm;
if (ok)
*ok = true;
return utcMsecs;
}
}
@ -2520,7 +2514,7 @@ static qint64 localMSecsToEpochMSecs(qint64 localMsecs,
--day;
QDate fakeDate(2037, month, day);
qint64 fakeDiff = fakeDate.daysTo(dt);
qint64 utcMsecs = qt_mktime(&fakeDate, &tm, daylightStatus, abbreviation, ok);
qint64 utcMsecs = qt_mktime(&fakeDate, &tm, daylightStatus, abbreviation);
if (localDate)
*localDate = fakeDate.addDays(fakeDiff);
if (localTime)
@ -2535,7 +2529,7 @@ static qint64 localMSecsToEpochMSecs(qint64 localMsecs,
} else {
// Clearly falls inside 1970-2037 suported range so can use mktime
qint64 utcMsecs = qt_mktime(&dt, &tm, daylightStatus, abbreviation, ok);
qint64 utcMsecs = qt_mktime(&dt, &tm, daylightStatus, abbreviation);
if (localDate)
*localDate = dt;
if (localTime)
@ -2639,15 +2633,18 @@ void QDateTimePrivate::setDateTime(const QDate &date, const QTime &time)
checkValidDateTime();
}
void QDateTimePrivate::getDateTime(QDate *date, QTime *time) const
QPair<QDate, QTime> QDateTimePrivate::getDateTime() const
{
msecsToTime(m_msecs, date, time);
QPair<QDate, QTime> result;
msecsToTime(m_msecs, &result.first, &result.second);
if (date && isNullDate())
*date = QDate();
if (isNullDate())
result.first = QDate();
if (time && isNullTime())
*time = QTime();
if (isNullTime())
result.second = QTime();
return result;
}
// Set the Daylight Status if LocalTime set via msecs
@ -3535,9 +3532,9 @@ QString QDateTime::toString(Qt::DateFormat format) const
default:
#ifndef QT_NO_TEXTDATE
case Qt::TextDate: {
QDate dt;
QTime tm;
d->getDateTime(&dt, &tm);
const QPair<QDate, QTime> p = d->getDateTime();
const QDate &dt = p.first;
const QTime &tm = p.second;
//We cant use date.toString(Qt::TextDate) as we need to insert the time before the year
buf = QString::fromLatin1("%1 %2 %3 %4 %5").arg(dt.shortDayName(dt.dayOfWeek()))
.arg(dt.shortMonthName(dt.month()))
@ -3553,9 +3550,9 @@ QString QDateTime::toString(Qt::DateFormat format) const
}
#endif
case Qt::ISODate: {
QDate dt;
QTime tm;
d->getDateTime(&dt, &tm);
const QPair<QDate, QTime> p = d->getDateTime();
const QDate &dt = p.first;
const QTime &tm = p.second;
buf = dt.toString(Qt::ISODate);
if (buf.isEmpty())
return QString(); // failed to convert
@ -3673,9 +3670,9 @@ QDateTime QDateTime::addDays(qint64 ndays) const
{
QDateTime dt(*this);
dt.detach();
QDate date;
QTime time;
d->getDateTime(&date, &time);
QPair<QDate, QTime> p = d->getDateTime();
QDate &date = p.first;
QTime &time = p.second;
date = date.addDays(ndays);
// Result might fall into "missing" DaylightTime transition hour,
// so call conversion and use the adjusted returned time
@ -3709,9 +3706,9 @@ QDateTime QDateTime::addMonths(int nmonths) const
{
QDateTime dt(*this);
dt.detach();
QDate date;
QTime time;
d->getDateTime(&date, &time);
QPair<QDate, QTime> p = d->getDateTime();
QDate &date = p.first;
QTime &time = p.second;
date = date.addMonths(nmonths);
// Result might fall into "missing" DaylightTime transition hour,
// so call conversion and use the adjusted returned time
@ -3745,9 +3742,9 @@ QDateTime QDateTime::addYears(int nyears) const
{
QDateTime dt(*this);
dt.detach();
QDate date;
QTime time;
d->getDateTime(&date, &time);
QPair<QDate, QTime> p = d->getDateTime();
QDate &date = p.first;
QTime &time = p.second;
date = date.addYears(nyears);
// Result might fall into "missing" DaylightTime transition hour,
// so call conversion and use the adjusted returned time
@ -4781,14 +4778,13 @@ QDataStream &operator>>(QDataStream &in, QTime &time)
*/
QDataStream &operator<<(QDataStream &out, const QDateTime &dateTime)
{
QDate dt;
QTime tm;
QPair<QDate, QTime> dateAndTime;
if (out.version() >= QDataStream::Qt_5_2) {
// In 5.2 we switched to using Qt::TimeSpec and added offset support
dateTime.d->getDateTime(&dt, &tm);
out << dt << tm << qint8(dateTime.timeSpec());
dateAndTime = dateTime.d->getDateTime();
out << dateAndTime << qint8(dateTime.timeSpec());
if (dateTime.timeSpec() == Qt::OffsetFromUTC)
out << qint32(dateTime.offsetFromUtc());
#ifndef QT_BOOTSTRAPPED
@ -4802,17 +4798,14 @@ QDataStream &operator<<(QDataStream &out, const QDateTime &dateTime)
// This approach is wrong and should not be used again; it breaks
// the guarantee that a deserialised local datetime is the same time
// of day, regardless of which timezone it was serialised in.
if (dateTime.isValid())
dateTime.toUTC().d->getDateTime(&dt, &tm);
else
dateTime.d->getDateTime(&dt, &tm);
out << dt << tm << qint8(dateTime.timeSpec());
dateAndTime = (dateTime.isValid() ? dateTime.toUTC() : dateTime).d->getDateTime();
out << dateAndTime << qint8(dateTime.timeSpec());
} else if (out.version() >= QDataStream::Qt_4_0) {
// From 4.0 to 5.1 (except 5.0) we used QDateTimePrivate::Spec
dateTime.d->getDateTime(&dt, &tm);
out << dt << tm;
dateAndTime = dateTime.d->getDateTime();
out << dateAndTime;
if (out.version() >= QDataStream::Qt_4_0) {
switch (dateTime.timeSpec()) {
case Qt::UTC:
@ -4835,8 +4828,8 @@ QDataStream &operator<<(QDataStream &out, const QDateTime &dateTime)
} else { // version < QDataStream::Qt_4_0
// Before 4.0 there was no TimeSpec, only Qt::LocalTime was supported
dateTime.d->getDateTime(&dt, &tm);
out << dt << tm;
dateAndTime = dateTime.d->getDateTime();
out << dateAndTime;
}

View File

@ -48,6 +48,7 @@
#include "qplatformdefs.h"
#include "QtCore/qatomic.h"
#include "QtCore/qdatetime.h"
#include "QtCore/qpair.h"
#include "qtimezone.h"
@ -113,7 +114,7 @@ public:
void setTimeSpec(Qt::TimeSpec spec, int offsetSeconds);
void setDateTime(const QDate &date, const QTime &time);
void getDateTime(QDate *date, QTime *time) const;
QPair<QDate, QTime> getDateTime() const;
void setDaylightStatus(DaylightStatus status);
DaylightStatus daylightStatus() const;

View File

@ -2376,15 +2376,21 @@ Qt::LayoutDirection QLocale::textDirection() const
case QLocale::KharoshthiScript:
case QLocale::LydianScript:
case QLocale::MandaeanScript:
case QLocale::ManichaeanScript:
case QLocale::MendeKikakuiScript:
case QLocale::MeroiticCursiveScript:
case QLocale::MeroiticScript:
case QLocale::NabataeanScript:
case QLocale::NkoScript:
case QLocale::OldNorthArabianScript:
case QLocale::OldSouthArabianScript:
case QLocale::OrkhonScript:
case QLocale::PalmyreneScript:
case QLocale::PhoenicianScript:
case QLocale::PsalterPahlaviScript:
case QLocale::SamaritanScript:
case QLocale::SyriacScript:
case QLocale::ThaanaScript:
case QLocale::NkoScript:
case QLocale::OldSouthArabianScript:
case QLocale::OrkhonScript:
case QLocale::PhoenicianScript:
return Qt::RightToLeft;
default:
break;

View File

@ -382,6 +382,31 @@ public:
Akoose = 312,
Lakota = 313,
StandardMoroccanTamazight = 314,
Mapuche = 315,
CentralKurdish = 316,
LowerSorbian = 317,
UpperSorbian = 318,
Kenyang = 319,
Mohawk = 320,
Nko = 321,
Prussian = 322,
Kiche = 323,
SouthernSami = 324,
LuleSami = 325,
InariSami = 326,
SkoltSami = 327,
Warlpiri = 328,
ManichaeanMiddlePersian = 329,
Mende = 330,
AncientNorthArabian = 331,
LinearA = 332,
HmongNjua = 333,
Ho = 334,
Lezghian = 335,
Bassa = 336,
Mono = 337,
TedimChin = 338,
Maithili = 339,
Norwegian = NorwegianBokmal,
Moldavian = Romanian,
SerboCroatian = Serbian,
@ -396,7 +421,7 @@ public:
Chewa = Nyanja,
Frisian = WesternFrisian,
Uigur = Uighur,
LastLanguage = StandardMoroccanTamazight
LastLanguage = Maithili
};
enum Script {
@ -505,9 +530,32 @@ public:
UgariticScript = 102,
BrailleScript = 103,
HiraganaScript = 104,
CaucasianAlbanianScript = 105,
BassaVahScript = 106,
DuployanScript = 107,
ElbasanScript = 108,
GranthaScript = 109,
PahawhHmongScript = 110,
KhojkiScript = 111,
LinearAScript = 112,
MahajaniScript = 113,
ManichaeanScript = 114,
MendeKikakuiScript = 115,
ModiScript = 116,
MroScript = 117,
OldNorthArabianScript = 118,
NabataeanScript = 119,
PalmyreneScript = 120,
PauCinHauScript = 121,
OldPermicScript = 122,
PsalterPahlaviScript = 123,
SiddhamScript = 124,
KhudawadiScript = 125,
TirhutaScript = 126,
VarangKshitiScript = 127,
SimplifiedChineseScript = SimplifiedHanScript,
TraditionalChineseScript = TraditionalHanScript,
LastScript = HiraganaScript
LastScript = VarangKshitiScript
};
enum Country {
AnyCountry = 0,

View File

@ -92,7 +92,7 @@
\note For the current keyboard input locale take a look at
QInputMethod::locale().
QLocale's data is based on Common Locale Data Repository v24.
QLocale's data is based on Common Locale Data Repository v27.
The double-to-string and string-to-double conversion functions are
covered by the following licenses:
@ -456,6 +456,33 @@
\value TaiDam
\value TaiNua
\value Ugaritic
\value Mapuche Since Qt 5.5
\value CentralKurdish Since Qt 5.5
\value LowerSorbian Since Qt 5.5
\value UpperSorbian Since Qt 5.5
\value Kenyang Since Qt 5.5
\value Mohawk Since Qt 5.5
\value Nko Since Qt 5.5
\value Prussian Since Qt 5.5
\value Kiche Since Qt 5.5
\value SouthernSami Since Qt 5.5
\value LuleSami Since Qt 5.5
\value InariSami Since Qt 5.5
\value SkoltSami Since Qt 5.5
\value Warlpiri Since Qt 5.5
\value ManichaeanMiddlePersian Since Qt 5.5
\value Mende Since Qt 5.5
\value AncientNorthArabian Since Qt 5.5
\value LinearA Since Qt 5.5
\value HmongNjua Since Qt 5.5
\value Ho Since Qt 5.5
\value Lezghian Since Qt 5.5
\value Bassa Since Qt 5.5
\value Mono Since Qt 5.5
\value TedimChin Since Qt 5.5
\value Maithili Since Qt 5.5
\value LowerSorbian Since Qt 5.5
\value UpperSorbian Since Qt 5.5
\omitvalue LastLanguage
\sa language(), languageToString()
@ -746,6 +773,7 @@
\value AvestanScript
\value BalineseScript
\value BamumScript
\value BassaVahScript Since Qt 5.5
\value BatakScript
\value BengaliScript
\value BopomofoScript
@ -755,6 +783,7 @@
\value BuhidScript
\value CanadianAboriginalScript
\value CarianScript
\value CaucasianAlbanianScript Since Qt 5.5
\value ChakmaScript
\value ChamScript
\value CherokeeScript
@ -763,12 +792,15 @@
\value CyrillicScript
\value DeseretScript
\value DevanagariScript
\value DuployanScript Since Qt 5.5
\value EgyptianHieroglyphsScript
\value ElbasanScript Since Qt 5.5
\value EthiopicScript
\value FraserScript
\value GeorgianScript
\value GlagoliticScript
\value GothicScript
\value GranthaScript Since Qt 5.5
\value GreekScript
\value GujaratiScript
\value GurmukhiScript
@ -788,41 +820,57 @@
\value KayahLiScript
\value KharoshthiScript
\value KhmerScript
\value KhojkiScript Since Qt 5.5
\value KhudawadiScript Since Qt 5.5
\value KoreanScript
\value LannaScript
\value LaoScript
\value LatinScript
\value LepchaScript
\value LimbuScript
\value LinearAScript Since Qt 5.5
\value LinearBScript
\value LycianScript
\value LydianScript
\value MahajaniScript Since Qt 5.5
\value MalayalamScript
\value MandaeanScript
\value ManichaeanScript Since Qt 5.5
\value MeiteiMayekScript
\value MendeKikakuiScript Since Qt 5.5
\value MeroiticScript
\value MeroiticCursiveScript
\value ModiScript Since Qt 5.5
\value MongolianScript
\value MroScript Since Qt 5.5
\value MyanmarScript
\value NabataeanScript Since Qt 5.5
\value NkoScript
\value NewTaiLueScript
\value OghamScript
\value OlChikiScript
\value OldItalicScript
\value OldNorthArabianScript Since Qt 5.5
\value OldPermicScript Since Qt 5.5
\value OldPersianScript
\value OldSouthArabianScript
\value OriyaScript
\value OrkhonScript
\value OsmanyaScript
\value PahawhHmongScript Since Qt 5.5
\value PalmyreneScript Since Qt 5.5
\value PauCinHauScript Since Qt 5.5
\value PhagsPaScript
\value PhoenicianScript
\value PollardPhoneticScript
\value PsalterPahlaviScript Since Qt 5.5
\value RejangScript
\value RunicScript
\value SamaritanScript
\value SaurashtraScript
\value SharadaScript
\value ShavianScript
\value SiddhamScript Since Qt 5.5
\value SimplifiedHanScript same as SimplifiedChineseScript
\value SimplifiedChineseScript same as SimplifiedHanScript
\value SinhalaScript
@ -842,10 +890,12 @@
\value ThaiScript
\value TibetanScript
\value TifinaghScript
\value TirhutaScript Since Qt 5.5
\value TraditionalHanScript same as TraditionalChineseScript
\value TraditionalChineseScript same as TraditionalHanScript
\value UgariticScript
\value VaiScript
\value VarangKshitiScript Since Qt 5.5
\value YiScript
\omitvalue LastScript

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2014 Intel Corporation
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@ -36,6 +37,7 @@
#include "qstring.h"
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <limits.h>
#include <math.h>
@ -63,6 +65,55 @@
QT_BEGIN_NAMESPACE
#include "../../3rdparty/freebsd/strtoull.c"
#include "../../3rdparty/freebsd/strtoll.c"
unsigned long long
qstrtoull(const char * nptr, const char **endptr, int base, bool *ok)
{
// strtoull accepts negative numbers. We don't.
// Use a different variable so we pass the original nptr to strtoul
// (we need that so endptr may be nptr in case of failure)
const char *begin = nptr;
while (ascii_isspace(*begin))
++begin;
if (*begin == '-') {
*ok = false;
return 0;
}
*ok = true;
errno = 0;
char *endptr2 = 0;
unsigned long long result = qt_strtoull(nptr, &endptr2, base);
if (endptr)
*endptr = endptr2;
if ((result == 0 || result == std::numeric_limits<unsigned long long>::max())
&& (errno || endptr2 == nptr)) {
*ok = false;
return 0;
}
return result;
}
long long
qstrtoll(const char * nptr, const char **endptr, int base, bool *ok)
{
*ok = true;
errno = 0;
char *endptr2 = 0;
long long result = qt_strtoll(nptr, &endptr2, base);
if (endptr)
*endptr = endptr2;
if ((result == 0 || result == std::numeric_limits<long long>::min()
|| result == std::numeric_limits<long long>::max())
&& (errno || nptr == endptr2)) {
*ok = false;
return 0;
}
return result;
}
static char *_qdtoa( NEEDS_VOLATILE double d, int mode, int ndigits, int *decpt,
int *sign, char **rve, char **digits_str);
@ -174,220 +225,6 @@ QString &exponentForm(QChar zero, QChar decimal, QChar exponential,
return digits;
}
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgment:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
// static char sccsid[] = "@(#)strtouq.c 8.1 (Berkeley) 6/4/93";
// "$FreeBSD: src/lib/libc/stdlib/strtoull.c,v 1.5.2.1 2001/03/02 09:45:20 obrien Exp $";
/*
* Convert a string to an unsigned long long integer.
*
* Ignores `locale' stuff. Assumes that the upper and lower case
* alphabets and digits are each contiguous.
*/
qulonglong qstrtoull(const char *nptr, const char **endptr, int base, bool *ok)
{
const char *s = nptr;
qulonglong acc;
unsigned char c;
qulonglong qbase, cutoff;
int any, cutlim;
if (ok != 0)
*ok = true;
/*
* See strtoq for comments as to the logic used.
*/
s = nptr;
do {
c = *s++;
} while (ascii_isspace(c));
if (c == '-') {
if (ok != 0)
*ok = false;
if (endptr != 0)
*endptr = s - 1;
return 0;
} else {
if (c == '+')
c = *s++;
}
if ((base == 0 || base == 16) &&
c == '0' && (*s == 'x' || *s == 'X')) {
c = s[1];
s += 2;
base = 16;
}
if (base == 0)
base = c == '0' ? 8 : 10;
qbase = unsigned(base);
cutoff = qulonglong(ULLONG_MAX) / qbase;
cutlim = qulonglong(ULLONG_MAX) % qbase;
for (acc = 0, any = 0;; c = *s++) {
if (!isascii(c))
break;
if (isdigit(c))
c -= '0';
else if (isalpha(c))
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
else
break;
if (c >= base)
break;
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
any = -1;
else {
any = 1;
acc *= qbase;
acc += c;
}
}
if (any == 0) {
if (ok != 0)
*ok = false;
} else if (any < 0) {
acc = ULLONG_MAX;
if (ok != 0)
*ok = false;
}
if (endptr != 0)
*endptr = (any ? s - 1 : nptr);
return acc;
}
// "$FreeBSD: src/lib/libc/stdlib/strtoll.c,v 1.5.2.1 2001/03/02 09:45:20 obrien Exp $";
/*
* Convert a string to a long long integer.
*
* Ignores `locale' stuff. Assumes that the upper and lower case
* alphabets and digits are each contiguous.
*/
qlonglong qstrtoll(const char *nptr, const char **endptr, int base, bool *ok)
{
const char *s;
qulonglong acc;
unsigned char c;
qulonglong qbase, cutoff;
int neg, any, cutlim;
/*
* Skip white space and pick up leading +/- sign if any.
* If base is 0, allow 0x for hex and 0 for octal, else
* assume decimal; if base is already 16, allow 0x.
*/
s = nptr;
do {
c = *s++;
} while (ascii_isspace(c));
if (c == '-') {
neg = 1;
c = *s++;
} else {
neg = 0;
if (c == '+')
c = *s++;
}
if ((base == 0 || base == 16) &&
c == '0' && (*s == 'x' || *s == 'X')) {
c = s[1];
s += 2;
base = 16;
}
if (base == 0)
base = c == '0' ? 8 : 10;
/*
* Compute the cutoff value between legal numbers and illegal
* numbers. That is the largest legal value, divided by the
* base. An input number that is greater than this value, if
* followed by a legal input character, is too big. One that
* is equal to this value may be valid or not; the limit
* between valid and invalid numbers is then based on the last
* digit. For instance, if the range for quads is
* [-9223372036854775808..9223372036854775807] and the input base
* is 10, cutoff will be set to 922337203685477580 and cutlim to
* either 7 (neg==0) or 8 (neg==1), meaning that if we have
* accumulated a value > 922337203685477580, or equal but the
* next digit is > 7 (or 8), the number is too big, and we will
* return a range error.
*
* Set any if any `digits' consumed; make it negative to indicate
* overflow.
*/
qbase = unsigned(base);
cutoff = neg ? qulonglong(0-(LLONG_MIN + LLONG_MAX)) + LLONG_MAX : LLONG_MAX;
cutlim = cutoff % qbase;
cutoff /= qbase;
for (acc = 0, any = 0;; c = *s++) {
if (!isascii(c))
break;
if (isdigit(c))
c -= '0';
else if (isalpha(c))
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
else
break;
if (c >= base)
break;
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
any = -1;
else {
any = 1;
acc *= qbase;
acc += c;
}
}
if (any < 0) {
acc = neg ? LLONG_MIN : LLONG_MAX;
if (ok != 0)
*ok = false;
} else if (neg) {
acc = (~acc) + 1;
}
if (endptr != 0)
*endptr = (any >= 0 ? s - 1 : nptr);
if (ok != 0)
*ok = any > 0;
return acc;
}
/* From: NetBSD: strtod.c,v 1.26 1998/02/03 18:44:21 perry Exp */
/* $FreeBSD: src/lib/libc/stdlib/netbsd_strtod.c,v 1.2.2.2 2001/03/02 17:14:15 tegge Exp $ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@
**
****************************************************************************/
/* This file is autogenerated from the Unicode 6.3 database. Do not edit */
/* This file is autogenerated from the Unicode 7.0 database. Do not edit */
//
// W A R N I N G
@ -51,7 +51,7 @@
QT_BEGIN_NAMESPACE
#define UNICODE_DATA_VERSION QChar::Unicode_6_3
#define UNICODE_DATA_VERSION QChar::Unicode_7_0
namespace QUnicodeTables {
@ -60,23 +60,23 @@ struct Properties {
ushort direction : 8; /* 5 used */
ushort combiningClass : 8;
ushort joining : 3;
signed short digitValue : 5; /* 5 used */
signed short digitValue : 5;
signed short mirrorDiff : 16;
signed short lowerCaseDiff : 16;
signed short upperCaseDiff : 16;
signed short titleCaseDiff : 16;
signed short caseFoldDiff : 16;
ushort lowerCaseSpecial : 1;
signed short lowerCaseDiff : 15;
ushort upperCaseSpecial : 1;
signed short upperCaseDiff : 15;
ushort titleCaseSpecial : 1;
signed short titleCaseDiff : 15;
ushort caseFoldSpecial : 1;
ushort unicodeVersion : 4;
signed short caseFoldDiff : 15;
ushort unicodeVersion : 8; /* 5 used */
ushort nfQuickCheck : 8;
ushort graphemeBreakClass : 4; /* 4 used */
ushort wordBreakClass : 4; /* 4 used */
ushort sentenceBreakClass : 8; /* 4 used */
ushort lineBreakClass : 8; /* 6 used */
ushort script : 8; /* 7 used */
ushort script : 8;
};
Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) Q_DECL_NOTHROW;

View File

@ -49,7 +49,7 @@ namespace QUnicodeTools {
// -----------------------------------------------------------------------------------------------------
//
// The text boundaries determination algorithm.
// See http://www.unicode.org/reports/tr29/tr29-23.html
// See http://www.unicode.org/reports/tr29/tr29-25.html
//
// -----------------------------------------------------------------------------------------------------
@ -341,7 +341,7 @@ static void getSentenceBreaks(const ushort *string, quint32 len, QCharAttributes
// -----------------------------------------------------------------------------------------------------
//
// The line breaking algorithm.
// See http://www.unicode.org/reports/tr14/tr14-32.html
// See http://www.unicode.org/reports/tr14/tr14-33.html
//
// -----------------------------------------------------------------------------------------------------
@ -659,7 +659,7 @@ Q_CORE_EXPORT void initCharAttributes(const ushort *string, int length,
// ----------------------------------------------------------------------------
//
// The Unicode script property. See http://www.unicode.org/reports/tr24/tr24-21.html
// The Unicode script property. See http://www.unicode.org/reports/tr24/tr24-22.html
//
// ----------------------------------------------------------------------------

View File

@ -81,6 +81,7 @@ bool qdbus_loadLibDBus()
return lib && lib->isLoaded();
lib = new QLibrary;
lib->setLoadHints(QLibrary::ExportExternalSymbolsHint); // make libdbus symbols available for apps that need more advanced control over the dbus
triedToLoadLibrary = true;
static int majorversions[] = { 3, 2, -1 };

View File

@ -88,7 +88,7 @@ QDBusAbstractInterfacePrivate::QDBusAbstractInterfacePrivate(const QString &serv
if (!connection.isConnected()) {
lastError = QDBusError(QDBusError::Disconnected,
QLatin1String("Not connected to D-Bus server"));
QDBusUtil::disconnectedErrorMessage());
} else if (!service.isEmpty()) {
currentOwner = connectionPrivate()->getNameOwner(service); // verify the name owner
if (currentOwner.isEmpty()) {
@ -131,8 +131,8 @@ bool QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, void *retu
// try to read this property
QDBusMessage msg = QDBusMessage::createMethodCall(service, path,
QLatin1String(DBUS_INTERFACE_PROPERTIES),
QLatin1String("Get"));
QDBusUtil::dbusInterfaceProperties(),
QStringLiteral("Get"));
QDBusMessagePrivate::setParametersValidated(msg, true);
msg << interface << QString::fromUtf8(mp.name());
QDBusMessage reply = connection.call(msg, QDBus::Block, timeout);
@ -144,7 +144,7 @@ bool QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, void *retu
if (reply.signature() != QLatin1String("v")) {
QString errmsg = QLatin1String("Invalid signature `%1' in return from call to "
DBUS_INTERFACE_PROPERTIES);
lastError = QDBusError(QDBusError::InvalidSignature, errmsg.arg(reply.signature()));
lastError = QDBusError(QDBusError::InvalidSignature, qMove(errmsg).arg(reply.signature()));
return false;
}
@ -198,8 +198,8 @@ bool QDBusAbstractInterfacePrivate::setProperty(const QMetaProperty &mp, const Q
// send the value
QDBusMessage msg = QDBusMessage::createMethodCall(service, path,
QLatin1String(DBUS_INTERFACE_PROPERTIES),
QLatin1String("Set"));
QDBusUtil::dbusInterfaceProperties(),
QStringLiteral("Set"));
QDBusMessagePrivate::setParametersValidated(msg, true);
msg << interface << QString::fromUtf8(mp.name()) << QVariant::fromValue(QDBusVariant(value));
QDBusMessage reply = connection.call(msg, QDBus::Block, timeout);
@ -290,10 +290,10 @@ QDBusAbstractInterface::QDBusAbstractInterface(QDBusAbstractInterfacePrivate &d,
&& !d.service.isEmpty()
&& !d.service.startsWith(QLatin1Char(':'))
&& d.connectionPrivate()->mode != QDBusConnectionPrivate::PeerMode)
d_func()->connection.connect(QLatin1String(DBUS_SERVICE_DBUS), // service
d_func()->connection.connect(QDBusUtil::dbusService(), // service
QString(), // path
QLatin1String(DBUS_INTERFACE_DBUS), // interface
QLatin1String("NameOwnerChanged"),
QDBusUtil::dbusInterface(), // interface
QDBusUtil::nameOwnerChanged(),
QStringList() << d.service,
QString(), // signature
this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
@ -316,10 +316,10 @@ QDBusAbstractInterface::QDBusAbstractInterface(const QString &service, const QSt
&& !service.isEmpty()
&& !service.startsWith(QLatin1Char(':'))
&& d_func()->connectionPrivate()->mode != QDBusConnectionPrivate::PeerMode)
d_func()->connection.connect(QLatin1String(DBUS_SERVICE_DBUS), // service
d_func()->connection.connect(QDBusUtil::dbusService(), // service
QString(), // path
QLatin1String(DBUS_INTERFACE_DBUS), // interface
QLatin1String("NameOwnerChanged"),
QDBusUtil::dbusInterface(), // interface
QDBusUtil::nameOwnerChanged(),
QStringList() << service,
QString(), //signature
this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));

View File

@ -462,7 +462,7 @@ bool QDBusConnection::send(const QDBusMessage &message) const
{
if (!d || !d->connection) {
QDBusError err = QDBusError(QDBusError::Disconnected,
QLatin1String("Not connected to D-BUS server"));
QDBusUtil::disconnectedErrorMessage());
if (d)
d->lastError = err;
return false;
@ -495,7 +495,7 @@ bool QDBusConnection::callWithCallback(const QDBusMessage &message, QObject *rec
{
if (!d || !d->connection) {
QDBusError err = QDBusError(QDBusError::Disconnected,
QLatin1String("Not connected to D-BUS server"));
QDBusUtil::disconnectedErrorMessage());
if (d)
d->lastError = err;
return false;
@ -553,7 +553,7 @@ QDBusMessage QDBusConnection::call(const QDBusMessage &message, QDBus::CallMode
{
if (!d || !d->connection) {
QDBusError err = QDBusError(QDBusError::Disconnected,
QLatin1String("Not connected to D-Bus server"));
QDBusUtil::disconnectedErrorMessage());
if (d)
d->lastError = err;
@ -968,7 +968,7 @@ bool QDBusConnection::isConnected() const
*/
QDBusError QDBusConnection::lastError() const
{
return d ? d->lastError : QDBusError(QDBusError::Disconnected, QStringLiteral("Not connected."));
return d ? d->lastError : QDBusError(QDBusError::Disconnected, QDBusUtil::disconnectedErrorMessage());
}
/*!

View File

@ -42,7 +42,7 @@
#include <QtCore/QVariant>
#include <QtCore/QDebug>
#include "qdbus_symbols_p.h" // for the DBUS_* constants
#include "qdbusutil_p.h" // for the DBUS_* constants
#ifndef QT_NO_DBUS
@ -154,8 +154,8 @@ const char *QDBusConnectionInterface::staticInterfaceName()
*/
QDBusConnectionInterface::QDBusConnectionInterface(const QDBusConnection &connection,
QObject *parent)
: QDBusAbstractInterface(QLatin1String(DBUS_SERVICE_DBUS),
QLatin1String(DBUS_PATH_DBUS),
: QDBusAbstractInterface(QDBusUtil::dbusService(),
QDBusUtil::dbusPath(),
DBUS_INTERFACE_DBUS, connection, parent)
{
connect(this, SIGNAL(NameAcquired(QString)), this, SIGNAL(serviceRegistered(QString)));

View File

@ -395,8 +395,9 @@ QString QDBusError::errorString(ErrorType error)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QDBusError &msg)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QDBusError(" << msg.name() << ", " << msg.message() << ')';
return dbg.space();
return dbg;
}
#endif

View File

@ -72,37 +72,22 @@ static dbus_int32_t server_slot = -1;
static QBasicAtomicInt isDebugging = Q_BASIC_ATOMIC_INITIALIZER(-1);
#define qDBusDebug if (::isDebugging == 0); else qDebug
static inline QString orgFreedesktopDBusString()
{
return QStringLiteral(DBUS_SERVICE_DBUS);
}
static inline QString dbusServiceString()
{
return orgFreedesktopDBusString();
}
static inline QString dbusInterfaceString()
{
// it's the same string, but just be sure
Q_ASSERT(orgFreedesktopDBusString() == QLatin1String(DBUS_INTERFACE_DBUS));
return orgFreedesktopDBusString();
}
static inline QDebug operator<<(QDebug dbg, const QThread *th)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QThread(ptr=" << (const void*)th;
if (th && !th->objectName().isEmpty())
dbg.nospace() << ", name=" << th->objectName();
else if (th)
dbg.nospace() << ", name=" << th->metaObject()->className();
dbg.nospace() << ')';
return dbg.space();
return dbg;
}
#if QDBUS_THREAD_DEBUG
static inline QDebug operator<<(QDebug dbg, const QDBusConnectionPrivate *conn)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QDBusConnection("
<< "ptr=" << (const void*)conn
<< ", name=" << conn->name
@ -113,7 +98,7 @@ static inline QDebug operator<<(QDebug dbg, const QDBusConnectionPrivate *conn)
else
dbg.nospace() << conn->thread();
dbg.nospace() << ')';
return dbg.space();
return dbg;
}
void qdbusDefaultThreadDebug(int action, int condition, QDBusConnectionPrivate *conn)
@ -1039,7 +1024,7 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p)
// prepopulate watchedServices:
// we know that the owner of org.freedesktop.DBus is itself
watchedServices.insert(dbusServiceString(), WatchedServiceData(dbusServiceString(), 1));
watchedServices.insert(QDBusUtil::dbusService(), WatchedServiceData(QDBusUtil::dbusService(), 1));
// prepopulate matchRefCounts:
// we know that org.freedesktop.DBus will never change owners
@ -1375,7 +1360,7 @@ bool QDBusConnectionPrivate::activateInternalFilters(const ObjectTreeNode &node,
// object may be null
const QString interface = msg.interface();
if (interface.isEmpty() || interface == QLatin1String(DBUS_INTERFACE_INTROSPECTABLE)) {
if (interface.isEmpty() || interface == QDBusUtil::dbusInterfaceIntrospectable()) {
if (msg.member() == QLatin1String("Introspect") && msg.signature().isEmpty()) {
//qDebug() << "QDBusConnectionPrivate::activateInternalFilters introspect" << msg.d_ptr->msg;
QDBusMessage reply = msg.createReply(qDBusIntrospectObject(node, msg.path()));
@ -1390,7 +1375,7 @@ bool QDBusConnectionPrivate::activateInternalFilters(const ObjectTreeNode &node,
}
if (node.obj && (interface.isEmpty() ||
interface == QLatin1String(DBUS_INTERFACE_PROPERTIES))) {
interface == QDBusUtil::dbusInterfaceProperties())) {
//qDebug() << "QDBusConnectionPrivate::activateInternalFilters properties" << msg.d_ptr->msg;
if (msg.member() == QLatin1String("Get") && msg.signature() == QLatin1String("ss")) {
QDBusMessage reply = qDBusPropertyGet(node, msg);
@ -1777,7 +1762,7 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError
// we don't use connectSignal here because we don't need the rules to be sent to the bus
// the bus will always send us these two signals
SignalHook hook;
hook.service = dbusServiceString();
hook.service = QDBusUtil::dbusService();
hook.path.clear(); // no matching
hook.obj = this;
hook.params << QMetaType::Void << QVariant::String; // both functions take a QString as parameter and return void
@ -2204,10 +2189,10 @@ QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusM
return pcall;
} else {
// we're probably disconnected at this point
lastError = error = QDBusError(QDBusError::Disconnected, QLatin1String("Not connected to server"));
lastError = error = QDBusError(QDBusError::Disconnected, QDBusUtil::disconnectedErrorMessage());
}
} else {
lastError = error = QDBusError(QDBusError::NoMemory, QLatin1String("Out of memory"));
lastError = error = QDBusError(QDBusError::NoMemory, QStringLiteral("Out of memory"));
}
q_dbus_message_unref(msg);
@ -2278,8 +2263,8 @@ void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook
WatchedServicesHash::mapped_type &data = watchedServices[hook.service];
if (++data.refcount == 1) {
// we need to watch for this service changing
connectSignal(dbusServiceString(), QString(), dbusInterfaceString(),
QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(),
connectSignal(QDBusUtil::dbusService(), QString(), QDBusUtil::dbusInterface(),
QStringLiteral("NameOwnerChanged"), QStringList() << hook.service, QString(),
this, SLOT(serviceOwnerChangedNoLock(QString,QString,QString)));
data.owner = getNameOwnerNoCache(hook.service);
qDBusDebug() << this << "Watching service" << hook.service << "for owner changes (current owner:"
@ -2358,8 +2343,8 @@ QDBusConnectionPrivate::disconnectSignal(SignalHookHash::Iterator &it)
if (sit != watchedServices.end()) {
if (--sit.value().refcount == 0) {
watchedServices.erase(sit);
disconnectSignal(dbusServiceString(), QString(), dbusInterfaceString(),
QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(),
disconnectSignal(QDBusUtil::dbusService(), QString(), QDBusUtil::dbusInterface(),
QStringLiteral("NameOwnerChanged"), QStringList() << hook.service, QString(),
this, SLOT(serviceOwnerChangedNoLock(QString,QString,QString)));
}
}
@ -2500,9 +2485,9 @@ QString QDBusConnectionPrivate::getNameOwner(const QString& serviceName)
QString QDBusConnectionPrivate::getNameOwnerNoCache(const QString &serviceName)
{
QDBusMessage msg = QDBusMessage::createMethodCall(dbusServiceString(),
QLatin1String(DBUS_PATH_DBUS), dbusInterfaceString(),
QLatin1String("GetNameOwner"));
QDBusMessage msg = QDBusMessage::createMethodCall(QDBusUtil::dbusService(),
QDBusUtil::dbusPath(), QDBusUtil::dbusInterface(),
QStringLiteral("GetNameOwner"));
QDBusMessagePrivate::setParametersValidated(msg, true);
msg << serviceName;
QDBusMessage reply = sendWithReply(msg, QDBus::Block);
@ -2525,8 +2510,8 @@ QDBusConnectionPrivate::findMetaObject(const QString &service, const QString &pa
// introspect the target object
QDBusMessage msg = QDBusMessage::createMethodCall(service, path,
QLatin1String(DBUS_INTERFACE_INTROSPECTABLE),
QLatin1String("Introspect"));
QDBusUtil::dbusInterfaceIntrospectable(),
QStringLiteral("Introspect"));
QDBusMessagePrivate::setParametersValidated(msg, true);
QDBusMessage reply = sendWithReply(msg, QDBus::Block);
@ -2585,7 +2570,7 @@ bool QDBusConnectionPrivate::isServiceRegisteredByThread(const QString &serviceN
{
if (!serviceName.isEmpty() && serviceName == baseService)
return true;
if (serviceName == dbusServiceString())
if (serviceName == QDBusUtil::dbusService())
return false;
QDBusReadLocker locker(UnregisterServiceAction, this);

View File

@ -813,6 +813,7 @@ static void debugVariantList(QDebug dbg, const QVariantList &list)
QDebug operator<<(QDebug dbg, const QDBusMessage &msg)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QDBusMessage(type=" << msg.type()
<< ", service=" << msg.service();
if (msg.type() == QDBusMessage::MethodCallMessage ||
@ -827,7 +828,7 @@ QDebug operator<<(QDebug dbg, const QDBusMessage &msg)
<< ", contents=(";
debugVariantList(dbg, msg.arguments());
dbg.nospace() << ") )";
return dbg.space();
return dbg;
}
#endif

View File

@ -36,6 +36,7 @@
#include "qdbusconnection_p.h"
#include "qdbusmetatype_p.h"
#include "qdbusutil_p.h"
#include "qcoreapplication.h"
#include "qcoreevent.h"
#include <private/qobject_p.h>
@ -383,7 +384,7 @@ QDBusError QDBusPendingCall::error() const
// not connected, return an error
QDBusError err = QDBusError(QDBusError::Disconnected,
QLatin1String("Not connected to D-Bus server"));
QDBusUtil::disconnectedErrorMessage());
return err;
}

View File

@ -34,6 +34,7 @@
#include "qdbusserver.h"
#include "qdbusconnection_p.h"
#include "qdbusconnectionmanager_p.h"
#include "qdbusutil_p.h"
#ifndef QT_NO_DBUS
@ -130,7 +131,7 @@ bool QDBusServer::isConnected() const
*/
QDBusError QDBusServer::lastError() const
{
return d ? d->lastError : QDBusError(QDBusError::Disconnected, QStringLiteral("Not connected."));
return d ? d->lastError : QDBusError(QDBusError::Disconnected, QDBusUtil::disconnectedErrorMessage());
}
/*!

View File

@ -33,7 +33,7 @@
#include "qdbusservicewatcher.h"
#include "qdbusconnection.h"
#include "qdbus_symbols_p.h"
#include "qdbusutil_p.h"
#include <QStringList>
@ -43,10 +43,6 @@
QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC_WITH_ARGS(QString, busService, (QLatin1String(DBUS_SERVICE_DBUS)))
Q_GLOBAL_STATIC_WITH_ARGS(QString, busInterface, (QLatin1String(DBUS_INTERFACE_DBUS)))
Q_GLOBAL_STATIC_WITH_ARGS(QString, signalName, (QLatin1String("NameOwnerChanged")))
class QDBusServiceWatcherPrivate: public QObjectPrivate
{
Q_DECLARE_PUBLIC(QDBusServiceWatcher)
@ -120,7 +116,7 @@ QStringList QDBusServiceWatcherPrivate::matchArgsForService(const QString &servi
void QDBusServiceWatcherPrivate::addService(const QString &service)
{
QStringList matchArgs = matchArgsForService(service);
connection.connect(*busService(), QString(), *busInterface(), *signalName(),
connection.connect(QDBusUtil::dbusService(), QString(), QDBusUtil::dbusInterface(), QDBusUtil::nameOwnerChanged(),
matchArgs, QString(), q_func(),
SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
}
@ -128,7 +124,7 @@ void QDBusServiceWatcherPrivate::addService(const QString &service)
void QDBusServiceWatcherPrivate::removeService(const QString &service)
{
QStringList matchArgs = matchArgsForService(service);
connection.disconnect(*busService(), QString(), *busInterface(), *signalName(),
connection.disconnect(QDBusUtil::dbusService(), QString(), QDBusUtil::dbusInterface(), QDBusUtil::nameOwnerChanged(),
matchArgs, QString(), q_func(),
SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
}

View File

@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2015 Intel Corporation.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtDBus module of the Qt Toolkit.
@ -51,6 +52,8 @@
#include <QtDBus/qdbusmacros.h>
#include <QtDBus/qdbuserror.h>
#include "qdbus_symbols_p.h"
#ifndef QT_NO_DBUS
QT_BEGIN_NAMESPACE
@ -147,6 +150,25 @@ namespace QDBusUtil
*error = QDBusError(QDBusError::InvalidInterface, QString::fromLatin1("Invalid error name: %1").arg(name));
return false;
}
inline QString dbusService()
{ return QStringLiteral(DBUS_SERVICE_DBUS); }
inline QString dbusPath()
{ return QStringLiteral(DBUS_PATH_DBUS); }
inline QString dbusInterface()
{
// it's the same string, but just be sure
Q_ASSERT(dbusService() == QLatin1String(DBUS_INTERFACE_DBUS));
return dbusService();
}
inline QString dbusInterfaceProperties()
{ return QStringLiteral(DBUS_INTERFACE_PROPERTIES); }
inline QString dbusInterfaceIntrospectable()
{ return QStringLiteral(DBUS_INTERFACE_INTROSPECTABLE); }
inline QString nameOwnerChanged()
{ return QStringLiteral("NameOwnerChanged"); }
inline QString disconnectedErrorMessage()
{ return QStringLiteral("Not connected to D-Bus server"); }
}
QT_END_NAMESPACE

View File

@ -137,6 +137,12 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
!(flags & (QDBusConnection::ExportScriptableInvokables | QDBusConnection::ExportNonScriptableInvokables))))
continue; // we're not exporting any slots or invokables
// we want to skip non-scriptable stuff as early as possible to avoid bogus warning
// for methods that are not being exported at all
bool isScriptable = mm.attributes() & QMetaMethod::Scriptable;
if (!isScriptable && !(flags & (isSignal ? QDBusConnection::ExportNonScriptableSignals : QDBusConnection::ExportNonScriptableInvokables | QDBusConnection::ExportNonScriptableSlots)))
continue;
QString xml = QString::fromLatin1(" <%1 name=\"%2\">\n")
.arg(isSignal ? QLatin1String("signal") : QLatin1String("method"))
.arg(QString::fromLatin1(mm.name()));
@ -179,7 +185,6 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
continue; // cloned signal?
int j;
bool isScriptable = mm.attributes() & QMetaMethod::Scriptable;
for (j = 1; j < types.count(); ++j) {
// input parameter for a slot or output for a signal
if (types.at(j) == QDBusMetaTypeId::message()) {

View File

@ -72,8 +72,6 @@ QT_BEGIN_NAMESPACE
Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32(quint32 *dst, const uchar *src, int len);
typedef void (QT_FASTCALL *Rgb888ToRgb32Converter)(quint32 *dst, const uchar *src, int len);
static Rgb888ToRgb32Converter rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32;
struct my_error_mgr : public jpeg_error_mgr {
jmp_buf setjmp_buffer;
};
@ -242,7 +240,9 @@ static bool ensureValidImage(QImage *dest, struct jpeg_decompress_struct *info,
static bool read_jpeg_image(QImage *outImage,
QSize scaledSize, QRect scaledClipRect,
QRect clipRect, volatile int inQuality, j_decompress_ptr info, struct my_error_mgr* err )
QRect clipRect, volatile int inQuality,
Rgb888ToRgb32Converter converter,
j_decompress_ptr info, struct my_error_mgr* err )
{
if (!setjmp(err->setjmp_buffer)) {
// -1 means default quality.
@ -383,7 +383,7 @@ static bool read_jpeg_image(QImage *outImage,
if (info->output_components == 3) {
uchar *in = rows[0] + clip.x() * 3;
QRgb *out = (QRgb*)outImage->scanLine(y);
rgb888ToRgb32ConverterPtr(out, in, clip.width());
converter(out, in, clip.width());
} else if (info->out_color_space == JCS_CMYK) {
// Convert CMYK->RGB.
uchar *in = rows[0] + clip.x() * 4;
@ -714,7 +714,8 @@ public:
};
QJpegHandlerPrivate(QJpegHandler *qq)
: quality(75), exifOrientation(1), iod_src(0), state(Ready), optimize(false), progressive(false), q(qq)
: quality(75), exifOrientation(1), iod_src(0),
rgb888ToRgb32ConverterPtr(qt_convert_rgb888_to_rgb32), state(Ready), optimize(false), progressive(false), q(qq)
{}
~QJpegHandlerPrivate()
@ -745,6 +746,8 @@ public:
struct my_jpeg_source_mgr * iod_src;
struct my_error_mgr err;
Rgb888ToRgb32Converter rgb888ToRgb32ConverterPtr;
State state;
bool optimize;
@ -968,7 +971,7 @@ bool QJpegHandlerPrivate::read(QImage *image)
if(state == ReadHeader)
{
bool success = read_jpeg_image(image, scaledSize, scaledClipRect, clipRect, quality, &info, &err);
bool success = read_jpeg_image(image, scaledSize, scaledClipRect, clipRect, quality, rgb888ToRgb32ConverterPtr, &info, &err);
if (success) {
for (int i = 0; i < readTexts.size()-1; i+=2)
image->setText(readTexts.at(i), readTexts.at(i+1));
@ -996,18 +999,18 @@ QJpegHandler::QJpegHandler()
// from qimage_neon.cpp
if (qCpuHasFeature(NEON))
rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_neon;
d->rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_neon;
#endif
#if defined(QT_COMPILER_SUPPORTS_SSSE3)
// from qimage_ssse3.cpps
if (qCpuHasFeature(SSSE3)) {
rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_ssse3;
d->rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_ssse3;
}
#endif // QT_COMPILER_SUPPORTS_SSSE3
#if defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2)
if (qCpuHasFeature(DSPR2)) {
rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_mips_dspr2_asm;
d->rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_mips_dspr2_asm;
}
#endif // QT_COMPILER_SUPPORTS_DSPR2
}

View File

@ -601,8 +601,9 @@ QCursor::operator QVariant() const
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QCursor &c)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QCursor(Qt::CursorShape(" << c.shape() << "))";
return dbg.space();
return dbg;
}
#endif

View File

@ -3721,8 +3721,8 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
dbg << ", " << button;
if (buttons && button != buttons)
dbg << ", buttons=" << buttons;
if (const int mods = int(me->modifiers()))
dbg << ", modifiers=0x" << hex << mods << dec;
if (me->modifiers())
dbg << ", " << me->modifiers();
dbg << ", localPos=" << me->localPos() << ", screenPos=" << me->screenPos();
if (me->source())
dbg << ", " << me->source();
@ -3744,9 +3744,9 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
{
const QKeyEvent *ke = static_cast<const QKeyEvent *>(e);
dbg << "QKeyEvent(" << type
<< ", key=0x" << hex << ke->key() << dec;
if (const int mods = ke->modifiers())
dbg << ", modifiers=0x" << hex << mods << dec;
<< ", " << static_cast<Qt::Key>(ke->key());
if (ke->modifiers())
dbg << ", " << ke->modifiers();
if (!ke->text().isEmpty())
dbg << ", text=" << ke->text();
if (ke->isAutoRepeat())

View File

@ -1601,8 +1601,9 @@ QDataStream &operator>>(QDataStream &s, QKeySequence &keysequence)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QKeySequence &p)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QKeySequence(" << p.toString() << ')';
return dbg.space();
return dbg;
}
#endif

View File

@ -636,12 +636,21 @@ void QOpenGLContext::destroy()
d->platformGLContext = 0;
delete d->functions;
d->functions = 0;
foreach (QAbstractOpenGLFunctions *func, d->externalVersionFunctions) {
QAbstractOpenGLFunctionsPrivate *func_d = QAbstractOpenGLFunctionsPrivate::get(func);
func_d->owningContext = 0;
func_d->initialized = false;
}
d->externalVersionFunctions.clear();
qDeleteAll(d->versionFunctions);
d->versionFunctions.clear();
qDeleteAll(d->versionFunctionsBackend);
d->versionFunctionsBackend.clear();
delete d->textureFunctions;
d->textureFunctions = 0;
d->nativeHandle = QVariant();
}
@ -719,7 +728,7 @@ QOpenGLFunctions *QOpenGLContext::functions() const
QAbstractOpenGLFunctions::initializeOpenGLFunctions() as long as this context
is current. It is also possible to call this function when the context is not
current, but in that case it is the caller's responsibility to ensure proper
intiialization by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions()
initialization by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions()
afterwards.
Usually one would use the template version of this function to automatically
@ -851,15 +860,26 @@ bool QOpenGLContext::hasExtension(const QByteArray &extension) const
/*!
Call this to get the default framebuffer object for the current surface.
On some platforms the default framebuffer object depends on the surface
being rendered to, and might be different from 0. Thus, instead of calling
glBindFramebuffer(0), you should call
On some platforms (for instance, iOS) the default framebuffer object depends
on the surface being rendered to, and might be different from 0. Thus,
instead of calling glBindFramebuffer(0), you should call
glBindFramebuffer(ctx->defaultFramebufferObject()) if you want your
application to work across different Qt platforms.
If you use the glBindFramebuffer() in QOpenGLFunctions you do not have to
worry about this, as it automatically binds the current context's
defaultFramebufferObject() when 0 is passed.
\note Widgets that render via framebuffer objects, like QOpenGLWidget and
QQuickWidget, will override the value returned from this function when
painting is active, because at that time the correct "default" framebuffer
is the widget's associated backing framebuffer, not the platform-specific
one belonging to the top-level window's surface. This ensures the expected
behavior for this function and other classes relying on it (for example,
QOpenGLFramebufferObject::bindDefault() or
QOpenGLFramebufferObject::release()).
\sa QOpenGLFramebufferObject
*/
GLuint QOpenGLContext::defaultFramebufferObject() const
{
@ -870,6 +890,9 @@ GLuint QOpenGLContext::defaultFramebufferObject() const
if (!d->surface || !d->surface->surfaceHandle())
return 0;
if (d->defaultFboRedirect)
return d->defaultFboRedirect;
return d->platformGLContext->defaultFramebufferObject(d->surface->surfaceHandle());
}
@ -1257,6 +1280,24 @@ void QOpenGLContext::removeFunctionsBackend(const QOpenGLVersionStatus &v)
d->versionFunctionsBackend.remove(v);
}
/*!
\internal
*/
void QOpenGLContext::insertExternalFunctions(QAbstractOpenGLFunctions *f)
{
Q_D(QOpenGLContext);
d->externalVersionFunctions.insert(f);
}
/*!
\internal
*/
void QOpenGLContext::removeExternalFunctions(QAbstractOpenGLFunctions *f)
{
Q_D(QOpenGLContext);
d->externalVersionFunctions.remove(f);
}
/*!
\internal
*/

View File

@ -229,6 +229,8 @@ private:
void insertFunctionsBackend(const QOpenGLVersionStatus &v,
QOpenGLVersionFunctionsBackend *backend);
void removeFunctionsBackend(const QOpenGLVersionStatus &v);
void insertExternalFunctions(QAbstractOpenGLFunctions *f);
void removeExternalFunctions(QAbstractOpenGLFunctions *f);
QOpenGLTextureHelper* textureFunctions() const;
void setTextureFunctions(QOpenGLTextureHelper* textureFuncs);

View File

@ -204,6 +204,7 @@ public:
, workaround_missingPrecisionQualifiers(false)
, active_engine(0)
, qgl_current_fbo_invalid(false)
, defaultFboRedirect(0)
{
requestedFormat = QSurfaceFormat::defaultFormat();
}
@ -216,6 +217,7 @@ public:
mutable QHash<QOpenGLVersionProfile, QAbstractOpenGLFunctions *> versionFunctions;
mutable QHash<QOpenGLVersionStatus, QOpenGLVersionFunctionsBackend *> versionFunctionsBackend;
mutable QSet<QAbstractOpenGLFunctions *> externalVersionFunctions;
void *qGLContextHandle;
void (*qGLContextDeleteFunction)(void *handle);
@ -241,6 +243,7 @@ public:
bool qgl_current_fbo_invalid;
QVariant nativeHandle;
GLuint defaultFboRedirect;
static QOpenGLContext *setCurrentContext(QOpenGLContext *context);

View File

@ -1152,6 +1152,7 @@ QDebug operator<<(QDebug dbg, const QPalette &p)
"BrightText", "ButtonText", "Base", "Window", "Shadow", "Highlight",
"HighlightedText", "Link", "LinkVisited", "AlternateBase", "NoRole",
"ToolTipBase","ToolTipText" };
QDebugStateSaver saver(dbg);
QDebug nospace = dbg.nospace();
const uint mask = p.resolve();
nospace << "QPalette(resolve=" << hex << showbase << mask << ',';
@ -1171,7 +1172,7 @@ QDebug operator<<(QDebug dbg, const QPalette &p)
}
}
nospace << ')' << noshowbase << dec;
return dbg.space();
return dbg;
}
#endif

View File

@ -392,6 +392,8 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
return QPlatformTheme::defaultThemeHint(QPlatformTheme::MousePressAndHoldInterval);
case TabFocusBehavior:
return QPlatformTheme::defaultThemeHint(QPlatformTheme::TabFocusBehavior);
case ReplayMousePressOutsidePopup:
return true;
}
return 0;

View File

@ -145,7 +145,8 @@ public:
SetFocusOnTouchRelease,
ShowIsMaximized,
MousePressAndHoldInterval,
TabFocusBehavior
TabFocusBehavior,
ReplayMousePressOutsidePopup
};
virtual QVariant styleHint(StyleHint hint) const;

View File

@ -88,14 +88,16 @@ struct QShortcutEntry
/*! \internal
QDebug operator<< for easy debug output of the shortcut entries.
*/
static QDebug &operator<<(QDebug &dbg, const QShortcutEntry *se) {
static QDebug &operator<<(QDebug &dbg, const QShortcutEntry *se)
{
QDebugStateSaver saver(dbg);
if (!se)
return dbg << "QShortcutEntry(0x0)";
dbg.nospace()
<< "QShortcutEntry(" << se->keyseq
<< "), id(" << se->id << "), enabled(" << se->enabled << "), autorepeat(" << se->autorepeat
<< "), owner(" << se->owner << ')';
return dbg.space();
return dbg;
}
#endif // QT_NO_DEBUGSTREAM

View File

@ -812,6 +812,7 @@ bool operator!=(const QSurfaceFormat& a, const QSurfaceFormat& b)
QDebug operator<<(QDebug dbg, const QSurfaceFormat &f)
{
const QSurfaceFormatPrivate * const d = f.d;
QDebugStateSaver saver(dbg);
dbg.nospace() << "QSurfaceFormat("
<< "version " << d->major << '.' << d->minor
@ -828,7 +829,7 @@ QDebug operator<<(QDebug dbg, const QSurfaceFormat &f)
<< ", profile " << d->profile
<< ')';
return dbg.space();
return dbg;
}
#endif

View File

@ -782,10 +782,12 @@ void QWindowSystemInterface::handleEnterWhatsThisEvent()
#endif
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QWindowSystemInterface::TouchPoint &p) {
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QWindowSystemInterface::TouchPoint &p)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "TouchPoint(" << p.id << " @" << p.area << " normalized " << p.normalPosition
<< " press " << p.pressure << " vel " << p.velocity << " state " << (int)p.state;
return dbg.space();
return dbg;
}
#endif

View File

@ -341,6 +341,7 @@ typedef QGenericMatrix<4, 3, float> QMatrix4x3;
template <int N, int M, typename T>
QDebug operator<<(QDebug dbg, const QGenericMatrix<N, M, T> &m)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QGenericMatrix<" << N << ", " << M
<< ", " << QTypeInfo<T>::name()
<< ">(" << endl << qSetFieldWidth(10);
@ -350,7 +351,7 @@ QDebug operator<<(QDebug dbg, const QGenericMatrix<N, M, T> &m)
dbg << endl;
}
dbg << qSetFieldWidth(0) << ')';
return dbg.space();
return dbg;
}
#endif

View File

@ -2010,6 +2010,7 @@ QMatrix4x4::operator QVariant() const
QDebug operator<<(QDebug dbg, const QMatrix4x4 &m)
{
QDebugStateSaver saver(dbg);
// Create a string that represents the matrix type.
QByteArray bits;
if (m.flagBits == QMatrix4x4::Identity) {
@ -2039,7 +2040,7 @@ QDebug operator<<(QDebug dbg, const QMatrix4x4 &m)
<< m(2, 0) << m(2, 1) << m(2, 2) << m(2, 3) << endl
<< m(3, 0) << m(3, 1) << m(3, 2) << m(3, 3) << endl
<< qSetFieldWidth(0) << ')';
return dbg.space();
return dbg;
}
#endif

View File

@ -950,10 +950,11 @@ QQuaternion::operator QVariant() const
QDebug operator<<(QDebug dbg, const QQuaternion &q)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QQuaternion(scalar:" << q.scalar()
<< ", vector:(" << q.x() << ", "
<< q.y() << ", " << q.z() << "))";
return dbg.space();
return dbg;
}
#endif

View File

@ -499,8 +499,9 @@ QVector2D::operator QVariant() const
QDebug operator<<(QDebug dbg, const QVector2D &vector)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QVector2D(" << vector.x() << ", " << vector.y() << ')';
return dbg.space();
return dbg;
}
#endif

View File

@ -697,9 +697,10 @@ float QVector3D::lengthSquared() const
QDebug operator<<(QDebug dbg, const QVector3D &vector)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QVector3D("
<< vector.x() << ", " << vector.y() << ", " << vector.z() << ')';
return dbg.space();
return dbg;
}
#endif

View File

@ -573,10 +573,11 @@ QVector4D::operator QVariant() const
QDebug operator<<(QDebug dbg, const QVector4D &vector)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QVector4D("
<< vector.x() << ", " << vector.y() << ", "
<< vector.z() << ", " << vector.w() << ')';
return dbg.space();
return dbg;
}
#endif

View File

@ -3650,7 +3650,7 @@ QOpenGLTexture::DepthStencilMode QOpenGLTexture::depthStencilMode() const
}
/*!
\enum ComparisonFunction
\enum QOpenGLTexture::ComparisonFunction
\since 5.5
This enum specifies which comparison operator is used when texture comparison
is enabled on this texture.

View File

@ -67,6 +67,17 @@ void QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(QOpenGLContext *con
context->removeFunctionsBackend(v);
}
void QAbstractOpenGLFunctionsPrivate::insertExternalFunctions(QOpenGLContext *context, QAbstractOpenGLFunctions *f)
{
Q_ASSERT(context);
context->insertExternalFunctions(f);
}
void QAbstractOpenGLFunctionsPrivate::removeExternalFunctions(QOpenGLContext *context, QAbstractOpenGLFunctions *f)
{
Q_ASSERT(context);
context->removeExternalFunctions(f);
}
/*!
\class QAbstractOpenGLFunctions
@ -182,6 +193,9 @@ QAbstractOpenGLFunctions::QAbstractOpenGLFunctions()
QAbstractOpenGLFunctions::~QAbstractOpenGLFunctions()
{
Q_D(QAbstractOpenGLFunctions);
if (d->owningContext)
d->removeExternalFunctions(d->owningContext, this);
delete d_ptr;
}
@ -191,6 +205,18 @@ bool QAbstractOpenGLFunctions::initializeOpenGLFunctions()
{
Q_D(QAbstractOpenGLFunctions);
d->initialized = true;
// For a subclass whose instance is not created via
// QOpenGLContext::versionFunctions() owningContext is not set. Set it now
// and register such instances to the context as external ones. These are
// not owned by the context but still need certain cleanup when the context
// is destroyed.
if (!d->owningContext) {
d->owningContext = QOpenGLContext::currentContext();
if (d->owningContext)
d->insertExternalFunctions(d->owningContext, this);
}
return true;
}

View File

@ -114,6 +114,8 @@ public:
QAtomicInt refs;
};
class QAbstractOpenGLFunctions;
class QAbstractOpenGLFunctionsPrivate
{
public:
@ -128,12 +130,16 @@ public:
const QOpenGLVersionStatus &v,
QOpenGLVersionFunctionsBackend *backend);
static void removeFunctionsBackend(QOpenGLContext *context, const QOpenGLVersionStatus &v);
static void insertExternalFunctions(QOpenGLContext *context, QAbstractOpenGLFunctions *f);
static void removeExternalFunctions(QOpenGLContext *context, QAbstractOpenGLFunctions *f);
static QAbstractOpenGLFunctionsPrivate *get(QAbstractOpenGLFunctions *q);
QOpenGLContext *owningContext;
bool initialized;
};
class QAbstractOpenGLFunctions
class Q_GUI_EXPORT QAbstractOpenGLFunctions
{
public:
virtual ~QAbstractOpenGLFunctions();
@ -154,6 +160,11 @@ protected:
friend class QOpenGLContext;
};
inline QAbstractOpenGLFunctionsPrivate *QAbstractOpenGLFunctionsPrivate::get(QAbstractOpenGLFunctions *q)
{
return q->d_func();
}
#if !defined(QT_OPENGL_ES_2)
class QOpenGLFunctions_1_0_CoreBackend : public QOpenGLVersionFunctionsBackend

View File

@ -189,11 +189,16 @@ bool QOpenGLVertexArrayObjectPrivate::create()
void QOpenGLVertexArrayObjectPrivate::destroy()
{
Q_Q(QOpenGLVertexArrayObject);
if (context) {
QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
context = 0;
}
if (!vao)
return;
Q_Q(QOpenGLVertexArrayObject);
switch (vaoFuncsType) {
#ifndef QT_OPENGL_ES_2
case Core_3_2:
@ -212,10 +217,6 @@ void QOpenGLVertexArrayObjectPrivate::destroy()
break;
}
Q_ASSERT(context);
QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
context = 0;
vao = 0;
}

View File

@ -1022,8 +1022,9 @@ QDebug operator<<(QDebug dbg, const QBrush &b)
"TexturePattern" // 24
};
QDebugStateSaver saver(dbg);
dbg.nospace() << "QBrush(" << b.color() << ',' << BRUSH_STYLES[b.style()] << ')';
return dbg.space();
return dbg;
}
#endif

View File

@ -2469,6 +2469,7 @@ void QColor::invalidate()
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QColor &c)
{
QDebugStateSaver saver(dbg);
if (!c.isValid())
dbg.nospace() << "QColor(Invalid)";
else if (c.spec() == QColor::Rgb)
@ -2481,7 +2482,7 @@ QDebug operator<<(QDebug dbg, const QColor &c)
else if (c.spec() == QColor::Hsl)
dbg.nospace() << "QColor(AHSL " << c.alphaF() << ", " << c.hslHueF() << ", " << c.hslSaturationF() << ", " << c.lightnessF() << ')';
return dbg.space();
return dbg;
}
#endif

View File

@ -1130,6 +1130,7 @@ QDataStream &operator>>(QDataStream &s, QMatrix &m)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QMatrix &m)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QMatrix("
<< "11=" << m.m11()
<< " 12=" << m.m12()
@ -1138,7 +1139,7 @@ QDebug operator<<(QDebug dbg, const QMatrix &m)
<< " dx=" << m.dx()
<< " dy=" << m.dy()
<< ')';
return dbg.space();
return dbg;
}
#endif

View File

@ -942,6 +942,7 @@ QRect QPageLayout::paintRectPixels(int resolution) const
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QPageLayout &layout)
{
QDebugStateSaver saver(dbg);
if (layout.isValid()) {
QString output = QStringLiteral("QPageLayout(%1, %2, l:%3 r:%4 t:%5 b:%6 %7)");
QString units;
@ -976,7 +977,7 @@ QDebug operator<<(QDebug dbg, const QPageLayout &layout)
} else {
dbg.nospace() << "QPageLayout()";
}
return dbg.space();
return dbg;
}
#endif

View File

@ -1854,6 +1854,7 @@ QSize QPageSize::sizePixels(PageSizeId pageSizeId, int resolution)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QPageSize &pageSize)
{
QDebugStateSaver saver(dbg);
if (pageSize.isValid()) {
QString output = QStringLiteral("QPageSize(\"%1\", \"%2\", %3x%4pt, %5)");
output = output.arg(pageSize.name())
@ -1865,7 +1866,7 @@ QDebug operator<<(QDebug dbg, const QPageSize &pageSize)
} else {
dbg.nospace() << "QPageSize()";
}
return dbg.space();
return dbg;
}
#endif

View File

@ -7462,6 +7462,7 @@ start_lengthVariant:
range.format.setFontUnderline(true);
underlineFormats.append(range);
}
#ifdef Q_OS_MAC
} else if (hidemnmemonic && *cin == QLatin1Char('(') && l >= 4 &&
cin[1] == QLatin1Char('&') && cin[2] != QLatin1Char('&') &&
cin[3] == QLatin1Char(')')) {
@ -7473,6 +7474,7 @@ start_lengthVariant:
length -= n + 4;
l -= 4;
continue;
#endif //Q_OS_MAC
}
*cout = *cin;
++cout;

View File

@ -1026,12 +1026,13 @@ QDebug operator<<(QDebug dbg, const QPen &p)
"CustomDashLine"
};
QDebugStateSaver saver(dbg);
dbg.nospace() << "QPen(" << p.width() << ',' << p.brush()
<< ',' << PEN_STYLES[p.style()] << ',' << int(p.capStyle())
<< ',' << int(p.joinStyle()) << ',' << p.dashPattern()
<< ',' << p.dashOffset()
<< ',' << p.miterLimit() << ')';
return dbg.space();
return dbg;
}
#endif

View File

@ -461,11 +461,12 @@ QRect QPolygon::boundingRect() const
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QPolygon &a)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QPolygon(";
for (int i = 0; i < a.count(); ++i)
dbg.nospace() << a.at(i);
dbg.nospace() << ')';
return dbg.space();
return dbg;
}
#endif
@ -802,11 +803,12 @@ QDataStream &operator>>(QDataStream &s, QPolygonF &a)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QPolygonF &a)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QPolygonF(";
for (int i = 0; i < a.count(); ++i)
dbg.nospace() << a.at(i);
dbg.nospace() << ')';
return dbg.space();
return dbg;
}
#endif

View File

@ -1091,6 +1091,7 @@ QDebug operator<<(QDebug dbg, const QTransform &m)
"TxProject"
};
QDebugStateSaver saver(dbg);
dbg.nospace() << "QTransform(type=" << typeStr[m.type()] << ','
<< " 11=" << m.m11()
<< " 12=" << m.m12()
@ -1103,7 +1104,7 @@ QDebug operator<<(QDebug dbg, const QTransform &m)
<< " 33=" << m.m33()
<< ')';
return dbg.space();
return dbg;
}
#endif

View File

@ -364,6 +364,29 @@ static quint64 findKnownValue(const QString &name, const QCssKnownValue *start,
return prop->id;
}
static inline bool isInheritable(Property propertyId)
{
switch (propertyId) {
case Font:
case FontFamily:
case FontSize:
case FontStyle:
case FontWeight:
case TextIndent:
case Whitespace:
case ListStyleType:
case ListStyle:
case TextAlignment:
case FontVariant:
case TextTransform:
case LineHeight:
return true;
default:
break;
}
return false;
}
///////////////////////////////////////////////////////////////////////////////
// Value Extractor
ValueExtractor::ValueExtractor(const QVector<Declaration> &decls, const QPalette &pal)
@ -2317,6 +2340,7 @@ bool Parser::parseProperty(Declaration *decl)
{
decl->d->property = lexem();
decl->d->propertyId = static_cast<Property>(findKnownValue(decl->d->property, properties, NumProperties));
decl->d->inheritable = isInheritable(decl->d->propertyId);
skipSpace();
return true;
}

View File

@ -426,12 +426,13 @@ struct Q_GUI_EXPORT Declaration
{
struct DeclarationData : public QSharedData
{
inline DeclarationData() : propertyId(UnknownProperty), important(false) {}
inline DeclarationData() : propertyId(UnknownProperty), important(false), inheritable(false) {}
QString property;
Property propertyId;
QVector<Value> values;
QVariant parsed;
bool important;
bool important:1;
bool inheritable:1;
};
QExplicitlySharedDataPointer<DeclarationData> d;
inline Declaration() : d(new DeclarationData()) {}

View File

@ -94,6 +94,8 @@ static const hb_script_t _qtscript_to_hbscript[] = {
HB_SCRIPT_BUHID,
HB_SCRIPT_TAGBANWA,
HB_SCRIPT_COPTIC,
// Unicode 4.0 additions
HB_SCRIPT_LIMBU,
HB_SCRIPT_TAI_LE,
HB_SCRIPT_LINEAR_B,
@ -102,6 +104,8 @@ static const hb_script_t _qtscript_to_hbscript[] = {
HB_SCRIPT_OSMANYA,
HB_SCRIPT_CYPRIOT,
HB_SCRIPT_BRAILLE,
// Unicode 4.1 additions
HB_SCRIPT_BUGINESE,
HB_SCRIPT_NEW_TAI_LUE,
HB_SCRIPT_GLAGOLITIC,
@ -109,11 +113,15 @@ static const hb_script_t _qtscript_to_hbscript[] = {
HB_SCRIPT_SYLOTI_NAGRI,
HB_SCRIPT_OLD_PERSIAN,
HB_SCRIPT_KHAROSHTHI,
// Unicode 5.0 additions
HB_SCRIPT_BALINESE,
HB_SCRIPT_CUNEIFORM,
HB_SCRIPT_PHOENICIAN,
HB_SCRIPT_PHAGS_PA,
HB_SCRIPT_NKO,
// Unicode 5.1 additions
HB_SCRIPT_SUNDANESE,
HB_SCRIPT_LEPCHA,
HB_SCRIPT_OL_CHIKI,
@ -125,6 +133,8 @@ static const hb_script_t _qtscript_to_hbscript[] = {
HB_SCRIPT_CARIAN,
HB_SCRIPT_LYDIAN,
HB_SCRIPT_CHAM,
// Unicode 5.2 additions
HB_SCRIPT_TAI_THAM,
HB_SCRIPT_TAI_VIET,
HB_SCRIPT_AVESTAN,
@ -140,16 +150,45 @@ static const hb_script_t _qtscript_to_hbscript[] = {
HB_SCRIPT_INSCRIPTIONAL_PAHLAVI,
HB_SCRIPT_OLD_TURKIC,
HB_SCRIPT_KAITHI,
// Unicode 6.0 additions
HB_SCRIPT_BATAK,
HB_SCRIPT_BRAHMI,
HB_SCRIPT_MANDAIC,
// Unicode 6.1 additions
HB_SCRIPT_CHAKMA,
HB_SCRIPT_MEROITIC_CURSIVE,
HB_SCRIPT_MEROITIC_HIEROGLYPHS,
HB_SCRIPT_MIAO,
HB_SCRIPT_SHARADA,
HB_SCRIPT_SORA_SOMPENG,
HB_SCRIPT_TAKRI
HB_SCRIPT_TAKRI,
// Unicode 7.0 additions
HB_SCRIPT_CAUCASIAN_ALBANIAN,
HB_SCRIPT_BASSA_VAH,
HB_SCRIPT_DUPLOYAN,
HB_SCRIPT_ELBASAN,
HB_SCRIPT_GRANTHA,
HB_SCRIPT_PAHAWH_HMONG,
HB_SCRIPT_KHOJKI,
HB_SCRIPT_LINEAR_A,
HB_SCRIPT_MAHAJANI,
HB_SCRIPT_MANICHAEAN,
HB_SCRIPT_MENDE_KIKAKUI,
HB_SCRIPT_MODI,
HB_SCRIPT_MRO,
HB_SCRIPT_OLD_NORTH_ARABIAN,
HB_SCRIPT_NABATAEAN,
HB_SCRIPT_PALMYRENE,
HB_SCRIPT_PAU_CIN_HAU,
HB_SCRIPT_OLD_PERMIC,
HB_SCRIPT_PSALTER_PAHLAVI,
HB_SCRIPT_SIDDHAM,
HB_SCRIPT_KHUDAWADI,
HB_SCRIPT_TIRHUTA,
HB_SCRIPT_WARANG_CITI
};
Q_STATIC_ASSERT(QChar::ScriptCount == sizeof(_qtscript_to_hbscript) / sizeof(_qtscript_to_hbscript[0]));

View File

@ -522,9 +522,11 @@ enum {
VietnameseCsbBit = 8,
SimplifiedChineseCsbBit = 18,
TraditionalChineseCsbBit = 20,
ThaiCsbBit = 16,
JapaneseCsbBit = 17,
KoreanCsbBit = 19,
KoreanJohabCsbBit = 21
KoreanJohabCsbBit = 21,
SymbolCsbBit = 31
};
/*!
@ -579,6 +581,11 @@ QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromTrueTypeBits(q
hasScript = true;
//qDebug("font %s supports Arabic", familyName.latin1());
}
if (codePageRange[0] & (1 << ThaiCsbBit)) {
writingSystems.setSupported(QFontDatabase::Thai);
hasScript = true;
//qDebug("font %s supports Thai", familyName.latin1());
}
if (codePageRange[0] & (1 << VietnameseCsbBit)) {
writingSystems.setSupported(QFontDatabase::Vietnamese);
hasScript = true;
@ -604,6 +611,11 @@ QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromTrueTypeBits(q
hasScript = true;
//qDebug("font %s supports Korean", familyName.latin1());
}
if (codePageRange[0] & (1 << SymbolCsbBit)) {
writingSystems = QSupportedWritingSystems();
hasScript = false;
}
if (!hasScript)
writingSystems.setSupported(QFontDatabase::Symbol);

View File

@ -881,16 +881,22 @@ static inline void qt_getJustificationOpportunities(const ushort *string, int le
int spaceAs;
switch (si.analysis.script) {
case QChar::Script_Arabic:
case QChar::Script_Syriac:
case QChar::Script_Nko:
case QChar::Script_Mandaic:
case QChar::Script_Mongolian:
case QChar::Script_PhagsPa:
case QChar::Script_Manichaean:
case QChar::Script_PsalterPahlavi:
// same as default but inter character justification takes precedence
spaceAs = Justification_Arabic_Space;
break;
case QChar::Script_Tibetan:
case QChar::Script_Hiragana:
case QChar::Script_Katakana:
case QChar::Script_Bopomofo:
case QChar::Script_Han:
// same as default but inter character justification is the only option
spaceAs = Justification_Character;
@ -1201,20 +1207,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st
uint cluster = infos->cluster;
if (Q_LIKELY(last_cluster != cluster)) {
if (Q_UNLIKELY(g.glyphs[i] == 0)) {
// hide characters that should normally be invisible
switch (string[item_pos + str_pos]) {
case QChar::LineFeed:
case 0x000c: // FormFeed
case QChar::CarriageReturn:
case QChar::LineSeparator:
case QChar::ParagraphSeparator:
g.attributes[i].dontPrint = true;
break;
default:
break;
}
}
g.attributes[i].clusterStart = true;
// fix up clusters so that the cluster indices will be monotonic
// and thus we never return out-of-order indices
@ -1222,7 +1215,32 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st
log_clusters[str_pos++] = last_glyph_pos;
last_glyph_pos = i + glyphs_shaped;
last_cluster = cluster;
g.attributes[i].clusterStart = true;
// hide characters that should normally be invisible
switch (string[item_pos + str_pos]) {
case QChar::LineFeed:
case 0x000c: // FormFeed
case QChar::CarriageReturn:
case QChar::LineSeparator:
case QChar::ParagraphSeparator:
g.attributes[i].dontPrint = true;
break;
case QChar::SoftHyphen:
if (!actualFontEngine->symbol) {
// U+00AD [SOFT HYPHEN] is a default ignorable codepoint,
// so we replace its glyph and metrics with ones for
// U+002D [HYPHEN-MINUS] and make it visible if it appears at line-break
g.glyphs[i] = actualFontEngine->glyphIndex('-');
if (Q_LIKELY(g.glyphs[i] != 0)) {
QGlyphLayout tmp = g.mid(i, 1);
actualFontEngine->recalcAdvances(&tmp, 0);
}
g.attributes[i].dontPrint = true;
}
break;
default:
break;
}
}
}
while (str_pos < item_length)
@ -1618,10 +1636,10 @@ void QTextEngine::itemize() const
for (int i = 0; i < length; ++i) {
switch (analysis[i].script) {
case QChar::Script_Latin:
case QChar::Script_Han:
case QChar::Script_Hiragana:
case QChar::Script_Katakana:
case QChar::Script_Bopomofo:
case QChar::Script_Han:
analysis[i].script = QChar::Script_Common;
break;
default:

View File

@ -3458,14 +3458,16 @@ void QTextFormatCollection::setDefaultFont(const QFont &f)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QTextLength &l)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QTextLength(QTextLength::Type(" << l.type() << "))";
return dbg.space();
return dbg;
}
QDebug operator<<(QDebug dbg, const QTextFormat &f)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QTextFormat(QTextFormat::FormatType(" << f.type() << "))";
return dbg.space();
return dbg;
}
#endif

View File

@ -1050,25 +1050,14 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
// set element specific attributes
switch (id) {
case Html_a:
charFormat.setAnchor(true);
for (int i = 0; i < attributes.count(); i += 2) {
const QString key = attributes.at(i);
if (key.compare(QLatin1String("href"), Qt::CaseInsensitive) == 0
&& !attributes.at(i + 1).isEmpty()) {
hasHref = true;
charFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
charFormat.setForeground(QGuiApplication::palette().link());
}
}
break;
case Html_em:
case Html_i:
case Html_cite:
case Html_address:
case Html_var:
case Html_dfn:
charFormat.setFontItalic(true);
charFormat.setAnchor(true);
break;
case Html_big:
charFormat.setProperty(QTextFormat::FontSizeAdjustment, int(1));
@ -1076,36 +1065,27 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
case Html_small:
charFormat.setProperty(QTextFormat::FontSizeAdjustment, int(-1));
break;
case Html_strong:
case Html_b:
charFormat.setFontWeight(QFont::Bold);
break;
case Html_h1:
charFormat.setFontWeight(QFont::Bold);
charFormat.setProperty(QTextFormat::FontSizeAdjustment, int(3));
margin[QTextHtmlParser::MarginTop] = 18;
margin[QTextHtmlParser::MarginBottom] = 12;
break;
case Html_h2:
charFormat.setFontWeight(QFont::Bold);
charFormat.setProperty(QTextFormat::FontSizeAdjustment, int(2));
margin[QTextHtmlParser::MarginTop] = 16;
margin[QTextHtmlParser::MarginBottom] = 12;
break;
case Html_h3:
charFormat.setFontWeight(QFont::Bold);
charFormat.setProperty(QTextFormat::FontSizeAdjustment, int(1));
margin[QTextHtmlParser::MarginTop] = 14;
margin[QTextHtmlParser::MarginBottom] = 12;
break;
case Html_h4:
charFormat.setFontWeight(QFont::Bold);
charFormat.setProperty(QTextFormat::FontSizeAdjustment, int(0));
margin[QTextHtmlParser::MarginTop] = 12;
margin[QTextHtmlParser::MarginBottom] = 12;
break;
case Html_h5:
charFormat.setFontWeight(QFont::Bold);
charFormat.setProperty(QTextFormat::FontSizeAdjustment, int(-1));
margin[QTextHtmlParser::MarginTop] = 12;
margin[QTextHtmlParser::MarginBottom] = 4;
@ -1114,11 +1094,7 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
margin[QTextHtmlParser::MarginTop] = 12;
margin[QTextHtmlParser::MarginBottom] = 12;
break;
case Html_center:
blockFormat.setAlignment(Qt::AlignCenter);
break;
case Html_ul:
listStyle = QTextListFormat::ListDisc;
// nested lists don't have margins, except for the toplevel one
if (!isNestedList(parser)) {
margin[QTextHtmlParser::MarginTop] = 12;
@ -1127,7 +1103,6 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
// no left margin as we use indenting instead
break;
case Html_ol:
listStyle = QTextListFormat::ListDecimal;
// nested lists don't have margins, except for the toplevel one
if (!isNestedList(parser)) {
margin[QTextHtmlParser::MarginTop] = 12;
@ -1135,26 +1110,12 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
}
// no left margin as we use indenting instead
break;
case Html_code:
case Html_tt:
case Html_kbd:
case Html_samp:
charFormat.setFontFamily(QString::fromLatin1("Courier New,courier"));
// <tt> uses a fixed font, so set the property
charFormat.setFontFixedPitch(true);
break;
case Html_br:
text = QChar(QChar::LineSeparator);
wsm = QTextHtmlParserNode::WhiteSpacePre;
break;
// ##### sub / sup
case Html_pre:
charFormat.setFontFamily(QString::fromLatin1("Courier New,courier"));
wsm = WhiteSpacePre;
margin[QTextHtmlParser::MarginTop] = 12;
margin[QTextHtmlParser::MarginBottom] = 12;
// <pre> uses a fixed font
charFormat.setFontFixedPitch(true);
break;
case Html_blockquote:
margin[QTextHtmlParser::MarginTop] = 12;
@ -1169,28 +1130,6 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
case Html_dd:
margin[QTextHtmlParser::MarginLeft] = 30;
break;
case Html_u:
charFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
break;
case Html_s:
charFormat.setFontStrikeOut(true);
break;
case Html_nobr:
wsm = WhiteSpaceNoWrap;
break;
case Html_th:
charFormat.setFontWeight(QFont::Bold);
blockFormat.setAlignment(Qt::AlignCenter);
break;
case Html_td:
blockFormat.setAlignment(Qt::AlignLeft);
break;
case Html_sub:
charFormat.setVerticalAlignment(QTextCharFormat::AlignSubScript);
break;
case Html_sup:
charFormat.setVerticalAlignment(QTextCharFormat::AlignSuperScript);
break;
default: break;
}
}
@ -1345,6 +1284,14 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector<QCss::Declaration>
case QCss::QtListNumberSuffix:
textListNumberSuffix = decl.d->values.first().variant.toString();
break;
case QCss::TextAlignment:
switch (identifier) {
case QCss::Value_Left: blockFormat.setAlignment(Qt::AlignLeft); break;
case QCss::Value_Center: blockFormat.setAlignment(Qt::AlignCenter); break;
case QCss::Value_Right: blockFormat.setAlignment(Qt::AlignRight); break;
default: break;
}
break;
default: break;
}
}
@ -1833,6 +1780,189 @@ void QTextHtmlParser::importStyleSheet(const QString &href)
}
}
QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode &node)
{
QVector<QCss::Declaration> decls;
QCss::Declaration decl;
QCss::Value val;
switch (node.id) {
case Html_a:
case Html_u: {
bool needsUnderline = (node.id == Html_u) ? true : false;
if (node.id == Html_a) {
for (int i = 0; i < node.attributes.count(); i += 2) {
const QString key = node.attributes.at(i);
if (key.compare(QLatin1String("href"), Qt::CaseInsensitive) == 0
&& !node.attributes.at(i + 1).isEmpty()) {
needsUnderline = true;
decl.d->property = QLatin1String("color");
decl.d->propertyId = QCss::Color;
val.type = QCss::Value::Color;
val.variant = QVariant(QGuiApplication::palette().link());
decl.d->values = QVector<QCss::Value>() << val;
decl.d->inheritable = true;
decls << decl;
break;
}
}
}
if (needsUnderline) {
decl = QCss::Declaration();
decl.d->property = QLatin1String("text-decoration");
decl.d->propertyId = QCss::TextDecoration;
val.type = QCss::Value::KnownIdentifier;
val.variant = QVariant(QCss::Value_Underline);
decl.d->values = QVector<QCss::Value>() << val;
decl.d->inheritable = true;
decls << decl;
}
break;
}
case Html_b:
case Html_strong:
case Html_h1:
case Html_h2:
case Html_h3:
case Html_h4:
case Html_h5:
case Html_th:
decl = QCss::Declaration();
decl.d->property = QLatin1String("font-weight");
decl.d->propertyId = QCss::FontWeight;
val.type = QCss::Value::KnownIdentifier;
val.variant = QVariant(QCss::Value_Bold);
decl.d->values = QVector<QCss::Value>() << val;
decl.d->inheritable = true;
decls << decl;
if (node.id == Html_b || node.id == Html_strong)
break;
// Delibrate fall through
case Html_big:
case Html_small:
if (node.id != Html_th) {
decl = QCss::Declaration();
decl.d->property = QLatin1String("font-size");
decl.d->propertyId = QCss::FontSize;
decl.d->inheritable = false;
val.type = QCss::Value::KnownIdentifier;
switch (node.id) {
case Html_h1: val.variant = QVariant(QCss::Value_XXLarge); break;
case Html_h2: val.variant = QVariant(QCss::Value_XLarge); break;
case Html_h3: case Html_big: val.variant = QVariant(QCss::Value_Large); break;
case Html_h4: val.variant = QVariant(QCss::Value_Medium); break;
case Html_h5: case Html_small: val.variant = QVariant(QCss::Value_Small); break;
default: break;
}
decl.d->values = QVector<QCss::Value>() << val;
decls << decl;
break;
}
// Delibrate fall through
case Html_center:
case Html_td:
decl = QCss::Declaration();
decl.d->property = QLatin1String("text-align");
decl.d->propertyId = QCss::TextAlignment;
val.type = QCss::Value::KnownIdentifier;
val.variant = (node.id == Html_td) ? QVariant(QCss::Value_Left) : QVariant(QCss::Value_Center);
decl.d->values = QVector<QCss::Value>() << val;
decl.d->inheritable = true;
decls << decl;
break;
case Html_s:
decl = QCss::Declaration();
decl.d->property = QLatin1String("text-decoration");
decl.d->propertyId = QCss::TextDecoration;
val.type = QCss::Value::KnownIdentifier;
val.variant = QVariant(QCss::Value_LineThrough);
decl.d->values = QVector<QCss::Value>() << val;
decl.d->inheritable = true;
decls << decl;
break;
case Html_em:
case Html_i:
case Html_cite:
case Html_address:
case Html_var:
case Html_dfn:
decl = QCss::Declaration();
decl.d->property = QLatin1String("font-style");
decl.d->propertyId = QCss::FontStyle;
val.type = QCss::Value::KnownIdentifier;
val.variant = QVariant(QCss::Value_Italic);
decl.d->values = QVector<QCss::Value>() << val;
decl.d->inheritable = true;
decls << decl;
break;
case Html_sub:
case Html_sup:
decl = QCss::Declaration();
decl.d->property = QLatin1String("vertical-align");
decl.d->propertyId = QCss::VerticalAlignment;
val.type = QCss::Value::KnownIdentifier;
val.variant = (node.id == Html_sub) ? QVariant(QCss::Value_Sub) : QVariant(QCss::Value_Super);
decl.d->values = QVector<QCss::Value>() << val;
decl.d->inheritable = true;
decls << decl;
break;
case Html_ul:
case Html_ol:
decl = QCss::Declaration();
decl.d->property = QLatin1String("list-style");
decl.d->propertyId = QCss::ListStyle;
val.type = QCss::Value::KnownIdentifier;
val.variant = (node.id == Html_ul) ? QVariant(QCss::Value_Disc) : QVariant(QCss::Value_Decimal);
decl.d->values = QVector<QCss::Value>() << val;
decl.d->inheritable = true;
decls << decl;
break;
case Html_code:
case Html_tt:
case Html_kbd:
case Html_samp:
case Html_pre: {
decl = QCss::Declaration();
decl.d->property = QLatin1String("font-family");
decl.d->propertyId = QCss::FontFamily;
QVector<QCss::Value> values;
val.type = QCss::Value::String;
val.variant = QLatin1String("Courier New");
values << val;
val.type = QCss::Value::TermOperatorComma;
val.variant = QVariant();
values << val;
val.type = QCss::Value::String;
val.variant = QLatin1String("courier");
values << val;
decl.d->values = values;
decl.d->inheritable = true;
decls << decl;
}
if (node.id != Html_pre)
break;
// Delibrate fall through
case Html_br:
case Html_nobr:
decl = QCss::Declaration();
decl.d->property = QLatin1String("whitespace");
decl.d->propertyId = QCss::Whitespace;
val.type = QCss::Value::KnownIdentifier;
switch (node.id) {
case Html_br: val.variant = QVariant(QCss::Value_PreWrap); break;
case Html_nobr: val.variant = QVariant(QCss::Value_NoWrap); break;
case Html_pre: val.variant = QVariant(QCss::Value_Pre); break;
default: break;
}
decl.d->values = QVector<QCss::Value>() << val;
decl.d->inheritable = true;
decls << decl;
break;
default:
break;
}
return decls;
}
QVector<QCss::Declaration> QTextHtmlParser::declarationsForNode(int node) const
{
QVector<QCss::Declaration> decls;
@ -1860,8 +1990,20 @@ QVector<QCss::Declaration> QTextHtmlParser::declarationsForNode(int node) const
const char *extraPseudo = 0;
if (nodes.at(node).id == Html_a && nodes.at(node).hasHref)
extraPseudo = "link";
decls = selector.declarationsForNode(n, extraPseudo);
// Ensure that our own style is taken into consideration
decls = standardDeclarationForNode(nodes.at(node));
decls += selector.declarationsForNode(n, extraPseudo);
n = selector.parentNode(n);
while (!selector.isNullNode(n)) {
QVector<QCss::Declaration> inheritedDecls;
inheritedDecls = selector.declarationsForNode(n, extraPseudo);
for (int i = 0; i < inheritedDecls.size(); ++i) {
const QCss::Declaration &decl = inheritedDecls.at(i);
if (decl.d->inheritable)
decls.prepend(decl);
}
n = selector.parentNode(n);
}
return decls;
}

View File

@ -119,9 +119,10 @@ QDataStream &operator>>(QDataStream &stream, QLayoutPolicy &policy)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QLayoutPolicy &p)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QLayoutPolicy(horizontalPolicy = " << p.horizontalPolicy()
<< ", verticalPolicy = " << p.verticalPolicy() << ')';
return dbg.space();
return dbg;
}
#endif

View File

@ -163,6 +163,29 @@ static AsyncStatus opStatus(const ComPtr<T> &op)
return status;
}
static qint64 writeIOStream(ComPtr<IOutputStream> stream, const char *data, qint64 len)
{
ComPtr<IBuffer> buffer;
HRESULT hr = g->bufferFactory->Create(len, &buffer);
Q_ASSERT_SUCCEEDED(hr);
hr = buffer->put_Length(len);
Q_ASSERT_SUCCEEDED(hr);
ComPtr<Windows::Storage::Streams::IBufferByteAccess> byteArrayAccess;
hr = buffer.As(&byteArrayAccess);
Q_ASSERT_SUCCEEDED(hr);
byte *bytes;
hr = byteArrayAccess->Buffer(&bytes);
Q_ASSERT_SUCCEEDED(hr);
memcpy(bytes, data, len);
ComPtr<IAsyncOperationWithProgress<UINT32, UINT32>> op;
hr = stream->WriteAsync(buffer.Get(), &op);
RETURN_IF_FAILED("Failed to write to stream", return -1);
UINT32 bytesWritten;
hr = QWinRTFunctions::await(op, &bytesWritten);
RETURN_IF_FAILED("Failed to write to stream", return -1);
return bytesWritten;
}
QNativeSocketEngine::QNativeSocketEngine(QObject *parent)
: QAbstractSocketEngine(*new QNativeSocketEnginePrivate(), parent)
{
@ -492,35 +515,12 @@ qint64 QNativeSocketEngine::write(const char *data, qint64 len)
hr = d->tcpSocket()->get_OutputStream(&stream);
else if (d->socketType == QAbstractSocket::UdpSocket)
hr = d->udpSocket()->get_OutputStream(&stream);
if (FAILED(hr)) {
qErrnoWarning(hr, "Failed to get output stream to socket.");
return -1;
}
RETURN_IF_FAILED("Failed to get output stream to socket", return -1);
ComPtr<IBuffer> buffer;
hr = g->bufferFactory->Create(len, &buffer);
Q_ASSERT_SUCCEEDED(hr);
hr = buffer->put_Length(len);
Q_ASSERT_SUCCEEDED(hr);
ComPtr<Windows::Storage::Streams::IBufferByteAccess> byteArrayAccess;
hr = buffer.As(&byteArrayAccess);
Q_ASSERT_SUCCEEDED(hr);
byte *bytes;
hr = byteArrayAccess->Buffer(&bytes);
Q_ASSERT_SUCCEEDED(hr);
memcpy(bytes, data, len);
ComPtr<IAsyncOperationWithProgress<UINT32, UINT32>> op;
hr = stream->WriteAsync(buffer.Get(), &op);
RETURN_IF_FAILED("Failed to write to stream", return -1);
UINT32 bytesWritten;
hr = QWinRTFunctions::await(op, &bytesWritten);
if (FAILED(hr)) {
qint64 bytesWritten = writeIOStream(stream, data, len);
if (bytesWritten < 0)
d->setError(QAbstractSocket::SocketAccessError, QNativeSocketEnginePrivate::AccessErrorString);
return -1;
}
if (bytesWritten && d->notifyOnWrite)
else if (bytesWritten > 0 && d->notifyOnWrite)
emit writeReady();
return bytesWritten;
@ -560,11 +560,10 @@ qint64 QNativeSocketEngine::writeDatagram(const char *data, qint64 len, const QH
ComPtr<IHostName> remoteHost;
ComPtr<IHostNameFactory> hostNameFactory;
if (FAILED(GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(),
&hostNameFactory))) {
qWarning("QNativeSocketEnginePrivate::nativeSendDatagram: could not obtain hostname factory");
return -1;
}
HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(),
&hostNameFactory);
RETURN_IF_FAILED("Could not obtain hostname factory", return -1);
const QString addressString = addr.toString();
HStringReference hostNameRef(reinterpret_cast<LPCWSTR>(addressString.utf16()));
hostNameFactory->CreateHostName(hostNameRef.Get(), &remoteHost);
@ -573,17 +572,13 @@ qint64 QNativeSocketEngine::writeDatagram(const char *data, qint64 len, const QH
ComPtr<IOutputStream> stream;
const QString portString = QString::number(port);
HStringReference portRef(reinterpret_cast<LPCWSTR>(portString.utf16()));
if (FAILED(d->udpSocket()->GetOutputStreamAsync(remoteHost.Get(), portRef.Get(), &streamOperation)))
return -1;
HRESULT hr;
while (hr = streamOperation->GetResults(&stream) == E_ILLEGAL_METHOD_CALL)
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
ComPtr<IDataWriterFactory> dataWriterFactory;
GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Storage_Streams_DataWriter).Get(), &dataWriterFactory);
ComPtr<IDataWriter> writer;
dataWriterFactory->CreateDataWriter(stream.Get(), &writer);
writer->WriteBytes(len, (unsigned char *)data);
return len;
hr = d->udpSocket()->GetOutputStreamAsync(remoteHost.Get(), portRef.Get(), &streamOperation);
RETURN_IF_FAILED("Failed to get output stream to socket", return -1);
hr = QWinRTFunctions::await(streamOperation, stream.GetAddressOf());
RETURN_IF_FAILED("Failed to get output stream to socket", return -1);
return writeIOStream(stream, data, len);
}
bool QNativeSocketEngine::hasPendingDatagrams() const

Some files were not shown because too many files have changed in this diff Show More