diff --git a/coin/instructions/common_environment.yaml b/coin/instructions/common_environment.yaml index 06f1c75b5e2..a18a1323ee9 100644 --- a/coin/instructions/common_environment.yaml +++ b/coin/instructions/common_environment.yaml @@ -1,5 +1,14 @@ type: Group instructions: + - type: Group + instructions: + - type: EnvironmentVariable + variableName: QTC_QT_BASE_URL + variableValue: "http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/archive/qt/6.1/6.1.0-beta3-released" + - type: EnvironmentVariable + variableName: QTC_QT_MODULES + variableValue: "qt5compat qtbase qtdeclarative qtimageformats qtquick3d qtquickcontrols2 qtquicktimeline qtserialport qtshadertools qtsvg qttools qttranslations" + - type: Group enable_if: condition: property @@ -73,5 +82,3 @@ instructions: condition: property property: host.os in_values: [Linux, MacOS] - - diff --git a/coin/instructions/qmake_module_build.yaml b/coin/instructions/qmake_module_build.yaml index 55751de8027..d5db49ac2bd 100644 --- a/coin/instructions/qmake_module_build.yaml +++ b/coin/instructions/qmake_module_build.yaml @@ -32,7 +32,8 @@ instructions: property: host.os in_values: [MacOS, Linux, Windows] - type: ExecuteCommand - command: "python -u /home/qt/work/build/qtsdk/packaging-tools/install_qt.py --qt-path /home/qt/work/build/qt5_install_dir --temp-path /home/qt/work/build/qt_temp --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qt5compat/qt5compat-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtbase/qtbase-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtdeclarative/qtdeclarative-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtgraphicaleffects/qtgraphicaleffects-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtimageformats/qtimageformats-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtlocation/qtlocation-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtmacextras/qtmacextras-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtquick3d/qtquick3d-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtquickcontrols/qtquickcontrols-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtquickcontrols2/qtquickcontrols2-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtquicktimeline/qtquicktimeline-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtscript/qtscript-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtserialport/qtserialport-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtshadertools/qtshadertools-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtsvg/qtsvg-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qttools/qttools-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qttranslations/qttranslations-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtx11extras/qtx11extras-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtxmlpatterns/qtxmlpatterns-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --qt-module file:///home/qt/work/build/downloads/qtdocumentation/qt-everywhere-documentation.7z --icu7z http://master.qt.io/development_releases/prebuilt/icu/prebuilt/56.1/icu-linux-g++-Rhel7.2-x64.7z" + command: "python -u {{.AgentWorkingDir}}/build/qtsdk/packaging-tools/install_qt.py --qt-path {{.AgentWorkingDir}}/build/qt5_install_dir --temp-path {{.AgentWorkingDir}}/build/qt_temp --base-url {{.Env.QTC_QT_BASE_URL}} --base-url-postfix=-Linux-CentOS_8_3-GCC-Linux-CentOS_8_3-X86_64.7z --icu7z http://master.qt.io/development_releases/prebuilt/icu/prebuilt/56.1/icu-linux-g++-Rhel7.2-x64.7z {{.Env.QTC_QT_MODULES}}" + executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution maxTimeInSeconds: 3600 maxTimeBetweenOutput: 360 userMessageOnFailure: "Failed to install qt, check logs." @@ -41,7 +42,8 @@ instructions: property: host.os equals_value: Linux - type: ExecuteCommand - command: "python -u /Users/qt/work/build/qtsdk/packaging-tools/install_qt.py --qt-path /Users/qt/work/build/qt5_install_dir --temp-path /Users/qt/work/build/qt_temp --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qt5compat/qt5compat-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtbase/qtbase-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtdeclarative/qtdeclarative-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtgraphicaleffects/qtgraphicaleffects-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtimageformats/qtimageformats-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtlocation/qtlocation-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtmacextras/qtmacextras-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtquick3d/qtquick3d-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtquickcontrols/qtquickcontrols-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtquickcontrols2/qtquickcontrols2-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtquicktimeline/qtquicktimeline-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtscript/qtscript-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtserialport/qtserialport-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtshadertools/qtshadertools-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtsvg/qtsvg-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qttools/qttools-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qttranslations/qttranslations-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtx11extras/qtx11extras-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtxmlpatterns/qtxmlpatterns-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z --qt-module file:///Users/qt/work/build/downloads/qtdocumentation/qt-everywhere-documentation.7z" + command: "python -u {{.AgentWorkingDir}}/build/qtsdk/packaging-tools/install_qt.py --qt-path {{.AgentWorkingDir}}/build/qt5_install_dir --temp-path {{.AgentWorkingDir}}/build/qt_temp --base-url {{.Env.QTC_QT_BASE_URL}} --base-url-postfix=-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64.7z {{.Env.QTC_QT_MODULES}}" + executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution maxTimeInSeconds: 3600 maxTimeBetweenOutput: 360 userMessageOnFailure: "Failed to install qt, check logs." @@ -59,7 +61,8 @@ instructions: property: host.os equals_value: Windows - type: ExecuteCommand - command: "python -u {{.AgentWorkingDir}}\\build\\qtsdk\\packaging-tools\\install_qt.py --qt-path {{.AgentWorkingDir}}\\build\\qt5_install_dir --temp-path {{.AgentWorkingDir}}\\build\\qt_temp --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qt5compat/qt5compat-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtbase/qtbase-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtdeclarative/qtdeclarative-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtgraphicaleffects/qtgraphicaleffects-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtimageformats/qtimageformats-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtlocation/qtlocation-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtmacextras/qtmacextras-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtquick3d/qtquick3d-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtquickcontrols/qtquickcontrols-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtquickcontrols2/qtquickcontrols2-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtquicktimeline/qtquicktimeline-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtscript/qtscript-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtserialport/qtserialport-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtshadertools/qtshadertools-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtsvg/qtsvg-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qttools/qttools-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qttranslations/qttranslations-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtx11extras/qtx11extras-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z --qt-module http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/qt/6.1.0/release_content//qtxmlpatterns/qtxmlpatterns-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z" + command: "python -u {{.AgentWorkingDir}}/build/qtsdk/packaging-tools/install_qt.py --qt-path {{.AgentWorkingDir}}/build/qt5_install_dir --temp-path {{.AgentWorkingDir}}/build/qt_temp --base-url {{.Env.QTC_QT_BASE_URL}} --base-url-postfix=-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z {{.Env.QTC_QT_MODULES}}" + executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution maxTimeInSeconds: 3600 maxTimeBetweenOutput: 360 userMessageOnFailure: "Failed to install qt, check logs." diff --git a/doc/qtcreator/images/qtcreator-kit-webassembly.png b/doc/qtcreator/images/qtcreator-kit-webassembly.png index d37450d245d..4f4e316f555 100644 Binary files a/doc/qtcreator/images/qtcreator-kit-webassembly.png and b/doc/qtcreator/images/qtcreator-kit-webassembly.png differ diff --git a/doc/qtcreator/images/qtcreator-webassembly-options.png b/doc/qtcreator/images/qtcreator-webassembly-options.png new file mode 100644 index 00000000000..73da8e34478 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-webassembly-options.png differ diff --git a/doc/qtcreator/src/qtquick/qtquick-timeline-view.qdoc b/doc/qtcreator/src/qtquick/qtquick-timeline-view.qdoc index a9fd2855058..0084125fc67 100644 --- a/doc/qtcreator/src/qtquick/qtquick-timeline-view.qdoc +++ b/doc/qtcreator/src/qtquick/qtquick-timeline-view.qdoc @@ -38,9 +38,9 @@ \image studio-timeline-empty.png "Empty Timeline view" Select the \inlineimage plus.png - (\uicontrol {Add Timeline (A)}) button, or press \key {A} to - \l{Creating Timelines}{create a timeline} and specify settings - for it in the \uicontrol {Timeline Settings} dialog. + (\uicontrol {Add Timeline}) button to \l{Creating Timelines} + {create a timeline} and specify settings for it in the + \uicontrol {Timeline Settings} dialog. \image studio-timeline-settings.png "Timeline Settings dialog" diff --git a/doc/qtcreator/src/qtquick/qtquick-timeline.qdoc b/doc/qtcreator/src/qtquick/qtquick-timeline.qdoc index 418a68cad63..156d15be92b 100644 --- a/doc/qtcreator/src/qtquick/qtquick-timeline.qdoc +++ b/doc/qtcreator/src/qtquick/qtquick-timeline.qdoc @@ -96,8 +96,8 @@ \list 1 \li In the \l Timeline view, select the \inlineimage plus.png - (\uicontrol {Add Timeline (A)}) button, or press \key {A} to - specify settings for the timeline and running the animation + (\uicontrol {Add Timeline}) button to specify settings + for the timeline and running the animation in the \uicontrol {Timeline Settings} dialog. \li In the \uicontrol {Timeline ID} field, enter an ID that describes the animated component. diff --git a/doc/qtcreator/src/webassembly/creator-webassembly.qdoc b/doc/qtcreator/src/webassembly/creator-webassembly.qdoc index 1e2fdc17571..9b1a84e1b9d 100644 --- a/doc/qtcreator/src/webassembly/creator-webassembly.qdoc +++ b/doc/qtcreator/src/webassembly/creator-webassembly.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Creator documentation. @@ -40,7 +40,8 @@ The experimental WebAssembly plugin enables you to build your applications in WebAssembly format and deploy and run them in the local web browser. - You can change the web browser in the project run settings. + You can change the web browser in the project's \l{Specifying Run Settings} + {run settings}. To build applications for the web and run them in a web browser, you need to install Qt for WebAssembly and the tool chain for compiling to WebAssembly. @@ -51,17 +52,12 @@ them in a browser: \list - \li Qt for WebAssembly 5.13.1, or later + \li Qt for WebAssembly 5.15, or later \li On Windows: \l{http://wiki.qt.io/MinGW}{\MinGW} 7.3.0, or later \li \l{https://emscripten.org/docs/introducing_emscripten/index.html} {emscripten} tool chain for compiling to WebAssembly - \li \c sed stream editor \endlist - \note You need to add the location of the \MinGW and \c sed installation - folders to the system path, either globally or for the Qt for WebAssembly - kit. - \section1 Setting Up the Development Environment You need to install and configure Qt for WebAssembly and the tool chain for @@ -75,15 +71,11 @@ \list 1 \li Use the Qt maintenance tool to install Qt for WebAssembly and, on Windows, \MinGW (found in \uicontrol {Developer and Designer Tools}). - \li Check out \c emsdk and install and activate \c emscripten, as - instructed in \l {Qt for WebAssembly}. - \note Do not use the \c{--embedded} option for activating the - \c emscripten version in the \c emsdk, because \QC - expects to find the \c{.emscripten} file describing the toolchain in - your home directory. - \li On Windows, you have to download and install \c sed, as instructed - in \l{http://gnuwin32.sourceforge.net/packages/sed.htm} - {sed for Windows}. + \li Check out a known-good Emscripten version supported by the Qt for + WebAssembly version that you installed, and install and activate + \c emscripten, as instructed in + \l {https://doc.qt.io/qt-5/wasm.html#install-emscripten} + {Install Emscripten}. \endlist \section2 Enabling the WebAssembly Plugin @@ -101,17 +93,19 @@ To configure \QC for building Qt apps for the web: \list 1 + \li Select \uicontrol Tools > \uicontrol Options > \uicontrol Devices > + \uicontrol WebAssembly. + \li In the \uicontrol {Emscripten SDK path} field, enter the root + directory where \c emsdk is installed. + \li \QC configures the \uicontrol {Emscripten SDK environment} for you + if the \c emsdk is supported by the Qt for WebAssembly version that + you will use for developing the application. + \image qtcreator-webassembly-options.png "Qt for WebAssembly device options" \li Select \uicontrol Tools > \uicontrol Options > \uicontrol Kits. \image qtcreator-kit-webassembly.png "Qt for WebAssembly kit" \li In the \uicontrol Compiler group, \uicontrol {Emscripten Compiler} should have been automatically detected for both C++ and C. If not, - check that emscripten is set up correctly and your home directory - contains an \c{.emscripten} file. - \li Select \uicontrol Change next to the \uicontrol Environment - field to append the locations where you installed \MinGW and - \c sed to the PATH variable. For example, on Windows: - \c {PATH=C:\Qt\Tools\mingw730_64\bin;C:\Program Files (x86)\GnuWin32\bin;${PATH}} - \li Select \uicontrol Apply to save the changes to the kit. + check that emscripten is set up correctly. \endlist \section2 Adding WebAssembly Kits @@ -129,9 +123,6 @@ set to \uicontrol {Web Browser}. \li In the \uicontrol Compiler field, select \uicontrol {Emscripten Compiler} for both C and C++. - \li Select \uicontrol Change next to the \uicontrol Environment - field to append the locations where you installed \MinGW and - \c sed to the PATH variable. \li Select \uicontrol Apply to add the kit. \endlist @@ -144,8 +135,8 @@ \li Select \uicontrol Projects > \uicontrol {Build & Run}, and then select the WebAssembly kit as the build and run kit for the project. \li Select \uicontrol Run to specify run settings. - \li In the \uicontrol Browser field, select the browser to run the - application in. + \li In the \uicontrol {Web browser} field, select the browser to run + the application in. \image qtcreator-settings-run-webassembly.png "Selecting the browser to run in" \endlist diff --git a/doc/qtdesignstudio/images/qt-bridge-clone.png b/doc/qtdesignstudio/images/qt-bridge-clone.png new file mode 100644 index 00000000000..09946e22a4d Binary files /dev/null and b/doc/qtdesignstudio/images/qt-bridge-clone.png differ diff --git a/doc/qtdesignstudio/images/qt-bridge-import-warning.png b/doc/qtdesignstudio/images/qt-bridge-import-warning.png index 8f037ca2630..bb1dc846b36 100644 Binary files a/doc/qtdesignstudio/images/qt-bridge-import-warning.png and b/doc/qtdesignstudio/images/qt-bridge-import-warning.png differ diff --git a/doc/qtdesignstudio/images/qt-bridge-import.png b/doc/qtdesignstudio/images/qt-bridge-import.png index f438beb3c2c..4f07304fcb0 100644 Binary files a/doc/qtdesignstudio/images/qt-bridge-import.png and b/doc/qtdesignstudio/images/qt-bridge-import.png differ diff --git a/doc/qtdesignstudio/images/qt-bridge-override.png b/doc/qtdesignstudio/images/qt-bridge-override.png index 86e045278b5..daf4922f93a 100644 Binary files a/doc/qtdesignstudio/images/qt-bridge-override.png and b/doc/qtdesignstudio/images/qt-bridge-override.png differ diff --git a/doc/qtdesignstudio/images/qt-bridge-sanitize.png b/doc/qtdesignstudio/images/qt-bridge-sanitize.png index 474472e7855..bcc874f13de 100644 Binary files a/doc/qtdesignstudio/images/qt-bridge-sanitize.png and b/doc/qtdesignstudio/images/qt-bridge-sanitize.png differ diff --git a/doc/qtdesignstudio/images/qt-bridge.png b/doc/qtdesignstudio/images/qt-bridge.png index 011ae971b3d..9638e188d2d 100644 Binary files a/doc/qtdesignstudio/images/qt-bridge.png and b/doc/qtdesignstudio/images/qt-bridge.png differ diff --git a/doc/qtdesignstudio/src/qtbridge/qtbridge-ps-using.qdoc b/doc/qtdesignstudio/src/qtbridge/qtbridge-ps-using.qdoc index a9cc81718af..8aa9c9a3c9c 100644 --- a/doc/qtdesignstudio/src/qtbridge/qtbridge-ps-using.qdoc +++ b/doc/qtdesignstudio/src/qtbridge/qtbridge-ps-using.qdoc @@ -204,6 +204,27 @@ You can now create a project in \QDS and import the assets to it, as described in \l {Creating Projects} and \l{Importing Designs}. + \section1 Cloning Documents + + \QBPS enables creating a clone of the current document. The clone workflow + allows the user to filter out certain kind of layers and groups. In the \QBPS + \uicontrol Settings dialog, select \uicontrol {Clone} to start cloning the document. + + \image qt-bridge-clone.png + + \section2 Clone Options + The following exclusion options can be selected to exclude certain kind of layers and + groups in the cloned document: + \list + \li \uicontrol Invisible: Select this option to exclude the invisible layers + and groups. + \li \uicontrol Skipped: Select this option to exclude the layers where the + \uicontrol {Export As} field value is set to \uicontrol Skipped. + \li \uicontrol {Empty Groups}: Select this option to exclude any empty groups. + This also applies to groups which will eventually become empty because of + the other selected exclusion options. + \endlist + \section1 Sanitizing Documents \QBPS enables removing all \QBPS related metadata from the active diff --git a/share/qtcreator/qmldesigner/qt4mcu/metadata.qml b/share/qtcreator/qmldesigner/qt4mcu/metadata.qml index 09afa0c88fe..20ddf65da7c 100644 --- a/share/qtcreator/qmldesigner/qt4mcu/metadata.qml +++ b/share/qtcreator/qmldesigner/qt4mcu/metadata.qml @@ -27,7 +27,7 @@ Metadata { id: metadataFile - defaultVersion: v17 + defaultVersion: v18 VersionData { id: v14 @@ -40,4 +40,10 @@ Metadata { name: "QUL 1.7" path: "qul-17.qml" } + + VersionData { + id: v18 + name: "QUL 1.8" + path: "qul-18.qml" + } } diff --git a/share/qtcreator/qmldesigner/qt4mcu/qul-18.qml b/share/qtcreator/qmldesigner/qt4mcu/qul-18.qml new file mode 100644 index 00000000000..b65084451b8 --- /dev/null +++ b/share/qtcreator/qmldesigner/qt4mcu/qul-18.qml @@ -0,0 +1,211 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +VersionData { + name: "QUL 1.8" + + bannedItems: ["QtQuick.AnimatedImage", + "QtQuick.FocusScope", + "QtQuick.TextInput", + "QtQuick.TextEdit", + "QtQuick.Flow", + "QtQuick.Grid", + "QtQuick.GridView", + "QtQuick.PathView", + "QtQuick.Controls", + "QtQuick.Controls.BusyIndicator", + "QtQuick.Controls.ButtonGroup", + "QtQuick.Controls.CheckDelegate", + "QtQuick.Controls.Container", + "QtQuick.Controls.ComboBox", + "QtQuick.Controls.DelayButton", + "QtQuick.Controls.Frame", + "QtQuick.Controls.GroupBox", + "QtQuick.Controls.ItemDelegate", + "QtQuick.Controls.Label", + "QtQuick.Controls.Page", + "QtQuick.Controls.PageIndicator", + "QtQuick.Controls.Pane", + "QtQuick.Controls.RadioDelegate", + "QtQuick.Controls.RangeSlider", + "QtQuick.Controls.RoundButton", + "QtQuick.Controls.ScrollView", + "QtQuick.Controls.SpinBox", + "QtQuick.Controls.StackView", + "QtQuick.Controls.SwipeDelegate", + "QtQuick.Controls.SwitchDelegate", + "QtQuick.Controls.ToolBar", + "QtQuick.Controls.ToolButton", + "QtQuick.Controls.TabBar", + "QtQuick.Controls.TabButton", + "QtQuick.Controls.TextArea", + "QtQuick.Controls.TextField", + "QtQuick.Controls.ToolSeparator", + "QtQuick.Controls.Tumbler"] + + allowedImports: ["QtQuick", + "QtQuick.Shapes", + "QtQuick.Controls", + "QtQuick.Timeline", + "QtQuickUltralite.Extras", + "QtQuickUltralite.Layers"] + + bannedImports: ["FlowView"] + + //ComplexProperty is not a type, it's just a way to handle bigger props + ComplexProperty { + prefix: "font" + bannedProperties: ["wordSpacing", "letterSpacing", "hintingPreference", + "kerning", "preferShaping", "capitalization", + "strikeout", "underline", "styleName"] + } + + QtQuick.Item { + bannedProperties: ["layer", "opacity", "gradient", "smooth", "antialiasing", + "border", "baselineOffset", "focus", "activeFocusOnTab", + "rotation", "scale", "transformOrigin"] + } + + QtQuick.Flickable { + bannedProperties: ["boundsBehavior", "boundsMovement", "flickDeceleration", + "flickableDirection", "leftMargin", "rightMargin", "bottomMargin", "topMargin", + "originX", "originY", "pixelAligned", "pressDelay", "synchronousDrag"] + } + + QtQuick.MouseArea { + bannedProperties: ["propagateComposedEvents", "preventStealing", "cursorShape", + "scrollGestureEnabled", "drag", "acceptedButtons", "hoverEnabled"] + } + + QtQuick.Image { + allowChildren: false + allowedProperties: ["rotation", "scale", "transformOrigin"] + bannedProperties: ["mirror", "mipmap", "cache", "autoTransform", "asynchronous", + "sourceSize", "smooth"] + } + + QtQuick.BorderImage { + bannedProperties: ["asynchronous", "cache", "currentFrame", "frameCount", + "horizontalTileMode", "mirror", "progress", "smooth", "sourceSize", + "status", "verticalTileMode"] + } + + QtQuick.Text { + allowChildren: false + allowedProperties: ["rotation", "scale", "transformOrigin"] + bannedProperties: ["elide", "lineHeight", "lineHeightMode", "wrapMode", "style", + "styleColor", "minimumPointSize", "minimumPixelSize", "styleColor", + "fontSizeMode", "renderType", "textFormat", "maximumLineCount"] + } + + //Padding is not an actual item, but rather set of properties in Text + Padding { + bannedProperties: ["bottomPadding", "topPadding", "leftPadding", "rightPadding"] + } + + QtQuick.Column { + bannedProperties: ["layoutDirection"] + } + + QtQuick.Row { + bannedProperties: ["layoutDirection"] + } + + QtQuick.ListView { + bannedProperties: ["cacheBuffer", "highlightRangeMode", "highlightMoveDuration", + "highlightResizeDuration", "preferredHighlightBegin", "layoutDirection", + "preferredHighlightEnd", "highlightFollowsCurrentItem", "keyNavigationWraps", + "snapMode", "highlightMoveVelocity", "highlightResizeVelocity"] + } + + QtQuick.Animation { + bannedProperties: ["paused"] + } + + //Quick Controls2 Items and properties: + + QtQuick.Controls.Control { + bannedProperties: ["focusPolicy", "hoverEnabled", "wheelEnabled"] + } + + QtQuick.Controls.AbstractButton { + bannedProperties: ["display", "autoExclusive"] + } + + QtQuick.Controls.ProgressBar { + bannedProperties: ["indeterminate"] + } + + QtQuick.Controls.Slider { + bannedProperties: ["live", "snapMode", "touchDragThreshold"] + } + + //Path and Shapes related: + + QtQuick.Path { + bannedProperties: ["scale", "pathElements"] + } + + QtQuick.PathArc { + bannedProperties: ["relativeX", "relativeY"] + } + + QtQuick.PathLine { + bannedProperties: ["relativeX", "relativeY"] + } + + QtQuick.PathMove { + bannedProperties: ["relativeX", "relativeY"] + } + + QtQuick.PathQuad { + bannedProperties: ["relativeX", "relativeY", + "relativeControlX", "relativeControlY"] + } + + QtQuick.PathCubic { + bannedProperties: ["relativeX", "relativeY", + "relativeControl1X", "relativeControl1Y", + "relativeControl2X", "relativeControl2Y"] + } + + QtQuick.PathElement { + //nothing + } + + QtQuick.PathSvg { + //nothing + } + + QtQuick.Shapes.Shape { + bannedProperties: ["asynchronous", "containsMode", "data", + "renderType", "status", "vendorExtensionsEnabled"] + } + + QtQuick.Shapes.ShapePath { + bannedProperties: ["dashOffset", "dashPattern", + "fillGradient", "strokeStyle"] + } +} diff --git a/src/libs/utils/qtcolorbutton.h b/src/libs/utils/qtcolorbutton.h index bc6c9bad398..13f4bf2308b 100644 --- a/src/libs/utils/qtcolorbutton.h +++ b/src/libs/utils/qtcolorbutton.h @@ -68,7 +68,7 @@ protected: void dragLeaveEvent(QDragLeaveEvent *event) override; void dropEvent(QDropEvent *event) override; #endif - +private: class QtColorButtonPrivate *d_ptr; friend class QtColorButtonPrivate; }; diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp index c626f4baa59..df157b9cad3 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp @@ -374,6 +374,11 @@ void DesignDocument::updateSubcomponentManager() currentModel()->imports() + currentModel()->possibleImports()); } +void DesignDocument::updateSubcomponentManagerImport(const Import &import) +{ + m_subComponentManager->updateImport(import); +} + void DesignDocument::deleteSelected() { if (!currentModel()) diff --git a/src/plugins/qmldesigner/components/integration/designdocument.h b/src/plugins/qmldesigner/components/integration/designdocument.h index 60a0f3f11a1..2f333430750 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.h +++ b/src/plugins/qmldesigner/components/integration/designdocument.h @@ -69,6 +69,7 @@ public: void attachRewriterToModel(); void close(); void updateSubcomponentManager(); + void updateSubcomponentManagerImport(const Import &import); bool isUndoAvailable() const; bool isRedoAvailable() const; diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp index 5b59284663e..28444490eac 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp @@ -292,6 +292,7 @@ void ItemLibraryWidget::handleAddImport(int index) } m_model->changeImports({import}, {}); + QmlDesignerPlugin::instance()->currentDesignDocument()->updateSubcomponentManagerImport(import); m_stackedWidget->setCurrentIndex(0); // switch to the Components view after import is added updateSearch(); diff --git a/src/plugins/qmldesigner/designercore/include/subcomponentmanager.h b/src/plugins/qmldesigner/designercore/include/subcomponentmanager.h index 674f7dff494..fe9daf24192 100644 --- a/src/plugins/qmldesigner/designercore/include/subcomponentmanager.h +++ b/src/plugins/qmldesigner/designercore/include/subcomponentmanager.h @@ -48,6 +48,7 @@ public: explicit SubComponentManager(Model *model, QObject *parent = nullptr); void update(const QUrl &fileUrl, const QList &imports); + void updateImport(const Import &import); QStringList qmlFiles() const; QStringList directories() const; @@ -57,8 +58,8 @@ private: // functions void parseFile(const QString &canonicalFilePath, bool addToLibrary, const QString&); void parseFile(const QString &canonicalFilePath); - void addImport(int pos, const Import &import); - void removeImport(int pos); + void addImport(const Import &import, int index = -1); + void removeImport(int index); void parseDirectories(); QFileInfoList watchedFiles(const QString &canonicalDirPath); void unregisterQmlFile(const QFileInfo &fileInfo, const QString &qualifier); diff --git a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp index 876bf27074b..8ad09c25815 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp @@ -69,10 +69,10 @@ SubComponentManager::SubComponentManager(Model *model, QObject *parent) this, [this](const QString &path) { parseDirectory(path); }); } -void SubComponentManager::addImport(int pos, const Import &import) +void SubComponentManager::addImport(const Import &import, int index) { if (debug) - qDebug() << Q_FUNC_INFO << pos << import.file().toUtf8(); + qDebug() << Q_FUNC_INFO << index << import.file().toUtf8(); if (import.isFileImport()) { QFileInfo dirInfo = QFileInfo(m_filePath.resolved(import.file()).toLocalFile()); @@ -97,12 +97,15 @@ void SubComponentManager::addImport(int pos, const Import &import) // TODO: QDeclarativeDomImport::Library } - m_imports.insert(pos, import); + if (index == -1) + m_imports.append(import); + else + m_imports.insert(index, import); } -void SubComponentManager::removeImport(int pos) +void SubComponentManager::removeImport(int index) { - const Import import = m_imports.takeAt(pos); + const Import import = m_imports.takeAt(index); if (import.isFileImport()) { const QFileInfo dirInfo = QFileInfo(m_filePath.resolved(import.file()).toLocalFile()); @@ -499,7 +502,7 @@ void SubComponentManager::update(const QUrl &filePath, const QList &impo removeImport(ii); for (int ii = i; ii < imports.size(); ++ii) { - addImport(ii, imports.at(ii)); + addImport(imports.at(ii), ii); } const QString newPath = newDir.absoluteFilePath(); @@ -513,5 +516,42 @@ void SubComponentManager::update(const QUrl &filePath, const QList &impo parseDirectories(); } +void SubComponentManager::updateImport(const Import &import) +{ + addImport(import); + + if (import.isFileImport()) { + QFileInfo dirInfo = QFileInfo(m_filePath.resolved(import.file()).toLocalFile()); + if (dirInfo.exists() && dirInfo.isDir()) + parseDirectory(dirInfo.canonicalFilePath(), true, dirInfo.baseName().toUtf8()); + } else { + QString url = import.url(); + url.replace('.', '/'); + QFileInfo dirInfo = QFileInfo(url); + const QStringList importPathList = importPaths(); + bool parsed = false; + for (const QString &path : importPathList) { + QString fullUrl = path + '/' + url; + dirInfo = QFileInfo(fullUrl); + + if (dirInfo.exists() && dirInfo.isDir()) { + parseDirectory(dirInfo.canonicalFilePath(), false); + parsed = true; + } + + QString fullUrlVersion = path + '/' + url + '.' + import.version().split('.').constFirst(); + dirInfo = QFileInfo(fullUrlVersion); + + if (dirInfo.exists() && dirInfo.isDir()) { + parseDirectory(dirInfo.canonicalFilePath(), false); + parsed = true; + } + + if (parsed) + break; + } + } +} + } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/designercore/model/modelnode.cpp b/src/plugins/qmldesigner/designercore/model/modelnode.cpp index ee3c863ac0d..f196f5ca406 100644 --- a/src/plugins/qmldesigner/designercore/model/modelnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/modelnode.cpp @@ -151,36 +151,14 @@ QString ModelNode::validId() static bool idIsQmlKeyWord(const QString& id) { - static const QSet keywords = { - "as", - "break", - "case", - "catch", - "continue", - "debugger", - "default", - "delete", - "do", - "else", - "finally", - "for", - "function", - "if", - "import", - "in", - "instanceof", - "new", - "return", - "switch", - "this", - "throw", - "try", - "typeof", - "var", - "void", - "while", - "with" - }; + static const QSet keywords = {"as", "break", "case", "catch", + "continue", "debugger", "default", "delete", + "do", "else", "finally", "for", + "function", "if", "import", "in", + "instanceof", "new", "print", "return", + "switch", "this", "throw", "try", + "typeof", "var", "void", "while", + "with"}; return keywords.contains(id); } diff --git a/src/plugins/qmlpreview/CMakeLists.txt b/src/plugins/qmlpreview/CMakeLists.txt index 00bda33ab0b..6e2dbc4238f 100644 --- a/src/plugins/qmlpreview/CMakeLists.txt +++ b/src/plugins/qmlpreview/CMakeLists.txt @@ -1,3 +1,5 @@ +find_package(Qt5 COMPONENTS QmlDebug REQUIRED) + add_qtc_plugin(QmlPreview DEPENDS QmlDebug QmlJS PLUGIN_DEPENDS Core ProjectExplorer QmlJSTools QtSupport ResourceEditor QmlProjectManager @@ -9,8 +11,6 @@ add_qtc_plugin(QmlPreview qmlpreviewruncontrol.cpp qmlpreviewruncontrol.h qmldebugtranslationclient.cpp qmldebugtranslationclient.h qmlpreview_global.h - projectfileselectionswidget.cpp projectfileselectionswidget.h - qmldebugtranslationwidget.cpp qmldebugtranslationwidget.h ) extend_qtc_plugin(QmlPreview @@ -19,3 +19,21 @@ extend_qtc_plugin(QmlPreview tests/qmlpreviewclient_test.cpp tests/qmlpreviewclient_test.h tests/qmlpreviewplugin_test.cpp tests/qmlpreviewplugin_test.h ) + +# check if Qt version have_qml_debug_translation_protocol +# will be introduced in Qt 6.2, but there are users +# who needs it in older but special built Qt versions aswell +string(REGEX MATCH "^[0-9]*" QT_VERSION_MAJOR ${Qt5_VERSION}) +get_target_property(qmldebugprivate_include_directories + Qt${QT_VERSION_MAJOR}::QmlDebugPrivate + INTERFACE_INCLUDE_DIRECTORIES +) +find_file(have_qml_debug_translation_protocol + NAMES private/qqmldebugtranslationprotocol_p.h + PATHS ${qmldebugprivate_include_directories} +) +extend_qtc_plugin(QmlPreview + CONDITION have_qml_debug_translation_protocol + PUBLIC_DEPENDS Qt5::QmlDebugPrivate + PUBLIC_DEFINES "FOUND_QML_DEBUG_TRANSLATION_PROTOCOL" +) diff --git a/src/plugins/qmlpreview/projectfileselectionswidget.cpp b/src/plugins/qmlpreview/projectfileselectionswidget.cpp deleted file mode 100644 index 44b8451dfcb..00000000000 --- a/src/plugins/qmlpreview/projectfileselectionswidget.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "projectfileselectionswidget.h" - -#include -#include -#include - -#include - -#include -#include -#include -#include - -namespace QmlPreview { - -class ProjectFileItem : public Utils::TreeItem -{ -public: - ProjectFileItem() = default; - ProjectFileItem(const Utils::FilePath &f, bool d) - : filePath(f) - , disabled(d) - {} - - Qt::ItemFlags flags(int) const override - { - return Qt::ItemIsUserCheckable | Qt::ItemIsEnabled; - } - - QVariant data(int , int role) const override - { - if (role == Qt::DisplayRole) - return filePath.toUserOutput(); - if (role == Qt::CheckStateRole) { - if (disabled) - return Qt::Unchecked; - else - return Qt::Checked; - } - return QVariant(); - } - - bool setData(int , const QVariant &data, int role) override - { - if (role != Qt::CheckStateRole) - return false; - disabled = (data == Qt::Unchecked); - return true; - } - - Utils::FilePath filePath; - bool disabled = false; -}; - - -ProjectFileSelectionsWidget::ProjectFileSelectionsWidget(const QString &projectSettingsKey, ProjectExplorer::FileType fileType, QWidget *parent) - : QWidget(parent) - , m_projectSettingsKey(projectSettingsKey) - , m_fileType(fileType) -{ - auto model = new Utils::TreeModel(this); - model->setHeader({tr("Files to test:")}); - auto updateCheckedFiles = [this, model] () { - m_checkedFiles.clear(); - QStringList uncheckedFiles; - model->forAllItems([&, this](ProjectFileItem *item) { - if (item->disabled) - uncheckedFiles.append(item->filePath.toString()); - else - m_checkedFiles.append(item->filePath); - }); - if (auto project = ProjectExplorer::SessionManager::startupProject()) - project->setNamedSettings(m_projectSettingsKey, uncheckedFiles); - emit selectionChanged(m_checkedFiles); - }; - - connect(model, &QAbstractItemModel::dataChanged, updateCheckedFiles); - - auto view = new QTreeView(this); - view->setMinimumSize(QSize(100, 100)); - view->setTextElideMode(Qt::ElideMiddle); - view->setWordWrap(false); - view->setUniformRowHeights(true); - view->setModel(model); - - const auto viewLayout = new QHBoxLayout; - viewLayout->addWidget(view); - - auto layout = new QVBoxLayout(this); - layout->setContentsMargins(0, 0, 0, 0); - layout->addLayout(viewLayout); - - auto initModel = [this, model, updateCheckedFiles](ProjectExplorer::Project *project) { - if (!project) - return; - - auto refreshModel = [this, model, updateCheckedFiles] () { - model->clear(); - if (auto project = ProjectExplorer::SessionManager::startupProject()) { - const auto settingsDisabledFiles = project->namedSettings(m_projectSettingsKey).toStringList(); - - if (auto rootProjectNode = project->rootProjectNode()) { - auto rootPath = rootProjectNode->filePath(); - - rootProjectNode->forEachNode([this, settingsDisabledFiles, model, rootPath](ProjectExplorer::FileNode *fileNode) { - if (fileNode->fileType() == m_fileType - && !fileNode->filePath().relativeChildPath(rootPath).startsWith("imports/")) { - bool isDisabled = settingsDisabledFiles.contains(fileNode->filePath().toString()); - model->rootItem()->appendChild(new ProjectFileItem(fileNode->filePath(), isDisabled)); - } - }); - } - updateCheckedFiles(); - } - }; - // deploymentDataChanged is only triggered if the active project changed, so it is not a - // problem that maybe many different targets are connected to refreshModel - this->connect(project->activeTarget(), &ProjectExplorer::Target::deploymentDataChanged, - model, refreshModel, Qt::UniqueConnection); - refreshModel(); - }; - - if (auto project = ProjectExplorer::SessionManager::startupProject()) { - initModel(project); - } - - connect(ProjectExplorer::SessionManager::instance(), - &ProjectExplorer::SessionManager::startupProjectChanged, - initModel); -} - -Utils::FilePaths ProjectFileSelectionsWidget::checkedFiles() -{ - return m_checkedFiles; -} - -} // QmlPreview diff --git a/src/plugins/qmlpreview/projectfileselectionswidget.h b/src/plugins/qmlpreview/projectfileselectionswidget.h deleted file mode 100644 index 4bacb41d49b..00000000000 --- a/src/plugins/qmlpreview/projectfileselectionswidget.h +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once -#include -#include - -#include - -namespace QmlPreview { - -class ProjectFileSelectionsWidget : public QWidget -{ - Q_OBJECT - -public: - explicit ProjectFileSelectionsWidget(const QString &projectSettingsKey, ProjectExplorer::FileType fileType, QWidget *parent = nullptr); - Utils::FilePaths checkedFiles(); -signals: - void selectionChanged(const Utils::FilePaths &selectedFiles); -private: - const QString m_projectSettingsKey; - ProjectExplorer::FileType m_fileType; - - Utils::FilePaths m_checkedFiles; -}; - -} // QmlPreview diff --git a/src/plugins/qmlpreview/qmldebugtranslationclient.cpp b/src/plugins/qmlpreview/qmldebugtranslationclient.cpp index 6ebc13d8f8a..3ef4351d498 100644 --- a/src/plugins/qmlpreview/qmldebugtranslationclient.cpp +++ b/src/plugins/qmlpreview/qmldebugtranslationclient.cpp @@ -26,8 +26,9 @@ #include "qmldebugtranslationclient.h" #include -#include -#include +#ifdef FOUND_QML_DEBUG_TRANSLATION_PROTOCOL +#include +#endif namespace QmlPreview { @@ -39,51 +40,14 @@ QmlDebugTranslationClient::QmlDebugTranslationClient(QmlDebug::QmlDebugConnectio void QmlDebugTranslationClient::changeLanguage(const QUrl &url, const QString &localeIsoCode) { QmlDebug::QPacket packet(dataStreamVersion()); - packet << static_cast(Command::ChangeLanguage) << url << localeIsoCode; +#ifdef FOUND_QML_DEBUG_TRANSLATION_PROTOCOL + sendMessage(QQmlDebugTranslation::createChangeLanguageRequest(packet, url, localeIsoCode)); +#else + const int request_change_language = 1; + packet << request_change_language << url << localeIsoCode; sendMessage(packet.data()); -} +#endif -void QmlDebugTranslationClient::changeWarningColor(const QColor &warningColor) -{ - QmlDebug::QPacket packet(dataStreamVersion()); - packet << static_cast(Command::ChangeWarningColor) << warningColor; - sendMessage(packet.data()); -} - -void QmlDebugTranslationClient::changeElidedTextWarningString(const QString &warningString) -{ - QmlDebug::QPacket packet(dataStreamVersion()); - packet << static_cast(Command::ChangeElidedTextWarningString) << warningString; - sendMessage(packet.data()); -} - -void QmlDebugTranslationClient::changeElideWarning(bool elideWarning) -{ - if (elideWarning) - enableElidedTextWarning(); - else - disableElidedTextWarning(); -} - -void QmlDebugTranslationClient::setDebugTranslationServiceLogFile(const QString &logFilePath) -{ - QmlDebug::QPacket packet(dataStreamVersion()); - packet << static_cast(Command::SetDebugTranslationServiceLogFile) << logFilePath; - sendMessage(packet.data()); -} - -void QmlDebugTranslationClient::enableElidedTextWarning() -{ - QmlDebug::QPacket packet(dataStreamVersion()); - packet << static_cast(Command::EnableElidedTextWarning); - sendMessage(packet.data()); -} - -void QmlDebugTranslationClient::disableElidedTextWarning() -{ - QmlDebug::QPacket packet(dataStreamVersion()); - packet << static_cast(Command::DisableElidedTextWarning); - sendMessage(packet.data()); } void QmlDebugTranslationClient::messageReceived(const QByteArray &data) diff --git a/src/plugins/qmlpreview/qmldebugtranslationclient.h b/src/plugins/qmlpreview/qmldebugtranslationclient.h index db00b6f0056..0b9e3594b2b 100644 --- a/src/plugins/qmlpreview/qmldebugtranslationclient.h +++ b/src/plugins/qmlpreview/qmldebugtranslationclient.h @@ -34,34 +34,14 @@ class QMLPREVIEW_EXPORT QmlDebugTranslationClient : public QmlDebug::QmlDebugCli { Q_OBJECT public: - //needs to be in sync with QQmlDebugTranslationClient in qtdeclarative/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.h - enum class Command { - ChangeLanguage, - MissingTranslationsChecked, - EnableElidedTextWarning, - DisableElidedTextWarning, - ChangeWarningColor, - ChangeElidedTextWarningString, - SetDebugTranslationServiceLogFile, - TestAllLanguages - }; - explicit QmlDebugTranslationClient(QmlDebug::QmlDebugConnection *connection); void changeLanguage(const QUrl &url, const QString &localeIsoCode); - void changeWarningColor(const QColor &warningColor); - void changeElidedTextWarningString(const QString &warningString); //is QByteArray better here? - void changeElideWarning(bool elideWarning); - void setDebugTranslationServiceLogFile(const QString &logFilePath); - void enableElidedTextWarning(); - void disableElidedTextWarning(); void messageReceived(const QByteArray &message) override; void stateChanged(State state) override; signals: -// void pathRequested(const QString &path); -// void errorReported(const QString &error); void debugServiceUnavailable(); }; diff --git a/src/plugins/qmlpreview/qmldebugtranslationwidget.cpp b/src/plugins/qmlpreview/qmldebugtranslationwidget.cpp deleted file mode 100644 index f835fa79459..00000000000 --- a/src/plugins/qmlpreview/qmldebugtranslationwidget.cpp +++ /dev/null @@ -1,523 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "qmldebugtranslationwidget.h" -#include "qmlpreviewruncontrol.h" -#include "qmlpreviewplugin.h" -#include "projectfileselectionswidget.h" - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace { -QObject *getPreviewPlugin() -{ - const QVector &specs = ExtensionSystem::PluginManager::plugins(); - const auto pluginIt = std::find_if(specs.cbegin(), specs.cend(), - [](const ExtensionSystem::PluginSpec *p) { - return p->name() == "QmlPreview"; - }); - - if (pluginIt != specs.cend()) - return (*pluginIt)->plugin(); - - return nullptr; -} - -} - -namespace QmlPreview { - -QmlDebugTranslationWidget::QmlDebugTranslationWidget(QWidget *parent, TestLanguageGetter languagesGetterMethod) - : QWidget(parent) - , m_testLanguagesGetter(languagesGetterMethod) - , m_warningColor(Qt::red) - //, m_foundTrColor(Qt::green) // invalid color -> init without the frame - , m_lastWarningColor(m_warningColor) - , m_lastfoundTrColor(Qt::green) - -{ - auto mainLayout = new QVBoxLayout(this); - - auto buttonGroup = new QButtonGroup(this); - // it gets the text from updateCurrentEditor method - m_singleFileButton = new QRadioButton(); - m_singleFileButton->setChecked(true); - buttonGroup->addButton(m_singleFileButton); - - const QString projectSettingsKey = "QmlPreview.DisabledDebugTranslationFiles"; - const ProjectExplorer::FileType filterFileType = ProjectExplorer::FileType::QML; - m_checkableProjectFileView = new ProjectFileSelectionsWidget(projectSettingsKey, filterFileType); - m_checkableProjectFileView->setVisible(false); - connect(m_checkableProjectFileView, &ProjectFileSelectionsWidget::selectionChanged, this, &QmlDebugTranslationWidget::setFiles); - m_multipleFileButton = new QRadioButton(tr("Multiple files")); - buttonGroup->addButton(m_multipleFileButton); - connect(m_multipleFileButton, &QAbstractButton::toggled, m_checkableProjectFileView, &QWidget::setVisible); - connect(m_multipleFileButton, &QAbstractButton::toggled, this, &QmlDebugTranslationWidget::updateFiles); - - mainLayout->addWidget(m_singleFileButton); - mainLayout->addWidget(m_multipleFileButton); - mainLayout->addWidget(m_checkableProjectFileView); - - // language checkboxes are add in updateAvailableTranslations method - m_selectLanguageLayout = new QHBoxLayout; - mainLayout->addLayout(m_selectLanguageLayout); - - auto settingsLayout = new QHBoxLayout(); - mainLayout->addLayout(settingsLayout); - - auto elideWarningCheckBox = new QCheckBox(tr("Elide warning")); - connect(elideWarningCheckBox, &QCheckBox::stateChanged, [this] (int state) { - m_elideWarning = (state == Qt::Checked); - }); - settingsLayout->addWidget(elideWarningCheckBox); - - auto warningColorCheckbox = new QCheckBox(tr("Warning color: ")); - settingsLayout->addWidget(warningColorCheckbox); - auto warningColorButton = new Utils::QtColorButton(); - connect(warningColorCheckbox, &QCheckBox::stateChanged, [warningColorButton, this] (int state) { - if (state == Qt::Checked) { - warningColorButton->setColor(m_lastWarningColor); - warningColorButton->setEnabled(true); - } else { - m_lastWarningColor = warningColorButton->color(); - warningColorButton->setColor({}); - warningColorButton->setEnabled(false); - } - }); - connect(warningColorButton, &Utils::QtColorButton::colorChanged, [this](const QColor &color) { - m_warningColor = color; - }); - warningColorCheckbox->setCheckState(Qt::Checked); - settingsLayout->addWidget(warningColorButton); - - auto foundTrColorCheckbox = new QCheckBox(tr("Found \"tr\" color: ")); - settingsLayout->addWidget(foundTrColorCheckbox); - auto foundTrColorButton = new Utils::QtColorButton(); - foundTrColorButton->setDisabled(true); - connect(foundTrColorCheckbox, &QCheckBox::stateChanged, [foundTrColorButton, this] (int state) { - if (state == Qt::Checked) { - foundTrColorButton->setColor(m_lastfoundTrColor); - foundTrColorButton->setEnabled(true); - } else { - m_lastfoundTrColor = foundTrColorButton->color(); - foundTrColorButton->setColor({}); - foundTrColorButton->setEnabled(false); - } - }); - connect(foundTrColorButton, &Utils::QtColorButton::colorChanged, [this](const QColor &color) { - m_foundTrColor = color; - }); - settingsLayout->addWidget(foundTrColorButton); - - settingsLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding)); - - auto controlLayout = new QHBoxLayout; - mainLayout->addLayout(controlLayout); - - auto showLogButton = new QToolButton; - showLogButton->setText(tr("Show Log")); - showLogButton->setCheckable(true); - controlLayout->addWidget(showLogButton); - - // TODO: do we still need this buttons? -// auto pauseButton = new QToolButton; -// pauseButton->setText(tr("Pause")); -// pauseButton->setCheckable(true); -// controlLayout->addWidget(pauseButton); - -// auto onTheFlyButton = new QToolButton; -// onTheFlyButton->setText(tr("On the Fly")); -// controlLayout->addWidget(onTheFlyButton); - - m_runTestButton = new QPushButton(); - m_runTestButton->setCheckable(true); - m_runTestButton->setText(runButtonText()); - connect(m_runTestButton, &QPushButton::toggled, [this](bool checked) { - m_runTestButton->setText(runButtonText(checked)); - }); - - connect(m_runTestButton, &QPushButton::clicked, [this](bool checked) { - if (checked) - runTest(); - else { - if (m_currentRunControl) - m_currentRunControl->initiateStop(); - // TODO: what happens if we already have a preview running? -// QmlPreviewPlugin::stopAllRunControls(); -// qWarning() << "not implemented"; // TODO: stop still running tests - } - }); - controlLayout->addWidget(m_runTestButton); - - m_runOutputWindow = new Core::OutputWindow(Core::Context("QmlPreview.DebugTranslation"), - "QmlPreview/OutputWindow/Zoom"); - - m_runOutputWindow->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - m_runOutputWindow->setReadOnly(true); - m_runOutputWindow->setVisible(false); - mainLayout->addWidget(m_runOutputWindow); - - QSpacerItem *endSpacerItem = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding); - mainLayout->addItem(endSpacerItem); - - connect(showLogButton, &QToolButton::toggled, m_runOutputWindow, [this, mainLayout, endSpacerItem](bool checked) { - m_runOutputWindow->setVisible(checked); - if (m_runOutputWindow->isVisible()) - mainLayout->takeAt(mainLayout->count() - 1); - else - mainLayout->addItem(endSpacerItem); - }); - - auto loadLogButton = new QToolButton; - loadLogButton->setText(tr("Load")); - controlLayout->addWidget(loadLogButton); - connect(loadLogButton, &QToolButton::clicked, this, &QmlDebugTranslationWidget::loadLogFile); - - auto saveLogButton = new QToolButton; - saveLogButton->setText(tr("Save")); - controlLayout->addWidget(saveLogButton); - connect(saveLogButton, &QToolButton::clicked, this, &QmlDebugTranslationWidget::saveLogToFile); - - auto clearButton = new QToolButton; - clearButton->setText(tr("Clear")); - controlLayout->addWidget(clearButton); - connect(clearButton, &QToolButton::clicked, this, &QmlDebugTranslationWidget::clear); - - Core::EditorManager *editorManager = Core::EditorManager::instance(); - connect(editorManager, &Core::EditorManager::currentEditorChanged, this, &QmlDebugTranslationWidget::updateCurrentEditor); - updateCurrentEditor(Core::EditorManager::currentEditor()); - - connect(ProjectExplorer::SessionManager::instance(), &ProjectExplorer::SessionManager::startupProjectChanged, - this, &QmlDebugTranslationWidget::updateCurrentTranslations); - - updateStartupProjectTranslations(); - - ProjectExplorer::TaskHub::addCategory("QmlPreview.Translation", tr("Translation issues")); -} - -QmlDebugTranslationWidget::~QmlDebugTranslationWidget() -{ - -} - -void QmlDebugTranslationWidget::updateCurrentEditor(const Core::IEditor *editor) -{ - if (editor && editor->document()) - m_currentFilePath = editor->document()->filePath(); - else - m_currentFilePath.clear(); - m_singleFileButton->setText(singleFileButtonText(m_currentFilePath.toString())); - updateFiles(); -} - -void QmlDebugTranslationWidget::updateStartupProjectTranslations() -{ - updateCurrentTranslations(ProjectExplorer::SessionManager::startupProject()); -} - -QColor QmlDebugTranslationWidget::warningColor() -{ - return m_warningColor; -} - -QColor QmlDebugTranslationWidget::foundTrColor() -{ - return m_foundTrColor; -} - -void QmlDebugTranslationWidget::updateCurrentTranslations(ProjectExplorer::Project *project) -{ - m_testLanguages.clear(); - for (int i = m_selectLanguageLayout->count()-1; i >= 0; --i) { - auto layoutItem = m_selectLanguageLayout->takeAt(i); - delete layoutItem->widget(); - delete layoutItem; - } - if (!project) - return; - - if (auto multiLanguageAspect = QmlProjectManager::QmlMultiLanguageAspect::current(project)) { - connect(multiLanguageAspect, &QmlProjectManager::QmlMultiLanguageAspect::changed, - this, &QmlDebugTranslationWidget::updateStartupProjectTranslations, - Qt::UniqueConnection); - auto languageLabel = new QLabel(); - languageLabel->setText(tr("Language to test:")); - m_selectLanguageLayout->addWidget(languageLabel); - if (multiLanguageAspect->value()) { - addLanguageCheckBoxes({multiLanguageAspect->currentLocale()}); - if (m_testLanguagesGetter) { - auto addTestLanguages = new QPushButton(tr("Add Test Languages")); - m_selectLanguageLayout->addWidget(addTestLanguages); - connect(addTestLanguages, &QPushButton::clicked, [this]() { - addLanguageCheckBoxes(m_testLanguagesGetter()); - }); - } - } else { - QString errorMessage; - addLanguageCheckBoxes(project->availableQmlPreviewTranslations(&errorMessage)); - } - m_selectLanguageLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum)); - } -} - -void QmlDebugTranslationWidget::updateFiles() -{ - if (m_multipleFileButton->isChecked()) - setFiles(m_checkableProjectFileView->checkedFiles()); - else - setFiles({m_currentFilePath}); -} - -void QmlDebugTranslationWidget::setFiles(const Utils::FilePaths &filePathes) -{ - m_selectedFilePaths = filePathes; -} - -void QmlDebugTranslationWidget::runTest() -{ - m_runOutputWindow->grayOutOldContent(); - - auto runControl = new ProjectExplorer::RunControl(ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE); - QTC_ASSERT(runControl, qWarning("Can not create a QmlPreviewRunner"); return;); - auto previewPlugin = qobject_cast(getPreviewPlugin()); - - connect(runControl, &ProjectExplorer::RunControl::started, [this, runControl, previewPlugin]() { - //Q_ASSERT(m_currentRunControl == nullptr); //TODO: who deletes the runcontrol - m_currentRunControl = runControl; - m_runOutputWindow->setLineParsers( - ProjectExplorer::OutputFormatterFactory::createFormatters(runControl->target())); - int timerCounter = 1; - const auto testLanguageList = m_testLanguages; - - if (m_elideWarning) - previewPlugin->changeElideWarning(true); - - auto testLanguages = [previewPlugin, runControl, testLanguageList](int timerCounter, const QString &previewedFile) { - for (auto language : testLanguageList) { - QTimer::singleShot(timerCounter * 1000, previewPlugin, [previewPlugin, runControl, language, previewedFile]() { - if (runControl && runControl->isRunning()) { - if (!previewedFile.isEmpty()) - previewPlugin->setPreviewedFile(previewedFile); - previewPlugin->setLocaleIsoCode(language); - } - }); - } - }; - for (auto filePath : qAsConst(m_selectedFilePaths)) { - testLanguages(timerCounter++, filePath.toString()); - } - }); - connect(runControl, &ProjectExplorer::RunControl::stopped, [this]() { - m_runTestButton->setChecked(false); - //delete m_currentRunControl; // who deletes the runcontrol? - m_currentRunControl = nullptr; - if (auto previewPlugin = qobject_cast(getPreviewPlugin())) - previewPlugin->setLocaleIsoCode(m_lastUsedLanguageBeforeTest); - }); - - connect(runControl, &ProjectExplorer::RunControl::appendMessage, - this, &QmlDebugTranslationWidget::appendMessage); - - if (auto project = ProjectExplorer::SessionManager::startupProject()) { - if (auto target = project->activeTarget()) { - if (auto multiLanguageAspect = QmlProjectManager::QmlMultiLanguageAspect::current(target)) - m_lastUsedLanguageBeforeTest = multiLanguageAspect->currentLocale(); - if (auto runConfiguration = target->activeRunConfiguration()) { - runControl->setRunConfiguration(runConfiguration); - if (runControl->createMainWorker()) { - previewPlugin->setLocaleIsoCode(QString()); - runControl->initiateStart(); - } - } - } - } -} - -void QmlDebugTranslationWidget::clear() -{ - m_runOutputWindow->clear(); - ProjectExplorer::TaskHub::clearTasks("QmlPreview.Translation"); -} - -QString QmlDebugTranslationWidget::currentDir() const -{ - return m_lastDir.isEmpty() ? - ProjectExplorer::ProjectTree::currentFilePath().parentDir().toString() : m_lastDir; -} - -void QmlDebugTranslationWidget::setCurrentDir(const QString &path) -{ - m_lastDir = path; -} - -void QmlDebugTranslationWidget::loadLogFile() -{ - const auto fileName = QFileDialog::getOpenFileName(this, QStringLiteral("Open File"), currentDir()); - if (!fileName.isEmpty()) { - setCurrentDir(QFileInfo(fileName).absolutePath()); - QFile f(fileName); - if (f.open(QFile::ReadOnly)) { - clear(); - while (!f.atEnd()) - appendMessage(QString::fromUtf8(f.readLine()), Utils::GeneralMessageFormat); - } else { - // TODO: maybe add this message to log and tasks - qWarning() << "Failed to open" << fileName << ":" << f.errorString(); - } - } -} - -void QmlDebugTranslationWidget::saveLogToFile() -{ - const QString fileName = QFileDialog::getSaveFileName( - this, tr("Choose file to save logged issues."), currentDir()); - if (!fileName.isEmpty()) { - setCurrentDir(QFileInfo(fileName).absolutePath()); - QFile f(fileName); - if (f.open(QFile::WriteOnly | QFile::Text)) - f.write(m_runOutputWindow->toPlainText().toUtf8()); - } -} - -void QmlDebugTranslationWidget::appendMessage(const QString &message, Utils::OutputFormat format) -{ - const auto newLine = QRegularExpression("[\r\n]"); - const auto messages = message.split(newLine, Qt::SkipEmptyParts); - - if (messages.count() > 1) { - for (auto m : messages) - appendMessage(m + "\n", format); - return; - } - const QString serviceSeperator = ": QQmlDebugTranslationService: "; - if (!message.contains(serviceSeperator)) - return; - QString locationString = message; - locationString = locationString.split(serviceSeperator).first(); - static const QRegularExpression qmlLineColumnLink("^(" QT_QML_URL_REGEXP ")" // url - ":(\\d+)" // line - ":(\\d+)$"); // column - const QRegularExpressionMatch qmlLineColumnMatch = qmlLineColumnLink.match(locationString); - - auto fileLine = -1; - QUrl fileUrl; - if (qmlLineColumnMatch.hasMatch()) { - fileUrl = QUrl(qmlLineColumnMatch.captured(1)); - fileLine = qmlLineColumnMatch.captured(2).toInt(); - } - - m_runOutputWindow->appendMessage(message, format); - - - auto type = ProjectExplorer::Task::TaskType::Warning; - auto description = message.split(serviceSeperator).at(1); - auto filePath = Utils::FilePath::fromString(fileUrl.toLocalFile()); - auto category = "QmlPreview.Translation"; - auto icon = Utils::Icons::WARNING.icon(); - - ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task(type, - description, - filePath, - fileLine, - category, - icon, - ProjectExplorer::Task::NoOptions)); -} - -QString QmlDebugTranslationWidget::singleFileButtonText(const QString &filePath) -{ - auto buttonText = tr("Current file: %1"); - if (filePath.isEmpty()) - return buttonText.arg(tr("Empty")); - return buttonText.arg(filePath); -} - -QString QmlDebugTranslationWidget::runButtonText(bool isRunning) -{ - if (isRunning) { - return tr("Stop"); - } - return tr("Run Language Tests"); -} - -void QmlDebugTranslationWidget::addLanguageCheckBoxes(const QStringList &languages) -{ - for (auto language : languages) { - auto languageCheckBox = new QCheckBox(language); - m_selectLanguageLayout->addWidget(languageCheckBox); - connect(languageCheckBox, &QCheckBox::stateChanged, [this, language] (int state) { - if (state == Qt::Checked) - m_testLanguages.append(language); - else - m_testLanguages.removeAll(language); - }); - languageCheckBox->setChecked(true); - } -} - -} // namespace QmlPreview diff --git a/src/plugins/qmlpreview/qmldebugtranslationwidget.h b/src/plugins/qmlpreview/qmldebugtranslationwidget.h deleted file mode 100644 index de0c7ba3624..00000000000 --- a/src/plugins/qmlpreview/qmldebugtranslationwidget.h +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include "qmlpreview_global.h" - -#include -#include - -#include - -QT_BEGIN_NAMESPACE -class QRadioButton; -class QPushButton; -class QHBoxLayout; -QT_END_NAMESPACE - -namespace Core { -class IEditor; -class OutputWindow; -} -namespace ProjectExplorer { -class Project; -class RunControl; -} - -namespace QmlPreview { - -class ProjectFileSelectionsWidget; - - -class QMLPREVIEW_EXPORT QmlDebugTranslationWidget : public QWidget -{ - using TestLanguageGetter = std::function; - Q_OBJECT -public: - explicit QmlDebugTranslationWidget(QWidget *parent = nullptr, TestLanguageGetter languagesGetterMethod = {}); - ~QmlDebugTranslationWidget() override; - - void setCurrentFile(const Utils::FilePath &filepath); - void setFiles(const Utils::FilePaths &filePathes); - void updateStartupProjectTranslations(); - - QColor warningColor(); - QColor foundTrColor(); -private: - void updateCurrentEditor(const Core::IEditor *editor); - void updateCurrentTranslations(ProjectExplorer::Project *project); - void updateFiles(); - void runTest(); - void appendMessage(const QString &message, Utils::OutputFormat format); - void clear(); - void loadLogFile(); - void saveLogToFile(); - QString currentDir() const; - void setCurrentDir(const QString &path); - - QString singleFileButtonText(const QString &filePath); - QString runButtonText(bool isRunning = false); - void addLanguageCheckBoxes(const QStringList &languages); - - QStringList m_testLanguages; - QString m_lastUsedLanguageBeforeTest; - bool m_elideWarning = false; - - Core::OutputWindow *m_runOutputWindow = nullptr; - - QRadioButton *m_singleFileButton = nullptr; - QRadioButton *m_multipleFileButton = nullptr; - ProjectFileSelectionsWidget *m_checkableProjectFileView = nullptr; - QPushButton *m_runTestButton = nullptr; - - Utils::FilePath m_currentFilePath; - Utils::FilePaths m_selectedFilePaths; - ProjectExplorer::RunControl *m_currentRunControl = nullptr; - - QString m_lastDir; - - QHBoxLayout *m_selectLanguageLayout; - TestLanguageGetter m_testLanguagesGetter; - QColor m_warningColor; - QColor m_foundTrColor; - QColor m_lastWarningColor; - QColor m_lastfoundTrColor; -}; - -} // namespace QmlPreview diff --git a/src/plugins/qmlpreview/qmlpreview.pro b/src/plugins/qmlpreview/qmlpreview.pro index ea53ac2f4ea..cfc571521f5 100644 --- a/src/plugins/qmlpreview/qmlpreview.pro +++ b/src/plugins/qmlpreview/qmlpreview.pro @@ -10,23 +10,19 @@ include(tests/tests.pri) HEADERS += \ qmlpreview_global.h \ qmldebugtranslationclient.h \ - qmldebugtranslationwidget.h \ qmlpreviewclient.h \ qmlpreviewplugin.h \ qmlpreviewruncontrol.h \ qmlpreviewconnectionmanager.h \ - qmlpreviewfileontargetfinder.h \ - projectfileselectionswidget.h + qmlpreviewfileontargetfinder.h SOURCES += \ qmlpreviewplugin.cpp \ qmldebugtranslationclient.cpp \ - qmldebugtranslationwidget.cpp \ qmlpreviewclient.cpp \ qmlpreviewruncontrol.cpp \ qmlpreviewconnectionmanager.cpp \ - qmlpreviewfileontargetfinder.cpp \ - projectfileselectionswidget.cpp + qmlpreviewfileontargetfinder.cpp OTHER_FILES += \ QmlPreview.json.in diff --git a/src/plugins/qmlpreview/qmlpreview.qbs b/src/plugins/qmlpreview/qmlpreview.qbs index 67734879620..08e64725789 100644 --- a/src/plugins/qmlpreview/qmlpreview.qbs +++ b/src/plugins/qmlpreview/qmlpreview.qbs @@ -26,8 +26,6 @@ QtcPlugin { "qmlpreviewclient.h", "qmldebugtranslationclient.cpp", "qmldebugtranslationclient.h", - "qmldebugtranslationwidget.cpp", - "qmldebugtranslationwidget.h", "qmlpreviewconnectionmanager.cpp", "qmlpreviewconnectionmanager.h", "qmlpreviewfileontargetfinder.cpp", @@ -37,8 +35,6 @@ QtcPlugin { "qmlpreviewplugin.h", "qmlpreviewruncontrol.cpp", "qmlpreviewruncontrol.h", - "projectfileselectionswidget.cpp", - "projectfileselectionswidget.h" ] } diff --git a/src/plugins/qmlpreview/qmlpreviewconnectionmanager.cpp b/src/plugins/qmlpreview/qmlpreviewconnectionmanager.cpp index 6767544c1d7..0087d97f21d 100644 --- a/src/plugins/qmlpreview/qmlpreviewconnectionmanager.cpp +++ b/src/plugins/qmlpreview/qmlpreviewconnectionmanager.cpp @@ -40,6 +40,9 @@ QmlPreviewConnectionManager::QmlPreviewConnectionManager(QObject *parent) : QmlDebug::QmlDebugConnectionManager(parent) { setTarget(nullptr); + m_createDebugTranslationClientMethod = [](QmlDebug::QmlDebugConnection *connection) { + return std::make_unique(connection); + }; } QmlPreviewConnectionManager::~QmlPreviewConnectionManager() = default; @@ -66,6 +69,11 @@ void QmlPreviewConnectionManager::setFpsHandler(QmlPreviewFpsHandler fpsHandler) m_fpsHandler = fpsHandler; } +void QmlPreviewConnectionManager::setQmlDebugTranslationClientCreator(QmlDebugTranslationClientCreator creator) +{ + m_createDebugTranslationClientMethod = creator; +} + void QmlPreviewConnectionManager::createClients() { createPreviewClient(); @@ -113,9 +121,9 @@ QUrl QmlPreviewConnectionManager::findValidI18nDirectoryAsUrl(const QString &loc void QmlPreviewConnectionManager::createDebugTranslationClient() { - m_qmlDebugTranslationClient = new QmlDebugTranslationClient(connection()); + m_qmlDebugTranslationClient = m_createDebugTranslationClientMethod(connection()); connect(this, &QmlPreviewConnectionManager::language, - m_qmlDebugTranslationClient, [this](const QString &locale) { + m_qmlDebugTranslationClient.get(), [this](const QString &locale) { m_lastUsedLanguage = locale; // findValidI18nDirectoryAsUrl does not work if we didn't load any file // service expects a context URL. @@ -124,10 +132,7 @@ void QmlPreviewConnectionManager::createDebugTranslationClient() m_qmlDebugTranslationClient->changeLanguage(findValidI18nDirectoryAsUrl(locale), locale); } }); - connect(this, &QmlPreviewConnectionManager::changeElideWarning, - m_qmlDebugTranslationClient, &QmlDebugTranslationClient::changeElideWarning); - - connect(m_qmlDebugTranslationClient.data(), &QmlDebugTranslationClient::debugServiceUnavailable, + connect(m_qmlDebugTranslationClient.get(), &QmlDebugTranslationClient::debugServiceUnavailable, this, []() { QMessageBox::warning(Core::ICore::dialogParent(), "Error connect to QML DebugTranslation service", "QML DebugTranslation feature is not available for this version of Qt."); @@ -260,7 +265,7 @@ void QmlPreviewConnectionManager::clearClient(QObject *client) void QmlPreviewConnectionManager::destroyClients() { clearClient(m_qmlPreviewClient); - clearClient(m_qmlDebugTranslationClient); + clearClient(m_qmlDebugTranslationClient.release()); m_fileSystemWatcher.removeFiles(m_fileSystemWatcher.files()); QTC_ASSERT(m_fileSystemWatcher.directories().isEmpty(), m_fileSystemWatcher.removeDirectories(m_fileSystemWatcher.directories())); diff --git a/src/plugins/qmlpreview/qmlpreviewconnectionmanager.h b/src/plugins/qmlpreview/qmlpreviewconnectionmanager.h index c63db57343c..a23c68c31a9 100644 --- a/src/plugins/qmlpreview/qmlpreviewconnectionmanager.h +++ b/src/plugins/qmlpreview/qmlpreviewconnectionmanager.h @@ -52,12 +52,12 @@ public: void setFileLoader(QmlPreviewFileLoader fileLoader); void setFileClassifier(QmlPreviewFileClassifier fileClassifier); void setFpsHandler(QmlPreviewFpsHandler fpsHandler); + void setQmlDebugTranslationClientCreator(QmlDebugTranslationClientCreator creator); signals: void loadFile(const QString &filename, const QString &changedFile, const QByteArray &contents); void zoom(float zoomFactor); void language(const QString &locale); - void changeElideWarning(bool elideWarning); void rerun(); void restart(); @@ -68,18 +68,19 @@ protected: private: void createPreviewClient(); void createDebugTranslationClient(); - QUrl findValidI18nDirectoryAsUrl(const QString &locale); void clearClient(QObject *client); + QUrl findValidI18nDirectoryAsUrl(const QString &locale); Utils::FileInProjectFinder m_projectFileFinder; QmlPreviewFileOnTargetFinder m_targetFileFinder; QPointer m_qmlPreviewClient; - QPointer m_qmlDebugTranslationClient; + std::unique_ptr m_qmlDebugTranslationClient; Utils::FileSystemWatcher m_fileSystemWatcher; QUrl m_lastLoadedUrl; QString m_lastUsedLanguage; QmlPreviewFileLoader m_fileLoader = nullptr; QmlPreviewFileClassifier m_fileClassifier = nullptr; QmlPreviewFpsHandler m_fpsHandler = nullptr; + QmlDebugTranslationClientCreator m_createDebugTranslationClientMethod; }; } // namespace Internal diff --git a/src/plugins/qmlpreview/qmlpreviewplugin.cpp b/src/plugins/qmlpreview/qmlpreviewplugin.cpp index 137c51b4b3d..06c3887dbdf 100644 --- a/src/plugins/qmlpreview/qmlpreviewplugin.cpp +++ b/src/plugins/qmlpreview/qmlpreviewplugin.cpp @@ -26,8 +26,6 @@ #include "qmlpreviewplugin.h" #include "qmlpreviewruncontrol.h" -#include "qmldebugtranslationwidget.h" - #ifdef WITH_TESTS #include "tests/qmlpreviewclient_test.h" #include "tests/qmlpreviewplugin_test.h" @@ -67,7 +65,6 @@ using namespace ProjectExplorer; namespace QmlPreview { -namespace Internal { class QmlPreviewParser : public QObject { @@ -151,8 +148,7 @@ public: float m_zoomFactor = -1.0; QmlPreview::QmlPreviewFpsHandler m_fpsHandler = nullptr; QString m_localeIsoCode; - bool m_translationElideWarning = false; - QPointer m_qmlDebugTranslationWidget; + QmlDebugTranslationClientCreator m_createDebugTranslationClientMethod; RunWorkerFactory localRunWorkerFactory{ RunWorkerFactory::make(), @@ -170,7 +166,7 @@ public: m_fpsHandler, m_zoomFactor, m_localeIsoCode, - m_translationElideWarning + m_createDebugTranslationClientMethod }); connect(q, &QmlPreviewPlugin::updatePreviews, runner, &QmlPreviewRunner::loadFile); @@ -182,8 +178,6 @@ public: runner, &QmlPreviewRunner::zoom); connect(q, &QmlPreviewPlugin::localeIsoCodeChanged, runner, &QmlPreviewRunner::language); - connect(q, &QmlPreviewPlugin::elideWarningChanged, - runner, &QmlPreviewRunner::changeElideWarning); connect(runner, &RunWorker::started, this, [this, runControl] { addPreview(runControl); @@ -222,50 +216,6 @@ QmlPreviewPluginPrivate::QmlPreviewPluginPrivate(QmlPreviewPlugin *parent) Core::ActionManager::registerAction(action, "QmlPreview.RunPreview"), Constants::G_BUILD_RUN); - action = new QAction(QmlPreviewPlugin::tr("Test Translations"), this); - action->setToolTip(QLatin1String("Runs the preview with all available translations and collects all issues.")); - action->setEnabled(SessionManager::startupProject() != nullptr); - connect(SessionManager::instance(), &SessionManager::startupProjectChanged, action, - &QAction::setEnabled); - connect(action, &QAction::triggered, this, [this]() { - if (SessionManager::startupProject()) { - // Deletion for this widget is taken care of in aboutToShutdown() and registerWindow() - m_qmlDebugTranslationWidget = new QmlDebugTranslationWidget(); - Core::ICore::registerWindow(m_qmlDebugTranslationWidget, Core::Context("Core.DebugTranslation")); - m_qmlDebugTranslationWidget->show(); - } - }); - menu->addAction( - Core::ActionManager::registerAction(action, "QmlPreview.TestTranslations"), - Constants::G_BUILD_RUN); - auto updateTestTranslationAction = [action]() { - bool showTestTranslationAction = false; - bool enableTestTranslationAction = false; - QtSupport::BaseQtVersion *activeQt{}; - if (auto project = SessionManager::startupProject()) { - if (auto target = project->activeTarget()) { - if (auto activeKit = target->kit()) - activeQt = QtSupport::QtKitAspect::qtVersion(activeKit); - } - } - for (auto qtVersion : QtSupport::QtVersionManager::versions()) { - if (qtVersion->features().contains("QtStudio")) { - showTestTranslationAction = true; - if (qtVersion == activeQt) - enableTestTranslationAction = true; - } - } - action->setVisible(showTestTranslationAction); - action->setEnabled(enableTestTranslationAction); - }; - connect(ProjectExplorer::SessionManager::instance(), - &ProjectExplorer::SessionManager::startupProjectChanged, - updateTestTranslationAction); - - connect(QtSupport::QtVersionManager::instance(), - &QtSupport::QtVersionManager::qtVersionsChanged, - updateTestTranslationAction); - menu = Core::ActionManager::actionContainer(Constants::M_FILECONTEXT); action = new QAction(QmlPreviewPlugin::tr("Preview File"), this); action->setEnabled(false); @@ -314,7 +264,6 @@ ExtensionSystem::IPlugin::ShutdownFlag QmlPreviewPlugin::aboutToShutdown() { d->m_parseThread.quit(); d->m_parseThread.wait(); - delete d->m_qmlDebugTranslationWidget; return SynchronousShutdown; } @@ -410,15 +359,9 @@ void QmlPreviewPlugin::setLocaleIsoCode(const QString &localeIsoCode) emit localeIsoCodeChanged(d->m_localeIsoCode); } -bool QmlPreviewPlugin::elideWarning() const +void QmlPreviewPlugin::setQmlDebugTranslationClientCreator(QmlDebugTranslationClientCreator creator) { - return d->m_translationElideWarning; -} - -void QmlPreviewPlugin::changeElideWarning(bool elideWarning) -{ - d->m_translationElideWarning = elideWarning; - emit elideWarningChanged(elideWarning); + d->m_createDebugTranslationClientMethod = creator; } void QmlPreviewPlugin::setFileLoader(QmlPreviewFileLoader fileLoader) @@ -588,7 +531,6 @@ void QmlPreviewParser::parse(const QString &name, const QByteArray &contents, emit failure(); } -} // namespace Internal } // namespace QmlPreview #include diff --git a/src/plugins/qmlpreview/qmlpreviewplugin.h b/src/plugins/qmlpreview/qmlpreviewplugin.h index b2455b10773..873564b5ac6 100644 --- a/src/plugins/qmlpreview/qmlpreviewplugin.h +++ b/src/plugins/qmlpreview/qmlpreviewplugin.h @@ -25,6 +25,9 @@ #pragma once +#include "qmlpreview_global.h" +#include "qmldebugtranslationclient.h" + #include #include #include @@ -34,16 +37,17 @@ namespace Core { class IEditor; } +namespace QmlDebug { class QmlDebugConnection; } + namespace QmlPreview { typedef bool (*QmlPreviewFileClassifier) (const QString &); typedef QByteArray (*QmlPreviewFileLoader)(const QString &, bool *); typedef void (*QmlPreviewFpsHandler)(quint16[8]); typedef QList QmlPreviewRunControlList; +typedef std::function(QmlDebug::QmlDebugConnection *)> QmlDebugTranslationClientCreator; -namespace Internal { - -class QmlPreviewPlugin : public ExtensionSystem::IPlugin +class QMLPREVIEW_EXPORT QmlPreviewPlugin : public ExtensionSystem::IPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QmlPreview.json") @@ -59,7 +63,6 @@ class QmlPreviewPlugin : public ExtensionSystem::IPlugin WRITE setFpsHandler NOTIFY fpsHandlerChanged) Q_PROPERTY(float zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged) Q_PROPERTY(QString localeIsoCode READ localeIsoCode WRITE setLocaleIsoCode NOTIFY localeIsoCodeChanged) - Q_PROPERTY(bool elideWarning READ elideWarning WRITE changeElideWarning NOTIFY elideWarningChanged) public: ~QmlPreviewPlugin() override; @@ -87,8 +90,7 @@ public: QString localeIsoCode() const; void setLocaleIsoCode(const QString &localeIsoCode); - bool elideWarning() const; - void changeElideWarning(bool elideWarning); + void setQmlDebugTranslationClientCreator(QmlDebugTranslationClientCreator creator); signals: void checkDocument(const QString &name, const QByteArray &contents, @@ -104,13 +106,11 @@ signals: void zoomFactorChanged(float zoomFactor); void localeIsoCodeChanged(const QString &localeIsoCode); - void elideWarningChanged(bool elideWarning); private: class QmlPreviewPluginPrivate *d = nullptr; }; -} // namespace Internal } // namespace QmlPreview Q_DECLARE_METATYPE(QmlPreview::QmlPreviewFileLoader) diff --git a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp index f04f7525277..fd1d3bde3d9 100644 --- a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp +++ b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp @@ -52,6 +52,8 @@ QmlPreviewRunner::QmlPreviewRunner(const QmlPreviewRunnerSetting &settings) m_connectionManager.setFileLoader(settings.fileLoader); m_connectionManager.setFileClassifier(settings.fileClassifier); m_connectionManager.setFpsHandler(settings.fpsHandler); + m_connectionManager.setQmlDebugTranslationClientCreator( + settings.createDebugTranslationClientMethod); connect(this, &QmlPreviewRunner::loadFile, &m_connectionManager, &Internal::QmlPreviewConnectionManager::loadFile); @@ -62,8 +64,6 @@ QmlPreviewRunner::QmlPreviewRunner(const QmlPreviewRunnerSetting &settings) &m_connectionManager, &Internal::QmlPreviewConnectionManager::zoom); connect(this, &QmlPreviewRunner::language, &m_connectionManager, &Internal::QmlPreviewConnectionManager::language); - connect(this, &QmlPreviewRunner::changeElideWarning, - &m_connectionManager, &Internal::QmlPreviewConnectionManager::changeElideWarning); connect(&m_connectionManager, &Internal::QmlPreviewConnectionManager::connectionOpened, this, [this, settings]() { @@ -71,8 +71,6 @@ QmlPreviewRunner::QmlPreviewRunner(const QmlPreviewRunnerSetting &settings) emit zoom(settings.zoom); if (!settings.language.isEmpty()) emit language(settings.language); - if (settings.translationElideWarning) - emit changeElideWarning(true); emit ready(); }); diff --git a/src/plugins/qmlpreview/qmlpreviewruncontrol.h b/src/plugins/qmlpreview/qmlpreviewruncontrol.h index c5171e22488..2b425ee8bd7 100644 --- a/src/plugins/qmlpreview/qmlpreviewruncontrol.h +++ b/src/plugins/qmlpreview/qmlpreviewruncontrol.h @@ -39,7 +39,7 @@ struct QmlPreviewRunnerSetting { QmlPreviewFpsHandler fpsHandler; float zoom = 1.0; QString language; - bool translationElideWarning = false; + QmlDebugTranslationClientCreator createDebugTranslationClientMethod; }; class QmlPreviewRunner : public ProjectExplorer::RunWorker @@ -59,7 +59,6 @@ signals: void zoom(float zoomFactor); void rerun(); void ready(); - void changeElideWarning(bool elideWarning); private: void start() override; void stop() override; diff --git a/src/plugins/qmlpreview/tests/qmlpreviewclient_test.cpp b/src/plugins/qmlpreview/tests/qmlpreviewclient_test.cpp index 9aec2d6cc66..8b99a8f1d7d 100644 --- a/src/plugins/qmlpreview/tests/qmlpreviewclient_test.cpp +++ b/src/plugins/qmlpreview/tests/qmlpreviewclient_test.cpp @@ -29,7 +29,6 @@ #include namespace QmlPreview { -namespace Internal { class TestableQmlPreviewClient : public QmlPreviewClient { @@ -139,7 +138,6 @@ void QmlPreviewClientTest::testMessageReceived() } } -} // namespace Internal } // namespace QmlPreview #include "qmlpreviewclient_test.moc" diff --git a/src/plugins/qmlpreview/tests/qmlpreviewclient_test.h b/src/plugins/qmlpreview/tests/qmlpreviewclient_test.h index 43ae0030036..dcb8d380c74 100644 --- a/src/plugins/qmlpreview/tests/qmlpreviewclient_test.h +++ b/src/plugins/qmlpreview/tests/qmlpreviewclient_test.h @@ -26,7 +26,6 @@ #include namespace QmlPreview { -namespace Internal { class QmlPreviewClientTest : public QObject { @@ -39,5 +38,4 @@ private slots: void testMessageReceived(); }; -} // namespace Internal } // namespace QmlPreview diff --git a/src/plugins/qmlpreview/tests/qmlpreviewplugin_test.cpp b/src/plugins/qmlpreview/tests/qmlpreviewplugin_test.cpp index 0e3306f15df..08ede8b185e 100644 --- a/src/plugins/qmlpreview/tests/qmlpreviewplugin_test.cpp +++ b/src/plugins/qmlpreview/tests/qmlpreviewplugin_test.cpp @@ -31,11 +31,10 @@ #include #include -Q_DECLARE_METATYPE(QmlPreview::Internal::TestFileLoader) -Q_DECLARE_METATYPE(QmlPreview::Internal::TestFpsHandler) +Q_DECLARE_METATYPE(QmlPreview::TestFileLoader) +Q_DECLARE_METATYPE(QmlPreview::TestFpsHandler) namespace QmlPreview { -namespace Internal { QmlPreviewPluginTest::QmlPreviewPluginTest(QObject *parent) : QObject(parent) { @@ -90,5 +89,4 @@ void QmlPreviewPluginTest::testFpsHandlerProperty() handler(stats); } -} // namespace Internal } // namespace QmlPreview diff --git a/src/plugins/qmlpreview/tests/qmlpreviewplugin_test.h b/src/plugins/qmlpreview/tests/qmlpreviewplugin_test.h index 8ceeb6669ca..5c28e9cc341 100644 --- a/src/plugins/qmlpreview/tests/qmlpreviewplugin_test.h +++ b/src/plugins/qmlpreview/tests/qmlpreviewplugin_test.h @@ -28,7 +28,6 @@ #include namespace QmlPreview { -namespace Internal { typedef QByteArray (*TestFileLoader)(const QString &, bool *); typedef void (*TestFpsHandler)(quint16[8]); @@ -45,5 +44,4 @@ private slots: void testFpsHandlerProperty(); }; -} // namespace Internal } // namespace QmlPreview diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 8cf610bd281..861ffcc9dda 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -1628,6 +1628,7 @@ void tst_Dumpers::dumper() "." }; //qDebug() << "Starting cmake: " << m_cmakeBinary << ' ' << qPrintable(options.join(' ')); + cmake.setProcessEnvironment(m_env); cmake.start(m_cmakeBinary, options); QVERIFY(cmake.waitForFinished()); output = cmake.readAllStandardOutput(); @@ -1648,6 +1649,7 @@ void tst_Dumpers::dumper() if (m_qtVersion && m_qtVersion < 0x050000) options << "-spec" << "unsupported/macx-clang"; #endif + qmake.setProcessEnvironment(m_env); qmake.start(m_qmakeBinary, options); QVERIFY(qmake.waitForFinished()); output = qmake.readAllStandardOutput(); diff --git a/tests/unit/unittest/imagecachegenerator-test.cpp b/tests/unit/unittest/imagecachegenerator-test.cpp index dd8bd4297da..2bd1fdf06a7 100644 --- a/tests/unit/unittest/imagecachegenerator-test.cpp +++ b/tests/unit/unittest/imagecachegenerator-test.cpp @@ -277,21 +277,21 @@ TEST_F(ImageCacheGenerator, CallWalCheckpointFullIfQueueIsEmpty) TEST_F(ImageCacheGenerator, CleanIsCallingAbortCallback) { - ON_CALL(collectorMock, start(_, _, _, _, _)) - .WillByDefault([&](auto, auto, auto, auto captureCallback, auto) { - captureCallback({}, {}); - waitInThread.wait(); - }); + ON_CALL(collectorMock, start(_, _, _, _, _)).WillByDefault([&](auto, auto, auto, auto, auto) { + notification.wait(); + }); generator.generateImage( "name", {}, {11}, imageCallbackMock.AsStdFunction(), abortCallbackMock.AsStdFunction(), {}); generator.generateImage( "name2", {}, {11}, imageCallbackMock.AsStdFunction(), abortCallbackMock.AsStdFunction(), {}); EXPECT_CALL(abortCallbackMock, Call(Eq(QmlDesigner::ImageCache::AbortReason::Abort))) - .Times(AtLeast(1)); + .Times(AtLeast(1)) + .WillRepeatedly([&](auto) { waitInThread.notify(); }); generator.clean(); - waitInThread.notify(); + notification.notify(); + waitInThread.wait(); } TEST_F(ImageCacheGenerator, WaitForFinished)