diff options
68 files changed, 1337 insertions, 454 deletions
diff --git a/doc/global/externalsites/qtcreator.qdoc b/doc/global/externalsites/qtcreator.qdoc new file mode 100644 index 0000000000..9ac80eb831 --- /dev/null +++ b/doc/global/externalsites/qtcreator.qdoc @@ -0,0 +1,491 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-deployment-qnx.html + \title Qt Creator: Deploying Applications to QNX Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-developing-bb10.html + \title Qt Creator: Connecting BlackBerry 10 Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-developing-qnx.html + \title Qt Creator: Connecting QNX Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-deployment-bb10.html + \title Qt Creator: Deploying Applications to BlackBerry 10 Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-developing-generic-linux.html + \title Qt Creator: Connecting Embedded Linux Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-publish-ovi-maemo.html + \title Qt Creator: Publishing Qt Content for Maemo Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-maemo-emulator.html + \title Qt Creator: Using Maemo or MeeGo Harmattan Emulator +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-developing-meego.html + \title Qt Creator: Connecting MeeGo Harmattan Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-developing-maemo.html + \title Qt Creator: Connecting Maemo Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-publish-ovi-meego.html + \title Qt Creator: Publishing Qt Content for MeeGo Harmattan Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-publishing-to-maemo-extras.html + \title Qt Creator: Publishing Maemo Applications to Extras-devel +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-deployment-maemo.html + \title Qt Creator: Deploying Applications to Linux-Based Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-faq.html + \title Qt Creator: FAQ +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-tips.html + \title Qt Creator: Tips and Tricks +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-help.html + \title Qt Creator: Using the Help Mode +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-quick-tour.html + \title Qt Creator: User Interface +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-cli.html + \title Qt Creator: Using Command Line Options +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-task-lists.html + \title Qt Creator: Showing Task List Files in Issues Pane +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-managing-sessions.html + \title Qt Creator: Managing Sessions +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-external.html + \title Qt Creator: Using External Tools +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-version-control.html + \title Qt Creator: Using Version Control Systems +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-keyboard-shortcuts.html + \title Qt Creator: Keyboard Shortcuts +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/quick-screens.html + \title Qt Creator: Creating Screens +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/quick-animations.html + \title Qt Creator: Animating Screens +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/quick-user-interaction.html + \title Qt Creator: Adding User Interaction Methods +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-qml-application.html + \title Qt Creator: Creating a Qt Quick Application +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/quick-export-to-qml.html + \title Qt Creator: Exporting Designs from Graphics Software +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-qml-modules-with-plugins.html + \title Qt Creator: Using QML Modules with Plugins +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-visual-editor.html + \title Qt Creator: Developing Qt Quick Applications +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/quick-application-logic.html + \title Qt Creator: Implementing Application Logic +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-using-qt-quick-designer.html + \title Qt Creator: Using Qt Quick Designer +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/quick-projects.html + \title Qt Creator: Creating Qt Quick Projects +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/quick-components.html + \title Qt Creator: Creating Components +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/qt-quick-toolbars.html + \title Qt Creator: Using Qt Quick Toolbars +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/quick-buttons.html + \title Qt Creator: Creating Buttons +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/quick-scalable-image.html + \title Qt Creator: Creating Scalable Buttons and Borders +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-options.html + \title Qt Creator: Configuring the Editor +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-functions.html + \title Qt Creator: Writing Code +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-coding-navigating.html + \title Qt Creator: Working in Edit Mode +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-highlighting.html + \title Qt Creator: Semantic Highlighting +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-checking-code-syntax.html + \title Qt Creator: Checking Code Syntax +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-completing-code.html + \title Qt Creator: Completing Code +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-codepasting.html + \title Qt Creator: Pasting and Fetching Code Snippets +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-macros.html + \title Qt Creator: Using Text Editing Macros +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-fakevim.html + \title Qt Creator: Using FakeVim Mode +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-indenting-code.html + \title Qt Creator: Indenting Text or Code +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-finding.html + \title Qt Creator: Finding and Replacing +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-refactoring.html + \title Qt Creator: Refactoring +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-locator.html + \title Qt Creator: Searching with the Locator +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-coding.html + \title Qt Creator: Coding +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-options-text.html + \title Qt Creator: Specifying Text Editor Settings +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-finding-overview.html + \title Qt Creator: Finding +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-mime-types.html + \title Qt Creator: Editing MIME Types +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-qml-debugging-example.html + \title Qt Creator: Debugging a Qt Quick Example Application +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-debugging-example.html + \title Qt Creator: Debugging a C++ Example Application +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-debugger-engines.html + \title Qt Creator: Setting Up Debugger +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-debugging-qml.html + \title Qt Creator: Debugging Qt Quick Projects +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-debugging.html + \title Qt Creator: Debugging +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-debugger-operating-modes.html + \title Qt Creator: Launching the Debugger +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-debug-mode.html + \title Qt Creator: Interacting with the Debugger +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-debugging-helpers.html + \title Qt Creator: Using Debugging Helpers +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-troubleshooting-debugging.html + \title Qt Creator: Troubleshooting Debugger +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/index.html + \title Qt Creator Manual +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-advanced.html + \title Qt Creator: Advanced Use +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-os-supported-platforms.html + \title Qt Creator: Supported Platforms +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-connecting-mobile.html + \title Qt Creator: Connecting Mobile Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-usability.html + \title Qt Creator: Optimizing Applications for Mobile Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-acknowledgements.html + \title Qt Creator: Acknowledgements +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-help-overview.html + \title Qt Creator: Getting Help +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/technical-support.html + \title Qt Creator: Technical Support +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-overview.html + \title Qt Creator: IDE Overview +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-testing.html + \title Qt Creator: Debugging and Analyzing +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-deployment.html + \title Qt Creator: Deploying to Mobile Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-tutorials.html + \title Qt Creator: Tutorials +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-known-issues.html + \title Qt Creator: Known Issues +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-design-mode.html + \title Qt Creator: Designing User Interfaces +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-publish-ovi.html + \title Qt Creator: Publishing +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-glossary.html + \title Qt Creator: Glossary +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-getting-started.html + \title Qt Creator: Getting Started +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-analyzer.html + \title Qt Creator: Detecting Memory Leaks +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-cache-profiler.html + \title Qt Creator: Profiling Function Execution +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-running-valgrind-remotely.html + \title Qt Creator: Running Valgrind Tools Remotely +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-valgrind-overview.html + \title Qt Creator: Using Valgrind Code Analysis Tools +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-analyze-mode.html + \title Qt Creator: Analyzing Code +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-qml-performance-monitor.html + \title Qt Creator: Profiling QML Applications +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-deploying-android.html + \title Qt Creator: Deploying Applications to Android Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-developing-android.html + \title Qt Creator: Connecting Android Devices +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-build-example-application.html + \title Qt Creator: Building and Running an Example +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-generic.html + \title Qt Creator: Setting Up a Generic Project +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-sharing-project-settings.html + \title Qt Creator: Sharing Project Settings +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-opening.html + \title Qt Creator: Opening Projects +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-managing.html + \title Qt Creator: Managing Projects +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-cmake.html + \title Qt Creator: Setting Up a CMake Project +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-targets.html + \title Qt Creator: Adding Kits +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-tool-chains.html + \title Qt Creator: Adding Compilers +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-qbs.html + \title Qt Creator: Setting Up a Qbs Project +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-creating.html + \title Qt Creator: Creating Projects +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-wizards.html + \title Qt Creator: Adding New Custom Wizards +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-projects-autotools.html + \title Qt Creator: Setting Up an Autotools Project +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-configuring-projects.html + \title Qt Creator: Configuring Projects +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-build-process-customizing.html + \title Qt Creator: Customizing the Build Process +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-build-settings.html + \title Qt Creator: Specifying Build Settings +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-code-style-settings.html + \title Qt Creator: Specifying Code Style Settings +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-run-settings.html + \title Qt Creator: Specifying Run Settings +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-qmake-libraries.html + \title Qt Creator: Adding Libraries to Projects +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-other.html + \title Qt Creator: Using Other Build Systems +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-running-targets.html + \title Qt Creator: Running on Multiple Platforms +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-build-dependencies.html + \title Qt Creator: Specifying Dependencies +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-building-running.html + \title Qt Creator: Building and Running +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-editor-settings.html + \title Qt Creator: Specifying Editor Settings +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-project-qmake.html + \title Qt Creator: Adding Qt Versions +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-building-targets.html + \title Qt Creator: Building for Multiple Platforms +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-using-qt-designer.html + \title Qt Creator: Developing Widget Based Applications +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-writing-program.html + \title Qt Creator: Creating a Qt Widget Based Application +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/adding-plugins.html + \title Qt Creator: Adding Qt Designer Plugins +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-configuring.html + \title Qt Creator: Configuring Qt Creator +*/ diff --git a/mkspecs/features/java.prf b/mkspecs/features/java.prf index 6cbd690c37..25f6e66427 100644 --- a/mkspecs/features/java.prf +++ b/mkspecs/features/java.prf @@ -17,7 +17,10 @@ android { CONFIG += android_app } -isEmpty(CLASS_DIR): CLASS_DIR = .classes +isEmpty(CLASS_DIR) { + bundled_jar_file: CLASS_DIR = .classes.bundled + else: CLASS_DIR = .classes +} CONFIG -= qt @@ -47,17 +50,16 @@ QMAKE_LIBS_OPENGL_ES2 = QMAKE_LIBDIR = QMAKE_EXTENSION_SHLIB = jar -# Override linker with dex (for Android) or jar (for other java builds) -android { - QMAKE_LINK_O_FLAG = --output= +# Override linker with dex (for distributable Android archives) or jar (for other java builds) +android:!bundled_jar_file { contains(QMAKE_HOST.os, Windows) { - QMAKE_LINK = $$PWD/data/android/dx $$SDK_ROOT --dex + DEX_CMD = $$PWD/data/android/dx $$SDK_ROOT } else { - QMAKE_LINK = $$SDK_ROOT/platform-tools/dx --dex + DEX_CMD = $$SDK_ROOT/platform-tools/dx } + QMAKE_LINK_SHLIB_CMD = $$DEX_CMD --dex --output $(TARGET) $$CLASS_DIR } else { - QMAKE_LINK_O_FLAG = "cf " - QMAKE_LINK = jar + QMAKE_LINK_SHLIB_CMD = jar cf $(TARGET) -C $$CLASS_DIR . } # Force link step to always happen, since we are always updating the diff --git a/mkspecs/features/qt_android_deps.prf b/mkspecs/features/qt_android_deps.prf index 27814a90a5..ba37649201 100644 --- a/mkspecs/features/qt_android_deps.prf +++ b/mkspecs/features/qt_android_deps.prf @@ -17,6 +17,12 @@ ANDROID_DEPENDS_DIR = $$MODULE_QMAKE_OUTDIR/lib/ DEPENDENCY_FILE = $$ANDROID_DEPENDS_DIR$$TARGET-android-dependencies.xml !build_pass { + !isEmpty(MODULE_PLUGIN_TYPES) { + for(PLUGIN_TYPE, MODULE_PLUGIN_TYPES) { + ANDROID_BUNDLED_FILES += "plugins/$$PLUGIN_TYPE" + } + } + !isEmpty(ANDROID_JAR_DEPENDENCIES) { for(JAR_FILE, ANDROID_JAR_DEPENDENCIES) { INIT_CLASS = $$section(JAR_FILE, ":", 1, 1) @@ -26,6 +32,15 @@ DEPENDENCY_FILE = $$ANDROID_DEPENDS_DIR$$TARGET-android-dependencies.xml } } + !isEmpty(ANDROID_BUNDLED_JAR_DEPENDENCIES) { + for(JAR_FILE, ANDROID_BUNDLED_JAR_DEPENDENCIES) { + INIT_CLASS = $$section(JAR_FILE, ":", 1, 1) + !isEmpty(INIT_CLASS): INIT_CLASS = "initClass=\"$$INIT_CLASS\"" + JAR_FILE = $$section(JAR_FILE, ":", 0, 0) + FILE_CONTENT += "<jar bundling=\"1\" file=\"$$JAR_FILE\" $$INIT_CLASS />" + } + } + !isEmpty(ANDROID_LIB_DEPENDENCIES) { for(LIB_FILE, ANDROID_LIB_DEPENDENCIES) { FILE_CONTENT += "<lib file=\"$$LIB_FILE\" />" @@ -40,13 +55,19 @@ DEPENDENCY_FILE = $$ANDROID_DEPENDS_DIR$$TARGET-android-dependencies.xml } } + !isEmpty(ANDROID_BUNDLED_FILES) { + for (BUNDLED_FILE, ANDROID_BUNDLED_FILES) { + FILE_CONTENT += "<bundled file=\"$$BUNDLED_FILE\" />" + } + } + !isEmpty(FILE_CONTENT) { FILE_CONTENT = "<rules><dependencies><lib name=\"$$TARGET\"><depends>" $$FILE_CONTENT "</depends></lib></dependencies></rules>" write_file($$DEPENDENCY_FILE, FILE_CONTENT) | error("Aborting.") } } -!isEmpty(ANDROID_JAR_DEPENDENCIES)|!isEmpty(ANDROID_LIB_DEPENDENCIES)|!isEmpty(ANDROID_LIB_DEPENDENCY_REPLACEMENTS) { +!isEmpty(ANDROID_JAR_DEPENDENCIES)|!isEmpty(ANDROID_LIB_DEPENDENCIES)|!isEmpty(ANDROID_LIB_DEPENDENCY_REPLACEMENTS)|!isEmpty(ANDROID_BUNDLED_JAR_DEPENDENCIES)|!isEmpty(ANDROID_BUNDLED_FILES) { install_dependencies_file.files = $$DEPENDENCY_FILE install_dependencies_file.path = $$[QT_INSTALL_LIBS] INSTALLS += install_dependencies_file diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 3e56911a38..c88f4e136f 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -1534,7 +1534,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCMIDLTool &tool) << attrTagL(_LocaleID, tool.LocaleID, /*ifNot*/ -1) << attrTagT(_MkTypLibCompatible, tool.MkTypLibCompatible) << attrTagS(_OutputDirectory, tool.OutputDirectory) - << attrTagX(_PreprocessorDefinitions, unquote(tool.PreprocessorDefinitions), ";") + << attrTagX(_PreprocessorDefinitions, tool.PreprocessorDefinitions, ";") << attrTagS(_ProxyFileName, tool.ProxyFileName) << attrTagS(_RedirectOutputAndErrors, tool.RedirectOutputAndErrors) << attrTagS(_ServerStubFile, tool.ServerStubFile) @@ -1619,7 +1619,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCResourceCompilerTool &tool) << attrTagS(_Culture, toString(tool.Culture)) << attrTagT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath) //unused << attrTagT(_NullTerminateStrings, tool.NullTerminateStrings) - << attrTagX(_PreprocessorDefinitions, unquote(tool.PreprocessorDefinitions), ";") + << attrTagX(_PreprocessorDefinitions, tool.PreprocessorDefinitions, ";") << attrTagS(_ResourceOutputFileName, tool.ResourceOutputFileName) << attrTagT(_ShowProgress, toTriState(tool.ShowProgress)) << attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-thai.c b/src/3rdparty/harfbuzz/src/harfbuzz-thai.c index d8f7d44887..e351dbfd49 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-thai.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-thai.c @@ -261,7 +261,7 @@ static HB_Bool HB_ThaiConvertStringToGlyphIndices (HB_ShaperItem *item) for (int lgi = 0; lgi < lgn; lgi++) { if ( rglyphs[lgi] == 0xdd/*TH_BLANK_BASE_GLYPH*/ ) { glyphString[slen++] = C_DOTTED_CIRCLE; - } else if (cstr[i] == (signed char)~0) { + } else if ((unsigned char)cstr[i] == (unsigned char)~0) { // The only glyphs that should be passed to this function that cannot be mapped to // tis620 are the ones of type Inherited class. Pass these glyphs untouched. glyphString[slen++] = string[i]; diff --git a/src/3rdparty/pcre/sljit/sljitUtils.c b/src/3rdparty/pcre/sljit/sljitUtils.c index 1f023fa644..b29b4036b3 100644 --- a/src/3rdparty/pcre/sljit/sljitUtils.c +++ b/src/3rdparty/pcre/sljit/sljitUtils.c @@ -315,12 +315,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw SLJIT_CALL sljit_stack_resize(struct sljit_sta aligned_new_limit = (new_limit + sljit_page_align) & ~sljit_page_align; aligned_old_limit = (stack->limit + sljit_page_align) & ~sljit_page_align; /* If madvise is available, we release the unnecessary space. */ -#if defined(POSIX_MADV_DONTNEED) - if (aligned_new_limit < aligned_old_limit) - posix_madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, POSIX_MADV_DONTNEED); -#elif defined(MADV_DONTNEED) +#if defined(MADV_DONTNEED) if (aligned_new_limit < aligned_old_limit) madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, MADV_DONTNEED); +#elif defined(POSIX_MADV_DONTNEED) + if (aligned_new_limit < aligned_old_limit) + posix_madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, POSIX_MADV_DONTNEED); #endif stack->limit = new_limit; return 0; diff --git a/src/3rdparty/sha3/KeccakF-1600-opt32.c b/src/3rdparty/sha3/KeccakF-1600-opt32.c index b1b442c7e0..4e32dca9cb 100755 --- a/src/3rdparty/sha3/KeccakF-1600-opt32.c +++ b/src/3rdparty/sha3/KeccakF-1600-opt32.c @@ -114,8 +114,8 @@ static void setInterleavedWordsInto8bytes(UINT8* dest, UINT32 even, UINT32 odd) const UINT32 * pI = (const UINT32 *)input; \ UINT32 * pS = state; \ UINT32 t, x0, x1; \ - int i; \ - for (i = (rateInLanes)-1; i >= 0; --i) \ + int i; \ + for (i = (int)(rateInLanes)-1; i >= 0; --i) \ { \ x0 = *(pI++); \ t = (x0 ^ (x0 >> 1)) & 0x22222222UL; x0 = x0 ^ t ^ (t << 1); \ @@ -170,7 +170,7 @@ static void xor8bytesIntoInterleavedWords(UINT32* evenAndOdd, const UINT8* sourc #define xorLanesIntoState(laneCount, state, input) \ { \ - int i; \ + unsigned i; \ for(i=0; i<(laneCount); i++) \ xor8bytesIntoInterleavedWords(state+i*2, input+i*8); \ } @@ -212,7 +212,7 @@ static void setInterleavedWordsInto8bytes(UINT8* dest, UINT32* evenAndOdd) #define extractLanes(laneCount, state, data) \ { \ - int i; \ + unsigned i; \ for(i=0; i<(laneCount); i++) \ setInterleavedWordsInto8bytes(data+i*8, (UINT32*)state+i*2); \ } diff --git a/src/android/jar/bundledjar.pro b/src/android/jar/bundledjar.pro new file mode 100644 index 0000000000..e82c01c51b --- /dev/null +++ b/src/android/jar/bundledjar.pro @@ -0,0 +1,3 @@ +TARGET = QtAndroid-bundled +CONFIG += bundled_jar_file +include(jar.pri) diff --git a/src/android/jar/distributedjar.pro b/src/android/jar/distributedjar.pro new file mode 100644 index 0000000000..15f362f629 --- /dev/null +++ b/src/android/jar/distributedjar.pro @@ -0,0 +1,2 @@ +TARGET = QtAndroid +include(jar.pri) diff --git a/src/android/jar/jar.pri b/src/android/jar/jar.pri new file mode 100644 index 0000000000..19501d7b29 --- /dev/null +++ b/src/android/jar/jar.pri @@ -0,0 +1,18 @@ +CONFIG += java +DESTDIR = $$[QT_INSTALL_PREFIX/get]/jar + +PATHPREFIX = $$PWD/src/org/qtproject/qt5/android/ + +JAVACLASSPATH += $$PWD/src/ +JAVASOURCES += \ + $$PATHPREFIX/QtActivityDelegate.java \ + $$PATHPREFIX/QtEditText.java \ + $$PATHPREFIX/QtInputConnection.java \ + $$PATHPREFIX/QtLayout.java \ + $$PATHPREFIX/QtNative.java \ + $$PATHPREFIX/QtNativeLibrariesDir.java \ + $$PATHPREFIX/QtSurface.java + +# install +target.path = $$[QT_INSTALL_PREFIX]/jar +INSTALLS += target diff --git a/src/android/jar/jar.pro b/src/android/jar/jar.pro index 1955f16142..8d19c1b7d6 100644 --- a/src/android/jar/jar.pro +++ b/src/android/jar/jar.pro @@ -1,19 +1,2 @@ -CONFIG += java -TARGET = QtAndroid -DESTDIR = $$[QT_INSTALL_PREFIX/get]/jar - -PATHPREFIX = $$PWD/src/org/qtproject/qt5/android/ - -JAVACLASSPATH += $$PWD/src/ -JAVASOURCES += \ - $$PATHPREFIX/QtActivityDelegate.java \ - $$PATHPREFIX/QtEditText.java \ - $$PATHPREFIX/QtInputConnection.java \ - $$PATHPREFIX/QtLayout.java \ - $$PATHPREFIX/QtNative.java \ - $$PATHPREFIX/QtNativeLibrariesDir.java \ - $$PATHPREFIX/QtSurface.java - -# install -target.path = $$[QT_INSTALL_PREFIX]/jar -INSTALLS += target +TEMPLATE = subdirs +SUBDIRS += bundledjar.pro distributedjar.pro diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index be618934df..06ece9d04c 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -704,10 +704,8 @@ public class QtActivityDelegate } } - if (keyCode == KeyEvent.KEYCODE_BACK && m_keyboardIsVisible) - { - if (!m_keyboardIsHiding) - hideSoftwareKeyboard(); + if (keyCode == KeyEvent.KEYCODE_BACK && m_keyboardIsVisible && !m_keyboardIsHiding) { + hideSoftwareKeyboard(); return true; } diff --git a/src/android/java/AndroidManifest.xml b/src/android/java/AndroidManifest.xml index 6a407dcb6e..48fb23ab28 100644 --- a/src/android/java/AndroidManifest.xml +++ b/src/android/java/AndroidManifest.xml @@ -11,8 +11,12 @@ <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> <meta-data android:name="android.app.lib_name" android:value=""/> + <!-- Deploy Qt libs as part of package --> + <meta-data android:name="android.app.bundle_local_qt_libs" android:value="1"/> + <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/> + <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/> <!-- Run with local libs --> - <meta-data android:name="android.app.use_local_qt_libs" android:value="0"/> + <meta-data android:name="android.app.use_local_qt_libs" android:value="1"/> <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> <meta-data android:name="android.app.load_local_libs" android:value=""/> <meta-data android:name="android.app.load_local_jars" android:value=""/> diff --git a/src/android/java/READ-THIS-BEFORE-MANUALLY-ADDING-FILES-TO-PACKAGE.txt b/src/android/java/READ-THIS-BEFORE-MANUALLY-ADDING-FILES-TO-PACKAGE.txt new file mode 100644 index 0000000000..978417721f --- /dev/null +++ b/src/android/java/READ-THIS-BEFORE-MANUALLY-ADDING-FILES-TO-PACKAGE.txt @@ -0,0 +1,6 @@ +If this package is accessed by Qt Creator, certain changes can be +overwritten without warning. In particular, Qt Creator may overwrite +settings which are maintained using its own UI, and files and +directories containing the string "--Managed_by_Qt_Creator--", as well +as native libraries whose file names begin with "libQt5" may be +deleted without warning if they are contained inside this package. diff --git a/src/android/java/res/values/libs.xml b/src/android/java/res/values/libs.xml index f47174e3d3..09fa409458 100644 --- a/src/android/java/res/values/libs.xml +++ b/src/android/java/res/values/libs.xml @@ -8,4 +8,6 @@ <item>Qt5Core</item> </array> <array name="bundled_libs"/> + <array name="bundled_in_lib" /> + <array name="bundled_in_assets" /> </resources> diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java index dfb638fbb0..22b34fdbef 100644 --- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java +++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java @@ -27,6 +27,11 @@ package org.qtproject.qt5.android.bindings; import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.io.InputStream; +import java.io.FileOutputStream; +import java.io.FileInputStream; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; @@ -47,6 +52,7 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Configuration; import android.content.res.Resources.Theme; +import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.Canvas; import android.net.Uri; @@ -89,6 +95,8 @@ public class QtActivity extends Activity private static final String ENVIRONMENT_VARIABLES_KEY = "environment.variables"; private static final String APPLICATION_PARAMETERS_KEY = "application.parameters"; private static final String BUNDLED_LIBRARIES_KEY = "bundled.libraries"; + private static final String BUNDLED_IN_LIB_RESOURCE_ID_KEY = "android.app.bundled_in_lib_resource_id"; + private static final String BUNDLED_IN_ASSETS_RESOURCE_ID_KEY = "android.app.bundled_in_assets_resource_id"; private static final String MAIN_LIBRARY_KEY = "main.library"; private static final String STATIC_INIT_CLASSES_KEY = "static.init.classes"; private static final String NECESSITAS_API_LEVEL_KEY = "necessitas.api.level"; @@ -120,6 +128,8 @@ public class QtActivity extends Activity // note that the android style plugin in Qt 5.1 is not fully functional. private static final int INCOMPATIBLE_MINISTRO_VERSION = 1; // Incompatible Ministro version. Ministro needs to be upgraded. + private static final int BUFFER_SIZE = 1024; + private ActivityInfo m_activityInfo = null; // activity info object, used to access the libs and the strings private DexClassLoader m_classLoader = null; // loader object private String[] m_sources = {"https://files.kde.org/necessitas/ministro/android/necessitas/qt5/latest"}; // Make sure you are using ONLY secure locations @@ -308,6 +318,92 @@ public class QtActivity extends Activity errorDialog.show(); } + static private void copyFile(InputStream inputStream, OutputStream outputStream) + throws IOException + { + byte[] buffer = new byte[BUFFER_SIZE]; + + int count; + while ((count = inputStream.read(buffer)) > 0) + outputStream.write(buffer, 0, count); + } + + + private void copyAsset(String source, String destination) + throws IOException + { + // Already exists, we don't have to do anything + File destinationFile = new File(destination); + if (destinationFile.exists()) + return; + + File parentDirectory = destinationFile.getParentFile(); + if (!parentDirectory.exists()) + parentDirectory.mkdirs(); + + destinationFile.createNewFile(); + + AssetManager assetsManager = getAssets(); + InputStream inputStream = assetsManager.open(source); + OutputStream outputStream = new FileOutputStream(destinationFile); + copyFile(inputStream, outputStream); + } + + private static void createBundledBinary(String source, String destination) + throws IOException + { + // Already exists, we don't have to do anything + File destinationFile = new File(destination); + if (destinationFile.exists()) + return; + + File parentDirectory = destinationFile.getParentFile(); + if (!parentDirectory.exists()) + parentDirectory.mkdirs(); + + destinationFile.createNewFile(); + + InputStream inputStream = new FileInputStream(source); + OutputStream outputStream = new FileOutputStream(destinationFile); + copyFile(inputStream, outputStream); + } + + private void extractBundledPluginsAndImports(String localPrefix) + throws IOException + { + ArrayList<String> libs = new ArrayList<String>(); + + { + String key = BUNDLED_IN_LIB_RESOURCE_ID_KEY; + java.util.Set<String> keys = m_activityInfo.metaData.keySet(); + if (m_activityInfo.metaData.containsKey(key)) { + String[] list = getResources().getStringArray(m_activityInfo.metaData.getInt(key)); + + for (String bundledImportBinary : list) { + String[] split = bundledImportBinary.split(":"); + String sourceFileName = localPrefix + "lib/" + split[0]; + String destinationFileName = localPrefix + split[1]; + createBundledBinary(sourceFileName, destinationFileName); + } + } + } + + { + String key = BUNDLED_IN_ASSETS_RESOURCE_ID_KEY; + if (m_activityInfo.metaData.containsKey(key)) { + String[] list = getResources().getStringArray(m_activityInfo.metaData.getInt(key)); + + for (String fileName : list) { + String[] split = fileName.split(":"); + String sourceFileName = split[0]; + String destinationFileName = localPrefix + split[1]; + copyAsset(sourceFileName, destinationFileName); + } + } + + } + } + private void startApp(final boolean firstStart) { try { @@ -328,13 +424,26 @@ public class QtActivity extends Activity && m_activityInfo.metaData.getInt("android.app.use_local_qt_libs") == 1) { ArrayList<String> libraryList = new ArrayList<String>(); + String localPrefix = "/data/local/tmp/qt/"; if (m_activityInfo.metaData.containsKey("android.app.libs_prefix")) localPrefix = m_activityInfo.metaData.getString("android.app.libs_prefix"); + boolean bundlingQtLibs = false; + if (m_activityInfo.metaData.containsKey("android.app.bundle_local_qt_libs") + && m_activityInfo.metaData.getInt("android.app.bundle_local_qt_libs") == 1) { + localPrefix = getApplicationInfo().dataDir + "/"; + extractBundledPluginsAndImports(localPrefix); + bundlingQtLibs = true; + } + if (m_qtLibs != null) { - for (int i=0;i<m_qtLibs.length;i++) - libraryList.add(localPrefix+"lib/lib"+m_qtLibs[i]+".so"); + for (int i=0;i<m_qtLibs.length;i++) { + libraryList.add(localPrefix + + "lib/lib" + + m_qtLibs[i] + + ".so"); + } } if (m_activityInfo.metaData.containsKey("android.app.load_local_libs")) { @@ -345,9 +454,10 @@ public class QtActivity extends Activity } } + String dexPaths = new String(); String pathSeparator = System.getProperty("path.separator", ":"); - if (m_activityInfo.metaData.containsKey("android.app.load_local_jars")) { + if (!bundlingQtLibs && m_activityInfo.metaData.containsKey("android.app.load_local_jars")) { String[] jarFiles = m_activityInfo.metaData.getString("android.app.load_local_jars").split(":"); for (String jar:jarFiles) { if (jar.length() > 0) { diff --git a/src/concurrent/doc/src/qtconcurrent-module.qdoc b/src/concurrent/doc/src/qtconcurrent-module.qdoc index 51721d916f..2144c2661a 100644 --- a/src/concurrent/doc/src/qtconcurrent-module.qdoc +++ b/src/concurrent/doc/src/qtconcurrent-module.qdoc @@ -27,7 +27,7 @@ /*! \module QtConcurrent - \title Qt Concurrent C++ classes + \title Qt Concurrent C++ Classes \brief The Qt Concurrent module contains functionality to support concurrent execution of program code \ingroup modules diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 3b7eb11229..0a5cc04a17 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -21,6 +21,8 @@ ANDROID_JAR_DEPENDENCIES = \ ANDROID_LIB_DEPENDENCIES = \ plugins/platforms/android/libqtforandroid.so \ libs/libgnustl_shared.so +ANDROID_BUNDLED_JAR_DEPENDENCIES = \ + jar/QtAndroid-bundled.jar load(qt_module) diff --git a/src/corelib/doc/src/qtcore-index.qdoc b/src/corelib/doc/src/qtcore-index.qdoc index 148dd68f55..9568ea9f8e 100644 --- a/src/corelib/doc/src/qtcore-index.qdoc +++ b/src/corelib/doc/src/qtcore-index.qdoc @@ -103,7 +103,7 @@ \section1 Reference These are links to the API reference materials. \list - \li \l{Qt Core C++ Classes}{C++ classes} + \li \l{Qt Core C++ Classes}{C++ Classes} \list \li \l{Animation Framework}{Animation Classes} \li \l{Threading Classes} diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index ab84adacce..9b609f76d0 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -658,7 +658,7 @@ # define Q_COMPILER_ALIGNOF # define Q_COMPILER_INHERITING_CONSTRUCTORS # define Q_COMPILER_THREAD_LOCAL -# if (__GNUC__ * 100 + __GNUC_MINOR__) > 408 || __GNUC_PATCHLEVEL__ > 1 +# if (__GNUC__ * 100 + __GNUC_MINOR__) > 408 || __GNUC_PATCHLEVEL__ >= 1 # define Q_COMPILER_REF_QUALIFIERS # endif # endif diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index 45e52d7b85..1ed4a77950 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -467,8 +467,6 @@ bool QBasicMutex::lockInternal(int timeout) QT_MUTEX_LOCK_NOEXCEPT // we try to acquire the mutex by changing to dummyLocked() if (d_ptr.testAndSetAcquire(d, dummyLocked())) { // Mutex acquired - Q_ASSERT(d->waiters.load() == -QMutexPrivate::BigNumber || d->waiters.load() == 0); - d->waiters.store(0); d->deref(); return true; } else { diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index b5f983899a..991cc9e170 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -529,6 +529,9 @@ int qt_repeatCount(const QString &s, int i) static const QLocaleData *default_data = 0; static uint default_number_options = 0; +static const QLocaleData *const c_data = locale_data; +static QLocalePrivate c_private = { c_data, Q_BASIC_ATOMIC_INITIALIZER(1), 0 }; + #ifndef QT_NO_SYSTEMLOCALE @@ -643,6 +646,12 @@ static const QLocaleData *defaultData() return default_data; } +const QLocaleData *QLocaleData::c() +{ + Q_ASSERT(locale_index[QLocale::C] == 0); + return c_data; +} + static QString getLocaleListData(const ushort *data, int size, int index) { static const ushort separator = ';'; @@ -699,20 +708,35 @@ const QLocaleData *QLocalePrivate::dataPointerForIndex(quint16 index) return &locale_data[index]; } -static quint16 localeDataIndex(const QLocaleData *p) +Q_GLOBAL_STATIC_WITH_ARGS(QSharedDataPointer<QLocalePrivate>, defaultLocalePrivate, + (QLocalePrivate::create(defaultData(), default_number_options))) + +static QLocalePrivate *localePrivateByName(const QString &name) { -#ifndef QT_NO_SYSTEMLOCALE - Q_ASSERT((p >= locale_data && p - locale_data < locale_data_size) - || (p != 0 && p == system_data)); - quint16 index = p == system_data ? locale_data_size : p - locale_data; -#else - Q_ASSERT(p >= locale_data && p - locale_data < locale_data_size); - quint16 index = p - locale_data; -#endif + if (name == QLatin1String("C")) + return &c_private; + return QLocalePrivate::create(findLocaleData(name)); +} - return index; +static QLocalePrivate *findLocalePrivate(QLocale::Language language, QLocale::Script script, + QLocale::Country country) +{ + if (language == QLocale::C) + return &c_private; + + const QLocaleData *data = QLocaleData::findLocaleData(language, script, country); + + int numberOptions = 0; + + // If not found, should default to system + if (data->m_language_id == QLocale::C && language != QLocale::C) { + numberOptions = default_number_options; + data = defaultData(); + } + return QLocalePrivate::create(data, numberOptions); } + /*! \internal */ @@ -751,7 +775,7 @@ QLocale::QLocale(QLocalePrivate &dd) */ QLocale::QLocale(const QString &name) - : d(new QLocalePrivate(localeDataIndex(findLocaleData(name)))) + : d(localePrivateByName(name)) { } @@ -764,7 +788,7 @@ QLocale::QLocale(const QString &name) */ QLocale::QLocale() - : d(new QLocalePrivate(localeDataIndex(defaultData()), default_number_options)) + : d(*defaultLocalePrivate) { } @@ -788,21 +812,10 @@ QLocale::QLocale() */ QLocale::QLocale(Language language, Country country) + : d(findLocalePrivate(language, QLocale::AnyScript, country)) { - const QLocaleData *data = QLocaleData::findLocaleData(language, QLocale::AnyScript, country); - int index; - int numberOptions = 0; - - // If not found, should default to system - if (data->m_language_id == QLocale::C && language != QLocale::C) { - numberOptions = default_number_options; - index = localeDataIndex(defaultData()); - } else { - index = localeDataIndex(data); - } - d = new QLocalePrivate(index, numberOptions); } -\ + /*! \since 4.8 @@ -828,19 +841,8 @@ QLocale::QLocale(Language language, Country country) */ QLocale::QLocale(Language language, Script script, Country country) + : d(findLocalePrivate(language, script, country)) { - const QLocaleData *data = QLocaleData::findLocaleData(language, script, country); - int index; - int numberOptions = 0; - - // If not found, should default to system - if (data->m_language_id == QLocale::C && language != QLocale::C) { - numberOptions = default_number_options; - index = localeDataIndex(defaultData()); - } else { - index = localeDataIndex(data); - } - d = new QLocalePrivate(index, numberOptions); } /*! @@ -998,6 +1000,11 @@ void QLocale::setDefault(const QLocale &locale) { default_data = locale.d->m_data; default_number_options = locale.numberOptions(); + + if (defaultLocalePrivate.exists()) { + // update the cached private + *defaultLocalePrivate = locale.d; + } } /*! @@ -2117,7 +2124,7 @@ QString QLocale::toString(double i, char f, int prec) const QLocale QLocale::system() { - return QLocale(*new QLocalePrivate(localeDataIndex(systemData()))); + return QLocale(*QLocalePrivate::create(systemData())); } @@ -2152,7 +2159,7 @@ QList<QLocale> QLocale::matchingLocales(QLocale::Language language, && (language == QLocale::AnyLanguage || data->m_language_id == uint(language))) { if ((script == QLocale::AnyScript || data->m_script_id == uint(script)) && (country == QLocale::AnyCountry || data->m_country_id == uint(country))) { - QLocale locale(*new QLocalePrivate(localeDataIndex(data))); + QLocale locale(*QLocalePrivate::create(data)); result.append(locale); } ++data; @@ -2252,7 +2259,7 @@ QString QLocale::standaloneMonthName(int month, FormatType type) const #ifndef QT_NO_SYSTEMLOCALE if (d->m_data == systemData()) { QVariant res = systemLocale()->query(type == LongFormat - ? QSystemLocale::MonthNameLong : QSystemLocale::MonthNameShort, + ? QSystemLocale::StandaloneMonthNameLong : QSystemLocale::StandaloneMonthNameShort, month); if (!res.isNull()) return res.toString(); diff --git a/src/corelib/tools/qlocale_blackberry.cpp b/src/corelib/tools/qlocale_blackberry.cpp index 1db7b7d546..6d60a97062 100644 --- a/src/corelib/tools/qlocale_blackberry.cpp +++ b/src/corelib/tools/qlocale_blackberry.cpp @@ -280,6 +280,10 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const return lc_language.monthName(in.toInt(), QLocale::LongFormat); case MonthNameShort: return lc_language.monthName(in.toInt(), QLocale::ShortFormat); + case StandaloneMonthNameLong: + return lc_language.standaloneMonthName(in.toInt(), QLocale::LongFormat); + case StandaloneMonthNameShort: + return lc_language.standaloneMonthName(in.toInt(), QLocale::ShortFormat); case DateToStringLong: return lc_region.toString(in.toDate(), QLocale::LongFormat); case DateToStringShort: diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm index 9292dccf19..f399b7689d 100644 --- a/src/corelib/tools/qlocale_mac.mm +++ b/src/corelib/tools/qlocale_mac.mm @@ -401,7 +401,9 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const return macDayName(in.toInt(), (type == DayNameShort)); case MonthNameLong: case MonthNameShort: - return macMonthName(in.toInt(), (type == MonthNameShort)); + case StandaloneMonthNameLong: + case StandaloneMonthNameShort: + return macMonthName(in.toInt(), (type == MonthNameShort || type == StandaloneMonthNameShort)); case DateToStringShort: case DateToStringLong: return macDateToString(in.toDate(), (type == DateToStringShort)); diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index 9674342307..a62ee9304b 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -115,7 +115,9 @@ public: ListToSeparatedString, // QString LocaleChanged, // system locale changed NativeLanguageName, // QString - NativeCountryName // QString + NativeCountryName, // QString + StandaloneMonthNameLong, // QString, in: int + StandaloneMonthNameShort // QString, in: int }; virtual QVariant query(QueryType type, QVariant in) const; virtual QLocale fallbackUiLocale() const; @@ -162,6 +164,7 @@ public: static const QLocaleData *findLocaleData(QLocale::Language language, QLocale::Script script, QLocale::Country country); + static const QLocaleData *c(); quint16 m_language_id, m_script_id, m_country_id; @@ -205,17 +208,16 @@ public: quint16 m_weekend_end : 3; }; -class Q_CORE_EXPORT QLocalePrivate : public QSharedData +class Q_CORE_EXPORT QLocalePrivate { public: - explicit QLocalePrivate(int index, int numberOptions = 0) - : m_index(index), m_numberOptions(numberOptions) - { - m_data = dataPointerForIndex(index); - } - - ~QLocalePrivate() + static QLocalePrivate *create(const QLocaleData *data, int numberOptions = 0) { + QLocalePrivate *retval = new QLocalePrivate; + retval->m_data = data; + retval->ref.store(1); + retval->m_numberOptions = numberOptions; + return retval; } QChar decimal() const { return QChar(m_data->m_decimal); } @@ -332,11 +334,19 @@ public: QString dateTimeToString(const QString &format, const QDate *date, const QTime *time, const QLocale *q) const; - quint16 m_index; - quint16 m_numberOptions; const QLocaleData *m_data; + QBasicAtomicInt ref; + quint16 m_numberOptions; }; +template <> +inline QLocalePrivate *QSharedDataPointer<QLocalePrivate>::clone() +{ + // cannot use QLocalePrivate's copy constructor + // since it is deleted in C++11 + return QLocalePrivate::create(d->m_data, d->m_numberOptions); +} + inline char QLocalePrivate::digitToCLocale(QChar in) const { const QChar _zero = zero(); diff --git a/src/corelib/tools/qlocale_unix.cpp b/src/corelib/tools/qlocale_unix.cpp index 4e443cd79b..9ea28895bd 100644 --- a/src/corelib/tools/qlocale_unix.cpp +++ b/src/corelib/tools/qlocale_unix.cpp @@ -173,6 +173,10 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const return lc_time.monthName(in.toInt(), QLocale::LongFormat); case MonthNameShort: return lc_time.monthName(in.toInt(), QLocale::ShortFormat); + case StandaloneMonthNameLong: + return lc_time.standaloneMonthName(in.toInt(), QLocale::LongFormat); + case StandaloneMonthNameShort: + return lc_time.standaloneMonthName(in.toInt(), QLocale::ShortFormat); case DateToStringLong: return lc_time.toString(in.toDate(), QLocale::LongFormat); case DateToStringShort: diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp index d576f1c281..0730002ca3 100644 --- a/src/corelib/tools/qlocale_win.cpp +++ b/src/corelib/tools/qlocale_win.cpp @@ -684,8 +684,10 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const case DayNameShort: return d->dayName(in.toInt(), QLocale::ShortFormat); case MonthNameLong: + case StandaloneMonthNameLong: return d->monthName(in.toInt(), QLocale::LongFormat); case MonthNameShort: + case StandaloneMonthNameShort: return d->monthName(in.toInt(), QLocale::ShortFormat); case DateToStringShort: return d->toString(in.toDate(), QLocale::ShortFormat); diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index 283209d08f..6667cae237 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -68,7 +68,7 @@ class QTextCursor; class Q_GUI_EXPORT QAccessible { Q_GADGET - Q_ENUMS(Role Event State) + Q_ENUMS(Role Event) public: enum Event { diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp index ccbfd36b70..664ff9eaf4 100644 --- a/src/gui/accessible/qaccessibleobject.cpp +++ b/src/gui/accessible/qaccessibleobject.cpp @@ -100,10 +100,6 @@ QAccessibleObject::~QAccessibleObject() */ QObject *QAccessibleObject::object() const { -#ifndef QT_NO_DEBUG - if (!d->object) - qWarning("QAccessibleInterface is invalid. Crash pending..."); -#endif return d->object; } diff --git a/src/gui/doc/images/icon.png b/src/gui/doc/images/icon.png Binary files differnew file mode 100644 index 0000000000..cc2b6ac93a --- /dev/null +++ b/src/gui/doc/images/icon.png diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 062f00c4c4..b44f563b3e 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -8,6 +8,10 @@ DEFINES += QT_NO_USING_NAMESPACE QMAKE_DOCS = $$PWD/doc/qtgui.qdocconf +MODULE_PLUGIN_TYPES = \ + platforms \ + imageformats + load(qt_module) # Code coverage with TestCocoon diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index c5be379b7d..ba97db4d39 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -947,11 +947,14 @@ QKeyEvent::~QKeyEvent() /*! \fn QString QKeyEvent::text() const - Returns the Unicode text that this key generated. The text - returned can be an empty string in cases - where modifier keys, such as Shift, Control, Alt, and Meta, - are being pressed or released. In such cases key() will contain - a valid value. + Returns the Unicode text that this key generated. + + Return values when modifier keys such as + Shift, Control, Alt, and Meta are pressed + differ among platforms and could return an empty string. + + \note \l key() will always return a valid value, + independent of modifier keys. \sa Qt::WA_KeyCompression */ diff --git a/src/network/doc/src/network-programming.qdoc b/src/network/doc/src/network-programming.qdoc index f236948b57..821b0ada15 100644 --- a/src/network/doc/src/network-programming.qdoc +++ b/src/network/doc/src/network-programming.qdoc @@ -51,7 +51,7 @@ \section1 Qt's Classes for Network Programming - The \l{Qt Network - C++ Classes} page contains a list of the C++ classes + The \l{Qt Network C++ Classes} page contains a list of the C++ classes in Qt Network. \section1 High Level Network Operations for HTTP and FTP diff --git a/src/network/network.pro b/src/network/network.pro index d2b2447611..79e357e0cb 100644 --- a/src/network/network.pro +++ b/src/network/network.pro @@ -11,6 +11,9 @@ DEFINES += QT_NO_USING_NAMESPACE #DEFINES += QUDPSOCKET_DEBUG QUDPSERVER_DEBUG win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x64000000 +MODULE_PLUGIN_TYPES = \ + bearer + QMAKE_DOCS = $$PWD/doc/qtnetwork.qdocconf load(qt_module) diff --git a/src/opengl/doc/src/qtopengl-index.qdoc b/src/opengl/doc/src/qtopengl-index.qdoc index 94109aa706..fc131c4b17 100644 --- a/src/opengl/doc/src/qtopengl-index.qdoc +++ b/src/opengl/doc/src/qtopengl-index.qdoc @@ -67,6 +67,6 @@ OpenGL module can take advantage of the whole Qt API for non-OpenGL-specific GUI functionality. - The \l{Qt OpenGL C++ classes} page gives an overview over the available classes + The \l{Qt OpenGL C++ Classes} page gives an overview over the available classes int this module. */ diff --git a/src/opengl/doc/src/qtopengl-module.qdoc b/src/opengl/doc/src/qtopengl-module.qdoc index e75eb49447..9c15a54428 100644 --- a/src/opengl/doc/src/qtopengl-module.qdoc +++ b/src/opengl/doc/src/qtopengl-module.qdoc @@ -27,7 +27,7 @@ /*! \module QtOpenGL - \title Qt OpenGL C++ classes + \title Qt OpenGL C++ Classes \ingroup modules \ingroup technology-apis diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 91472f9efb..f4cfa3ca40 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -648,8 +648,8 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QChar::Script sc } if (f.hintingPreference == QFont::PreferDefaultHinting) { - QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment(); - if (desktopEnvironment == "GNOME" || desktopEnvironment == "UNITY") { + const QPlatformServices *services = QGuiApplicationPrivate::platformIntegration()->services(); + if (services && (services->desktopEnvironment() == "GNOME" || services->desktopEnvironment() == "UNITY")) { void *hintStyleResource = QGuiApplication::platformNativeInterface()->nativeResourceForScreen("hintstyle", QGuiApplication::primaryScreen()); diff --git a/src/plugins/platforms/android/src/qandroidinputcontext.cpp b/src/plugins/platforms/android/src/qandroidinputcontext.cpp index 2180560b04..1981ac0b75 100644 --- a/src/plugins/platforms/android/src/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/src/qandroidinputcontext.cpp @@ -237,13 +237,11 @@ static JNINativeMethod methods[] = { QAndroidInputContext::QAndroidInputContext():QPlatformInputContext() { - JNIEnv *env = 0; - if (QtAndroid::javaVM()->AttachCurrentThread(&env, NULL) < 0) { - qCritical() << "AttachCurrentThread failed"; + QtAndroid::AttachedJNIEnv env; + if (!env.jniEnv) return; - } - jclass clazz = QtAndroid::findClass(QtNativeInputConnectionClassName, env); + jclass clazz = QtAndroid::findClass(QtNativeInputConnectionClassName, env.jniEnv); if (clazz == NULL) { qCritical() << "Native registration unable to find class '" << QtNativeInputConnectionClassName @@ -251,14 +249,14 @@ QAndroidInputContext::QAndroidInputContext():QPlatformInputContext() return; } - if (env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])) < 0) { + if (env.jniEnv->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])) < 0) { qCritical() << "RegisterNatives failed for '" << QtNativeInputConnectionClassName << "'"; return; } - clazz = QtAndroid::findClass(QtExtractedTextClassName, env); + clazz = QtAndroid::findClass(QtExtractedTextClassName, env.jniEnv); if (clazz == NULL) { qCritical() << "Native registration unable to find class '" << QtExtractedTextClassName @@ -266,44 +264,44 @@ QAndroidInputContext::QAndroidInputContext():QPlatformInputContext() return; } - m_extractedTextClass = static_cast<jclass>(env->NewGlobalRef(clazz)); - m_classConstructorMethodID = env->GetMethodID(m_extractedTextClass, "<init>", "()V"); + m_extractedTextClass = static_cast<jclass>(env.jniEnv->NewGlobalRef(clazz)); + m_classConstructorMethodID = env.jniEnv->GetMethodID(m_extractedTextClass, "<init>", "()V"); if (m_classConstructorMethodID == NULL) { qCritical() << "GetMethodID failed"; return; } - m_partialEndOffsetFieldID = env->GetFieldID(m_extractedTextClass, "partialEndOffset", "I"); + m_partialEndOffsetFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "partialEndOffset", "I"); if (m_partialEndOffsetFieldID == NULL) { qCritical() << "Can't find field partialEndOffset"; return; } - m_partialStartOffsetFieldID = env->GetFieldID(m_extractedTextClass, "partialStartOffset", "I"); + m_partialStartOffsetFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "partialStartOffset", "I"); if (m_partialStartOffsetFieldID == NULL) { qCritical() << "Can't find field partialStartOffset"; return; } - m_selectionEndFieldID = env->GetFieldID(m_extractedTextClass, "selectionEnd", "I"); + m_selectionEndFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "selectionEnd", "I"); if (m_selectionEndFieldID == NULL) { qCritical() << "Can't find field selectionEnd"; return; } - m_selectionStartFieldID = env->GetFieldID(m_extractedTextClass, "selectionStart", "I"); + m_selectionStartFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "selectionStart", "I"); if (m_selectionStartFieldID == NULL) { qCritical() << "Can't find field selectionStart"; return; } - m_startOffsetFieldID = env->GetFieldID(m_extractedTextClass, "startOffset", "I"); + m_startOffsetFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "startOffset", "I"); if (m_startOffsetFieldID == NULL) { qCritical() << "Can't find field startOffset"; return; } - m_textFieldID = env->GetFieldID(m_extractedTextClass, "text", "Ljava/lang/String;"); + m_textFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "text", "Ljava/lang/String;"); if (m_textFieldID == NULL) { qCritical() << "Can't find field text"; return; diff --git a/src/plugins/platforms/android/src/qandroidplatformservices.cpp b/src/plugins/platforms/android/src/qandroidplatformservices.cpp index 841a9d4d51..0df882f1f0 100644 --- a/src/plugins/platforms/android/src/qandroidplatformservices.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformservices.cpp @@ -46,29 +46,25 @@ QAndroidPlatformServices::QAndroidPlatformServices() { - JNIEnv *env; - if (QtAndroid::javaVM()->AttachCurrentThread(&env, NULL) < 0) { - qCritical() << "AttachCurrentThread failed"; + QtAndroid::AttachedJNIEnv env; + if (!env.jniEnv) return; - } - m_openURIMethodID = env->GetStaticMethodID(QtAndroid::applicationClass(), + m_openURIMethodID = env.jniEnv->GetStaticMethodID(QtAndroid::applicationClass(), "openURL", "(Ljava/lang/String;)V"); } bool QAndroidPlatformServices::openUrl(const QUrl &url) { - JNIEnv *env; - if (QtAndroid::javaVM()->AttachCurrentThread(&env, NULL) < 0) { - qCritical() << "AttachCurrentThread failed"; + QtAndroid::AttachedJNIEnv env; + if (!env.jniEnv) return false; - } - jstring string = env->NewString(reinterpret_cast<const jchar *>(url.toString().constData()), + jstring string = env.jniEnv->NewString(reinterpret_cast<const jchar *>(url.toString().constData()), url.toString().length()); - env->CallStaticVoidMethod(QtAndroid::applicationClass(), m_openURIMethodID, string); - env->DeleteLocalRef(string); + env.jniEnv->CallStaticVoidMethod(QtAndroid::applicationClass(), m_openURIMethodID, string); + env.jniEnv->DeleteLocalRef(string); return true; } diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 8337e00eb6..36d7a49746 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -54,6 +54,7 @@ #include "qcocoamenu.h" #include "qcocoamenubar.h" #include "qcocoahelpers.h" +#include "qcocoaautoreleasepool.h" #include <QtCore/qfileinfo.h> #include <QtGui/private/qguiapplication_p.h> @@ -250,27 +251,17 @@ QPixmap QCocoaTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const QPixmap QCocoaTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size) const { - FSRef macRef; - OSStatus status = FSPathMakeRef(reinterpret_cast<const UInt8*>(fileInfo.canonicalFilePath().toUtf8().constData()), - &macRef, 0); - if (status != noErr) - return QPixmap(); - FSCatalogInfo info; - HFSUniStr255 macName; - status = FSGetCatalogInfo(&macRef, kIconServicesCatalogInfoMask, &info, &macName, 0, 0); - if (status != noErr) - return QPixmap(); - IconRef iconRef; - SInt16 iconLabel; - status = GetIconRefFromFileInfo(&macRef, macName.length, macName.unicode, - kIconServicesCatalogInfoMask, &info, kIconServicesNormalUsageFlag, - &iconRef, &iconLabel); - if (status != noErr) - return QPixmap(); + QCocoaAutoReleasePool pool; - QPixmap pixmap = qt_mac_convert_iconref(iconRef, size.width(), size.height()); - ReleaseIconRef(iconRef); + NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile:QCFString::toNSString(fileInfo.canonicalFilePath())]; + if (!iconImage) + return QPixmap(); + NSRect iconRect = NSMakeRect(0, 0, size.width(), size.height()); + CGImageRef cgImage = [iconImage CGImageForProposedRect:&iconRect + context:[NSGraphicsContext currentContext] + hints:nil]; + QPixmap pixmap = QPixmap::fromImage(qt_mac_toQImage(cgImage)); return pixmap; } diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp index ebf8e4af85..cd92a07f00 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp @@ -131,6 +131,7 @@ void QEglFSWindow::setGeometry(const QRect &) QRect rect(screen()->availableGeometry()); QPlatformWindow::setGeometry(rect); QWindowSystemInterface::handleGeometryChange(window(), rect); + QWindowSystemInterface::handleExposeEvent(window(), QRegion(rect)); } void QEglFSWindow::setWindowState(Qt::WindowState) diff --git a/src/plugins/platforms/ios/qiosbackingstore.mm b/src/plugins/platforms/ios/qiosbackingstore.mm index f3c1af2b2d..6007e247f0 100644 --- a/src/plugins/platforms/ios/qiosbackingstore.mm +++ b/src/plugins/platforms/ios/qiosbackingstore.mm @@ -74,7 +74,6 @@ void QIOSBackingStore::beginPaint(const QRegion &) m_context->makeCurrent(window()); - static_cast<QOpenGLPaintDevice *>(paintDevice())->setSize(window()->size()); QIOSWindow *iosWindow = static_cast<QIOSWindow *>(window()->handle()); static_cast<QOpenGLPaintDevice *>(paintDevice())->setSize(window()->size() * iosWindow->devicePixelRatio()); } diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm index e2a6113010..807c75df54 100644 --- a/src/plugins/platforms/ios/qioscontext.mm +++ b/src/plugins/platforms/ios/qioscontext.mm @@ -52,20 +52,17 @@ QIOSContext::QIOSContext(QOpenGLContext *context) : QPlatformOpenGLContext() , m_eaglContext([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]) + , m_format(context->format()) { - // Start out with the requested format - QSurfaceFormat format = context->format(); - - format.setRenderableType(QSurfaceFormat::OpenGLES); - format.setMajorVersion(2); - format.setMinorVersion(0); - - // Even though iOS internally double-buffers its rendering, we - // report single-buffered here since the buffer remains unchanged - // when swapping unlesss you manually clear it yourself. - format.setSwapBehavior(QSurfaceFormat::SingleBuffer); - - m_format = format; + m_format.setRenderableType(QSurfaceFormat::OpenGLES); + m_format.setMajorVersion(2); + m_format.setMinorVersion(0); + + // iOS internally double-buffers its rendering using copy instead of flipping, + // so technically we could report that we are single-buffered so that clients + // could take advantage of the unchanged buffer, but this means clients (and Qt) + // will also assume that swapBufferes() is not needed, which is _not_ the case. + m_format.setSwapBehavior(QSurfaceFormat::DoubleBuffer); } QIOSContext::~QIOSContext() diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm index d26eca54e5..9abb4ba851 100644 --- a/src/plugins/platforms/ios/qiosglobal.mm +++ b/src/plugins/platforms/ios/qiosglobal.mm @@ -104,7 +104,8 @@ Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientat break; case UIDeviceOrientationFaceUp: case UIDeviceOrientationFaceDown: - qtOrientation = static_cast<Qt::ScreenOrientation>(-1); // not supported ATM. + // FIXME: Use cached device orientation, or fall back to interface orientation + qtOrientation = Qt::PortraitOrientation; break; default: qtOrientation = Qt::PortraitOrientation; diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index b73f9c3cbc..c1613c1af4 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -83,9 +83,18 @@ - (void) orientationChanged:(NSNotification *)notification { Q_UNUSED(notification); - Qt::ScreenOrientation orientation = toQtScreenOrientation([UIDevice currentDevice].orientation); - if (orientation != -1) - QWindowSystemInterface::handleScreenOrientationChange(m_screen->screen(), orientation); + + UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation; + switch (deviceOrientation) { + case UIDeviceOrientationFaceUp: + case UIDeviceOrientationFaceDown: + // We ignore these events, as iOS will send events with the 'regular' + // orientations alongside these two orientations. + return; + default: + Qt::ScreenOrientation screenOrientation = toQtScreenOrientation(deviceOrientation); + QWindowSystemInterface::handleScreenOrientationChange(m_screen->screen(), screenOrientation); + } } @end diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index c845b875bf..6291396e6e 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -630,7 +630,7 @@ void QXcbWindow::show() const QWindow *tp = window()->transientParent(); if (isTransient(window()) || tp != 0) { xcb_window_t transientXcbParent = 0; - if (tp) + if (tp && tp->handle()) transientXcbParent = static_cast<const QXcbWindow *>(tp->handle())->winId(); // Default to client leader if there is no transient parent, else modal dialogs can // be hidden by their parents. diff --git a/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp b/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp index 25d45eb81d..77a78d2140 100644 --- a/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp +++ b/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp @@ -430,6 +430,7 @@ void QGtk2FileDialogHelper::applyOptions() if (!initialNameFilter.isEmpty()) selectNameFilter(initialNameFilter); +#if GTK_CHECK_VERSION(2, 20, 0) GtkWidget *acceptButton = gtk_dialog_get_widget_for_response(gtkDialog, GTK_RESPONSE_OK); if (acceptButton) { if (opts->isLabelExplicitlySet(QFileDialogOptions::Accept)) @@ -447,6 +448,7 @@ void QGtk2FileDialogHelper::applyOptions() else gtk_button_set_label(GTK_BUTTON(rejectButton), GTK_STOCK_CANCEL); } +#endif } void QGtk2FileDialogHelper::setNameFilters(const QStringList &filters) diff --git a/src/sql/doc/qtsql.qdocconf b/src/sql/doc/qtsql.qdocconf index e53bd50b55..c2686079d5 100644 --- a/src/sql/doc/qtsql.qdocconf +++ b/src/sql/doc/qtsql.qdocconf @@ -21,7 +21,7 @@ qhp.QtSql.customFilters.Qt.filterAttributes = qtsql $QT_VERSION qhp.QtSql.subprojects = classes qhp.QtSql.subprojects.classes.title = C++ Classes -qhp.QtSql.subprojects.classes.indexTitle = Qt SQL Module C++ Classes +qhp.QtSql.subprojects.classes.indexTitle = Qt SQL C++ Classes qhp.QtSql.subprojects.classes.selectors = class fake:headerfile qhp.QtSql.subprojects.classes.sortPages = true tagfile = ../../../doc/qtsql/qtsql.tags diff --git a/src/sql/doc/src/qtsql.qdoc b/src/sql/doc/src/qtsql.qdoc index 15b8603a66..8ce981756a 100644 --- a/src/sql/doc/src/qtsql.qdoc +++ b/src/sql/doc/src/qtsql.qdoc @@ -54,13 +54,13 @@ \section1 Reference These are links to the API reference materials. \list - \li \l{Qt SQL Module C++ Classes}{C++ classes} + \li \l{Qt SQL C++ Classes}{C++ Classes} \endlist */ /*! \module QtSql - \title Qt SQL Module C++ Classes + \title Qt SQL C++ Classes \ingroup modules \brief Provides a driver layer, SQL API layer, and a user interface layer for SQL databases. diff --git a/src/sql/sql.pro b/src/sql/sql.pro index 4f5af51c52..10004cb445 100644 --- a/src/sql/sql.pro +++ b/src/sql/sql.pro @@ -4,6 +4,9 @@ QT = core-private DEFINES += QT_NO_USING_NAMESPACE win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x62000000 +MODULE_PLUGIN_TYPES = \ + sqldrivers + QMAKE_DOCS = $$PWD/doc/qtsql.qdocconf load(qt_module) diff --git a/src/testlib/3rdparty/valgrind_p.h b/src/testlib/3rdparty/valgrind_p.h index bbce1b24d6..4745371d81 100644 --- a/src/testlib/3rdparty/valgrind_p.h +++ b/src/testlib/3rdparty/valgrind_p.h @@ -133,6 +133,7 @@ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \ { \ (_zzq_rlval) = (_zzq_default); \ + (void)_zzq_rlval; \ } #else /* ! NVALGRIND */ @@ -205,6 +206,7 @@ typedef : "cc", "memory" \ ); \ _zzq_rlval = _zzq_result; \ + (void)_zzq_rlval; \ } #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \ @@ -319,6 +321,7 @@ typedef : "b" (_zzq_default), "b" (_zzq_ptr) \ : "cc", "memory", "r3", "r4"); \ _zzq_rlval = _zzq_result; \ + (void)_zzq_rlval; \ } #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \ @@ -377,6 +380,7 @@ typedef : "0" (_zzq_default), "r" (_zzq_ptr) \ : "cc", "memory"); \ _zzq_rlval = _zzq_result; \ + (void)_zzq_rlval; \ } #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \ @@ -447,6 +451,7 @@ typedef : "b" (_zzq_ptr) \ : "r3", "r4", "cc", "memory"); \ _zzq_rlval = _zzq_result; \ + (void)_zzq_rlval; \ } #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \ @@ -519,6 +524,7 @@ typedef : "b" (_zzq_ptr) \ : "r3", "r4", "cc", "memory"); \ _zzq_rlval = _zzq_result; \ + (void)_zzq_rlval; \ } #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \ diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp index 766697dfc2..ce3b34841e 100644 --- a/src/tools/qdoc/config.cpp +++ b/src/tools/qdoc/config.cpp @@ -55,8 +55,9 @@ QT_BEGIN_NAMESPACE -/* - An entry on the MetaStack. +/*! + An entry in a stack, where each entry is a list + of string values. */ class MetaStackEntry { @@ -68,14 +69,19 @@ public: QStringList next; }; -/* +/*! + Start accumulating values in a list by appending an empty + string to the list. */ void MetaStackEntry::open() { next.append(QString()); } -/* +/*! + Stop accumulating values and append the list of accumulated + values to the complete list of accumulated values. + */ void MetaStackEntry::close() { @@ -83,8 +89,10 @@ void MetaStackEntry::close() next.clear(); } -/* - ### +/*! + \class MetaStack + + This class maintains a stack of values of config file variables. */ class MetaStack : private QStack<MetaStackEntry> { @@ -97,12 +105,21 @@ public: QStringList getExpanded(const Location& location); }; +/*! + The default constructor pushes a new stack entry and + opens it. + */ MetaStack::MetaStack() { push(MetaStackEntry()); top().open(); } +/*! + Processes the character \a ch using the \a location. + It really just builds up a name by appending \a ch to + it. + */ void MetaStack::process(QChar ch, const Location& location) { if (ch == QLatin1Char('{')) { @@ -133,6 +150,9 @@ void MetaStack::process(QChar ch, const Location& location) top().open(); } else { + /* + This is where all the processing is done. + */ QStringList::Iterator pre = top().next.begin(); while (pre != top().next.end()) { *pre += ch; @@ -141,6 +161,9 @@ void MetaStack::process(QChar ch, const Location& location) } } +/*! + Returns the accumulated string values. + */ QStringList MetaStack::getExpanded(const Location& location) { if (count() > 1) @@ -176,9 +199,7 @@ Config::Config(const QString& programName) { loc = Location::null; lastLocation_ = Location::null; - locMap.clear(); - stringPairMap.clear(); - stringListPairMap.clear(); + configVars_.clear(); numInstances++; } @@ -211,19 +232,6 @@ void Config::load(const QString& fileName) } /*! - Writes the qdoc configuration data to the named file. - The previous contents of the file are overwritten. - */ -void Config::unload(const QString& fileName) -{ - QStringPairMap::ConstIterator v = stringPairMap.constBegin(); - while (v != stringPairMap.constEnd()) { - qDebug() << v.key() << " = " << v.value().second; - ++v; - } - qDebug() << "fileName:" << fileName; -} -/*! Joins all the strings in \a values into a single string with the individual \a values separated by ' '. Then it inserts the result into the string list map with \a var as the key. @@ -233,10 +241,7 @@ void Config::unload(const QString& fileName) */ void Config::setStringList(const QString& var, const QStringList& values) { - stringPairMap[var].first = QDir::currentPath(); - stringPairMap[var].second = values.join(QLatin1Char(' ')); - stringListPairMap[var].first = QDir::currentPath(); - stringListPairMap[var].second = values; + configVars_.insert(var,ConfigVar(var, values, QDir::currentPath())); } /*! @@ -303,30 +308,29 @@ QSet<QString> Config::getOutputFormats() const */ QString Config::getString(const QString& var) const { - if (!locMap[var].isEmpty()) - (Location&) lastLocation_ = locMap[var]; - return stringPairMap[var].second; -} - -/*! - This function looks up the variable \a var in the location map - and, if found, sets the internal variable \c{lastLocation_} to the - location that \a var maps to. - - Then it looks up \a var in the configuration variable map and, - if found, constructs a path from the pair value, which consists - of the directory path of the configuration file where the value - came from, and the value itself. The constructed path is returned. - */ -QString Config::getPath(const QString& var) const -{ - if (!locMap[var].isEmpty()) - (Location&) lastLocation_ = locMap[var]; - QString path; - if (stringPairMap.contains(var)) { - path = QDir(stringPairMap[var].first + "/" + stringPairMap[var].second).absolutePath(); + QList<ConfigVar> configVars = configVars_.values(var); + QString value; + int high = 0; + if (!configVars.empty()) { + int i = configVars.size() - 1; + while (i >= 0) { + const ConfigVar& cv = configVars[i]; + if (!cv.location_.isEmpty()) + (Location&) lastLocation_ = cv.location_; + if (!cv.values_.isEmpty()) { + if (!cv.plus_) + value.clear(); + for (int j=0; j<cv.values_.size(); ++j) { + if (!value.isEmpty() && !value.endsWith(QChar('\n'))) + value.append(QChar(' ')); + value.append(cv.values_[j]); + high = j; + } + } + --i; + } } - return path; + return value; } /*! @@ -341,40 +345,65 @@ QSet<QString> Config::getStringSet(const QString& var) const /*! First, this function looks up the configuration variable \a var - in the location map and, if found, sets the internal variable + in the location map. If found, it sets the internal variable \c{lastLocation_} to the Location that \a var maps to. - Then it looks up the configuration variable \a var in the string - list map, and returns the string list that \a var maps to. + Then it looks up the configuration variable \a var in the map of + configuration variable records. If found, it gets a list of all + the records for \a var. Then it appends all the values for \a var + to a list and returns the list. As it appends the values from each + record, if the \a var used '=' instead of '+=' the list is cleared + before the values are appended. \note '+=' should always be used. + The final list is returned. */ QStringList Config::getStringList(const QString& var) const { - if (!locMap[var].isEmpty()) - (Location&) lastLocation_ = locMap[var]; - return stringListPairMap[var].second; + QList<ConfigVar> configVars = configVars_.values(var); + QStringList values; + if (!configVars.empty()) { + int i = configVars.size() - 1; + while (i >= 0) { + if (!configVars[i].location_.isEmpty()) + (Location&) lastLocation_ = configVars[i].location_; + if (configVars[i].plus_) + values.append(configVars[i].values_); + else + values = configVars[i].values_; + --i; + } + } + return values; } - /*! \brief Returns the a path list where all paths are canonicalized, then made relative to the config file. \param var The variable containing the list of paths. \see Location::canonicalRelativePath() */ -QStringList Config::getCanonicalRelativePathList(const QString& var) const +QStringList Config::getCanonicalPathList(const QString& var) const { - if (!locMap[var].isEmpty()) - (Location&) lastLocation_ = locMap[var]; QStringList t; - QStringListPairMap::const_iterator it = stringListPairMap.constFind(var); - if (it != stringListPairMap.constEnd()) { - const QStringList& sl = it.value().second; - if (!sl.isEmpty()) { - t.reserve(sl.size()); - for (int i=0; i<sl.size(); ++i) { - const QString &canonicalized = location().canonicalRelativePath(sl[i]); - t.append(canonicalized); + QList<ConfigVar> configVars = configVars_.values(var); + if (!configVars.empty()) { + int i = configVars.size() - 1; + while (i >= 0) { + const ConfigVar& cv = configVars[i]; + if (!cv.location_.isEmpty()) + (Location&) lastLocation_ = cv.location_; + if (!cv.plus_) { + t.clear(); + } + const QString d = cv.currentPath_; + const QStringList& sl = cv.values_; + if (!sl.isEmpty()) { + t.reserve(t.size() + sl.size()); + for (int i=0; i<sl.size(); ++i) { + QDir dir(d + "/" + sl[i]); + t.append(dir.canonicalPath()); + } } + --i; } } return t; @@ -382,32 +411,30 @@ QStringList Config::getCanonicalRelativePathList(const QString& var) const /*! This function should only be called when the configuration - variable \a var maps to a string list that contains file paths. + variable \a var maps to string lists that contain file paths. It cleans the paths with QDir::cleanPath() before returning them. - - First, this function looks up the configuration variable \a var - in the location map and, if found, sets the internal variable - \c{lastLocation_} the Location that \a var maps to. - - Then it looks up the configuration variable \a var in the string - list map, which maps to a string list that contains file paths. - These paths might not be clean, so QDir::cleanPath() is called - for each one. The string list returned contains cleaned paths. */ QStringList Config::getCleanPathList(const QString& var) const { - if (!locMap[var].isEmpty()) - (Location&) lastLocation_ = locMap[var]; QStringList t; - QStringListPairMap::const_iterator it = stringListPairMap.constFind(var); - if (it != stringListPairMap.constEnd()) { - const QStringList& sl = it.value().second; - if (!sl.isEmpty()) { - t.reserve(sl.size()); - for (int i=0; i<sl.size(); ++i) { - t.append(QDir::cleanPath(sl[i])); + QList<ConfigVar> configVars = configVars_.values(var); + if (!configVars.empty()) { + int i = configVars.size() - 1; + while (i >= 0) { + const ConfigVar& cv = configVars[i]; + if (!cv.plus_) + t.clear(); + if (!cv.location_.isEmpty()) + (Location&) lastLocation_ = cv.location_; + const QStringList& sl = cv.values_; + if (!sl.isEmpty()) { + t.reserve(t.size() + sl.size()); + for (int i=0; i<sl.size(); ++i) { + t.append(QDir::cleanPath(sl[i].simplified())); + } } + --i; } } return t; @@ -415,7 +442,7 @@ QStringList Config::getCleanPathList(const QString& var) const /*! This function should only be called when the configuration - variable \a var maps to a string list that contains file paths. + variable \a var maps to string lists that contain file paths. It cleans the paths with QDir::cleanPath() before returning them. @@ -424,30 +451,39 @@ QStringList Config::getCleanPathList(const QString& var) const \c{lastLocation_} the Location that \a var maps to. Then it looks up the configuration variable \a var in the string - list map, which maps to a string list that contains file paths. + list map, which maps to one or more records that each contains a + list of file paths. + These paths might not be clean, so QDir::cleanPath() is called for each one. The string list returned contains cleaned paths. */ QStringList Config::getPathList(const QString& var) const { - if (!locMap[var].isEmpty()) - (Location&) lastLocation_ = locMap[var]; QStringList t; - QStringListPairMap::const_iterator it = stringListPairMap.constFind(var); - if (it != stringListPairMap.constEnd()) { - const QStringList& sl = it.value().second; - const QString d = it.value().first; - if (!sl.isEmpty()) { - t.reserve(sl.size()); - for (int i=0; i<sl.size(); ++i) { - QFileInfo fileInfo; - QString path = d + "/" + QDir::cleanPath(sl[i]); - fileInfo.setFile(path); - if (!fileInfo.exists()) - lastLocation_.warning(tr("File '%1' does not exist").arg(path)); - else - t.append(path); + QList<ConfigVar> configVars = configVars_.values(var); + if (!configVars.empty()) { + int i = configVars.size() - 1; + while (i >= 0) { + const ConfigVar& cv = configVars[i]; + if (!cv.plus_) + t.clear(); + if (!cv.location_.isEmpty()) + (Location&) lastLocation_ = cv.location_; + const QString d = cv.currentPath_; + const QStringList& sl = cv.values_; + if (!sl.isEmpty()) { + t.reserve(t.size() + sl.size()); + for (int i=0; i<sl.size(); ++i) { + QFileInfo fileInfo; + QString path = d + "/" + QDir::cleanPath(sl[i].simplified()); + fileInfo.setFile(path); + if (!fileInfo.exists()) + lastLocation_.warning(tr("File '%1' does not exist").arg(path)); + else + t.append(path); + } } + --i; } } return t; @@ -509,30 +545,31 @@ QSet<QString> Config::subVars(const QString& var) const { QSet<QString> result; QString varDot = var + QLatin1Char('.'); - QStringPairMap::ConstIterator v = stringPairMap.constBegin(); - while (v != stringPairMap.constEnd()) { - if (v.key().startsWith(varDot)) { - QString subVar = v.key().mid(varDot.length()); + ConfigVarMultimap::ConstIterator i = configVars_.constBegin(); + while (i != configVars_.constEnd()) { + if (i.key().startsWith(varDot)) { + QString subVar = i.key().mid(varDot.length()); int dot = subVar.indexOf(QLatin1Char('.')); if (dot != -1) subVar.truncate(dot); - result.insert(subVar); + if (!result.contains(subVar)) + result.insert(subVar); } - ++v; + ++i; } return result; } /*! - Same as subVars(), but in this case we return a string map - with the matching keys (stripped of the prefix \a var and - mapped to their values. The pairs are inserted into \a t + Same as subVars(), but in this case we return a config var + multimap with the matching keys (stripped of the prefix \a var + and mapped to their values. The pairs are inserted into \a t */ -void Config::subVarsAndValues(const QString& var, QStringPairMap& t) const +void Config::subVarsAndValues(const QString& var, ConfigVarMultimap& t) const { QString varDot = var + QLatin1Char('.'); - QStringPairMap::ConstIterator v = stringPairMap.constBegin(); - while (v != stringPairMap.constEnd()) { + ConfigVarMultimap::ConstIterator v = configVars_.constBegin(); + while (v != configVars_.constEnd()) { if (v.key().startsWith(varDot)) { QString subVar = v.key().mid(varDot.length()); int dot = subVar.indexOf(QLatin1Char('.')); @@ -559,7 +596,7 @@ QStringList Config::getAllFiles(const QString &filesVar, const QSet<QString> &excludedFiles) { QStringList result = getStringList(filesVar); - QStringList dirs = getCanonicalRelativePathList(dirsVar); + QStringList dirs = getCanonicalPathList(dirsVar); QString nameFilter = getString(filesVar + dot + QLatin1String(CONFIG_FILEEXTENSIONS)); @@ -575,7 +612,7 @@ QStringList Config::getExampleQdocFiles(const QSet<QString> &excludedDirs, const QSet<QString> &excludedFiles) { QStringList result; - QStringList dirs = getCanonicalRelativePathList("exampledirs"); + QStringList dirs = getCanonicalPathList("exampledirs"); QString nameFilter = " *.qdoc"; QStringList::ConstIterator d = dirs.constBegin(); @@ -590,7 +627,7 @@ QStringList Config::getExampleImageFiles(const QSet<QString> &excludedDirs, const QSet<QString> &excludedFiles) { QStringList result; - QStringList dirs = getCanonicalRelativePathList("exampledirs"); + QStringList dirs = getCanonicalPathList("exampledirs"); QString nameFilter = getString(CONFIG_EXAMPLES + dot + QLatin1String(CONFIG_IMAGEEXTENSIONS)); QStringList::ConstIterator d = dirs.constBegin(); @@ -869,7 +906,7 @@ void Config::load(Location location, const QString& fileName) Location keyLoc = location; bool plus = false; QString stringValue; - QStringList stringListValue; + QStringList rhsValues; QString word; bool inQuote = false; bool prevWordQuoted = true; @@ -931,6 +968,7 @@ void Config::load(Location location, const QString& fileName) else { /* It wasn't an include statement, so it's something else. + We must see either '=' or '+=' next. If not, fatal error. */ if (cc == '+') { plus = true; @@ -972,7 +1010,12 @@ void Config::load(Location location, const QString& fileName) if (metWord) stringValue += QLatin1Char(' '); stringValue += word; - stringListValue << word; +#if 0 + if (metWord) + rhsValues << QString(" " + word); + else +#endif + rhsValues << word; metWord = true; word.clear(); prevWordQuoted = false; @@ -988,7 +1031,7 @@ void Config::load(Location location, const QString& fileName) stringValue += QLatin1Char(' '); stringValue += word; if (!word.isEmpty()) - stringListValue << word; + rhsValues << word; metWord = true; word.clear(); prevWordQuoted = true; @@ -1025,30 +1068,9 @@ void Config::load(Location location, const QString& fileName) if (!keySyntax.exactMatch(*key)) keyLoc.fatal(tr("Invalid key '%1'").arg(*key)); - if (plus) { - if (locMap[*key].isEmpty()) { - locMap[*key] = keyLoc; - } - else { - locMap[*key].setEtc(true); - } - if (stringPairMap[*key].second.isEmpty()) { - stringPairMap[*key].first = QDir::currentPath(); - stringPairMap[*key].second = stringValue; - } - else { - stringPairMap[*key].second += QLatin1Char(' ') + stringValue; - } - stringListPairMap[*key].first = QDir::currentPath(); - stringListPairMap[*key].second += stringListValue; - } - else { - locMap[*key] = keyLoc; - stringPairMap[*key].first = QDir::currentPath(); - stringPairMap[*key].second = stringValue; - stringListPairMap[*key].first = QDir::currentPath(); - stringListPairMap[*key].second = stringListValue; - } + ConfigVarMultimap::Iterator i; + i = configVars_.insert(*key, ConfigVar(*key, rhsValues, QDir::currentPath(), keyLoc)); + i.value().plus_ = (plus ? true : false); ++key; } } @@ -1058,8 +1080,9 @@ void Config::load(Location location, const QString& fileName) } } popWorkingDir(); - if (!workingDirs_.isEmpty()) - QDir::setCurrent(QFileInfo(workingDirs_.top()).path()); + if (!workingDirs_.isEmpty()) { + QDir::setCurrent(workingDirs_.top()); + } } QStringList Config::getFilesHere(const QString& uncleanDir, @@ -1068,8 +1091,7 @@ QStringList Config::getFilesHere(const QString& uncleanDir, const QSet<QString> &excludedDirs, const QSet<QString> &excludedFiles) { - // - QString dir = location.isEmpty() ? QDir::cleanPath(uncleanDir) : location.canonicalRelativePath(uncleanDir); + QString dir = location.isEmpty() ? QDir::cleanPath(uncleanDir) : Location::canonicalRelativePath(uncleanDir); QStringList result; if (excludedDirs.contains(dir)) return result; diff --git a/src/tools/qdoc/config.h b/src/tools/qdoc/config.h index e21998070a..f23873b8f9 100644 --- a/src/tools/qdoc/config.h +++ b/src/tools/qdoc/config.h @@ -56,19 +56,29 @@ QT_BEGIN_NAMESPACE /* - In QStringPair, the first string is the path to a directory; - the second string is some value. + This struct contains all the information for + one config variable found in a qdocconf file. */ -typedef QPair<QString, QString> QStringPair; +struct ConfigVar { + bool plus_; + QString name_; + QStringList values_; + QString currentPath_; + Location location_; + + ConfigVar() : plus_(false) { } + + ConfigVar(const QString& name, const QStringList& values, const QString& dir) + : plus_(true), name_(name), values_(values), currentPath_(dir) { } + + ConfigVar(const QString& name, const QStringList& values, const QString& dir, const Location& loc) + : plus_(false), name_(name), values_(values), currentPath_(dir), location_(loc) { } +}; /* - In QStringListPair, the first string is the path to a directory; - the string list is a list of string values. + In this multimap, the key is a config variable name. */ -typedef QPair<QString, QStringList> QStringListPair; -typedef QMultiMap<QString, QStringPair> QStringPairMultiMap; -typedef QMap<QString, QStringPair> QStringPairMap; -typedef QMap<QString, QStringListPair> QStringListPairMap; +typedef QMultiMap<QString, ConfigVar> ConfigVarMultimap; class Config { @@ -79,7 +89,6 @@ public: ~Config(); void load(const QString& fileName); - void unload(const QString& fileName); void setStringList(const QString& var, const QStringList& values); const QString& programName() const { return prog; } @@ -90,16 +99,15 @@ public: QString getOutputDir() const; QSet<QString> getOutputFormats() const; QString getString(const QString& var) const; - QString getPath(const QString& var) const; QSet<QString> getStringSet(const QString& var) const; QStringList getStringList(const QString& var) const; - QStringList getCanonicalRelativePathList(const QString& var) const; + QStringList getCanonicalPathList(const QString& var) const; QStringList getCleanPathList(const QString& var) const; QStringList getPathList(const QString& var) const; QRegExp getRegExp(const QString& var) const; QList<QRegExp> getRegExpList(const QString& var) const; QSet<QString> subVars(const QString& var) const; - void subVarsAndValues(const QString& var, QStringPairMap& t) const; + void subVarsAndValues(const QString& var, ConfigVarMultimap& t) const; QStringList getAllFiles(const QString& filesVar, const QString& dirsVar, const QSet<QString> &excludedDirs = QSet<QString>(), @@ -146,12 +154,7 @@ private: QString prog; Location loc; Location lastLocation_; - QMap<QString, Location> locMap; - QMap<QString, QString> stringValueMap; - QMap<QString, QStringList> stringListValueMap; - - QStringPairMap stringPairMap; - QStringListPairMap stringListPairMap; + ConfigVarMultimap configVars_; static QMap<QString, QString> uncompressedFiles; static QMap<QString, QString> extractedDirs; diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp index a828101551..314dda3a9d 100644 --- a/src/tools/qdoc/ditaxmlgenerator.cpp +++ b/src/tools/qdoc/ditaxmlgenerator.cpp @@ -5829,8 +5829,11 @@ bool DitaXmlGenerator::writeMetadataElements(const InnerNode* inner, QString DitaXmlGenerator::getMetadataElement(const InnerNode* inner, DitaXmlGenerator::DitaTag t) { QString s = Generator::getMetadataElement(inner, ditaTags[t]); - if (s.isEmpty()) - s = metadataDefault(t); + if (s.isEmpty()) { + QStringList sl = metadataDefault(t); + if (!sl.isEmpty()) + s = sl[0]; + } return s; } @@ -5850,7 +5853,7 @@ QStringList DitaXmlGenerator::getMetadataElements(const InnerNode* inner, { QStringList s = Generator::getMetadataElements(inner,ditaTags[t]); if (s.isEmpty()) - s.append(metadataDefault(t)); + s = metadataDefault(t); return s; } @@ -5858,9 +5861,9 @@ QStringList DitaXmlGenerator::getMetadataElements(const InnerNode* inner, Returns the value of key \a t or an empty string if \a t is not found in the map. */ -QString DitaXmlGenerator::metadataDefault(DitaTag t) const +QStringList DitaXmlGenerator::metadataDefault(DitaTag t) const { - return metadataDefaults.value(ditaTags[t]).second; + return metadataDefaults.value(ditaTags[t]).values_; } /*! diff --git a/src/tools/qdoc/ditaxmlgenerator.h b/src/tools/qdoc/ditaxmlgenerator.h index 15ef4260b2..a55ccf81c8 100644 --- a/src/tools/qdoc/ditaxmlgenerator.h +++ b/src/tools/qdoc/ditaxmlgenerator.h @@ -458,7 +458,7 @@ private: int leaveSection(); bool inSection() const { return (sectionNestingLevel > 0); } int currentSectionNestingLevel() const { return sectionNestingLevel; } - QString metadataDefault(DitaTag t) const; + QStringList metadataDefault(DitaTag t) const; QString stripMarkup(const QString& src) const; Node* collectNodesByTypeAndSubtype(const InnerNode* parent); void writeDitaRefs(const DitaRefList& ditarefs); @@ -507,7 +507,7 @@ private: static QString ditaTags[]; QStack<QXmlStreamWriter*> xmlWriterStack; QStack<DitaTag> tagStack; - QStringPairMap metadataDefaults; + ConfigVarMultimap metadataDefaults; QVector<NodeMultiMap*> nodeTypeMaps; QVector<NodeMultiMap*> nodeSubtypeMaps; QVector<NodeMultiMap*> pageTypeMaps; diff --git a/src/tools/qdoc/location.cpp b/src/tools/qdoc/location.cpp index 86329b9190..64a635115e 100644 --- a/src/tools/qdoc/location.cpp +++ b/src/tools/qdoc/location.cpp @@ -229,15 +229,13 @@ QString Location::fileName() const /*! - * \brief Returns \a path which is canonicalized and relative to the config file. - * - * QDir::relativeFilePath does not canonicalize the paths, so - * if the config file is located at qtbase\src\widgets\doc\qtwidgets.qdocconf - * and it has a reference to any ancestor folder (e.g. ".." or even "../doc") - * \param path - * \return + \brief Returns \a path which is canonicalized and relative to the config file. + + QDir::relativeFilePath does not canonicalize the paths, so + if the config file is located at qtbase\src\widgets\doc\qtwidgets.qdocconf + and it has a reference to any ancestor folder (e.g. ".." or even "../doc") */ -QString Location::canonicalRelativePath(const QString &path) const +QString Location::canonicalRelativePath(const QString &path) { QDir configFileDir(QDir::current()); QDir dir(path); diff --git a/src/tools/qdoc/location.h b/src/tools/qdoc/location.h index 20ddfd076e..33472810d3 100644 --- a/src/tools/qdoc/location.h +++ b/src/tools/qdoc/location.h @@ -81,7 +81,6 @@ public: int depth() const { return stkDepth; } const QString& filePath() const { return stkTop->filePath; } QString fileName() const; - QString canonicalRelativePath(const QString &path) const; int lineNo() const { return stkTop->lineNo; } int columnNo() const { return stkTop->columnNo; } bool etc() const { return etcetera; } @@ -101,6 +100,7 @@ public: static void logToStdErr(const QString& message); static void startLoggingProgress() { logProgress_ = true; } static void stopLoggingProgress() { logProgress_ = false; } + static QString canonicalRelativePath(const QString &path); private: enum MessageType { Warning, Error }; diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp index a4e35c5f96..ef8a6fd9c5 100644 --- a/src/tools/qdoc/main.cpp +++ b/src/tools/qdoc/main.cpp @@ -360,7 +360,7 @@ static void processQdocconfFile(const QString &fileName) QStringList excludedFilesList; Generator::debugSegfault("Reading excludedirs"); - excludedDirsList = config.getCanonicalRelativePathList(CONFIG_EXCLUDEDIRS); + excludedDirsList = config.getCanonicalPathList(CONFIG_EXCLUDEDIRS); foreach (const QString &excludeDir, excludedDirsList) { QString p = QDir::fromNativeSeparators(excludeDir); QDir tmp(p); diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index b2bf2c5565..8ff6419075 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -1660,7 +1660,20 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD extraHeight = 0, finalyoff = 0; - const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(opt); + const bool combo = opt->type == QStyleOption::SO_ComboBox; + const bool button = opt->type == QStyleOption::SO_Button; + const bool pressed = bdi->state == kThemeStatePressed; + + if (button && pressed) { + if (bdi->kind == kThemePushButton) { + extraHeight = 2; + } else if (bdi->kind == kThemePushButtonSmall) { + xoff = 1; + extraWidth = 2; + extraHeight = 5; + } + } + int width = int(macRect.size.width) + extraWidth; int height = int(macRect.size.height) + extraHeight; @@ -1668,8 +1681,9 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD return; // nothing to draw QString key = QLatin1String("$qt_mac_style_ctb_") + QString::number(bdi->kind) + QLatin1Char('_') - + QString::number(bdi->value) + QLatin1Char('_') + QString::number(width) - + QLatin1Char('_') + QString::number(height); + + QString::number(bdi->value) + QLatin1Char('_') + + (button ? QString::number(bdi->state) + QLatin1Char('_') : QString()) + + QLatin1Char('_') + QString::number(width) + QLatin1Char('_') + QString::number(height); QPixmap pm; if (!QPixmapCache::find(key, pm)) { QPixmap activePixmap(width, height); @@ -1680,17 +1694,18 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD // ourselves, if a scaled version is needed. QPainter tmpPainter(&activePixmap); QMacStylePrivate::drawCombobox(macRect, *bdi, &tmpPainter); - } - else { + } else { QMacCGContext cg(&activePixmap); HIRect newRect = CGRectMake(xoff, yoff, macRect.size.width, macRect.size.height); + if (button && pressed) + bdi->state = kThemeStateActive; HIThemeDrawButton(&newRect, bdi, cg, kHIThemeOrientationNormal, 0); } } - if (!combo && bdi->value == kThemeButtonOff) { + if (!combo && !button && bdi->value == kThemeButtonOff) { pm = activePixmap; - } else if (combo) { + } else if (combo || button) { QImage image = activePixmap.toImage(); for (int y = 0; y < height; ++y) { @@ -1711,6 +1726,8 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD qSwap(darkest, mid); int gray = (mid + 2 * lightest) / 3; + if (pressed) + gray *= 0.88; pixel = qRgba(gray, gray, gray, qAlpha(pixel)); } } @@ -1753,7 +1770,7 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD } QPixmapCache::insert(key, pm); } - p->drawPixmap(int(macRect.origin.x), int(macRect.origin.y) + finalyoff, width, height, pm); + p->drawPixmap(int(macRect.origin.x) - xoff, int(macRect.origin.y) + finalyoff, width, height, pm); } QMacStyle::QMacStyle() @@ -3539,23 +3556,52 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter newRect.origin.y += QMacStylePrivate::PushButtonTopOffset; newRect.size.width -= QMacStylePrivate::PushButtonRightOffset - 4; } - HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0); - if (btn->features & QStyleOptionButton::HasMenu) { + bool hasMenu = btn->features & QStyleOptionButton::HasMenu; + if (hasMenu && bdi.state == kThemeStatePressed && QSysInfo::macVersion() > QSysInfo::MV_10_6) + d->drawColorlessButton(newRect, &bdi, p, opt); + else + HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0); + + if (hasMenu) { int mbi = proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w); QRect ir = btn->rect; - int arrowYOffset = bdi.kind == kThemePushButton ? 4 : 2; - HIRect arrowRect = CGRectMake(ir.right() - mbi - QMacStylePrivate::PushButtonRightOffset, - ir.height() / 2 - arrowYOffset, mbi, ir.height() / 2); + int arrowXOffset = 0; + if (QSysInfo::macVersion() > QSysInfo::MV_10_6) + arrowXOffset = bdi.kind == kThemePushButton ? 6 : + bdi.kind == kThemePushButtonSmall ? 7 : 8; + int arrowYOffset; + if (QSysInfo::macVersion() > QSysInfo::MV_10_6) + arrowYOffset = bdi.kind == kThemePushButton ? 3 : + bdi.kind == kThemePushButtonSmall ? 1 : 2; + else + arrowYOffset = bdi.kind == kThemePushButton ? 4 : 2; + if (!w) { + // adjustment for Qt Quick Controls + arrowYOffset -= ir.top(); + if (bdi.kind == kThemePushButtonSmall) + arrowYOffset += 1; + } + QRect ar = QRect(ir.right() - mbi - QMacStylePrivate::PushButtonRightOffset, + ir.height() / 2 - arrowYOffset, mbi, ir.height() / 2); + ar = visualRect(btn->direction, ir, ar); + HIRect arrowRect = CGRectMake(ar.x() + arrowXOffset, ar.y(), ar.width(), ar.height()); HIThemePopupArrowDrawInfo pdi; pdi.version = qt_mac_hitheme_version; pdi.state = tds == kThemeStateInactive ? kThemeStateActive : tds; pdi.orientation = kThemeArrowDown; - if (arrowRect.size.width < 8.) - pdi.size = kThemeArrow5pt; - else - pdi.size = kThemeArrow9pt; + if (QSysInfo::macVersion() > QSysInfo::MV_10_6) { + if (bdi.kind == kThemePushButtonMini) + pdi.size = kThemeArrow5pt; + else if (bdi.kind == kThemePushButton || bdi.kind == kThemePushButtonSmall) + pdi.size = kThemeArrow7pt; + } else { + if (arrowRect.size.width < 8.) + pdi.size = kThemeArrow5pt; + else + pdi.size = kThemeArrow9pt; + } HIThemeDrawPopupArrow(&arrowRect, &pdi, cg, kHIThemeOrientationNormal); } } @@ -3621,8 +3667,12 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter QRect freeContentRect = btn->rect; QRect textRect = itemTextRect( btn->fontMetrics, freeContentRect, Qt::AlignCenter, btn->state & State_Enabled, btn->text); - if (hasMenu) - textRect.adjust(-1, 0, -1, 0); + if (hasMenu) { + if (QSysInfo::macVersion() > QSysInfo::MV_10_6) + textRect.moveTo(w ? 15 : 11, textRect.top()); // Supports Qt Quick Controls + else + textRect.adjust(-1, 0, -1, 0); + } // Draw the icon: if (hasIcon) { int contentW = textRect.width(); @@ -3662,6 +3712,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) { QStyleOptionComboBox comboCopy = *cb; comboCopy.direction = Qt::LeftToRight; + if ((opt->state & QStyle::State_Small) && QSysInfo::macVersion() > QSysInfo::MV_10_6) + comboCopy.rect.translate(0, w ? -1 : -2); // Supports Qt Quick Controls QCommonStyle::drawControl(CE_ComboBoxLabel, &comboCopy, p, w); } break; diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro index 18a4d57900..43f7ae8af3 100644 --- a/src/widgets/widgets.pro +++ b/src/widgets/widgets.pro @@ -7,6 +7,9 @@ DEFINES += QT_NO_USING_NAMESPACE win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000 irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused +MODULE_PLUGIN_TYPES = \ + accessible + QMAKE_DOCS = $$PWD/doc/qtwidgets.qdocconf load(qt_module) diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index 95271adeb0..5a8da45a88 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -2223,11 +2223,57 @@ void QPlainTextEdit::changeEvent(QEvent *e) #ifndef QT_NO_WHEELEVENT void QPlainTextEdit::wheelEvent(QWheelEvent *e) { + Q_D(QPlainTextEdit); + if (!(d->control->textInteractionFlags() & Qt::TextEditable)) { + if (e->modifiers() & Qt::ControlModifier) { + const int delta = e->delta(); + if (delta < 0) + zoomOut(); + else if (delta > 0) + zoomIn(); + return; + } + } QAbstractScrollArea::wheelEvent(e); updateMicroFocus(); } #endif +/*! + \fn QPlainTextEdit::zoomIn(int range) + + Zooms in on the text by making the base font size \a range + points larger and recalculating all font sizes to be the new size. + This does not change the size of any images. + + \sa zoomOut() +*/ +void QPlainTextEdit::zoomIn(int range) +{ + QFont f = font(); + const int newSize = f.pointSize() + range; + if (newSize <= 0) + return; + f.setPointSize(newSize); + setFont(f); +} + +/*! + \fn QPlainTextEdit::zoomOut(int range) + + \overload + + Zooms out on the text by making the base font size \a range points + smaller and recalculating all font sizes to be the new size. This + does not change the size of any images. + + \sa zoomIn() +*/ +void QPlainTextEdit::zoomOut(int range) +{ + zoomIn(-range); +} + #ifndef QT_NO_CONTEXTMENU /*! This function creates the standard context menu which is shown when the user clicks on the line edit with the right mouse diff --git a/src/widgets/widgets/qplaintextedit.h b/src/widgets/widgets/qplaintextedit.h index 42e8288cf3..81548818ef 100644 --- a/src/widgets/widgets/qplaintextedit.h +++ b/src/widgets/widgets/qplaintextedit.h @@ -202,6 +202,9 @@ public Q_SLOTS: void centerCursor(); + void zoomIn(int range = 1); + void zoomOut(int range = 1); + Q_SIGNALS: void textChanged(); void undoAvailable(bool b); diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp index bf2c8a4495..4b3bf6de65 100644 --- a/src/widgets/widgets/qtextedit.cpp +++ b/src/widgets/widgets/qtextedit.cpp @@ -445,6 +445,8 @@ void QTextEditPrivate::_q_ensureVisible(const QRectF &_rect) example, the documentTitle() function will return the text from within HTML \c{<title>} tags. + \note Zooming into HTML documents only works if the font-size is not set to a fixed size. + \section1 Using QTextEdit as an Editor All the information about using QTextEdit as a display widget also diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 0a1af0a058..e7ad52a257 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -4082,8 +4082,22 @@ void tst_QString::arg() QCOMPARE( QString("%2 %L1").arg(12345.6789).arg(12345.6789), QString("12345.7 12.345,7") ); + QCOMPARE( QString("[%2] [%L1]").arg(12345.6789, 9).arg(12345.6789, 9), + QString("[ 12345.7] [ 12.345,7]") ); + QCOMPARE( QString("[%2] [%L1]").arg(12345.6789, 9, 'g', 7).arg(12345.6789, 9, 'g', 7), + QString("[ 12345.68] [12.345,68]") ); + QCOMPARE( QString("[%2] [%L1]").arg(12345.6789, 10, 'g', 7, QLatin1Char('0')).arg(12345.6789, 10, 'g', 7, QLatin1Char('0')), + QString("[0012345.68] [012.345,68]") ); + QCOMPARE( QString("%2 %L1").arg(123456789).arg(123456789), QString("123456789 123.456.789") ); + QCOMPARE( QString("[%2] [%L1]").arg(123456789, 12).arg(123456789, 12), + QString("[ 123456789] [ 123.456.789]") ); + QCOMPARE( QString("[%2] [%L1]").arg(123456789, 13, 10, QLatin1Char('0')).arg(123456789, 12, 10, QLatin1Char('0')), + QString("[000123456789] [00123.456.789]") ); + QCOMPARE( QString("[%2] [%L1]").arg(123456789, 13, 16, QLatin1Char('0')).arg(123456789, 12, 16, QLatin1Char('0')), + QString("[0000075bcd15] [00000075bcd15]") ); + QCOMPARE( QString("%L2 %L1 %3").arg(12345.7).arg(123456789).arg('c'), QString("123.456.789 12.345,7 c") ); @@ -4125,6 +4139,14 @@ void tst_QString::arg() QCOMPARE(QString("%1").arg(1000., 3, 'g', -1, QChar('x')), QString("1000")); QCOMPARE(QString("%1").arg(-1., 3, 'g', -1, QChar('x')), QString("x-1")); QCOMPARE(QString("%1").arg(-100., 3, 'g', -1, QChar('x')), QString("-100")); + + QLocale::setDefault(QString("ar")); + QCOMPARE( QString("%L1").arg(12345.6789, 10, 'g', 7, QLatin1Char('0')), + QString::fromUtf8("\xd9\xa0\xd9\xa1\xd9\xa2\xd9\xac\xd9\xa3\xd9\xa4\xd9\xa5\xd9\xab\xd9\xa6\xd9\xa8") ); // "٠١٢٬٣٤٥٫٦٨" + QCOMPARE( QString("%L1").arg(123456789, 13, 10, QLatin1Char('0')), + QString("\xd9\xa0\xd9\xa0\xd9\xa1\xd9\xa2\xd9\xa3\xd9\xac\xd9\xa4\xd9\xa5\xd9\xa6\xd9\xac\xd9\xa7\xd9\xa8\xd9\xa9") ); // ٠٠١٢٣٬٤٥٦٬٧٨٩ + + QLocale::setDefault(QLocale::system()); } void tst_QString::number() diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp index a3ce31f585..9135c57420 100644 --- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp +++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp @@ -59,6 +59,11 @@ class tst_QDnsLookup: public QObject { Q_OBJECT + QString domainName(const QString &input); + QString domainNameList(const QString &input); +public slots: + void initTestCase(); + private slots: void lookup_data(); void lookup(); @@ -66,6 +71,40 @@ private slots: void lookupAbortRetry(); }; +void tst_QDnsLookup::initTestCase() +{ + QTest::addColumn<QString>("tld"); + QTest::newRow("normal") << ".test.macieira.org"; + QTest::newRow("idn") << ".alqualond\xc3\xab.test.macieira.org"; +} + +QString tst_QDnsLookup::domainName(const QString &input) +{ + if (input.isEmpty()) + return input; + + if (input.endsWith(QLatin1Char('.'))) { + QString nodot = input; + nodot.chop(1); + return nodot; + } + + QFETCH_GLOBAL(QString, tld); + return input + tld; +} + +QString tst_QDnsLookup::domainNameList(const QString &input) +{ + QStringList list = input.split(QLatin1Char(';')); + QString result; + foreach (const QString &s, list) { + if (!result.isEmpty()) + result += ';'; + result += domainName(s); + } + return result; +} + void tst_QDnsLookup::lookup_data() { QTest::addColumn<int>("type"); @@ -81,47 +120,42 @@ void tst_QDnsLookup::lookup_data() QTest::newRow("a-empty") << int(QDnsLookup::A) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << ""<< "" << QByteArray(); QTest::newRow("a-notfound") << int(QDnsLookup::A) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("a-idn") << int(QDnsLookup::A) << QString::fromUtf8("alqualondë.troll.no") << int(QDnsLookup::NoError) << "alqualonde.troll.no" << "10.3.3.55" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("a-single") << int(QDnsLookup::A) << "lupinella.troll.no" << int(QDnsLookup::NoError) << "" << "10.3.4.6" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("a-multi") << int(QDnsLookup::A) << "multi.dev.troll.no" << int(QDnsLookup::NoError) << "" << "1.2.3.4 1.2.3.5 10.3.3.31" << "" << "" << "" << "" << QByteArray(); - + QTest::newRow("a-single") << int(QDnsLookup::A) << "a-single" << int(QDnsLookup::NoError) << "" << "192.0.2.1" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("a-multi") << int(QDnsLookup::A) << "a-multi" << int(QDnsLookup::NoError) << "" << "192.0.2.1;192.0.2.2;192.0.2.3" << "" << "" << "" << "" << QByteArray(); QTest::newRow("aaaa-empty") << int(QDnsLookup::AAAA) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("aaaa-notfound") << int(QDnsLookup::AAAA) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("aaaa-single") << int(QDnsLookup::AAAA) << "dns6-test-dev.troll.no" << int(QDnsLookup::NoError) << "" << "2001:470:1f01:115::10" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("aaaa-multi") << int(QDnsLookup::AAAA) << "multi-dns6-test-dev.troll.no" << int(QDnsLookup::NoError) << "" << "2001:470:1f01:115::11 2001:470:1f01:115::12" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("aaaa-single") << int(QDnsLookup::AAAA) << "aaaa-single" << int(QDnsLookup::NoError) << "" << "2001:db8::1" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("aaaa-multi") << int(QDnsLookup::AAAA) << "aaaa-multi" << int(QDnsLookup::NoError) << "" << "2001:db8::1;2001:db8::2;2001:db8::3" << "" << "" << "" << "" << QByteArray(); QTest::newRow("any-empty") << int(QDnsLookup::ANY) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("any-notfound") << int(QDnsLookup::ANY) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("any-ascii") << int(QDnsLookup::ANY) << "fluke.troll.no" << int(QDnsLookup::NoError) << "" << "10.3.3.31" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("any-a-single") << int(QDnsLookup::ANY) << "a-single" << int(QDnsLookup::NoError) << "" << "192.0.2.1" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("any-a-plus-aaaa") << int(QDnsLookup::ANY) << "a-plus-aaaa" << int(QDnsLookup::NoError) << "" << "198.51.100.1;2001:db8::1:1" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("any-multi") << int(QDnsLookup::ANY) << "multi" << int(QDnsLookup::NoError) << "" << "198.51.100.1;198.51.100.2;198.51.100.3;2001:db8::1:1;2001:db8::1:2" << "" << "" << "" << "" << QByteArray(); QTest::newRow("mx-empty") << int(QDnsLookup::MX) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("mx-notfound") << int(QDnsLookup::MX) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("mx-ascii") << int(QDnsLookup::MX) << "troll.no" << int(QDnsLookup::NoError) << "" << "" << "10 smtp.trolltech.com" << "" << "" << "" << QByteArray(); -#if 0 - // FIXME: we need an IDN MX record in the troll.no domain - QTest::newRow("mx-idn") << int(QDnsLookup::MX) << QString::fromUtf8("råkat.se") << int(QDnsLookup::NoError) << "" << "" << "10 mail.cdr.se" << "" << "" << "" << QByteArray(); -#endif + QTest::newRow("mx-single") << int(QDnsLookup::MX) << "mx-single" << int(QDnsLookup::NoError) << "" << "" << "10 multi" << "" << "" << "" << QByteArray(); + QTest::newRow("mx-single-cname") << int(QDnsLookup::MX) << "mx-single-cname" << int(QDnsLookup::NoError) << "" << "" << "10 cname" << "" << "" << "" << QByteArray(); + QTest::newRow("mx-multi") << int(QDnsLookup::MX) << "mx-multi" << int(QDnsLookup::NoError) << "" << "" << "10 multi;20 a-single" << "" << "" << "" << QByteArray(); QTest::newRow("ns-empty") << int(QDnsLookup::NS) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("ns-notfound") << int(QDnsLookup::NS) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("ns-ascii") << int(QDnsLookup::NS) << "troll.no" << int(QDnsLookup::NoError) << "" << "" << "" << "ns-0.trolltech.net ns-1.trolltech.net" << "" << "" << QByteArray(); + QTest::newRow("ns-single") << int(QDnsLookup::NS) << "ns-single" << int(QDnsLookup::NoError) << "" << "" << "" << "ns3.macieira.info." << "" << "" << QByteArray(); + QTest::newRow("ns-multi") << int(QDnsLookup::NS) << "ns-multi" << int(QDnsLookup::NoError) << "" << "" << "" << "gondolin.macieira.info.;ns3.macieira.info." << "" << "" << QByteArray(); QTest::newRow("ptr-empty") << int(QDnsLookup::PTR) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("ptr-notfound") << int(QDnsLookup::PTR) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - // FIXME: we need PTR records in the troll.no domain - QTest::newRow("ptr-ascii") << int(QDnsLookup::PTR) << "8.8.8.8.in-addr.arpa" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "google-public-dns-a.google.com" << "" << QByteArray(); + QTest::newRow("ptr-single") << int(QDnsLookup::PTR) << "ptr-single" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "a-single" << "" << QByteArray(); QTest::newRow("srv-empty") << int(QDnsLookup::SRV) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("srv-notfound") << int(QDnsLookup::SRV) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); -#if 0 - // FIXME: we need SRV records in the troll.no domain - QTest::newRow("srv-idn") << int(QDnsLookup::SRV) << QString::fromUtf8("_xmpp-client._tcp.råkat.se") << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "5 0 5224 jabber.cdr.se" << QByteArray(); -#endif + QTest::newRow("srv-single") << int(QDnsLookup::SRV) << "_echo._tcp.srv-single" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "5 0 7 multi" << QByteArray(); + QTest::newRow("srv-prio") << int(QDnsLookup::SRV) << "_echo._tcp.srv-prio" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "1 0 7 multi;2 0 7 a-plus-aaaa" << QByteArray(); QTest::newRow("txt-empty") << int(QDnsLookup::TXT) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("txt-notfound") << int(QDnsLookup::TXT) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - // FIXME: we need TXT records in the troll.no domain - QTest::newRow("txt-ascii") << int(QDnsLookup::TXT) << "gmail.com" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "" << QByteArray("v=spf1 redirect=_spf.google.com"); + QTest::newRow("txt-single") << int(QDnsLookup::TXT) << "txt-single" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "" << QByteArray("Hello"); } void tst_QDnsLookup::lookup() @@ -137,6 +171,14 @@ void tst_QDnsLookup::lookup() QFETCH(QString, srv); QFETCH(QByteArray, txt); + // transform the inputs + domain = domainName(domain); + cname = domainName(cname); + mx = domainNameList(mx); + ns = domainNameList(ns); + ptr = domainNameList(ptr); + srv = domainNameList(srv); + QDnsLookup lookup; lookup.setType(static_cast<QDnsLookup::Type>(type)); lookup.setName(domain); @@ -168,7 +210,7 @@ void tst_QDnsLookup::lookup() addresses << record.value().toString().toLower(); } addresses.sort(); - QCOMPARE(addresses.join(' '), host); + QCOMPARE(addresses.join(';'), host); // mail exchanges QStringList mailExchanges; @@ -176,7 +218,7 @@ void tst_QDnsLookup::lookup() QCOMPARE(record.name(), domain); mailExchanges << QString("%1 %2").arg(QString::number(record.preference()), record.exchange()); } - QCOMPARE(mailExchanges.join(' '), mx); + QCOMPARE(mailExchanges.join(';'), mx); // name servers QStringList nameServers; @@ -186,7 +228,7 @@ void tst_QDnsLookup::lookup() nameServers << record.value(); } nameServers.sort(); - QCOMPARE(nameServers.join(' '), ns); + QCOMPARE(nameServers.join(';'), ns); // pointers if (!ptr.isEmpty()) { @@ -208,7 +250,7 @@ void tst_QDnsLookup::lookup() QString::number(record.port()), record.target()); } - QCOMPARE(services.join(' '), srv); + QCOMPARE(services.join(';'), srv); // text if (!txt.isEmpty()) { @@ -228,25 +270,25 @@ void tst_QDnsLookup::lookupReuse() // first lookup lookup.setType(QDnsLookup::A); - lookup.setName("lupinella.troll.no"); + lookup.setName(domainName("a-single")); lookup.lookup(); QVERIFY(waitForDone(&lookup)); QVERIFY(lookup.isFinished()); QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError)); QVERIFY(!lookup.hostAddressRecords().isEmpty()); - QCOMPARE(lookup.hostAddressRecords().first().name(), QString("lupinella.troll.no")); - QCOMPARE(lookup.hostAddressRecords().first().value(), QHostAddress("10.3.4.6")); + QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("a-single")); + QCOMPARE(lookup.hostAddressRecords().first().value(), QHostAddress("192.0.2.1")); // second lookup lookup.setType(QDnsLookup::AAAA); - lookup.setName("dns6-test-dev.troll.no"); + lookup.setName(domainName("aaaa-single")); lookup.lookup(); QVERIFY(waitForDone(&lookup)); QVERIFY(lookup.isFinished()); QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError)); QVERIFY(!lookup.hostAddressRecords().isEmpty()); - QCOMPARE(lookup.hostAddressRecords().first().name(), QString("dns6-test-dev.troll.no")); - QCOMPARE(lookup.hostAddressRecords().first().value(), QHostAddress("2001:470:1f01:115::10")); + QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("aaaa-single")); + QCOMPARE(lookup.hostAddressRecords().first().value(), QHostAddress("2001:db8::1")); } @@ -256,7 +298,7 @@ void tst_QDnsLookup::lookupAbortRetry() // try and abort the lookup lookup.setType(QDnsLookup::A); - lookup.setName("lupinella.troll.no"); + lookup.setName(domainName("a-single")); lookup.lookup(); lookup.abort(); QVERIFY(waitForDone(&lookup)); @@ -266,14 +308,14 @@ void tst_QDnsLookup::lookupAbortRetry() // retry a different lookup lookup.setType(QDnsLookup::AAAA); - lookup.setName("dns6-test-dev.troll.no"); + lookup.setName(domainName("aaaa-single")); lookup.lookup(); QVERIFY(waitForDone(&lookup)); QVERIFY(lookup.isFinished()); QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError)); QVERIFY(!lookup.hostAddressRecords().isEmpty()); - QCOMPARE(lookup.hostAddressRecords().first().name(), QString("dns6-test-dev.troll.no")); - QCOMPARE(lookup.hostAddressRecords().first().value(), QHostAddress("2001:470:1f01:115::10")); + QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("aaaa-single")); + QCOMPARE(lookup.hostAddressRecords().first().value(), QHostAddress("2001:db8::1")); } QTEST_MAIN(tst_QDnsLookup) diff --git a/tests/auto/network/kernel/qdnslookup_appless/tst_qdnslookup_appless.cpp b/tests/auto/network/kernel/qdnslookup_appless/tst_qdnslookup_appless.cpp index 4169d30466..84b63c7148 100644 --- a/tests/auto/network/kernel/qdnslookup_appless/tst_qdnslookup_appless.cpp +++ b/tests/auto/network/kernel/qdnslookup_appless/tst_qdnslookup_appless.cpp @@ -56,7 +56,7 @@ private slots: void tst_QDnsLookup_Appless::noApplication() { QTest::ignoreMessage(QtWarningMsg, "QDnsLookup requires a QCoreApplication"); - QDnsLookup dns(QDnsLookup::A, "troll.no"); + QDnsLookup dns(QDnsLookup::A, "a-single.test.macieira.org"); dns.lookup(); } @@ -66,7 +66,7 @@ void tst_QDnsLookup_Appless::recreateApplication() char **argv = 0; for (int i = 0; i < 10; ++i) { QCoreApplication app(argc, argv); - QDnsLookup dns(QDnsLookup::A, "lupinella.troll.no"); + QDnsLookup dns(QDnsLookup::A, "a-single.test.macieira.org"); dns.lookup(); if (!dns.isFinished()) { QObject::connect(&dns, SIGNAL(finished()), @@ -83,7 +83,7 @@ void tst_QDnsLookup_Appless::destroyApplicationDuringLookup() char **argv = 0; for (int i = 0; i < 10; ++i) { QCoreApplication app(argc, argv); - QDnsLookup dns(QDnsLookup::A, "lupinella.troll.no"); + QDnsLookup dns(QDnsLookup::A, "a-single.test.macieira.info"); dns.lookup(); } } diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp index 2c295b5949..ee6ea546f3 100644 --- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp @@ -93,7 +93,7 @@ #include "../../../network-settings.h" -const char * const lupinellaIp = "10.3.4.6"; +#define TEST_DOMAIN ".test.macieira.org" class tst_QHostInfo : public QObject @@ -223,7 +223,7 @@ void tst_QHostInfo::initTestCase() if (res == 0) { // this test worked freeaddrinfo(result); - res = getaddrinfo("ipv6-test.dev.troll.no", "80", &hint, &result); + res = getaddrinfo("aaaa-single" TEST_DOMAIN, "80", &hint, &result); if (res == 0 && result != 0 && result->ai_family != AF_INET) { freeaddrinfo(result); ipv6LookupsAvailable = true; @@ -260,14 +260,14 @@ void tst_QHostInfo::lookupIPv4_data() QTest::newRow("lookup_01") << QtNetworkSettings::serverName() << QtNetworkSettings::serverIP().toString() << int(QHostInfo::NoError); QTest::newRow("empty") << "" << "" << int(QHostInfo::HostNotFound); - QTest::newRow("single_ip4") << "lupinella.troll.no" << lupinellaIp << int(QHostInfo::NoError); - QTest::newRow("multiple_ip4") << "multi.dev.troll.no" << "1.2.3.4 1.2.3.5 10.3.3.31" << int(QHostInfo::NoError); - QTest::newRow("literal_ip4") << lupinellaIp << lupinellaIp << int(QHostInfo::NoError); + QTest::newRow("single_ip4") << "a-single" TEST_DOMAIN << "192.0.2.1" << int(QHostInfo::NoError); + QTest::newRow("multiple_ip4") << "a-multi" TEST_DOMAIN << "192.0.2.1 192.0.2.2 192.0.2.3" << int(QHostInfo::NoError); + QTest::newRow("literal_ip4") << "192.0.2.1" << "192.0.2.1" << int(QHostInfo::NoError); - QTest::newRow("notfound") << "this-name-does-not-exist-hopefully." << "" << int(QHostInfo::HostNotFound); + QTest::newRow("notfound") << "invalid" TEST_DOMAIN << "" << int(QHostInfo::HostNotFound); - QTest::newRow("idn-ace") << "xn--alqualond-34a.troll.no" << "10.3.3.55" << int(QHostInfo::NoError); - QTest::newRow("idn-unicode") << QString::fromLatin1("alqualond\353.troll.no") << "10.3.3.55" << int(QHostInfo::NoError); + QTest::newRow("idn-ace") << "a-single.xn--alqualond-34a" TEST_DOMAIN << "192.0.2.1" << int(QHostInfo::NoError); + QTest::newRow("idn-unicode") << QString::fromLatin1("a-single.alqualond\353" TEST_DOMAIN) << "192.0.2.1" << int(QHostInfo::NoError); } void tst_QHostInfo::lookupIPv4() @@ -305,11 +305,9 @@ void tst_QHostInfo::lookupIPv6_data() QTest::addColumn<QString>("addresses"); QTest::addColumn<int>("err"); - QTest::newRow("ipv6-net") << "www.ipv6-net.org" << "62.93.217.177 2001:618:1401::4" << int(QHostInfo::NoError); - QTest::newRow("ipv6-test") << "ipv6-test.dev.troll.no" << "2001:638:a00:2::2" << int(QHostInfo::NoError); - QTest::newRow("dns6-test") << "dns6-test-dev.troll.no" << "2001:470:1f01:115::10" << int(QHostInfo::NoError); - QTest::newRow("multi-dns6") << "multi-dns6-test-dev.troll.no" << "2001:470:1f01:115::11 2001:470:1f01:115::12" << int(QHostInfo::NoError); - QTest::newRow("dns46-test") << "dns46-test-dev.troll.no" << "10.3.4.90 2001:470:1f01:115::13" << int(QHostInfo::NoError); + QTest::newRow("aaaa-single") << "aaaa-single" TEST_DOMAIN << "2001:db8::1" << int(QHostInfo::NoError); + QTest::newRow("aaaa-multi") << "aaaa-multi" TEST_DOMAIN << "2001:db8::1 2001:db8::2 2001:db8::3" << int(QHostInfo::NoError); + QTest::newRow("a-plus-aaaa") << "a-plus-aaaa" TEST_DOMAIN << "198.51.100.1 2001:db8::1:1" << int(QHostInfo::NoError); // avoid using real IPv6 addresses here because this will do a DNS query // real addresses are between 2000:: and 3fff:ffff:ffff:ffff:ffff:ffff:ffff @@ -415,7 +413,7 @@ void tst_QHostInfo::raceCondition() { for (int i = 0; i < 1000; ++i) { QTcpSocket socket; - socket.connectToHost("notavalidname.troll.no", 80); + socket.connectToHost("invalid" TEST_DOMAIN, 80); } } @@ -424,10 +422,10 @@ class LookupThread : public QThread protected: inline void run() { - QHostInfo info = QHostInfo::fromName("qt-project.org"); + QHostInfo info = QHostInfo::fromName("a-single" TEST_DOMAIN); QCOMPARE(info.error(), QHostInfo::NoError); QVERIFY(info.addresses().count() > 0); - QCOMPARE(info.addresses().at(0).toString(), QString("87.238.53.172")); + QCOMPARE(info.addresses().at(0).toString(), QString("192.0.2.1")); } }; @@ -462,7 +460,7 @@ public: void LookupReceiver::start() { for (int i=0;i<numrequests;i++) - QHostInfo::lookupHost(QString("qt-project.org"), this, SLOT(resultsReady(QHostInfo))); + QHostInfo::lookupHost(QString("a-single" TEST_DOMAIN), this, SLOT(resultsReady(QHostInfo))); } void LookupReceiver::resultsReady(const QHostInfo &info) @@ -493,7 +491,7 @@ void tst_QHostInfo::threadSafetyAsynchronousAPI() QVERIFY(threads.at(k)->wait(60000)); foreach (LookupReceiver* receiver, receivers) { QCOMPARE(receiver->result.error(), QHostInfo::NoError); - QCOMPARE(receiver->result.addresses().at(0).toString(), QString("87.238.53.172")); + QCOMPARE(receiver->result.addresses().at(0).toString(), QString("192.0.2.1")); QCOMPARE(receiver->numrequests, 0); } } @@ -530,9 +528,15 @@ void tst_QHostInfo::multipleDifferentLookups_data() void tst_QHostInfo::multipleDifferentLookups() { QStringList hostnameList; - hostnameList << "www.ovi.com" << "www.nokia.com" << "qt-project.org" << "www.trolltech.com" << "troll.no" - << "www.qtcentre.org" << "forum.nokia.com" << "www.nokia.com" << "wiki.forum.nokia.com" - << "www.nokia.com" << "nokia.de" << "127.0.0.1" << "----"; + hostnameList << "a-single" TEST_DOMAIN + << "a-multi" TEST_DOMAIN + << "aaaa-single" TEST_DOMAIN + << "aaaa-multi" TEST_DOMAIN + << "a-plus-aaaa" TEST_DOMAIN + << "multi" TEST_DOMAIN + << "localhost" TEST_DOMAIN + << "cname" TEST_DOMAIN + << "127.0.0.1" << "----"; QFETCH(int, repeats); const int COUNT = hostnameList.size(); @@ -604,7 +608,7 @@ void tst_QHostInfo::abortHostLookup() lookupsDoneCounter = 0; bool valid = false; int id = -1; - QHostInfo result = qt_qhostinfo_lookup("qt-project.org", this, SLOT(resultsReady(QHostInfo)), &valid, &id); + QHostInfo result = qt_qhostinfo_lookup("a-single" TEST_DOMAIN, this, SLOT(resultsReady(QHostInfo)), &valid, &id); QVERIFY(!valid); //it is assumed that the DNS request/response in the backend is slower than it takes to call abort QHostInfo::abortHostLookup(id); @@ -631,7 +635,7 @@ void tst_QHostInfo::abortHostLookupInDifferentThread() lookupsDoneCounter = 0; bool valid = false; int id = -1; - QHostInfo result = qt_qhostinfo_lookup("qt-project.org", this, SLOT(resultsReady(QHostInfo)), &valid, &id); + QHostInfo result = qt_qhostinfo_lookup("a-single" TEST_DOMAIN, this, SLOT(resultsReady(QHostInfo)), &valid, &id); QVERIFY(!valid); QThread thread; LookupAborter aborter; diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index d1e6693608..e7450fdd2c 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -1184,7 +1184,12 @@ void tst_QMenuBar::task256322_highlight() QTest::mouseMove(win.menuBar(), nothingCenter); QTRY_VERIFY(!menu2.isVisible()); QVERIFY(!menu.isVisible()); - QCOMPARE(win.menuBar()->activeAction(), nothing); + QAction *activeAction = win.menuBar()->activeAction(); +#ifdef Q_OS_MAC + if ((QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) && (activeAction != nothing)) + QEXPECT_FAIL("", "QTBUG-30565: Unstable test", Continue); +#endif + QCOMPARE(activeAction, nothing); QTest::mouseRelease(win.menuBar(), Qt::LeftButton, 0, nothingCenter); } |