From 7fc0dcec0dd4ede004ec71ebd86a8997add8942c Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 30 Mar 2023 10:05:46 +0200 Subject: [PATCH 01/36] Fix lots of tr.h files not being mentioned in CMakeLists.txt Change-Id: I63d364ac50d9587339b10a5571870cb9a81c54ee Reviewed-by: Qt CI Bot Reviewed-by: Reviewed-by: hjk --- .../autotoolsprojectmanager/CMakeLists.txt | 1 + src/plugins/baremetal/CMakeLists.txt | 1 + src/plugins/bazaar/CMakeLists.txt | 1 + src/plugins/beautifier/CMakeLists.txt | 1 + src/plugins/clangcodemodel/CMakeLists.txt | 1 + src/plugins/clangformat/CMakeLists.txt | 1 + src/plugins/classview/CMakeLists.txt | 1 + src/plugins/clearcase/CMakeLists.txt | 1 + .../cmakeprojectmanager/CMakeLists.txt | 1 + src/plugins/coco/CMakeLists.txt | 3 +- .../CMakeLists.txt | 1 + src/plugins/conan/CMakeLists.txt | 1 + src/plugins/cpaster/CMakeLists.txt | 1 + src/plugins/cppcheck/CMakeLists.txt | 1 + src/plugins/ctfvisualizer/CMakeLists.txt | 1 + src/plugins/cvs/CMakeLists.txt | 1 + src/plugins/designer/CMakeLists.txt | 1 + src/plugins/emacskeys/CMakeLists.txt | 1 + src/plugins/fossil/CMakeLists.txt | 2 +- .../genericprojectmanager/CMakeLists.txt | 1 + src/plugins/gitlab/CMakeLists.txt | 1 + src/plugins/glsleditor/CMakeLists.txt | 1 + src/plugins/haskell/CMakeLists.txt | 1 + src/plugins/helloworld/CMakeLists.txt | 1 + src/plugins/help/CMakeLists.txt | 1 + src/plugins/imageviewer/CMakeLists.txt | 1 + src/plugins/ios/CMakeLists.txt | 1 + src/plugins/macros/CMakeLists.txt | 1 + src/plugins/marketplace/CMakeLists.txt | 1 + src/plugins/mercurial/CMakeLists.txt | 1 + .../mesonprojectmanager/CMakeLists.txt | 147 +++++++++--------- src/plugins/nim/CMakeLists.txt | 1 + src/plugins/perforce/CMakeLists.txt | 1 + src/plugins/projectexplorer/CMakeLists.txt | 1 + src/plugins/python/CMakeLists.txt | 1 + src/plugins/qnx/CMakeLists.txt | 1 + src/plugins/remotelinux/CMakeLists.txt | 1 + src/plugins/resourceeditor/CMakeLists.txt | 1 + src/plugins/serialterminal/CMakeLists.txt | 1 + src/plugins/silversearcher/CMakeLists.txt | 1 + src/plugins/subversion/CMakeLists.txt | 1 + src/plugins/todo/CMakeLists.txt | 1 + src/plugins/valgrind/CMakeLists.txt | 1 + src/plugins/welcome/CMakeLists.txt | 1 + 44 files changed, 118 insertions(+), 75 deletions(-) diff --git a/src/plugins/autotoolsprojectmanager/CMakeLists.txt b/src/plugins/autotoolsprojectmanager/CMakeLists.txt index 64446adc3a2..0536178881e 100644 --- a/src/plugins/autotoolsprojectmanager/CMakeLists.txt +++ b/src/plugins/autotoolsprojectmanager/CMakeLists.txt @@ -7,6 +7,7 @@ add_qtc_plugin(AutotoolsProjectManager autotoolsbuildconfiguration.cpp autotoolsbuildconfiguration.h autotoolsbuildsystem.cpp autotoolsbuildsystem.h autotoolsprojectconstants.h + autotoolsprojectmanagertr.h autotoolsprojectplugin.cpp autotoolsprojectplugin.h configurestep.cpp configurestep.h makefileparser.cpp makefileparser.h diff --git a/src/plugins/baremetal/CMakeLists.txt b/src/plugins/baremetal/CMakeLists.txt index 046e0531c33..7a25aa19598 100644 --- a/src/plugins/baremetal/CMakeLists.txt +++ b/src/plugins/baremetal/CMakeLists.txt @@ -10,6 +10,7 @@ add_qtc_plugin(BareMetal baremetaldeviceconfigurationwizardpages.cpp baremetaldeviceconfigurationwizardpages.h baremetalplugin.cpp baremetalplugin.h baremetalrunconfiguration.cpp baremetalrunconfiguration.h + baremetaltr.h debugserverproviderchooser.cpp debugserverproviderchooser.h debugserverprovidermanager.cpp debugserverprovidermanager.h debugserverproviderssettingspage.cpp debugserverproviderssettingspage.h diff --git a/src/plugins/bazaar/CMakeLists.txt b/src/plugins/bazaar/CMakeLists.txt index 97d9c0153f8..c6341d71937 100644 --- a/src/plugins/bazaar/CMakeLists.txt +++ b/src/plugins/bazaar/CMakeLists.txt @@ -7,6 +7,7 @@ add_qtc_plugin(Bazaar bazaareditor.cpp bazaareditor.h bazaarplugin.cpp bazaarplugin.h bazaarsettings.cpp bazaarsettings.h + bazaartr.h branchinfo.cpp branchinfo.h commiteditor.cpp commiteditor.h constants.h diff --git a/src/plugins/beautifier/CMakeLists.txt b/src/plugins/beautifier/CMakeLists.txt index 7d18a27a591..d721f1ef201 100644 --- a/src/plugins/beautifier/CMakeLists.txt +++ b/src/plugins/beautifier/CMakeLists.txt @@ -11,6 +11,7 @@ add_qtc_plugin(Beautifier beautifierabstracttool.h beautifierconstants.h beautifierplugin.cpp beautifierplugin.h + beautifiertr.h clangformat/clangformat.cpp clangformat/clangformat.h clangformat/clangformatconstants.h clangformat/clangformatoptionspage.cpp clangformat/clangformatoptionspage.h diff --git a/src/plugins/clangcodemodel/CMakeLists.txt b/src/plugins/clangcodemodel/CMakeLists.txt index 50007413e15..ace39071713 100644 --- a/src/plugins/clangcodemodel/CMakeLists.txt +++ b/src/plugins/clangcodemodel/CMakeLists.txt @@ -13,6 +13,7 @@ add_qtc_plugin(ClangCodeModel clangactivationsequencecontextprocessor.cpp clangactivationsequencecontextprocessor.h clangactivationsequenceprocessor.cpp clangactivationsequenceprocessor.h clangcodemodelplugin.cpp clangcodemodelplugin.h + clangcodemodeltr.h clangcompletioncontextanalyzer.cpp clangcompletioncontextanalyzer.h clangconstants.h clangdast.cpp clangdast.h diff --git a/src/plugins/clangformat/CMakeLists.txt b/src/plugins/clangformat/CMakeLists.txt index 19014d22fe5..79767a2ffed 100644 --- a/src/plugins/clangformat/CMakeLists.txt +++ b/src/plugins/clangformat/CMakeLists.txt @@ -12,6 +12,7 @@ add_qtc_plugin(ClangFormat clangformatindenter.cpp clangformatindenter.h clangformatplugin.cpp clangformatplugin.h clangformatsettings.cpp clangformatsettings.h + clangformattr.h clangformatutils.cpp clangformatutils.h EXPLICIT_MOC clangformatconfigwidget.cpp clangformatconfigwidget.h diff --git a/src/plugins/classview/CMakeLists.txt b/src/plugins/classview/CMakeLists.txt index d8918dff7cb..caac4802bfc 100644 --- a/src/plugins/classview/CMakeLists.txt +++ b/src/plugins/classview/CMakeLists.txt @@ -10,6 +10,7 @@ add_qtc_plugin(ClassView classviewplugin.cpp classviewplugin.h classviewsymbolinformation.cpp classviewsymbolinformation.h classviewsymbollocation.cpp classviewsymbollocation.h + classviewtr.h classviewtreeitemmodel.cpp classviewtreeitemmodel.h classviewutils.cpp classviewutils.h ) diff --git a/src/plugins/clearcase/CMakeLists.txt b/src/plugins/clearcase/CMakeLists.txt index 12697375361..42cae223808 100644 --- a/src/plugins/clearcase/CMakeLists.txt +++ b/src/plugins/clearcase/CMakeLists.txt @@ -11,6 +11,7 @@ add_qtc_plugin(ClearCase clearcasesubmiteditor.cpp clearcasesubmiteditor.h clearcasesubmiteditorwidget.cpp clearcasesubmiteditorwidget.h clearcasesync.cpp clearcasesync.h + clearcasetr.h settingspage.cpp settingspage.h versionselector.cpp versionselector.h ) diff --git a/src/plugins/cmakeprojectmanager/CMakeLists.txt b/src/plugins/cmakeprojectmanager/CMakeLists.txt index 997f4c8920b..683a2a407a8 100644 --- a/src/plugins/cmakeprojectmanager/CMakeLists.txt +++ b/src/plugins/cmakeprojectmanager/CMakeLists.txt @@ -28,6 +28,7 @@ add_qtc_plugin(CMakeProjectManager cmakeprojectconstants.h cmakeprojectimporter.cpp cmakeprojectimporter.h cmakeprojectmanager.cpp cmakeprojectmanager.h + cmakeprojectmanagertr.h cmakeprojectnodes.cpp cmakeprojectnodes.h cmakeprojectplugin.cpp cmakeprojectplugin.h cmakesettingspage.cpp cmakesettingspage.h diff --git a/src/plugins/coco/CMakeLists.txt b/src/plugins/coco/CMakeLists.txt index ee5685ccbbf..43f4fd7c4a3 100644 --- a/src/plugins/coco/CMakeLists.txt +++ b/src/plugins/coco/CMakeLists.txt @@ -2,6 +2,7 @@ add_qtc_plugin(Coco PUBLIC_DEPENDS app_version PLUGIN_DEPENDS Core LanguageClient SOURCES - cocoplugin.cpp cocoplugin.h cocolanguageclient.cpp cocolanguageclient.h + cocoplugin.cpp cocoplugin.h + cocotr.h ) diff --git a/src/plugins/compilationdatabaseprojectmanager/CMakeLists.txt b/src/plugins/compilationdatabaseprojectmanager/CMakeLists.txt index 8bd36a7b6f0..8e0430f59e5 100644 --- a/src/plugins/compilationdatabaseprojectmanager/CMakeLists.txt +++ b/src/plugins/compilationdatabaseprojectmanager/CMakeLists.txt @@ -5,6 +5,7 @@ add_qtc_plugin(CompilationDatabaseProjectManager compilationdatabaseconstants.h compilationdatabaseproject.cpp compilationdatabaseproject.h compilationdatabaseprojectmanagerplugin.cpp compilationdatabaseprojectmanagerplugin.h + compilationdatabaseprojectmanagertr.h compilationdatabaseutils.cpp compilationdatabaseutils.h compilationdbparser.cpp compilationdbparser.h ) diff --git a/src/plugins/conan/CMakeLists.txt b/src/plugins/conan/CMakeLists.txt index 7833f6c970e..c9ad746a84d 100644 --- a/src/plugins/conan/CMakeLists.txt +++ b/src/plugins/conan/CMakeLists.txt @@ -5,4 +5,5 @@ add_qtc_plugin(Conan conaninstallstep.cpp conaninstallstep.h conanplugin.cpp conanplugin.h conansettings.cpp conansettings.h + conantr.h ) diff --git a/src/plugins/cpaster/CMakeLists.txt b/src/plugins/cpaster/CMakeLists.txt index da48a556885..5bc29709f2b 100644 --- a/src/plugins/cpaster/CMakeLists.txt +++ b/src/plugins/cpaster/CMakeLists.txt @@ -11,6 +11,7 @@ add_qtc_plugin(CodePaster cpasterconstants.h cpaster.qrc cpasterplugin.cpp cpasterplugin.h + cpastertr.h dpastedotcomprotocol.cpp dpastedotcomprotocol.h fileshareprotocol.cpp fileshareprotocol.h fileshareprotocolsettingspage.cpp fileshareprotocolsettingspage.h diff --git a/src/plugins/cppcheck/CMakeLists.txt b/src/plugins/cppcheck/CMakeLists.txt index dc9bbb0661e..6cd06dc9c67 100644 --- a/src/plugins/cppcheck/CMakeLists.txt +++ b/src/plugins/cppcheck/CMakeLists.txt @@ -14,5 +14,6 @@ add_qtc_plugin(Cppcheck cppchecktextmark.cpp cppchecktextmark.h cppchecktextmarkmanager.cpp cppchecktextmarkmanager.h cppchecktool.cpp cppchecktool.h + cppchecktr.h cppchecktrigger.cpp cppchecktrigger.h ) diff --git a/src/plugins/ctfvisualizer/CMakeLists.txt b/src/plugins/ctfvisualizer/CMakeLists.txt index 8ba905d5f3b..d8f9c5a3ce4 100644 --- a/src/plugins/ctfvisualizer/CMakeLists.txt +++ b/src/plugins/ctfvisualizer/CMakeLists.txt @@ -15,6 +15,7 @@ add_qtc_plugin(CtfVisualizer ctfstatisticsview.h ctfvisualizerplugin.h ctfvisualizertool.h + ctfvisualizertr.h ctftimelinemodel.h ctftracemanager.h ctfvisualizerconstants.h diff --git a/src/plugins/cvs/CMakeLists.txt b/src/plugins/cvs/CMakeLists.txt index 1cc14dfc166..7a21e0c85d0 100644 --- a/src/plugins/cvs/CMakeLists.txt +++ b/src/plugins/cvs/CMakeLists.txt @@ -6,5 +6,6 @@ add_qtc_plugin(CVS cvsplugin.cpp cvsplugin.h cvssettings.cpp cvssettings.h cvssubmiteditor.cpp cvssubmiteditor.h + cvstr.h cvsutils.cpp cvsutils.h ) diff --git a/src/plugins/designer/CMakeLists.txt b/src/plugins/designer/CMakeLists.txt index e2c26b39068..f6304e4a67d 100644 --- a/src/plugins/designer/CMakeLists.txt +++ b/src/plugins/designer/CMakeLists.txt @@ -16,6 +16,7 @@ add_qtc_plugin(Designer designer_export.h designerconstants.h designercontext.cpp designercontext.h + designertr.h editordata.h editorwidget.cpp editorwidget.h formeditorfactory.cpp formeditorfactory.h diff --git a/src/plugins/emacskeys/CMakeLists.txt b/src/plugins/emacskeys/CMakeLists.txt index 20fd37aa294..9ae0bc923f5 100644 --- a/src/plugins/emacskeys/CMakeLists.txt +++ b/src/plugins/emacskeys/CMakeLists.txt @@ -4,4 +4,5 @@ add_qtc_plugin(EmacsKeys emacskeysconstants.h emacskeysplugin.cpp emacskeysplugin.h emacskeysstate.cpp emacskeysstate.h + emacskeystr.h ) diff --git a/src/plugins/fossil/CMakeLists.txt b/src/plugins/fossil/CMakeLists.txt index 22f76911043..07485229450 100644 --- a/src/plugins/fossil/CMakeLists.txt +++ b/src/plugins/fossil/CMakeLists.txt @@ -1,4 +1,3 @@ - add_qtc_plugin(Fossil PLUGIN_DEPENDS Core TextEditor ProjectExplorer VcsBase @@ -14,6 +13,7 @@ add_qtc_plugin(Fossil fossileditor.cpp fossileditor.h fossilplugin.cpp fossilplugin.h fossilsettings.cpp fossilsettings.h + fossiltr.h pullorpushdialog.cpp pullorpushdialog.h revisioninfo.h wizard/fossiljsextension.cpp wizard/fossiljsextension.h diff --git a/src/plugins/genericprojectmanager/CMakeLists.txt b/src/plugins/genericprojectmanager/CMakeLists.txt index 5b1ef6f84e4..764ce9282c6 100644 --- a/src/plugins/genericprojectmanager/CMakeLists.txt +++ b/src/plugins/genericprojectmanager/CMakeLists.txt @@ -10,6 +10,7 @@ add_qtc_plugin(GenericProjectManager genericproject.cpp genericproject.h genericprojectconstants.h genericprojectfileseditor.cpp genericprojectfileseditor.h + genericprojectmanagertr.h genericprojectplugin.cpp genericprojectplugin.h genericprojectwizard.cpp genericprojectwizard.h ) diff --git a/src/plugins/gitlab/CMakeLists.txt b/src/plugins/gitlab/CMakeLists.txt index a9da31b7066..16242b1a3fa 100644 --- a/src/plugins/gitlab/CMakeLists.txt +++ b/src/plugins/gitlab/CMakeLists.txt @@ -9,6 +9,7 @@ add_qtc_plugin(GitLab gitlabparameters.cpp gitlabparameters.h gitlabplugin.cpp gitlabplugin.h gitlabprojectsettings.cpp gitlabprojectsettings.h + gitlabtr.h queryrunner.cpp queryrunner.h resultparser.cpp resultparser.h ) diff --git a/src/plugins/glsleditor/CMakeLists.txt b/src/plugins/glsleditor/CMakeLists.txt index 85cbe99986f..b02e95cda74 100644 --- a/src/plugins/glsleditor/CMakeLists.txt +++ b/src/plugins/glsleditor/CMakeLists.txt @@ -9,6 +9,7 @@ add_qtc_plugin(GLSLEditor glsleditor.qrc glsleditorconstants.h glsleditorplugin.cpp glsleditorplugin.h + glsleditortr.h glslhighlighter.cpp glslhighlighter.h glslindenter.cpp glslindenter.h ) diff --git a/src/plugins/haskell/CMakeLists.txt b/src/plugins/haskell/CMakeLists.txt index 8f6cc4f1d85..0a62921168a 100644 --- a/src/plugins/haskell/CMakeLists.txt +++ b/src/plugins/haskell/CMakeLists.txt @@ -14,6 +14,7 @@ add_qtc_plugin(Haskell haskellproject.cpp haskellproject.h haskellrunconfiguration.cpp haskellrunconfiguration.h haskelltokenizer.cpp haskelltokenizer.h + haskelltr.h optionspage.cpp optionspage.h stackbuildstep.cpp stackbuildstep.h ) diff --git a/src/plugins/helloworld/CMakeLists.txt b/src/plugins/helloworld/CMakeLists.txt index e14fbba2c8a..18a93c47b8b 100644 --- a/src/plugins/helloworld/CMakeLists.txt +++ b/src/plugins/helloworld/CMakeLists.txt @@ -3,5 +3,6 @@ add_qtc_plugin(HelloWorld PLUGIN_DEPENDS Core SOURCES helloworldplugin.cpp helloworldplugin.h + helloworldtr.h helloworldwindow.cpp helloworldwindow.h ) diff --git a/src/plugins/help/CMakeLists.txt b/src/plugins/help/CMakeLists.txt index 76a680c7595..c37b5b0c313 100644 --- a/src/plugins/help/CMakeLists.txt +++ b/src/plugins/help/CMakeLists.txt @@ -14,6 +14,7 @@ add_qtc_plugin(Help helpmanager.cpp helpmanager.h helpmode.cpp helpmode.h helpplugin.cpp helpplugin.h + helptr.h helpviewer.cpp helpviewer.h helpwidget.cpp helpwidget.h localhelpmanager.cpp localhelpmanager.h diff --git a/src/plugins/imageviewer/CMakeLists.txt b/src/plugins/imageviewer/CMakeLists.txt index 5c6f0ca98b6..b55ef9931e6 100644 --- a/src/plugins/imageviewer/CMakeLists.txt +++ b/src/plugins/imageviewer/CMakeLists.txt @@ -13,6 +13,7 @@ add_qtc_plugin(ImageViewer imageviewerconstants.h imageviewerfile.cpp imageviewerfile.h imageviewerplugin.cpp imageviewerplugin.h + imageviewertr.h multiexportdialog.cpp multiexportdialog.h EXPLICIT_MOC imageviewer.h ) diff --git a/src/plugins/ios/CMakeLists.txt b/src/plugins/ios/CMakeLists.txt index 5f4abd1913c..ebfaa6fc69b 100644 --- a/src/plugins/ios/CMakeLists.txt +++ b/src/plugins/ios/CMakeLists.txt @@ -20,6 +20,7 @@ add_qtc_plugin(Ios iossettingswidget.cpp iossettingswidget.h iossimulator.cpp iossimulator.h iostoolhandler.cpp iostoolhandler.h + iostr.h simulatorcontrol.cpp simulatorcontrol.h simulatorinfomodel.cpp simulatorinfomodel.h simulatoroperationdialog.cpp simulatoroperationdialog.h diff --git a/src/plugins/macros/CMakeLists.txt b/src/plugins/macros/CMakeLists.txt index a5dee70052c..aef9a332ddc 100644 --- a/src/plugins/macros/CMakeLists.txt +++ b/src/plugins/macros/CMakeLists.txt @@ -14,6 +14,7 @@ add_qtc_plugin(Macros macrosconstants.h macrosplugin.cpp macrosplugin.h macrotextfind.cpp macrotextfind.h + macrostr.h savedialog.cpp savedialog.h texteditormacrohandler.cpp texteditormacrohandler.h ) diff --git a/src/plugins/marketplace/CMakeLists.txt b/src/plugins/marketplace/CMakeLists.txt index f663bc95110..b101b8c049f 100644 --- a/src/plugins/marketplace/CMakeLists.txt +++ b/src/plugins/marketplace/CMakeLists.txt @@ -2,6 +2,7 @@ add_qtc_plugin(Marketplace PLUGIN_DEPENDS Core SOURCES marketplaceplugin.h + marketplacetr.h productlistmodel.cpp productlistmodel.h qtmarketplacewelcomepage.cpp qtmarketplacewelcomepage.h ) diff --git a/src/plugins/mercurial/CMakeLists.txt b/src/plugins/mercurial/CMakeLists.txt index 37cccb62544..1a0edc4100d 100644 --- a/src/plugins/mercurial/CMakeLists.txt +++ b/src/plugins/mercurial/CMakeLists.txt @@ -10,6 +10,7 @@ add_qtc_plugin(Mercurial mercurialeditor.cpp mercurialeditor.h mercurialplugin.cpp mercurialplugin.h mercurialsettings.cpp mercurialsettings.h + mercurialtr.h revertdialog.cpp revertdialog.h srcdestdialog.cpp srcdestdialog.h ) diff --git a/src/plugins/mesonprojectmanager/CMakeLists.txt b/src/plugins/mesonprojectmanager/CMakeLists.txt index 62f4b231ee8..d4d7420d7b0 100644 --- a/src/plugins/mesonprojectmanager/CMakeLists.txt +++ b/src/plugins/mesonprojectmanager/CMakeLists.txt @@ -3,84 +3,85 @@ add_qtc_plugin(MesonProjectManager DEPENDS QmlJS PLUGIN_DEPENDS Core CppEditor ProjectExplorer TextEditor QtSupport SOURCES - mesonprojectplugin.cpp - mesonprojectplugin.h - versionhelper.h - mesonactionsmanager.h - mesonactionsmanager.cpp - toolsmodel.cpp - toolssettingswidget.h - toolssettingswidget.cpp - toolssettingspage.cpp - toolssettingspage.h - toolitemsettings.cpp - toolitemsettings.h - tooltreeitem.cpp - tooltreeitem.h - toolsmodel.h - ninjatoolkitaspect.cpp - ninjatoolkitaspect.h - toolkitaspectwidget.h - toolkitaspectwidget.cpp - mesontoolkitaspect.cpp - mesontoolkitaspect.h - toolssettingsaccessor.h - toolssettingsaccessor.cpp - settings.h - settings.cpp - mesonwrapper.cpp - mesonwrapper.h - ninjawrapper.h - toolwrapper.h - toolwrapper.cpp - mesontools.h - mesontools.cpp - mesoninfoparser.h - buildoptions.h - target.h - mesoninfo.h - common.h - buildoptionsparser.h - buildsystemfilesparser.h - infoparser.h - targetparser.h - kitdata.h - kithelper.h - mesonproject.h - mesonproject.cpp - mesonprojectimporter.h - mesonprojectimporter.cpp - mesonbuildsystem.h - mesonbuildsystem.cpp - mesonprojectparser.h - mesonprojectparser.cpp - mesonbuildconfiguration.h - mesonbuildconfiguration.cpp - ninjabuildstep.h - ninjabuildstep.cpp - mesonbuildsettingswidget.h - mesonbuildsettingswidget.cpp - buildoptionsmodel.h - buildoptionsmodel.cpp arrayoptionlineedit.cpp arrayoptionlineedit.h - mesonprocess.h - mesonprocess.cpp - mesonoutputparser.h - mesonoutputparser.cpp - ninjaparser.h - ninjaparser.cpp - mesonrunconfiguration.h - mesonrunconfiguration.cpp - projecttree.h - projecttree.cpp - mesonprojectnodes.h - mesonprojectnodes.cpp - machinefilemanager.h + buildoptions.h + buildoptionsmodel.cpp + buildoptionsmodel.h + buildoptionsparser.h + buildsystemfilesparser.h + common.h + infoparser.h + kitdata.h + kithelper.h machinefilemanager.cpp - nativefilegenerator.h + machinefilemanager.h + mesonactionsmanager.cpp + mesonactionsmanager.h + mesonbuildconfiguration.cpp + mesonbuildconfiguration.h + mesonbuildsettingswidget.cpp + mesonbuildsettingswidget.h + mesonbuildsystem.cpp + mesonbuildsystem.h + mesoninfo.h + mesoninfoparser.h + mesonoutputparser.cpp + mesonoutputparser.h + mesonprocess.cpp + mesonprocess.h + mesonproject.cpp + mesonproject.h + mesonprojectimporter.cpp + mesonprojectimporter.h + mesonprojectmanagertr.h + mesonprojectnodes.cpp + mesonprojectnodes.h + mesonprojectparser.cpp + mesonprojectparser.h + mesonprojectplugin.cpp + mesonprojectplugin.h + mesonrunconfiguration.cpp + mesonrunconfiguration.h + mesontoolkitaspect.cpp + mesontoolkitaspect.h + mesontools.cpp + mesontools.h + mesonwrapper.cpp + mesonwrapper.h nativefilegenerator.cpp + nativefilegenerator.h + ninjabuildstep.cpp + ninjabuildstep.h + ninjaparser.cpp + ninjaparser.h + ninjatoolkitaspect.cpp + ninjatoolkitaspect.h + ninjawrapper.h + projecttree.cpp + projecttree.h resources_meson.qrc + settings.cpp + settings.h + target.h + targetparser.h + toolitemsettings.cpp + toolitemsettings.h + toolkitaspectwidget.cpp + toolkitaspectwidget.h + toolsmodel.cpp + toolsmodel.h + toolssettingsaccessor.cpp + toolssettingsaccessor.h + toolssettingspage.cpp + toolssettingspage.h + toolssettingswidget.cpp + toolssettingswidget.h + tooltreeitem.cpp + tooltreeitem.h + toolwrapper.cpp + toolwrapper.h + versionhelper.h ) file(RELATIVE_PATH RELATIVE_TEST_PATH "${PROJECT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/src/plugins/nim/CMakeLists.txt b/src/plugins/nim/CMakeLists.txt index a7320e46184..02cf6356f4f 100644 --- a/src/plugins/nim/CMakeLists.txt +++ b/src/plugins/nim/CMakeLists.txt @@ -9,6 +9,7 @@ add_qtc_plugin(Nim nim.qrc nimconstants.h nimplugin.cpp nimplugin.h + nimtr.h project/nimblebuildstep.h project/nimblebuildstep.cpp project/nimbleproject.h project/nimbleproject.cpp project/nimblerunconfiguration.h project/nimblerunconfiguration.cpp diff --git a/src/plugins/perforce/CMakeLists.txt b/src/plugins/perforce/CMakeLists.txt index a24f97ec8c0..1cb8c6fd7aa 100644 --- a/src/plugins/perforce/CMakeLists.txt +++ b/src/plugins/perforce/CMakeLists.txt @@ -10,4 +10,5 @@ add_qtc_plugin(Perforce perforcesettings.cpp perforcesettings.h perforcesubmiteditor.cpp perforcesubmiteditor.h perforcesubmiteditorwidget.cpp perforcesubmiteditorwidget.h + perforcetr.h ) diff --git a/src/plugins/projectexplorer/CMakeLists.txt b/src/plugins/projectexplorer/CMakeLists.txt index 518d2842c8b..58f8c73d1d6 100644 --- a/src/plugins/projectexplorer/CMakeLists.txt +++ b/src/plugins/projectexplorer/CMakeLists.txt @@ -137,6 +137,7 @@ add_qtc_plugin(ProjectExplorer projectexplorericons.cpp projectexplorericons.h projectexplorersettings.h projectexplorersettingspage.cpp projectexplorersettingspage.h + projectexplorertr.h projectfilewizardextension.cpp projectfilewizardextension.h projectimporter.cpp projectimporter.h projectmacro.cpp projectmacro.h diff --git a/src/plugins/python/CMakeLists.txt b/src/plugins/python/CMakeLists.txt index a508e14ddc8..e98190a5691 100644 --- a/src/plugins/python/CMakeLists.txt +++ b/src/plugins/python/CMakeLists.txt @@ -18,5 +18,6 @@ add_qtc_plugin(Python pythonrunconfiguration.cpp pythonrunconfiguration.h pythonscanner.cpp pythonscanner.h pythonsettings.cpp pythonsettings.h + pythontr.h pythonutils.cpp pythonutils.h ) diff --git a/src/plugins/qnx/CMakeLists.txt b/src/plugins/qnx/CMakeLists.txt index 66dd7058770..f6c5907b4e8 100644 --- a/src/plugins/qnx/CMakeLists.txt +++ b/src/plugins/qnx/CMakeLists.txt @@ -19,6 +19,7 @@ add_qtc_plugin(Qnx qnxrunconfiguration.cpp qnxrunconfiguration.h qnxsettingspage.cpp qnxsettingspage.h qnxtoolchain.cpp qnxtoolchain.h + qnxtr.h qnxutils.cpp qnxutils.h qnxversionnumber.cpp qnxversionnumber.h slog2inforunner.cpp slog2inforunner.h diff --git a/src/plugins/remotelinux/CMakeLists.txt b/src/plugins/remotelinux/CMakeLists.txt index 2899475f13d..08581c2f67f 100644 --- a/src/plugins/remotelinux/CMakeLists.txt +++ b/src/plugins/remotelinux/CMakeLists.txt @@ -26,6 +26,7 @@ add_qtc_plugin(RemoteLinux remotelinuxplugin.cpp remotelinuxplugin.h remotelinuxrunconfiguration.cpp remotelinuxrunconfiguration.h remotelinuxsignaloperation.cpp remotelinuxsignaloperation.h + remotelinuxtr.h rsyncdeploystep.cpp rsyncdeploystep.h sshkeycreationdialog.cpp sshkeycreationdialog.h sshprocessinterface.h diff --git a/src/plugins/resourceeditor/CMakeLists.txt b/src/plugins/resourceeditor/CMakeLists.txt index 1db8386ff0b..4697ab72eaa 100644 --- a/src/plugins/resourceeditor/CMakeLists.txt +++ b/src/plugins/resourceeditor/CMakeLists.txt @@ -10,6 +10,7 @@ add_qtc_plugin(ResourceEditor resourceeditorconstants.h resourceeditorfactory.cpp resourceeditorfactory.h resourceeditorplugin.cpp resourceeditorplugin.h + resourceeditortr.h resourceeditorw.cpp resourceeditorw.h resourcenode.cpp resourcenode.h ) diff --git a/src/plugins/serialterminal/CMakeLists.txt b/src/plugins/serialterminal/CMakeLists.txt index dc801e4af42..31dccffe00d 100644 --- a/src/plugins/serialterminal/CMakeLists.txt +++ b/src/plugins/serialterminal/CMakeLists.txt @@ -10,4 +10,5 @@ add_qtc_plugin(SerialTerminal serialterminalconstants.h serialterminalplugin.cpp serialterminalplugin.h serialterminalsettings.cpp serialterminalsettings.h + serialterminaltr.h ) diff --git a/src/plugins/silversearcher/CMakeLists.txt b/src/plugins/silversearcher/CMakeLists.txt index bff78e573a8..7cc12ebb294 100644 --- a/src/plugins/silversearcher/CMakeLists.txt +++ b/src/plugins/silversearcher/CMakeLists.txt @@ -4,6 +4,7 @@ add_qtc_plugin(SilverSearcher findinfilessilversearcher.cpp findinfilessilversearcher.h silversearcheroutputparser.cpp silversearcheroutputparser.h silversearcherplugin.cpp silversearcherplugin.h + silversearchertr.h ) extend_qtc_plugin(SilverSearcher CONDITION WITH_TESTS diff --git a/src/plugins/subversion/CMakeLists.txt b/src/plugins/subversion/CMakeLists.txt index 816d0089e98..4b309761ed9 100644 --- a/src/plugins/subversion/CMakeLists.txt +++ b/src/plugins/subversion/CMakeLists.txt @@ -8,4 +8,5 @@ add_qtc_plugin(Subversion subversionplugin.cpp subversionplugin.h subversionsettings.cpp subversionsettings.h subversionsubmiteditor.cpp subversionsubmiteditor.h + subversiontr.h ) diff --git a/src/plugins/todo/CMakeLists.txt b/src/plugins/todo/CMakeLists.txt index 149488b589e..cc8b72a2d66 100644 --- a/src/plugins/todo/CMakeLists.txt +++ b/src/plugins/todo/CMakeLists.txt @@ -21,4 +21,5 @@ add_qtc_plugin(Todo todoplugin.cpp todoplugin.h todoplugin.qrc todoprojectsettingswidget.cpp todoprojectsettingswidget.h + todotr.h ) diff --git a/src/plugins/valgrind/CMakeLists.txt b/src/plugins/valgrind/CMakeLists.txt index dfe2620cae9..3e1f149730f 100644 --- a/src/plugins/valgrind/CMakeLists.txt +++ b/src/plugins/valgrind/CMakeLists.txt @@ -31,6 +31,7 @@ add_qtc_plugin(Valgrind valgrindplugin.cpp valgrindrunner.cpp valgrindrunner.h valgrindsettings.cpp valgrindsettings.h + valgrindtr.h xmlprotocol/announcethread.cpp xmlprotocol/announcethread.h xmlprotocol/error.cpp xmlprotocol/error.h xmlprotocol/errorlistmodel.cpp xmlprotocol/errorlistmodel.h diff --git a/src/plugins/welcome/CMakeLists.txt b/src/plugins/welcome/CMakeLists.txt index 4b073015813..e72fe90f2d4 100644 --- a/src/plugins/welcome/CMakeLists.txt +++ b/src/plugins/welcome/CMakeLists.txt @@ -5,4 +5,5 @@ add_qtc_plugin(Welcome introductionwidget.cpp introductionwidget.h welcome.qrc welcomeplugin.cpp + welcometr.h ) From 5c5e12981e7fd5f1a6e1df20e0e8762bfedd09f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Fri, 31 Mar 2023 16:47:22 +0200 Subject: [PATCH 02/36] SquishTests: Add an explanation about automatically created kits Change-Id: I1bb351c56600fa4a6e420299bdbaff1c436d19c9 Reviewed-by: Reviewed-by: Christian Stenger --- tests/system/suite_general/tst_default_settings/test.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/system/suite_general/tst_default_settings/test.py b/tests/system/suite_general/tst_default_settings/test.py index c084e7b83c0..10a31534535 100644 --- a/tests/system/suite_general/tst_default_settings/test.py +++ b/tests/system/suite_general/tst_default_settings/test.py @@ -142,6 +142,10 @@ def __qtFunc__(it, foundQt, qmakePath): def __kitFunc__(it, foundQt, foundCompNames): global currentSelectedTreeItem, warningOrError qtVersionStr = str(waitForObjectExists(":Kits_QtVersion_QComboBox").currentText) + # The following may fail if Creator doesn't find a Qt version in PATH. It will then create one + # Qt-less kit for each available toolchain instead of just one default Desktop kit. + # Since Qt usually is in PATH on the test machines anyway, we consider this too much of a + # corner case to add error handling code or make Qt in PATH a hard requirement for the tests. test.compare(it, "Desktop (default)", "Verifying whether default Desktop kit has been created.") if foundQt: test.compare(qtVersionStr, foundQt, "Verifying if Qt versions match.") From 6ad3531b15c960a367470af1c249e3029d1b53b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Sat, 1 Apr 2023 00:44:19 +0200 Subject: [PATCH 03/36] SquishTests: Handle expected failure of qml refactoring Change-Id: I05b19c33de6e1245bfb6610f7a3fd39ba428aa28 Reviewed-by: Reviewed-by: Christian Stenger --- tests/system/suite_QMLS/tst_QMLS04/test.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/system/suite_QMLS/tst_QMLS04/test.py b/tests/system/suite_QMLS/tst_QMLS04/test.py index 2b64a54bf1e..bcb282560b9 100644 --- a/tests/system/suite_QMLS/tst_QMLS04/test.py +++ b/tests/system/suite_QMLS/tst_QMLS04/test.py @@ -48,8 +48,12 @@ def main(): except: pass # open MyComponent.qml file for verification - if not test.verify(openDocument(myCompTE), - "Was MyComponent.qml properly generated in project explorer?"): + docOpened = openDocument(myCompTE) + if JIRA.isBugStillOpen(28985): + test.xverify(docOpened, "Was MyComponent.qml properly generated in project explorer?") + saveAndExit() + return + if not test.verify(docOpened, "Was MyComponent.qml properly generated in project explorer?"): test.fatal("Could not open MyComponent.qml.") saveAndExit() return From 03195429374af53bf90ed48e9b9c6e2d4df9a7b3 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 3 Apr 2023 14:12:39 +0200 Subject: [PATCH 04/36] ClangCodeModel: Do not try to rename macros and namespaces with clangd Unfortunately, clangd refuses to rename macros and namespaces. Fall back to our old two-stage "find + replace" approach for macros (which clangd can find just fine) and employ the built-in code model for namespaces (as they don't get indexed at all by clangd). Change-Id: I08b1088ff4de9220427e089ef0700dbf2a944081 Reviewed-by: Christian Stenger Reviewed-by: Qt CI Bot Reviewed-by: --- src/plugins/clangcodemodel/clangdclient.cpp | 57 +++++++++++++++---- src/plugins/clangcodemodel/clangdclient.h | 2 +- .../clangmodelmanagersupport.cpp | 5 +- .../clangcodemodel/test/clangdtests.cpp | 2 +- 4 files changed, 51 insertions(+), 15 deletions(-) diff --git a/src/plugins/clangcodemodel/clangdclient.cpp b/src/plugins/clangcodemodel/clangdclient.cpp index 1ae8adc616c..7b2fc5353e2 100644 --- a/src/plugins/clangcodemodel/clangdclient.cpp +++ b/src/plugins/clangcodemodel/clangdclient.cpp @@ -508,21 +508,56 @@ void ClangdClient::closeExtraFile(const Utils::FilePath &filePath) SendDocUpdates::Ignore); } -void ClangdClient::findUsages(TextDocument *document, const QTextCursor &cursor, +void ClangdClient::findUsages(const CppEditor::CursorInEditor &cursor, const std::optional &replacement, const std::function &renameCallback) { // Quick check: Are we even on anything searchable? - const QTextCursor adjustedCursor = d->adjustedCursor(cursor, document); + const QTextCursor adjustedCursor = d->adjustedCursor(cursor.cursor(), cursor.textDocument()); const QString searchTerm = d->searchTermFromCursor(adjustedCursor); if (searchTerm.isEmpty()) return; if (replacement && versionNumber() >= QVersionNumber(16) - && Utils::qtcEnvironmentVariable("QTC_CLANGD_RENAMING") != "0") { - symbolSupport().renameSymbol(document, adjustedCursor, *replacement, renameCallback, - CppEditor::preferLowerCaseFileNames()); - return; + && Utils::qtcEnvironmentVariable("QTC_CLANGD_RENAMING") != "0") { + + // If we have up-to-date highlighting data, we can prevent giving clangd + // macros or namespaces to rename, which it can't cope with. + // TODO: Fix this upstream for macros; see https://github.com/clangd/clangd/issues/729. + bool useClangdForRenaming = true; + const auto highlightingData = d->highlightingData.constFind(cursor.textDocument()); + if (highlightingData != d->highlightingData.end() + && highlightingData->previousTokens.second == documentVersion(cursor.filePath())) { + const auto candidate = std::lower_bound( + highlightingData->previousTokens.first.cbegin(), + highlightingData->previousTokens.first.cend(), + cursor.cursor().position(), + [&cursor](const ExpandedSemanticToken &token, int pos) { + const int startPos = Utils::Text::positionInText( + cursor.textDocument()->document(), token.line, token.column); + return startPos + token.length < pos; + }); + if (candidate != highlightingData->previousTokens.first.cend()) { + const int startPos = Utils::Text::positionInText( + cursor.textDocument()->document(), candidate->line, candidate->column); + if (startPos <= cursor.cursor().position()) { + if (candidate->type == "namespace") { + CppEditor::CppModelManager::globalRename( + cursor, *replacement, renameCallback, + CppEditor::CppModelManager::Backend::Builtin); + return; + } + if (candidate->type == "macro") + useClangdForRenaming = false; + } + } + } + + if (useClangdForRenaming) { + symbolSupport().renameSymbol(cursor.textDocument(), adjustedCursor, *replacement, + renameCallback, CppEditor::preferLowerCaseFileNames()); + return; + } } const bool categorize = CppEditor::codeModelSettings()->categorizeFindReferences(); @@ -531,14 +566,15 @@ void ClangdClient::findUsages(TextDocument *document, const QTextCursor &cursor, if (searchTerm != "operator" && Utils::allOf(searchTerm, [](const QChar &c) { return c.isLetterOrNumber() || c == '_'; })) { - d->findUsages(document, adjustedCursor, searchTerm, replacement, renameCallback, categorize); + d->findUsages(cursor.textDocument(), adjustedCursor, searchTerm, replacement, + renameCallback, categorize); return; } // Otherwise get the proper spelling of the search term from clang, so we can put it into the // search widget. - const auto symbolInfoHandler = [this, doc = QPointer(document), adjustedCursor, replacement, - renameCallback, categorize] + const auto symbolInfoHandler = [this, doc = QPointer(cursor.textDocument()), adjustedCursor, + replacement, renameCallback, categorize] (const QString &name, const QString &, const MessageId &) { if (!doc) return; @@ -546,7 +582,8 @@ void ClangdClient::findUsages(TextDocument *document, const QTextCursor &cursor, return; d->findUsages(doc.data(), adjustedCursor, name, replacement, renameCallback, categorize); }; - requestSymbolInfo(document->filePath(), Range(adjustedCursor).start(), symbolInfoHandler); + requestSymbolInfo(cursor.textDocument()->filePath(), Range(adjustedCursor).start(), + symbolInfoHandler); } void ClangdClient::checkUnused(const Utils::Link &link, Core::SearchResult *search, diff --git a/src/plugins/clangcodemodel/clangdclient.h b/src/plugins/clangcodemodel/clangdclient.h index 772920b2776..67416d73795 100644 --- a/src/plugins/clangcodemodel/clangdclient.h +++ b/src/plugins/clangcodemodel/clangdclient.h @@ -53,7 +53,7 @@ public: void openExtraFile(const Utils::FilePath &filePath, const QString &content = {}); void closeExtraFile(const Utils::FilePath &filePath); - void findUsages(TextEditor::TextDocument *document, const QTextCursor &cursor, + void findUsages(const CppEditor::CursorInEditor &cursor, const std::optional &replacement, const std::function &renameCallback); void checkUnused(const Utils::Link &link, Core::SearchResult *search, diff --git a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp index 5cc123ac911..248e97349fa 100644 --- a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp +++ b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp @@ -320,7 +320,7 @@ void ClangModelManagerSupport::globalRename(const CppEditor::CursorInEditor &cur client && client->isFullyIndexed()) { QTC_ASSERT(client->documentOpen(cursor.textDocument()), client->openDocument(cursor.textDocument())); - client->findUsages(cursor.textDocument(), cursor.cursor(), replacement, callback); + client->findUsages(cursor, replacement, callback); return; } CppModelManager::globalRename(cursor, replacement, callback, CppModelManager::Backend::Builtin); @@ -332,8 +332,7 @@ void ClangModelManagerSupport::findUsages(const CppEditor::CursorInEditor &curso client && client->isFullyIndexed()) { QTC_ASSERT(client->documentOpen(cursor.textDocument()), client->openDocument(cursor.textDocument())); - client->findUsages(cursor.textDocument(), cursor.cursor(), {}, {}); - + client->findUsages(cursor, {}, {}); return; } CppModelManager::findUsages(cursor, CppModelManager::Backend::Builtin); diff --git a/src/plugins/clangcodemodel/test/clangdtests.cpp b/src/plugins/clangcodemodel/test/clangdtests.cpp index b5103d3552d..c60a45f1df2 100644 --- a/src/plugins/clangcodemodel/test/clangdtests.cpp +++ b/src/plugins/clangcodemodel/test/clangdtests.cpp @@ -294,7 +294,7 @@ void ClangdTestFindReferences::test() QVERIFY(doc); QTextCursor cursor(doc->document()); cursor.setPosition(pos); - client()->findUsages(doc, cursor, {}, {}); + client()->findUsages(CppEditor::CursorInEditor(cursor, doc->filePath(), nullptr, doc), {}, {}); QVERIFY(waitForSignalOrTimeout(client(), &ClangdClient::findUsagesDone, timeOutInMs())); QCOMPARE(m_actualResults.size(), expectedResults.size()); From 3c0c26f7b35b967ae21375ca00c25bc520d736b4 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 3 Apr 2023 12:26:01 +0200 Subject: [PATCH 05/36] ClangCodeModel: Adapt to updated clangd tooltip format The header file path is not the last line anymore; see https://reviews.llvm.org/D146244. Change-Id: Ifbc2b55c0a82c661454d487c287fe4fb5a950d38 Reviewed-by: Qt CI Bot Reviewed-by: Reviewed-by: David Schulz --- src/plugins/clangcodemodel/clangdclient.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/plugins/clangcodemodel/clangdclient.cpp b/src/plugins/clangcodemodel/clangdclient.cpp index 7b2fc5353e2..392a6a1ffe8 100644 --- a/src/plugins/clangcodemodel/clangdclient.cpp +++ b/src/plugins/clangcodemodel/clangdclient.cpp @@ -1069,9 +1069,8 @@ void ClangdClient::gatherHelpItemForTooltip(const HoverRequest::Response &hoverR QString cleanString = markupString; cleanString.remove('`'); const QStringList lines = cleanString.trimmed().split('\n'); - if (!lines.isEmpty()) { - const auto markupFilePath = Utils::FilePath::fromUserInput( - lines.last().simplified()); + for (const QString &line : lines) { + const auto markupFilePath = Utils::FilePath::fromUserInput(line.simplified()); if (markupFilePath.exists()) { d->setHelpItemForTooltip(hoverResponse.id(), filePath, From 4d688c932baa41e9c4d04084bd4ce682301f7a48 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 11 Oct 2022 10:49:34 +0200 Subject: [PATCH 06/36] Clangd: do not modify the default replacement string Fixes: QTCREATORBUG-28321 Fixes: QTCREATORBUG-28910 Change-Id: I4cfaf5ea3916a0ecbf0b0bae4d0c231513671c73 Reviewed-by: Christian Kandeler Reviewed-by: Reviewed-by: Leena Miettinen --- src/plugins/clangcodemodel/clangdclient.cpp | 2 -- src/plugins/languageclient/languageclientsymbolsupport.cpp | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/clangcodemodel/clangdclient.cpp b/src/plugins/clangcodemodel/clangdclient.cpp index 392a6a1ffe8..9fa2e792ab6 100644 --- a/src/plugins/clangcodemodel/clangdclient.cpp +++ b/src/plugins/clangcodemodel/clangdclient.cpp @@ -370,8 +370,6 @@ ClangdClient::ClangdClient(Project *project, const Utils::FilePath &jsonDbDir, c setActivateDocumentAutomatically(true); setCompletionAssistProvider(new ClangdCompletionAssistProvider(this)); setQuickFixAssistProvider(new ClangdQuickFixProvider(this)); - symbolSupport().setDefaultRenamingSymbolMapper( - [](const QString &oldSymbol) { return oldSymbol + "_new"; }); symbolSupport().setLimitRenamingToProjects(true); if (!project) { QJsonObject initOptions; diff --git a/src/plugins/languageclient/languageclientsymbolsupport.cpp b/src/plugins/languageclient/languageclientsymbolsupport.cpp index 995ca770f3d..b5f301d4433 100644 --- a/src/plugins/languageclient/languageclientsymbolsupport.cpp +++ b/src/plugins/languageclient/languageclientsymbolsupport.cpp @@ -549,8 +549,11 @@ void SymbolSupport::handleRenameResponse(Core::SearchResult *search, const std::optional &error = response.error(); QString errorMessage; if (error.has_value()) { - m_client->log(*error); errorMessage = error->toString(); + if (errorMessage.contains("Cannot rename symbol: new name is the same as the old name")) + errorMessage = Tr::tr("Start typing to see replacements"); // clangd optimization + else + m_client->log(*error); } const std::optional &edits = response.result(); From 892ccd2097ece7e8f77ab278dc83d83f6cc0ce7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Mon, 3 Apr 2023 16:15:25 +0200 Subject: [PATCH 07/36] SquishTests: Add function for finding elements of project tree Change-Id: I08c3c22a404d2b58bdb1205f22e5cf937c6027b0 Reviewed-by: Reviewed-by: Christian Stenger --- tests/system/shared/project_explorer.py | 31 +++++++++++++++++----- tests/system/suite_QMLS/tst_QMLS04/test.py | 5 ++-- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/tests/system/shared/project_explorer.py b/tests/system/shared/project_explorer.py index 8f50fae7e62..ca7952022ee 100644 --- a/tests/system/shared/project_explorer.py +++ b/tests/system/shared/project_explorer.py @@ -96,16 +96,33 @@ def getExecutableAndTargetFromToolTip(toolTip): return None, target return exe.group(1).strip(), target + +# treeElement is the dot-separated tree to the wanted element, e.g. +# root.first.second.leaf +def waitForProjectTreeItem(treeElement, timeoutMSec): + projectTV = ":Qt Creator_Utils::NavigationTreeView" + projItem = None + treeElementWithBranch = addBranchWildcardToRoot(treeElement) + for _ in range(timeoutMSec / 200): + try: + projItem = waitForObjectItem(projectTV, treeElement, 100) + except: + try: + projItem = waitForObjectItem(projectTV, treeElementWithBranch, 100) + except: + pass + if projItem: + return projItem + raise LookupError("Could not find project tree element: %s or %s" + % (treeElement, treeElementWithBranch)) + + def invokeContextMenuOnProject(projectName, menuItem): try: - projItem = waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", projectName, 3000) + projItem = waitForProjectTreeItem(projectName, 4000) except: - try: - projItem = waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", - addBranchWildcardToRoot(projectName), 1000) - except: - test.fatal("Failed to find root node of the project '%s'." % projectName) - return + test.fatal("Failed to find root node of the project '%s'." % projectName) + return openItemContextMenu(waitForObject(":Qt Creator_Utils::NavigationTreeView"), str(projItem.text).replace("_", "\\_").replace(".", "\\."), 5, 5, 0) activateItem(waitForObjectItem("{name='Project.Menu.Project' type='QMenu' visible='1'}", menuItem)) diff --git a/tests/system/suite_QMLS/tst_QMLS04/test.py b/tests/system/suite_QMLS/tst_QMLS04/test.py index bcb282560b9..351b59ac638 100644 --- a/tests/system/suite_QMLS/tst_QMLS04/test.py +++ b/tests/system/suite_QMLS/tst_QMLS04/test.py @@ -41,10 +41,9 @@ def main(): # there should be new QML file generated with name "MyComponent.qml" try: # openDocument() doesn't wait for expected elements, so it might be faster than the updates - # to the tree. Explicitly wait here to avoid timing issues. Using wFOI() instead of + # to the tree. Explicitly wait here to avoid timing issues. Using wFPTI() instead of # snooze() allows to proceed earlier, just in case it can find the item. - waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", - addBranchWildcardToRoot(myCompTE), 2000) + waitForProjectTreeItem(myCompTE, 2000) except: pass # open MyComponent.qml file for verification From 41c1b76af0aa88b4ccfcb6c0e034160e0ecb029f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Sat, 1 Apr 2023 01:14:28 +0200 Subject: [PATCH 08/36] SquishTests: Stabilize tst_rename_macros Change-Id: I9d77bf9daa66b46e2b16c8618e1848538cb797aa Reviewed-by: Reviewed-by: Christian Stenger --- tests/system/suite_editors/tst_rename_macros/test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/system/suite_editors/tst_rename_macros/test.py b/tests/system/suite_editors/tst_rename_macros/test.py index 0ad013cc9a2..49737f3b492 100644 --- a/tests/system/suite_editors/tst_rename_macros/test.py +++ b/tests/system/suite_editors/tst_rename_macros/test.py @@ -78,6 +78,7 @@ def testRenameMacroAfterSourceMoving(): if not content: return False formerTexts["testfiles.Headers.testfile\\.h"] = content + waitForProjectTreeItem("testfiles.Headers.anothertestfile\\.h", 5000) content = openDocumentPlaceCursor("testfiles.Headers.anothertestfile\\.h", "#define ANOTHERTESTFILE_H", __paste__) if not content: From f019dd14e038e300cd82b4cea8fc5c44e623db4d Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 4 Apr 2023 13:46:31 +0200 Subject: [PATCH 09/36] qbs build: Fix qtc module There should be no symbol "Qt" in that module's scope; it's a qbs bug this worked so far. Change-Id: Iddf69669656b41fa7a7a96b2fae4f6584275812d Reviewed-by: Christian Stenger --- qbs/modules/qtc/qtc.qbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qbs/modules/qtc/qtc.qbs b/qbs/modules/qtc/qtc.qbs index ee5e0bb6b59..c37e05ce9dd 100644 --- a/qbs/modules/qtc/qtc.qbs +++ b/qbs/modules/qtc/qtc.qbs @@ -100,7 +100,7 @@ Module { Properties { condition: cpp.present && qbs.toolchain.contains("msvc") && product.Qt - && Utilities.versionCompare(Qt.core.version, "6.3") >= 0 + && Utilities.versionCompare(product.Qt.core.version, "6.3") >= 0 && Utilities.versionCompare(cpp.compilerVersion, "19.10") >= 0 && Utilities.versionCompare(qbs.version, "1.23") < 0 cpp.cxxFlags: "/permissive-" From 031f51794a944787a6e7757f0906c0776c9eeba4 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 4 Apr 2023 13:39:56 +0200 Subject: [PATCH 10/36] Python: Don't leak running futures on shutdown This patch fixes the following assert on shutdown: "Shutting down while process /testenv/bin/python is running\"\n". Change-Id: I4c32ead5e4952b69ffc6037739fd417a632eda1a Reviewed-by: Friedemann Kleint Reviewed-by: David Schulz --- src/plugins/python/pythonplugin.cpp | 15 ++++++++++++--- src/plugins/python/pythonplugin.h | 3 +++ src/plugins/python/pythonrunconfiguration.cpp | 17 ++++++++--------- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/plugins/python/pythonplugin.cpp b/src/plugins/python/pythonplugin.cpp index dff3c0cb220..3bc19a8725b 100644 --- a/src/plugins/python/pythonplugin.cpp +++ b/src/plugins/python/pythonplugin.cpp @@ -16,9 +16,11 @@ #include #include +#include #include using namespace ProjectExplorer; +using namespace Utils; namespace Python::Internal { @@ -34,6 +36,7 @@ public: PySideBuildConfigurationFactory buildConfigFactory; SimpleTargetRunnerFactory runWorkerFactory{{runConfigFactory.runConfigurationId()}}; PythonSettings settings; + FutureSynchronizer m_futureSynchronizer; }; PythonPlugin::PythonPlugin() @@ -52,6 +55,12 @@ PythonPlugin *PythonPlugin::instance() return m_instance; } +FutureSynchronizer *PythonPlugin::futureSynchronizer() +{ + QTC_ASSERT(m_instance, return nullptr); + return &m_instance->d->m_futureSynchronizer; +} + void PythonPlugin::initialize() { d = new PythonPluginPrivate; @@ -62,9 +71,9 @@ void PythonPlugin::initialize() void PythonPlugin::extensionsInitialized() { // Add MIME overlay icons (these icons displayed at Project dock panel) - QString imageFile = Utils::creatorTheme()->imageFile(Utils::Theme::IconOverlayPro, - ::Constants::FILEOVERLAY_PY); - Utils::FileIconProvider::registerIconOverlayForSuffix(imageFile, "py"); + const QString imageFile = Utils::creatorTheme()->imageFile(Theme::IconOverlayPro, + ::Constants::FILEOVERLAY_PY); + FileIconProvider::registerIconOverlayForSuffix(imageFile, "py"); TaskHub::addCategory(PythonErrorTaskCategory, "Python", true); } diff --git a/src/plugins/python/pythonplugin.h b/src/plugins/python/pythonplugin.h index ef0860bbca4..7c8ca121f3c 100644 --- a/src/plugins/python/pythonplugin.h +++ b/src/plugins/python/pythonplugin.h @@ -5,6 +5,8 @@ #include +namespace Utils { class FutureSynchronizer; } + namespace Python::Internal { class PythonPlugin final : public ExtensionSystem::IPlugin @@ -17,6 +19,7 @@ public: ~PythonPlugin() final; static PythonPlugin *instance(); + static Utils::FutureSynchronizer *futureSynchronizer(); private: void initialize() final; diff --git a/src/plugins/python/pythonrunconfiguration.cpp b/src/plugins/python/pythonrunconfiguration.cpp index 2163e2b7ed6..d21e7f8bfcb 100644 --- a/src/plugins/python/pythonrunconfiguration.cpp +++ b/src/plugins/python/pythonrunconfiguration.cpp @@ -9,6 +9,7 @@ #include "pysideuicextracompiler.h" #include "pythonconstants.h" #include "pythonlanguageclient.h" +#include "pythonplugin.h" #include "pythonproject.h" #include "pythonsettings.h" #include "pythontr.h" @@ -31,6 +32,7 @@ #include #include +#include #include #include #include @@ -241,15 +243,12 @@ void PythonRunConfigurationPrivate::checkForPySide(const FilePath &python, { const PipPackage package(pySidePackageName); QObject::disconnect(m_watcherConnection); - m_watcherConnection = QObject::connect(&m_watcher, - &QFutureWatcher::finished, - q, - [=]() { - handlePySidePackageInfo(m_watcher.result(), - python, - pySidePackageName); - }); - m_watcher.setFuture(Pip::instance(python)->info(package)); + m_watcherConnection = QObject::connect(&m_watcher, &QFutureWatcherBase::finished, q, [=] { + handlePySidePackageInfo(m_watcher.result(), python, pySidePackageName); + }); + const auto future = Pip::instance(python)->info(package); + m_watcher.setFuture(future); + PythonPlugin::futureSynchronizer()->addFuture(future); } void PythonRunConfigurationPrivate::handlePySidePackageInfo(const PipPackageInfo &pySideInfo, From 06427a038b42023b44aa5690596636c11637c837 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 30 Mar 2023 18:31:09 +0200 Subject: [PATCH 11/36] Android: Force reset/update of pre-existing toolchains Toolchains are only (re-)created if the NDK changes. And till now, the environment for the toolchain was only set during its creation. However, if the user only changes the JDK location, we don't want to recreate the toolchain but to still update the JAVA_HOME variable for the environment. This change does so that resetToolChain() is called also for pre- existing toolchains (not just the newly created ones). That triggers a call of addToEnvironment(), which sets the potentially updated JAVA_HOME variable. Fixes: QTCREATORBUG-28827 Change-Id: Id55f59f3ef3c8bfbb2b811052e0f60f495843dc3 Reviewed-by: Assam Boudjelthia --- src/plugins/android/androidtoolchain.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/android/androidtoolchain.cpp b/src/plugins/android/androidtoolchain.cpp index 00335be2ef1..7af3bb417b6 100644 --- a/src/plugins/android/androidtoolchain.cpp +++ b/src/plugins/android/androidtoolchain.cpp @@ -230,9 +230,14 @@ ToolChainList AndroidToolChainFactory::autodetectToolChainsFromNdks( atc->setPlatformCodeGenFlags({"-target", target}); atc->setPlatformLinkerFlags({"-target", target}); atc->setDisplayName(displayName); - atc->resetToolChain(compilerCommand); tc = atc; } + + // Do not only reset newly created toolchains. This triggers call to + // addToEnvironment, so that e.g. JAVA_HOME gets updated. + if (auto gccTc = dynamic_cast(tc)) + gccTc->resetToolChain(compilerCommand); + tc->setDetection(ToolChain::AutoDetection); result << tc; ++targetItr; From da7009ac164f7df847739dd63de1e8595825cb9c Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 4 Apr 2023 15:31:03 +0200 Subject: [PATCH 12/36] Python: Remove unneeded mutex The mutex may potentially block concurrent calls to Pip::infoImpl(). Make infoImpl() a static method in cpp. Change-Id: I06e2de08674b5669e58684743d67a569da43d662 Reviewed-by: David Schulz --- src/plugins/python/pipsupport.cpp | 16 +++++++--------- src/plugins/python/pipsupport.h | 3 --- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/plugins/python/pipsupport.cpp b/src/plugins/python/pipsupport.cpp index 848184b462f..a282702d9bd 100644 --- a/src/plugins/python/pipsupport.cpp +++ b/src/plugins/python/pipsupport.cpp @@ -143,20 +143,13 @@ Pip *Pip::instance(const FilePath &python) return it.value(); } -QFuture Pip::info(const PipPackage &package) -{ - return Utils::runAsync(&Pip::infoImpl, this, package); -} - -PipPackageInfo Pip::infoImpl(const PipPackage &package) +static PipPackageInfo infoImpl(const PipPackage &package, const FilePath &python) { PipPackageInfo result; QtcProcess pip; - pip.setCommand(CommandLine(m_python, {"-m", "pip", "show", "-f", package.packageName})); - m_lock.lock(); + pip.setCommand(CommandLine(python, {"-m", "pip", "show", "-f", package.packageName})); pip.runBlocking(); - m_lock.unlock(); QString fieldName; QStringList data; const QString pipOutput = pip.allOutput(); @@ -180,6 +173,11 @@ PipPackageInfo Pip::infoImpl(const PipPackage &package) return result; } +QFuture Pip::info(const PipPackage &package) +{ + return Utils::runAsync(infoImpl, package, m_python); +} + Pip::Pip(const Utils::FilePath &python) : QObject(PythonPlugin::instance()) , m_python(python) diff --git a/src/plugins/python/pipsupport.h b/src/plugins/python/pipsupport.h index e5f53768ce9..4ef6fcca730 100644 --- a/src/plugins/python/pipsupport.h +++ b/src/plugins/python/pipsupport.h @@ -55,9 +55,6 @@ public: private: Pip(const Utils::FilePath &python); - PipPackageInfo infoImpl(const PipPackage &package); - - QMutex m_lock; Utils::FilePath m_python; }; From c53c9592faae66188512a5a067de1235cc37d697 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 4 Apr 2023 13:53:41 +0200 Subject: [PATCH 13/36] CMakeProject templates/examples: Fix the install line The installation command needs to define RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} Fixes: QTCREATORBUG-28999 Change-Id: If3f6ed15ef248eb07628bdc9fa4d11a678839a27 Reviewed-by: Joerg Bornemann --- doc/qtcreator/examples/accelbubble/CMakeLists.txt | 4 +++- doc/qtcreator/examples/textfinder/CMakeLists.txt | 4 +++- doc/qtcreator/examples/transitions/CMakeLists.txt | 4 +++- share/qtcreator/templates/wizards/codesnippet/CMakeLists.txt | 4 +++- .../templates/wizards/projects/consoleapp/CMakeLists.txt | 4 +++- .../templates/wizards/projects/plainc/CMakeLists.txt | 4 +++- .../templates/wizards/projects/plaincpp/CMakeLists.txt | 4 +++- .../wizards/projects/qtquickapplication/CMakeLists.txt | 4 +++- .../wizards/projects/qtwidgetsapplication/CMakeLists.txt | 4 +++- 9 files changed, 27 insertions(+), 9 deletions(-) diff --git a/doc/qtcreator/examples/accelbubble/CMakeLists.txt b/doc/qtcreator/examples/accelbubble/CMakeLists.txt index 868e5ea1331..9e67614807a 100644 --- a/doc/qtcreator/examples/accelbubble/CMakeLists.txt +++ b/doc/qtcreator/examples/accelbubble/CMakeLists.txt @@ -40,6 +40,8 @@ target_link_libraries(appaccelbubble install(TARGETS appaccelbubble BUNDLE DESTINATION . - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) qt_finalize_executable(appaccelbubble) diff --git a/doc/qtcreator/examples/textfinder/CMakeLists.txt b/doc/qtcreator/examples/textfinder/CMakeLists.txt index 77a0ba8c152..a00ccd856b4 100644 --- a/doc/qtcreator/examples/textfinder/CMakeLists.txt +++ b/doc/qtcreator/examples/textfinder/CMakeLists.txt @@ -62,7 +62,9 @@ set_target_properties(TextFinder PROPERTIES install(TARGETS TextFinder BUNDLE DESTINATION . - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) if(QT_VERSION_MAJOR EQUAL 6) qt_finalize_executable(TextFinder) diff --git a/doc/qtcreator/examples/transitions/CMakeLists.txt b/doc/qtcreator/examples/transitions/CMakeLists.txt index 3dec945039b..8b363fc8e27 100644 --- a/doc/qtcreator/examples/transitions/CMakeLists.txt +++ b/doc/qtcreator/examples/transitions/CMakeLists.txt @@ -33,4 +33,6 @@ target_link_libraries(apptransitions install(TARGETS apptransitions BUNDLE DESTINATION . - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/share/qtcreator/templates/wizards/codesnippet/CMakeLists.txt b/share/qtcreator/templates/wizards/codesnippet/CMakeLists.txt index 603186293d9..325903743c0 100644 --- a/share/qtcreator/templates/wizards/codesnippet/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/codesnippet/CMakeLists.txt @@ -28,7 +28,9 @@ install(TARGETS %{ProjectName} @if %{MacOSBundle} BUNDLE DESTINATION . @endif - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) set_target_properties(%{ProjectName} PROPERTIES MACOSX_BUNDLE %{MacOSBundleValue}) diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt index e53a18b1f90..7be8ecf05aa 100644 --- a/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt @@ -36,4 +36,6 @@ endif() @endif install(TARGETS %{ProjectName} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/share/qtcreator/templates/wizards/projects/plainc/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/plainc/CMakeLists.txt index 53d5f414ca0..49bf10a0890 100644 --- a/share/qtcreator/templates/wizards/projects/plainc/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/plainc/CMakeLists.txt @@ -5,4 +5,6 @@ project(%{ProjectName} LANGUAGES C) add_executable(%{ProjectName} %{CFileName}) install(TARGETS %{ProjectName} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/share/qtcreator/templates/wizards/projects/plaincpp/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/plaincpp/CMakeLists.txt index 008eb2ff62e..232bf6d489c 100644 --- a/share/qtcreator/templates/wizards/projects/plaincpp/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/plaincpp/CMakeLists.txt @@ -8,4 +8,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) add_executable(%{ProjectName} %{CppFileName}) install(TARGETS %{ProjectName} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt index 1f196bef178..92e2a825af7 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt @@ -41,4 +41,6 @@ target_link_libraries(%{TargetName} install(TARGETS %{TargetName} BUNDLE DESTINATION . - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt index 7573f4cf025..8856a476b9e 100644 --- a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt @@ -74,7 +74,9 @@ set_target_properties(%{ProjectName} PROPERTIES install(TARGETS %{ProjectName} BUNDLE DESTINATION . - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) if(QT_VERSION_MAJOR EQUAL 6) qt_finalize_executable(%{ProjectName}) From cb4074713facfe9d787d7dd11c3dad87699fc848 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Mon, 3 Apr 2023 11:31:54 +0200 Subject: [PATCH 14/36] Dumpers: Fix std::string for clang >= 15 libc++ has changed the layout of std::string again. (see https://reviews.llvm.org/D128285) This patch adds checks to differentiate between the two versions. Fixes: QTCREATORBUG-28806 Change-Id: Ic21c488cf1c173120beddf414ca39040dfaba096 Reviewed-by: Qt CI Bot Reviewed-by: hjk --- share/qtcreator/debugger/libcpp_stdtypes.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/share/qtcreator/debugger/libcpp_stdtypes.py b/share/qtcreator/debugger/libcpp_stdtypes.py index cebd4da435f..5a72629da75 100644 --- a/share/qtcreator/debugger/libcpp_stdtypes.py +++ b/share/qtcreator/debugger/libcpp_stdtypes.py @@ -182,6 +182,7 @@ def std_1_string_dumper(d, value): size = 0 size_mode_value = 0 short_mode = False + libcxx_version = 14 layoutModeIsDSC = layoutDecider.name == '__data_' if (layoutModeIsDSC): @@ -200,8 +201,15 @@ def std_1_string_dumper(d, value): if not size_mode: raise Exception("Could not find size_mode") - size_mode_value = size_mode.integer() - short_mode = ((size_mode_value & 1) == 0) + if size_mode.name == '__is_long_': + libcxx_version = 15 + short_mode = (size_mode.integer() == 0) + + size_mode = D[1][0][1] + size_mode_value = size_mode.integer() + else: + size_mode_value = size_mode.integer() + short_mode = ((size_mode_value & 1) == 0) if short_mode: s = D[1] @@ -209,8 +217,13 @@ def std_1_string_dumper(d, value): if not s: raise Exception("Could not find s") - location_sp = s[0] if layoutModeIsDSC else s[1] - size = size_mode_value if layoutModeIsDSC else ((size_mode_value >> 1) % 256) + if libcxx_version == 14: + location_sp = s[0] if layoutModeIsDSC else s[1] + size = size_mode_value if layoutModeIsDSC else ((size_mode_value >> 1) % 256) + elif libcxx_version == 15: + location_sp = s[0] if layoutModeIsDSC else s[2] + size = size_mode_value + else: l = D[0] if not l: From 36ca97d32b2f7c8d1a6cdfbff44b436a3e714a48 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 3 Apr 2023 15:17:18 +0200 Subject: [PATCH 15/36] PE: Silence soft assert Change-Id: Ie07d261cc49a20fd57d885e9be9d63c4b4a8743f Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp index f155c5656e7..25a897bd799 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp @@ -627,7 +627,7 @@ void LineEditField::setupCompletion(FancyLineEdit *lineEdit) && !isReservedName(entry.extraInfo) && !entry.extraInfo.startsWith('~') && !entry.extraInfo.contains("Anonymous:") - && !FilePath::fromString(entry.extraInfo).isAbsolutePath(); + && !FilePath::fromUserInput(entry.extraInfo).isAbsolutePath(); const bool isBaseClassCandidate = !isReservedName(entry.displayName) && !entry.displayName.startsWith("Anonymous:"); if (isBaseClassCandidate) From 66f939c75847391a3b124ecbc173176abf573aae Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 5 Apr 2023 16:00:55 +0200 Subject: [PATCH 16/36] Wizard: Fix generated project file Change-Id: Ibef37ad8ecc696a35766bbda94a113e747d69771 Reviewed-by: David Schulz --- share/qtcreator/templates/wizards/autotest/files/tst.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/qtcreator/templates/wizards/autotest/files/tst.pro b/share/qtcreator/templates/wizards/autotest/files/tst.pro index 49ab1c90d83..670c72e7987 100644 --- a/share/qtcreator/templates/wizards/autotest/files/tst.pro +++ b/share/qtcreator/templates/wizards/autotest/files/tst.pro @@ -47,7 +47,7 @@ CONFIG += thread CONFIG -= qt SOURCES += \\ - %{MainCppName} \ + %{MainCppName} \\ %{TestCaseFileGTestWithCppSuffix} @endif @if "%{TestFrameWork}" == "BoostTest" From 42c653b53c9e6acfd336c133a14a81290784a673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Tue, 4 Apr 2023 00:26:21 +0200 Subject: [PATCH 17/36] SquishTests: Don't filter out code model issues when we need them Amends c46dff01995128bd97c03e6d732c85f662355bf9 Change-Id: I5f2613edf15f86161a576ab21f16f079bd12a59f Reviewed-by: Reviewed-by: Christian Stenger --- tests/system/shared/build_utils.py | 13 ++++++++----- .../system/suite_editors/tst_memberoperator/test.py | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/system/shared/build_utils.py b/tests/system/shared/build_utils.py index 4cf1bf82dcb..74063c72f9f 100644 --- a/tests/system/shared/build_utils.py +++ b/tests/system/shared/build_utils.py @@ -23,14 +23,17 @@ def toggleIssuesFilter(filterName, checked): test.log("Exception while toggling filter '%s'" % filterName, "%s(%s)" % (str(t), str(v))) -def getBuildIssues(): + +def getBuildIssues(ignoreCodeModel=True): ensureChecked(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton") model = waitForObject(":Qt Creator.Issues_QListView").model() - # filter out possible code model issues present inside the Issues pane - toggleIssuesFilter("Clang Code Model", False) + if ignoreCodeModel: + # filter out possible code model issues present inside the Issues pane + toggleIssuesFilter("Clang Code Model", False) result = dumpBuildIssues(model) - # reset the filter - toggleIssuesFilter("Clang Code Model", True) + if ignoreCodeModel: + # reset the filter + toggleIssuesFilter("Clang Code Model", True) return result # this method checks the last build (if there's one) and logs the number of errors, warnings and diff --git a/tests/system/suite_editors/tst_memberoperator/test.py b/tests/system/suite_editors/tst_memberoperator/test.py index cbdf411f144..ba1f1476850 100644 --- a/tests/system/suite_editors/tst_memberoperator/test.py +++ b/tests/system/suite_editors/tst_memberoperator/test.py @@ -25,7 +25,7 @@ def __noBuildIssues__(): def __syntaxErrorDetected__(): - buildIssues = getBuildIssues() + buildIssues = getBuildIssues(False) for issue in buildIssues: if issue[3] in ["Expected ';' after expression (fix available)", "Expected ';' at end of declaration (fix available)", From 028686b4196d9c1a71d292e2a64a55e514ec7f5c Mon Sep 17 00:00:00 2001 From: Artem Sokolovskii Date: Tue, 4 Apr 2023 14:28:27 +0200 Subject: [PATCH 18/36] ClangFormat: Grey out Clang-Format Style config when not overridden Add feature to grey out the Clang-Format Style configuration widget after unchecking the 'Override' checkbox. Change-Id: I94bbb1f4436f3caeaed55d49582211257e480d0d Reviewed-by: Reviewed-by: Christian Kandeler --- .../clangformat/clangformatconfigwidget.cpp | 6 ++++-- .../clangformat/clangformatglobalconfigwidget.cpp | 15 +++++++++++++-- .../clangformat/clangformatglobalconfigwidget.h | 5 ++++- src/plugins/clangformat/clangformatplugin.cpp | 4 ++-- .../cppeditor/cppcodestylesettingspage.cpp | 2 +- src/plugins/texteditor/codestyleeditor.cpp | 4 +++- src/plugins/texteditor/icodestylepreferences.cpp | 11 +++++++++++ src/plugins/texteditor/icodestylepreferences.h | 3 +++ .../texteditor/icodestylepreferencesfactory.cpp | 2 +- .../texteditor/icodestylepreferencesfactory.h | 6 ++++-- 10 files changed, 46 insertions(+), 12 deletions(-) diff --git a/src/plugins/clangformat/clangformatconfigwidget.cpp b/src/plugins/clangformat/clangformatconfigwidget.cpp index 1d91bd9857f..12e02b4fa74 100644 --- a/src/plugins/clangformat/clangformatconfigwidget.cpp +++ b/src/plugins/clangformat/clangformatconfigwidget.cpp @@ -89,7 +89,8 @@ ClangFormatConfigWidget::ClangFormatConfigWidget(TextEditor::ICodeStylePreferenc d->checksScrollArea->setWidget(d->checksWidget); d->checksScrollArea->setWidgetResizable(true); - d->checksWidget->setEnabled(!codeStyle->isReadOnly()); + d->checksWidget->setEnabled(!codeStyle->isReadOnly() + && !codeStyle->isTemporarilyReadOnly()); FilePath fileName; if (d->project) @@ -140,7 +141,8 @@ void ClangFormatConfigWidget::slotCodeStyleChanged( d->config->setIsReadOnly(codeStyle->isReadOnly()); d->style = d->config->style(); - d->checksWidget->setEnabled(!codeStyle->isReadOnly()); + d->checksWidget->setEnabled(!codeStyle->isReadOnly() + && !codeStyle->isTemporarilyReadOnly()); fillTable(); updatePreview(); diff --git a/src/plugins/clangformat/clangformatglobalconfigwidget.cpp b/src/plugins/clangformat/clangformatglobalconfigwidget.cpp index f332a97070f..1b57403f32c 100644 --- a/src/plugins/clangformat/clangformatglobalconfigwidget.cpp +++ b/src/plugins/clangformat/clangformatglobalconfigwidget.cpp @@ -9,6 +9,7 @@ #include "clangformatutils.h" #include +#include #include @@ -24,10 +25,11 @@ using namespace Utils; namespace ClangFormat { -ClangFormatGlobalConfigWidget::ClangFormatGlobalConfigWidget(ProjectExplorer::Project *project, - QWidget *parent) +ClangFormatGlobalConfigWidget::ClangFormatGlobalConfigWidget( + TextEditor::ICodeStylePreferences *codeStyle, ProjectExplorer::Project *project, QWidget *parent) : CppCodeStyleWidget(parent) , m_project(project) + , m_codeStyle(codeStyle) { resize(489, 305); @@ -164,10 +166,19 @@ void ClangFormatGlobalConfigWidget::initOverrideCheckBox() Tr::tr("Override Clang Format configuration file with the chosen configuration.")); m_overrideDefault->setChecked(getProjectOverriddenSettings(m_project)); + m_codeStyle->currentPreferences()->setTemporarilyReadOnly(!m_overrideDefault->isChecked()); connect(m_overrideDefault, &QCheckBox::toggled, this, [this](bool checked) { if (m_project) m_project->setNamedSettings(Constants::OVERRIDE_FILE_ID, checked); + else { + m_codeStyle->currentPreferences()->setTemporarilyReadOnly(!checked); + emit m_codeStyle->currentPreferencesChanged(m_codeStyle->currentPreferences()); + } + }); + + connect(m_codeStyle, &TextEditor::ICodeStylePreferences::currentPreferencesChanged, this, [this] { + m_codeStyle->currentPreferences()->setTemporarilyReadOnly(!m_overrideDefault->isChecked()); }); } diff --git a/src/plugins/clangformat/clangformatglobalconfigwidget.h b/src/plugins/clangformat/clangformatglobalconfigwidget.h index 49657cfe201..989aa58a925 100644 --- a/src/plugins/clangformat/clangformatglobalconfigwidget.h +++ b/src/plugins/clangformat/clangformatglobalconfigwidget.h @@ -14,6 +14,7 @@ class QLabel; QT_END_NAMESPACE namespace ProjectExplorer { class Project; } +namespace TextEditor { class ICodeStylePreferences; } namespace ClangFormat { @@ -22,7 +23,8 @@ class ClangFormatGlobalConfigWidget : public CppEditor::CppCodeStyleWidget Q_OBJECT public: - explicit ClangFormatGlobalConfigWidget(ProjectExplorer::Project *project = nullptr, + explicit ClangFormatGlobalConfigWidget(TextEditor::ICodeStylePreferences *codeStyle, + ProjectExplorer::Project *project = nullptr, QWidget *parent = nullptr); ~ClangFormatGlobalConfigWidget() override; void apply() override; @@ -36,6 +38,7 @@ private: bool projectClangFormatFileExists(); ProjectExplorer::Project *m_project; + TextEditor::ICodeStylePreferences *m_codeStyle; QLabel *m_projectHasClangFormat; QLabel *m_formattingModeLabel; diff --git a/src/plugins/clangformat/clangformatplugin.cpp b/src/plugins/clangformat/clangformatplugin.cpp index c958406d7b9..b64ca2ac94e 100644 --- a/src/plugins/clangformat/clangformatplugin.cpp +++ b/src/plugins/clangformat/clangformatplugin.cpp @@ -51,9 +51,9 @@ public: } CodeStyleEditorWidget *createAdditionalGlobalSettings( - Project *project, QWidget *parent) override + ICodeStylePreferences *codeStyle, Project *project, QWidget *parent) override { - return new ClangFormatGlobalConfigWidget(project, parent); + return new ClangFormatGlobalConfigWidget(codeStyle, project, parent); } }; diff --git a/src/plugins/cppeditor/cppcodestylesettingspage.cpp b/src/plugins/cppeditor/cppcodestylesettingspage.cpp index 43778c51daf..ebb4a37485d 100644 --- a/src/plugins/cppeditor/cppcodestylesettingspage.cpp +++ b/src/plugins/cppeditor/cppcodestylesettingspage.cpp @@ -414,7 +414,7 @@ void CppCodeStylePreferencesWidget::setCodeStyleSettings(const CppCodeStyleSetti void CppCodeStylePreferencesWidget::slotCurrentPreferencesChanged(ICodeStylePreferences *preferences, bool preview) { - const bool enable = !preferences->isReadOnly(); + const bool enable = !preferences->isReadOnly() && !preferences->isTemporarilyReadOnly(); for (QWidget *widget : d->m_controllers) widget->setEnabled(enable); diff --git a/src/plugins/texteditor/codestyleeditor.cpp b/src/plugins/texteditor/codestyleeditor.cpp index d36e9a4bfda..6aaf5ae9483 100644 --- a/src/plugins/texteditor/codestyleeditor.cpp +++ b/src/plugins/texteditor/codestyleeditor.cpp @@ -31,7 +31,9 @@ CodeStyleEditor::CodeStyleEditor(ICodeStylePreferencesFactory *factory, m_layout = new QVBoxLayout(this); auto selector = new CodeStyleSelectorWidget(factory, project, this); selector->setCodeStyle(codeStyle); - m_additionalGlobalSettingsWidget = factory->createAdditionalGlobalSettings(project, parent); + m_additionalGlobalSettingsWidget = factory->createAdditionalGlobalSettings(codeStyle, + project, + parent); if (m_additionalGlobalSettingsWidget) m_layout->addWidget(m_additionalGlobalSettingsWidget); diff --git a/src/plugins/texteditor/icodestylepreferences.cpp b/src/plugins/texteditor/icodestylepreferences.cpp index e0ab8bbd3dd..931714b71c5 100644 --- a/src/plugins/texteditor/icodestylepreferences.cpp +++ b/src/plugins/texteditor/icodestylepreferences.cpp @@ -24,6 +24,7 @@ public: QByteArray m_id; QString m_displayName; bool m_readOnly = false; + bool m_temporarilyReadOnly = false; QString m_settingsSuffix; }; @@ -71,6 +72,16 @@ void ICodeStylePreferences::setReadOnly(bool on) d->m_readOnly = on; } +void ICodeStylePreferences::setTemporarilyReadOnly(bool on) +{ + d->m_temporarilyReadOnly = on; +} + +bool ICodeStylePreferences::isTemporarilyReadOnly() const +{ + return d->m_temporarilyReadOnly; +} + void ICodeStylePreferences::setTabSettings(const TabSettings &settings) { if (d->m_tabSettings == settings) diff --git a/src/plugins/texteditor/icodestylepreferences.h b/src/plugins/texteditor/icodestylepreferences.h index 8d7a0102882..1c363903445 100644 --- a/src/plugins/texteditor/icodestylepreferences.h +++ b/src/plugins/texteditor/icodestylepreferences.h @@ -37,6 +37,9 @@ public: bool isReadOnly() const; void setReadOnly(bool on); + bool isTemporarilyReadOnly() const; + void setTemporarilyReadOnly(bool on); + void setTabSettings(const TabSettings &settings); TabSettings tabSettings() const; TabSettings currentTabSettings() const; diff --git a/src/plugins/texteditor/icodestylepreferencesfactory.cpp b/src/plugins/texteditor/icodestylepreferencesfactory.cpp index dc876fc3e15..19f35338071 100644 --- a/src/plugins/texteditor/icodestylepreferencesfactory.cpp +++ b/src/plugins/texteditor/icodestylepreferencesfactory.cpp @@ -18,7 +18,7 @@ CodeStyleEditorWidget *ICodeStylePreferencesFactory::createCodeStyleEditor( } CodeStyleEditorWidget *ICodeStylePreferencesFactory::createAdditionalGlobalSettings( - ProjectExplorer::Project *, QWidget *) + ICodeStylePreferences *, ProjectExplorer::Project *, QWidget *) { return nullptr; } diff --git a/src/plugins/texteditor/icodestylepreferencesfactory.h b/src/plugins/texteditor/icodestylepreferencesfactory.h index ead42985039..6a4c7f2f54f 100644 --- a/src/plugins/texteditor/icodestylepreferencesfactory.h +++ b/src/plugins/texteditor/icodestylepreferencesfactory.h @@ -40,8 +40,10 @@ public: virtual CodeStyleEditorWidget *createCodeStyleEditor(ICodeStylePreferences *codeStyle, ProjectExplorer::Project *project = nullptr, QWidget *parent = nullptr); - virtual CodeStyleEditorWidget *createAdditionalGlobalSettings( - ProjectExplorer::Project *project = nullptr, QWidget *parent = nullptr); + virtual CodeStyleEditorWidget *createAdditionalGlobalSettings(ICodeStylePreferences *codeStyle, + ProjectExplorer::Project *project + = nullptr, + QWidget *parent = nullptr); virtual Utils::Id languageId() = 0; virtual QString displayName() = 0; virtual ICodeStylePreferences *createCodeStyle() const = 0; From f7ad1f02a1a5921811f8821e37d891ad40b96c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Thu, 6 Apr 2023 13:03:09 +0200 Subject: [PATCH 19/36] SquishTests: Fix waitForProjectTreeItem() for python3 Amends 892ccd2097ece7e8f77ab278dc83d83f6cc0ce7e Change-Id: I18e2c9a5407e4c70dfdae5e9c17959897ea33d50 Reviewed-by: Christian Stenger --- tests/system/shared/project_explorer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/shared/project_explorer.py b/tests/system/shared/project_explorer.py index ca7952022ee..447b8057d5b 100644 --- a/tests/system/shared/project_explorer.py +++ b/tests/system/shared/project_explorer.py @@ -103,7 +103,7 @@ def waitForProjectTreeItem(treeElement, timeoutMSec): projectTV = ":Qt Creator_Utils::NavigationTreeView" projItem = None treeElementWithBranch = addBranchWildcardToRoot(treeElement) - for _ in range(timeoutMSec / 200): + for _ in range(__builtins__.int(timeoutMSec / 200)): try: projItem = waitForObjectItem(projectTV, treeElement, 100) except: From 6536ea7f05a7b0b70626fb0fcc77b5bade4c0721 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 6 Apr 2023 15:04:01 +0200 Subject: [PATCH 20/36] Update qbs submodule to HEAD of 2.0 branch Change-Id: Ie07019ff0a93394a3738b5e0dc5718e74668992d Reviewed-by: Christian Stenger --- src/shared/qbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/qbs b/src/shared/qbs index 0319b0acc7a..289aac0aa1c 160000 --- a/src/shared/qbs +++ b/src/shared/qbs @@ -1 +1 @@ -Subproject commit 0319b0acc7a11f9ba84d8708d8e88575470ca75c +Subproject commit 289aac0aa1cccb2ef66a17f572aeb59236c6bd29 From 41e78b9e57065311d3019c38e813b49e1323cc90 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 6 Apr 2023 12:52:22 +0200 Subject: [PATCH 21/36] SquishTests: Fix compiler substitution on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I970622c888d6c8b7c63e8b1674419ba900ea6d24 Reviewed-by: Robert Löhning --- tests/system/shared/qtcreator.py | 4 +++- tests/system/suite_debugger/tst_build_new_project/test.py | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/system/shared/qtcreator.py b/tests/system/shared/qtcreator.py index f82f3c6e09d..543c3c7ad4f 100644 --- a/tests/system/shared/qtcreator.py +++ b/tests/system/shared/qtcreator.py @@ -248,7 +248,9 @@ def substituteMsvcPaths(settingsDir, version, targetBitness=64): try: msvcPath = os.path.join("C:\\Program Files (x86)", "Microsoft Visual Studio", version, msvcFlavor, "VC", "Tools", "MSVC") - msvcPath = os.path.join(msvcPath, os.listdir(msvcPath)[0], "bin", hostArch, targetArch) + foundVersions = os.listdir(msvcPath) # undetermined order + foundVersions.sort(reverse=True) # we explicitly want the latest and greatest + msvcPath = os.path.join(msvcPath, foundVersions[0], "bin", hostArch, targetArch) __substitute__(os.path.join(settingsDir, "QtProject", 'qtcreator', 'toolchains.xml'), "SQUISH_MSVC%s_%d_PATH" % (version, targetBitness), msvcPath) return diff --git a/tests/system/suite_debugger/tst_build_new_project/test.py b/tests/system/suite_debugger/tst_build_new_project/test.py index 86d0c1b5f38..ca0d6f70879 100644 --- a/tests/system/suite_debugger/tst_build_new_project/test.py +++ b/tests/system/suite_debugger/tst_build_new_project/test.py @@ -19,9 +19,6 @@ def main(): if platform.system() in ('Microsoft', 'Windows'): expectConfigureToFail = [ Targets.DESKTOP_5_4_1_GCC ] # gcc 4.9 does not know C++17 - # Qt5.10 does not default enable C++17 - expectBuildToFail = [ Targets.DESKTOP_5_10_1_DEFAULT ] - for kit, config in availableConfigs: selectBuildConfig(kit, config) test.log("Testing build configuration: " + config) From 584874f15ffccd878025057b81b4c5d82fb61936 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 21 Feb 2023 14:11:40 +0100 Subject: [PATCH 22/36] Move examples manifest parser in separate function and file. To make it auto-testable. Change-Id: I19d263bf080a0089eb9a4ec0f379c52446771c0a Reviewed-by: David Schulz (cherry picked from commit 7e7509744761cf8b42bdfbb5f6f849d432a3ec9f) Reviewed-by: hjk --- src/plugins/qtsupport/CMakeLists.txt | 2 + src/plugins/qtsupport/exampleslistmodel.cpp | 230 ++------------- src/plugins/qtsupport/exampleslistmodel.h | 25 -- src/plugins/qtsupport/examplesparser.cpp | 270 ++++++++++++++++++ src/plugins/qtsupport/examplesparser.h | 38 +++ .../qtsupport/gettingstartedwelcomepage.cpp | 1 + src/plugins/qtsupport/qtsupport.qbs | 2 + 7 files changed, 330 insertions(+), 238 deletions(-) create mode 100644 src/plugins/qtsupport/examplesparser.cpp create mode 100644 src/plugins/qtsupport/examplesparser.h diff --git a/src/plugins/qtsupport/CMakeLists.txt b/src/plugins/qtsupport/CMakeLists.txt index 30fe2fb32bf..5d69a7fc38a 100644 --- a/src/plugins/qtsupport/CMakeLists.txt +++ b/src/plugins/qtsupport/CMakeLists.txt @@ -8,6 +8,8 @@ add_qtc_plugin(QtSupport codegensettings.cpp codegensettings.h codegensettingspage.cpp codegensettingspage.h exampleslistmodel.cpp exampleslistmodel.h + examplesparser.cpp + examplesparser.h externaleditors.cpp externaleditors.h gettingstartedwelcomepage.cpp gettingstartedwelcomepage.h profilereader.cpp profilereader.h diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index 26af348ca76..700248e1f97 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -3,6 +3,7 @@ #include "exampleslistmodel.h" +#include "examplesparser.h" #include "qtsupporttr.h" #include @@ -288,38 +289,11 @@ ExamplesViewController::ExamplesViewController(ExampleSetModel *exampleSetModel, updateExamples(); } -static QString fixStringForTags(const QString &string) -{ - QString returnString = string; - returnString.remove(QLatin1String("")); - returnString.remove(QLatin1String("")); - returnString.remove(QLatin1String("")); - returnString.remove(QLatin1String("")); - return returnString; -} - -static QStringList trimStringList(const QStringList &stringlist) -{ - return Utils::transform(stringlist, [](const QString &str) { return str.trimmed(); }); -} - -static QString relativeOrInstallPath(const QString &path, const QString &manifestPath, - const QString &installPath) -{ - const QChar slash = QLatin1Char('/'); - const QString relativeResolvedPath = manifestPath + slash + path; - const QString installResolvedPath = installPath + slash + path; - if (QFile::exists(relativeResolvedPath)) - return relativeResolvedPath; - if (QFile::exists(installResolvedPath)) - return installResolvedPath; - // doesn't exist, just return relative - return relativeResolvedPath; -} - static bool isValidExampleOrDemo(ExampleItem *item) { QTC_ASSERT(item, return false); + if (item->type == Tutorial) + return true; static QString invalidPrefix = QLatin1String("qthelp:////"); /* means that the qthelp url doesn't have any namespace */ QString reason; @@ -345,158 +319,6 @@ static bool isValidExampleOrDemo(ExampleItem *item) return ok || debugExamples(); } -static QList parseExamples(QXmlStreamReader *reader, - const QString &projectsOffset, - const QString &examplesInstallPath) -{ - QList result; - std::unique_ptr item; - const QChar slash = QLatin1Char('/'); - while (!reader->atEnd()) { - switch (reader->readNext()) { - case QXmlStreamReader::StartElement: - if (reader->name() == QLatin1String("example")) { - item = std::make_unique(); - item->type = Example; - QXmlStreamAttributes attributes = reader->attributes(); - item->name = attributes.value(QLatin1String("name")).toString(); - item->projectPath = attributes.value(QLatin1String("projectPath")).toString(); - item->hasSourceCode = !item->projectPath.isEmpty(); - item->projectPath = relativeOrInstallPath(item->projectPath, projectsOffset, examplesInstallPath); - item->imageUrl = attributes.value(QLatin1String("imageUrl")).toString(); - QPixmapCache::remove(item->imageUrl); - item->docUrl = attributes.value(QLatin1String("docUrl")).toString(); - item->isHighlighted = attributes.value(QLatin1String("isHighlighted")).toString() == QLatin1String("true"); - - } else if (reader->name() == QLatin1String("fileToOpen")) { - const QString mainFileAttribute = reader->attributes().value( - QLatin1String("mainFile")).toString(); - const QString filePath = relativeOrInstallPath( - reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement), - projectsOffset, examplesInstallPath); - item->filesToOpen.append(filePath); - if (mainFileAttribute.compare(QLatin1String("true"), Qt::CaseInsensitive) == 0) - item->mainFile = filePath; - } else if (reader->name() == QLatin1String("description")) { - item->description = fixStringForTags(reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); - } else if (reader->name() == QLatin1String("dependency")) { - item->dependencies.append(projectsOffset + slash + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); - } else if (reader->name() == QLatin1String("tags")) { - item->tags = trimStringList(reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement).split(QLatin1Char(','), Qt::SkipEmptyParts)); - } else if (reader->name() == QLatin1String("platforms")) { - item->platforms = trimStringList(reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement).split(QLatin1Char(','), Qt::SkipEmptyParts)); - } - break; - case QXmlStreamReader::EndElement: - if (reader->name() == QLatin1String("example")) { - if (isValidExampleOrDemo(item.get())) - result.push_back(item.release()); - } else if (reader->name() == QLatin1String("examples")) { - return result; - } - break; - default: // nothing - break; - } - } - return result; -} - -static QList parseDemos(QXmlStreamReader *reader, - const QString &projectsOffset, - const QString &demosInstallPath) -{ - QList result; - std::unique_ptr item; - const QChar slash = QLatin1Char('/'); - while (!reader->atEnd()) { - switch (reader->readNext()) { - case QXmlStreamReader::StartElement: - if (reader->name() == QLatin1String("demo")) { - item = std::make_unique(); - item->type = Demo; - QXmlStreamAttributes attributes = reader->attributes(); - item->name = attributes.value(QLatin1String("name")).toString(); - item->projectPath = attributes.value(QLatin1String("projectPath")).toString(); - item->hasSourceCode = !item->projectPath.isEmpty(); - item->projectPath = relativeOrInstallPath(item->projectPath, projectsOffset, demosInstallPath); - item->imageUrl = attributes.value(QLatin1String("imageUrl")).toString(); - QPixmapCache::remove(item->imageUrl); - item->docUrl = attributes.value(QLatin1String("docUrl")).toString(); - item->isHighlighted = attributes.value(QLatin1String("isHighlighted")).toString() == QLatin1String("true"); - } else if (reader->name() == QLatin1String("fileToOpen")) { - item->filesToOpen.append(relativeOrInstallPath(reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement), - projectsOffset, demosInstallPath)); - } else if (reader->name() == QLatin1String("description")) { - item->description = fixStringForTags(reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); - } else if (reader->name() == QLatin1String("dependency")) { - item->dependencies.append(projectsOffset + slash + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); - } else if (reader->name() == QLatin1String("tags")) { - item->tags = reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement).split(QLatin1Char(',')); - } - break; - case QXmlStreamReader::EndElement: - if (reader->name() == QLatin1String("demo")) { - if (isValidExampleOrDemo(item.get())) - result.push_back(item.release()); - } else if (reader->name() == QLatin1String("demos")) { - return result; - } - break; - default: // nothing - break; - } - } - return result; -} - -static QList parseTutorials(QXmlStreamReader *reader, const QString &projectsOffset) -{ - QList result; - std::unique_ptr item = std::make_unique(); - const QChar slash = QLatin1Char('/'); - while (!reader->atEnd()) { - switch (reader->readNext()) { - case QXmlStreamReader::StartElement: - if (reader->name() == QLatin1String("tutorial")) { - item = std::make_unique(); - item->type = Tutorial; - QXmlStreamAttributes attributes = reader->attributes(); - item->name = attributes.value(QLatin1String("name")).toString(); - item->projectPath = attributes.value(QLatin1String("projectPath")).toString(); - item->hasSourceCode = !item->projectPath.isEmpty(); - item->projectPath.prepend(slash); - item->projectPath.prepend(projectsOffset); - item->imageUrl = Utils::StyleHelper::dpiSpecificImageFile( - attributes.value(QLatin1String("imageUrl")).toString()); - QPixmapCache::remove(item->imageUrl); - item->docUrl = attributes.value(QLatin1String("docUrl")).toString(); - item->isVideo = attributes.value(QLatin1String("isVideo")).toString() == QLatin1String("true"); - item->videoUrl = attributes.value(QLatin1String("videoUrl")).toString(); - item->videoLength = attributes.value(QLatin1String("videoLength")).toString(); - } else if (reader->name() == QLatin1String("fileToOpen")) { - item->filesToOpen.append(projectsOffset + slash + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); - } else if (reader->name() == QLatin1String("description")) { - item->description = fixStringForTags(reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); - } else if (reader->name() == QLatin1String("dependency")) { - item->dependencies.append(projectsOffset + slash + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); - } else if (reader->name() == QLatin1String("tags")) { - item->tags = reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement).split(QLatin1Char(',')); - } - break; - case QXmlStreamReader::EndElement: - if (reader->name() == QLatin1String("tutorial")) - result.push_back(item.release()); - else if (reader->name() == QLatin1String("tutorials")) - return result; - break; - default: // nothing - break; - } - } - return result; -} - void ExamplesViewController::updateExamples() { QString examplesInstallPath; @@ -509,41 +331,23 @@ void ExamplesViewController::updateExamples() QList items; for (const QString &exampleSource : sources) { - QFile exampleFile(exampleSource); - if (!exampleFile.open(QIODevice::ReadOnly)) { - if (debugExamples()) - qWarning() << "ERROR: Could not open file" << exampleSource; + if (debugExamples()) { + qWarning() << QString::fromLatin1("Reading file \"%1\"...") + .arg(QFileInfo(exampleSource).absoluteFilePath()); + } + + const expected_str> result + = parseExamples(exampleSource, examplesInstallPath, demosInstallPath, m_isExamples); + if (!result) { + if (debugExamples()) { + qWarning() << "ERROR: Could not read examples from" << exampleSource << ":" + << result.error(); + } continue; } - - QFileInfo fi(exampleSource); - QString offsetPath = fi.path(); - QDir examplesDir(offsetPath); - QDir demosDir(offsetPath); - - if (debugExamples()) - qWarning() << QString::fromLatin1("Reading file \"%1\"...").arg(fi.absoluteFilePath()); - QXmlStreamReader reader(&exampleFile); - while (!reader.atEnd()) - switch (reader.readNext()) { - case QXmlStreamReader::StartElement: - if (m_isExamples && reader.name() == QLatin1String("examples")) - items += parseExamples(&reader, examplesDir.path(), examplesInstallPath); - else if (m_isExamples && reader.name() == QLatin1String("demos")) - items += parseDemos(&reader, demosDir.path(), demosInstallPath); - else if (!m_isExamples && reader.name() == QLatin1String("tutorials")) - items += parseTutorials(&reader, examplesDir.path()); - break; - default: // nothing - break; - } - - if (reader.hasError() && debugExamples()) { - qWarning().noquote().nospace() << "ERROR: Could not parse file as XML document (" - << exampleSource << "):" << reader.lineNumber() << ':' << reader.columnNumber() - << ": " << reader.errorString(); - } + items += filtered(*result, isValidExampleOrDemo); } + if (m_isExamples) { if (m_exampleSetModel->selectedQtSupports(Android::Constants::ANDROID_DEVICE_TYPE)) { items = Utils::filtered(items, [](ExampleItem *item) { diff --git a/src/plugins/qtsupport/exampleslistmodel.h b/src/plugins/qtsupport/exampleslistmodel.h index a4e8fe9eba6..0047bf45e3e 100644 --- a/src/plugins/qtsupport/exampleslistmodel.h +++ b/src/plugins/qtsupport/exampleslistmodel.h @@ -77,29 +77,6 @@ private: bool m_initalized = false; }; -enum InstructionalType -{ - Example = 0, Demo, Tutorial -}; - -class ExampleItem : public Core::ListItem -{ -public: - QString projectPath; - QString docUrl; - QStringList filesToOpen; - QString mainFile; /* file to be visible after opening filesToOpen */ - QStringList dependencies; - InstructionalType type; - int difficulty = 0; - bool hasSourceCode = false; - bool isVideo = false; - bool isHighlighted = false; - QString videoUrl; - QString videoLength; - QStringList platforms; -}; - class ExamplesViewController : public QObject { Q_OBJECT @@ -119,5 +96,3 @@ private: } // namespace Internal } // namespace QtSupport - -Q_DECLARE_METATYPE(QtSupport::Internal::ExampleItem *) diff --git a/src/plugins/qtsupport/examplesparser.cpp b/src/plugins/qtsupport/examplesparser.cpp new file mode 100644 index 00000000000..2bd50bf8102 --- /dev/null +++ b/src/plugins/qtsupport/examplesparser.cpp @@ -0,0 +1,270 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#include "examplesparser.h" + +#include +#include + +#include +#include +#include +#include +#include + +using namespace Utils; + +namespace QtSupport::Internal { + +static QString relativeOrInstallPath(const QString &path, + const QString &manifestPath, + const QString &installPath) +{ + const QChar slash = QLatin1Char('/'); + const QString relativeResolvedPath = manifestPath + slash + path; + const QString installResolvedPath = installPath + slash + path; + if (QFile::exists(relativeResolvedPath)) + return relativeResolvedPath; + if (QFile::exists(installResolvedPath)) + return installResolvedPath; + // doesn't exist, just return relative + return relativeResolvedPath; +} + +static QString fixStringForTags(const QString &string) +{ + QString returnString = string; + returnString.remove(QLatin1String("")); + returnString.remove(QLatin1String("")); + returnString.remove(QLatin1String("")); + returnString.remove(QLatin1String("")); + return returnString; +} + +static QStringList trimStringList(const QStringList &stringlist) +{ + return Utils::transform(stringlist, [](const QString &str) { return str.trimmed(); }); +} + +static QList parseExamples(QXmlStreamReader *reader, + const QString &projectsOffset, + const QString &examplesInstallPath) +{ + QList result; + std::unique_ptr item; + const QChar slash = QLatin1Char('/'); + while (!reader->atEnd()) { + switch (reader->readNext()) { + case QXmlStreamReader::StartElement: + if (reader->name() == QLatin1String("example")) { + item = std::make_unique(); + item->type = Example; + QXmlStreamAttributes attributes = reader->attributes(); + item->name = attributes.value(QLatin1String("name")).toString(); + item->projectPath = attributes.value(QLatin1String("projectPath")).toString(); + item->hasSourceCode = !item->projectPath.isEmpty(); + item->projectPath = relativeOrInstallPath(item->projectPath, + projectsOffset, + examplesInstallPath); + item->imageUrl = attributes.value(QLatin1String("imageUrl")).toString(); + QPixmapCache::remove(item->imageUrl); + item->docUrl = attributes.value(QLatin1String("docUrl")).toString(); + item->isHighlighted = attributes.value(QLatin1String("isHighlighted")).toString() + == QLatin1String("true"); + + } else if (reader->name() == QLatin1String("fileToOpen")) { + const QString mainFileAttribute + = reader->attributes().value(QLatin1String("mainFile")).toString(); + const QString filePath + = relativeOrInstallPath(reader->readElementText( + QXmlStreamReader::ErrorOnUnexpectedElement), + projectsOffset, + examplesInstallPath); + item->filesToOpen.append(filePath); + if (mainFileAttribute.compare(QLatin1String("true"), Qt::CaseInsensitive) == 0) + item->mainFile = filePath; + } else if (reader->name() == QLatin1String("description")) { + item->description = fixStringForTags( + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); + } else if (reader->name() == QLatin1String("dependency")) { + item->dependencies.append( + projectsOffset + slash + + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); + } else if (reader->name() == QLatin1String("tags")) { + item->tags = trimStringList( + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement) + .split(QLatin1Char(','), Qt::SkipEmptyParts)); + } else if (reader->name() == QLatin1String("platforms")) { + item->platforms = trimStringList( + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement) + .split(QLatin1Char(','), Qt::SkipEmptyParts)); + } + break; + case QXmlStreamReader::EndElement: + if (reader->name() == QLatin1String("example")) { + result.push_back(item.release()); + } else if (reader->name() == QLatin1String("examples")) { + return result; + } + break; + default: // nothing + break; + } + } + return result; +} + +static QList parseDemos(QXmlStreamReader *reader, + const QString &projectsOffset, + const QString &demosInstallPath) +{ + QList result; + std::unique_ptr item; + const QChar slash = QLatin1Char('/'); + while (!reader->atEnd()) { + switch (reader->readNext()) { + case QXmlStreamReader::StartElement: + if (reader->name() == QLatin1String("demo")) { + item = std::make_unique(); + item->type = Demo; + QXmlStreamAttributes attributes = reader->attributes(); + item->name = attributes.value(QLatin1String("name")).toString(); + item->projectPath = attributes.value(QLatin1String("projectPath")).toString(); + item->hasSourceCode = !item->projectPath.isEmpty(); + item->projectPath = relativeOrInstallPath(item->projectPath, + projectsOffset, + demosInstallPath); + item->imageUrl = attributes.value(QLatin1String("imageUrl")).toString(); + QPixmapCache::remove(item->imageUrl); + item->docUrl = attributes.value(QLatin1String("docUrl")).toString(); + item->isHighlighted = attributes.value(QLatin1String("isHighlighted")).toString() + == QLatin1String("true"); + } else if (reader->name() == QLatin1String("fileToOpen")) { + item->filesToOpen.append( + relativeOrInstallPath(reader->readElementText( + QXmlStreamReader::ErrorOnUnexpectedElement), + projectsOffset, + demosInstallPath)); + } else if (reader->name() == QLatin1String("description")) { + item->description = fixStringForTags( + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); + } else if (reader->name() == QLatin1String("dependency")) { + item->dependencies.append( + projectsOffset + slash + + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); + } else if (reader->name() == QLatin1String("tags")) { + item->tags = reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement) + .split(QLatin1Char(',')); + } + break; + case QXmlStreamReader::EndElement: + if (reader->name() == QLatin1String("demo")) { + result.push_back(item.release()); + } else if (reader->name() == QLatin1String("demos")) { + return result; + } + break; + default: // nothing + break; + } + } + return result; +} + +static QList parseTutorials(QXmlStreamReader *reader, const QString &projectsOffset) +{ + QList result; + std::unique_ptr item = std::make_unique(); + const QChar slash = QLatin1Char('/'); + while (!reader->atEnd()) { + switch (reader->readNext()) { + case QXmlStreamReader::StartElement: + if (reader->name() == QLatin1String("tutorial")) { + item = std::make_unique(); + item->type = Tutorial; + QXmlStreamAttributes attributes = reader->attributes(); + item->name = attributes.value(QLatin1String("name")).toString(); + item->projectPath = attributes.value(QLatin1String("projectPath")).toString(); + item->hasSourceCode = !item->projectPath.isEmpty(); + item->projectPath.prepend(slash); + item->projectPath.prepend(projectsOffset); + item->imageUrl = Utils::StyleHelper::dpiSpecificImageFile( + attributes.value(QLatin1String("imageUrl")).toString()); + QPixmapCache::remove(item->imageUrl); + item->docUrl = attributes.value(QLatin1String("docUrl")).toString(); + item->isVideo = attributes.value(QLatin1String("isVideo")).toString() + == QLatin1String("true"); + item->videoUrl = attributes.value(QLatin1String("videoUrl")).toString(); + item->videoLength = attributes.value(QLatin1String("videoLength")).toString(); + } else if (reader->name() == QLatin1String("fileToOpen")) { + item->filesToOpen.append( + projectsOffset + slash + + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); + } else if (reader->name() == QLatin1String("description")) { + item->description = fixStringForTags( + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); + } else if (reader->name() == QLatin1String("dependency")) { + item->dependencies.append( + projectsOffset + slash + + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); + } else if (reader->name() == QLatin1String("tags")) { + item->tags = reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement) + .split(QLatin1Char(',')); + } + break; + case QXmlStreamReader::EndElement: + if (reader->name() == QLatin1String("tutorial")) + result.push_back(item.release()); + else if (reader->name() == QLatin1String("tutorials")) + return result; + break; + default: // nothing + break; + } + } + return result; +} + +expected_str> parseExamples(const QString &manifest, + const QString &examplesInstallPath, + const QString &demosInstallPath, + const bool examples) +{ + QFile exampleFile(manifest); + if (!exampleFile.open(QIODevice::ReadOnly)) + return make_unexpected(QString("Could not open file \"%1\"").arg(manifest)); + + QFileInfo fi(manifest); + QString offsetPath = fi.path(); + QDir examplesDir(offsetPath); + QDir demosDir(offsetPath); + + QList items; + QXmlStreamReader reader(&exampleFile); + while (!reader.atEnd()) { + switch (reader.readNext()) { + case QXmlStreamReader::StartElement: + if (examples && reader.name() == QLatin1String("examples")) + items += parseExamples(&reader, examplesDir.path(), examplesInstallPath); + else if (examples && reader.name() == QLatin1String("demos")) + items += parseDemos(&reader, demosDir.path(), demosInstallPath); + else if (!examples && reader.name() == QLatin1String("tutorials")) + items += parseTutorials(&reader, examplesDir.path()); + break; + default: // nothing + break; + } + } + + if (reader.hasError()) { + qDeleteAll(items); + return make_unexpected(QString("Could not parse file \"%1\" as XML document: %2:%3: %4") + .arg(manifest) + .arg(reader.lineNumber()) + .arg(reader.columnNumber()) + .arg(reader.errorString())); + } + return items; +} + +} // namespace QtSupport::Internal diff --git a/src/plugins/qtsupport/examplesparser.h b/src/plugins/qtsupport/examplesparser.h new file mode 100644 index 00000000000..d08a8da11bc --- /dev/null +++ b/src/plugins/qtsupport/examplesparser.h @@ -0,0 +1,38 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#pragma once + +#include +#include + +namespace QtSupport::Internal { + +enum InstructionalType { Example = 0, Demo, Tutorial }; + +class ExampleItem : public Core::ListItem +{ +public: + QString projectPath; + QString docUrl; + QStringList filesToOpen; + QString mainFile; /* file to be visible after opening filesToOpen */ + QStringList dependencies; + InstructionalType type; + int difficulty = 0; + bool hasSourceCode = false; + bool isVideo = false; + bool isHighlighted = false; + QString videoUrl; + QString videoLength; + QStringList platforms; +}; + +Utils::expected_str> parseExamples(const QString &manifest, + const QString &examplesInstallPath, + const QString &demosInstallPath, + bool examples); + +} // namespace QtSupport::Internal + +Q_DECLARE_METATYPE(QtSupport::Internal::ExampleItem *) diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp index 36bbcfb902b..fea56880356 100644 --- a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp +++ b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp @@ -4,6 +4,7 @@ #include "gettingstartedwelcomepage.h" #include "exampleslistmodel.h" +#include "examplesparser.h" #include "qtsupporttr.h" #include diff --git a/src/plugins/qtsupport/qtsupport.qbs b/src/plugins/qtsupport/qtsupport.qbs index 58f0ea61c3b..526cf4a24fe 100644 --- a/src/plugins/qtsupport/qtsupport.qbs +++ b/src/plugins/qtsupport/qtsupport.qbs @@ -77,6 +77,8 @@ Project { "qtsupport.qrc", "exampleslistmodel.cpp", "exampleslistmodel.h", + "examplesparser.cpp", + "examplesparser.h", "profilereader.cpp", "profilereader.h", "qscxmlcgenerator.cpp", From f1fde363a080384779ccf1126d1ba4da2d11bb71 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 17 Mar 2023 13:00:34 +0100 Subject: [PATCH 23/36] Build: Optionally sign on Windows Add an argument to the build script that takes a signing command (path to sign is added at the end, run in cwd) Task-number: QTCREATORBUG-25740 Task-number: QTCREATORBUG-28909 Change-Id: I6d3bdf7bd9fab0ea1fc129da08cf77c9a5448b31 Reviewed-by: Cristian Adam Reviewed-by: --- scripts/build.py | 11 +++++++++++ scripts/build_plugin.py | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/scripts/build.py b/scripts/build.py index d6a30a18ff3..2fced683b1b 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -8,6 +8,7 @@ from __future__ import print_function import argparse import collections import os +import shlex import shutil import common @@ -43,6 +44,8 @@ def get_arguments(): # signing parser.add_argument('--keychain-unlock-script', help='Path to script for unlocking the keychain used for signing (macOS)') + parser.add_argument('--sign-command', + help='Command to use for signing (Windows). The installation directory to sign is added at the end. Is run in the CWD.') # cdbextension parser.add_argument('--python-path', @@ -262,6 +265,14 @@ def zipPatternForApp(paths): def package_qtcreator(args, paths): + if common.is_windows_platform() and args.sign_command: + command = shlex.split(args.sign_command) + if not args.no_qtcreator: + common.check_print_call(command + [paths.install]) + common.check_print_call(command + [paths.wininterrupt_install]) + if not args.no_cdb: + common.check_print_call(command + [paths.qtcreatorcdbext_install]) + if not args.no_zip: if not args.no_qtcreator: common.check_print_call(['7z', 'a', '-mmt' + args.zip_threads, diff --git a/scripts/build_plugin.py b/scripts/build_plugin.py index 38d247d4d50..4f4ddfdcb02 100755 --- a/scripts/build_plugin.py +++ b/scripts/build_plugin.py @@ -9,6 +9,7 @@ import argparse import collections import glob import os +import shlex import common @@ -46,6 +47,9 @@ def get_arguments(): # signing parser.add_argument('--keychain-unlock-script', help='Path to script for unlocking the keychain used for signing (macOS)') + parser.add_argument('--sign-command', + help='Command to use for signing (Windows). The installation directory to sign is added at the end. Is run in the CWD.') + args = parser.parse_args() args.with_debug_info = args.build_type == 'RelWithDebInfo' return args @@ -140,6 +144,9 @@ def build(args, paths): def package(args, paths): if not os.path.exists(paths.result): os.makedirs(paths.result) + if common.is_windows_platform() and args.sign_command: + command = shlex.split(args.sign_command) + common.check_print_call(command + [paths.install]) common.check_print_call(['7z', 'a', '-mmt2', os.path.join(paths.result, args.name + '.7z'), '*'], paths.install) if os.path.exists(paths.dev_install): # some plugins might not provide anything in Devel From b18254f4637d1a8befd57957af5cce0e502ce6b0 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 24 Mar 2023 11:52:09 +0100 Subject: [PATCH 24/36] German translation: QmlJS(Editor|Tools) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I2fb3dba6fe1fc43f41c4461fac44601300d38bdd Reviewed-by: Robert Löhning Reviewed-by: Reviewed-by: Christian Stenger --- share/qtcreator/translations/qtcreator_de.ts | 131 +++++++++++-------- 1 file changed, 73 insertions(+), 58 deletions(-) diff --git a/share/qtcreator/translations/qtcreator_de.ts b/share/qtcreator/translations/qtcreator_de.ts index c8f29dc178b..097371fc242 100644 --- a/share/qtcreator/translations/qtcreator_de.ts +++ b/share/qtcreator/translations/qtcreator_de.ts @@ -41940,11 +41940,21 @@ For qmlproject projects, use the importPaths property to add import paths. For CMake projects, make sure QML_IMPORT_PATH variable is in CMakeCache.txt. For qmlRegister... calls, make sure that you define the Module URI as a string literal. - + QML-Modul wurde nicht gefunden (%1). + +Import-Verzeichnisse: +%2 + +Für qmake-Projekte benutzen Sie die Variable QML_IMPORT_PATH, um Importpfade hinzuzufügen. +Für Qbs-Projekte geben Sie eine qmlImportPaths-Eigenschaft in Ihrem Produkt an, um Importpfade hinzuzufügen. +Für qmlproject-Projekte benutzen Sie die importPaths-Eigenschaft, um Importpfade hinzuzufügen. +Für CMake-Projekte stellen Sie sicher, dass die Variable QML_IMPORT_PATH in CMakeCache.txt steht. +Für qmlRegister...-Aufrufe stellen Sie sicher, dass Sie den Modul-URI als Zeichenkettenliteral definieren. + QML module contains C++ plugins, currently reading type information... %1 - + Das QML-Modul enthält C++-Plugins. Lese Typinformationen... %1 Implicit import '%1' of QML module '%2' not found. @@ -41970,7 +41980,7 @@ Für CMake-Projekte stellen Sie sicher, dass die Variable QML_IMPORT_PATH in CMa Hit maximal recursion depth in AST visit. - + Maximale Rekursionstiefe beim Durchlaufen des Syntaxbaums erreicht. package import requires a version number @@ -41978,7 +41988,7 @@ Für CMake-Projekte stellen Sie sicher, dass die Variable QML_IMPORT_PATH in CMa Nested inline components are not supported - + Verschachtelte Inline-Komponenten werden nicht unterstützt Errors while loading qmltypes from %1: @@ -42070,7 +42080,7 @@ Für CMake-Projekte stellen Sie sicher, dass die Variable QML_IMPORT_PATH in CMa Expected string literal to contain 'Package/Name major.minor' or 'Name major.minor'. - Das Zeichenkettenliteral sollte 'Package/Name major.minor' oder 'Name major.minor' enthalten./ + Das Zeichenkettenliteral sollte 'Package/Name major.minor' oder 'Name major.minor' enthalten. Expected array of numbers after colon. @@ -42278,87 +42288,87 @@ Weitere Informationen finden Sie auf der Dokumentationsseite "Checking Code Imperative code is not supported in Qt Design Studio. - + Imperativer Code wird von Qt Design Studio nicht unterstützt. This type (%1) is not supported in Qt Design Studio. - + Dieser Typ (%1) wird von Qt Design Studio nicht unterstützt. Reference to parent item cannot be resolved correctly by Qt Design Studio. - + Die Referenz zum übergeordneten Element kann von Qt Design Studio nicht korrekt aufgelöst werden. This visual property binding cannot be evaluated in the local context and might not show up in Qt Design Studio as expected. - + Diese visuelle Bindung der Eigenschaft kann nicht im lokalen Kontext ausgewertet werden und wird möglicherweise nicht wie erwartet in Qt Design Studio angezeigt. Qt Design Studio only supports states in the root item. - + Qt Design Studio unterstützt States nur im Wurzelelement. This id might be ambiguous and is not supported in Qt Design Studio. - + Diese ID ist möglicherweise nicht eindeutig und wird von Qt Design Studio nicht unterstützt. This type (%1) is not supported as a root element by Qt Design Studio. - + Dieser Typ (%1) wird von Qt Design Studio nicht als Wurzelelement unterstützt. This type (%1) is not supported as a root element of a UI file (.ui.qml). - + Dieser Typ (%1) wird von UI-Dateien (.ui.qml) nicht als Wurzelelement unterstützt. This type (%1) is not supported in a UI file (.ui.qml). - + Dieser Typ (%1) wird von UI-Dateien (.ui.qml) nicht unterstützt. Functions are not supported in a UI file (.ui.qml). - + Funktionen werden von UI-Dateien (.ui.qml) nicht unterstützt. JavaScript blocks are not supported in a UI file (.ui.qml). - + JavaScript-Blöcke werden von UI-Dateien (.ui.qml) nicht unterstützt. Behavior type is not supported in a UI file (.ui.qml). - + Der Behavior-Typ wird von UI-Dateien (.ui.qml) nicht unterstützt. States are only supported in the root item in a UI file (.ui.qml). - + States werden nur im Wurzelelement von UI-Dateien (.ui.qml) unterstützt. Referencing the parent of the root item is not supported in a UI file (.ui.qml). - + Das Referenzieren auf das übergeordnete Element des Wurzelelements wird von UI-Dateien (.ui.qml) nicht unterstützt. Do not mix translation functions in a UI file (.ui.qml). - + Vermischen Sie keine Übersetzungsfunktionen in UI-Dateien (.ui.qml). Type cannot be instantiated recursively (%1). - + Typ kann nicht rekursiv instanziiert werden (%1). Logical value does not depend on actual values. - + Logischer Wert hängt nicht von tatsächlichen Werten ab. Components are only allowed to have a single child element. - + Komponenten dürfen nur ein einziges Kindelement besitzen. Components require a child element. - + Komponenten müssen ein Kindelement besitzen. Do not reference the root item as alias. - + Referenzieren Sie das Wurzelelement nicht als Alias. Avoid referencing the root item in a hierarchy. - + Vermeiden Sie, das Wurzelelement in einer Hierarchie zu referenzieren. A State cannot have a child item (%1). @@ -42446,8 +42456,7 @@ Weitere Informationen finden Sie auf der Dokumentationsseite "Checking Code Minimum number value is %1. - Minimalwert ist %1. - + Minimalwert ist %1. Maximum number value is exclusive. @@ -42485,7 +42494,7 @@ Weitere Informationen finden Sie auf der Dokumentationsseite "Checking Code Automatic type dump of QML module failed. Errors: %1 - Die automatische Ausgabe der Typen des QML-Modules schlug fehl. + Die automatische Ausgabe der Typen des QML-Moduls schlug fehl. Fehler: %1 @@ -42506,12 +42515,16 @@ First 10 lines or errors: %1 Check General Messages for details. - + Die automatische Ausgabe der Typen des QML-Moduls schlug fehl. +Die ersten 10 Zeilen oder Fehler: + +%1 +Überprüfen Sie die Ansicht "Allgemeine Ausgaben", um Details zu erhalten. Warnings while parsing QML type information of %1: %2 - Warnungen beim Auswerten der QML-Typinformation von %1: + Warnungen beim Auswerten der QML-Typinformationen von %1: %2 @@ -42556,25 +42569,27 @@ Bitte erstellen Sie die Anwendung qmldump auf der Einstellungsseite der Qt-Versi The type will only be available in the QML editors when the type name is a string literal. - Dieser Typ wird im QML Editor nur sichtbar sein, wenn der Typname ein Zeichenketten-Literal ist. + Dieser Typ wird im QML-Editor nur sichtbar sein, wenn der Typname ein Zeichenkettenliteral ist. The module URI cannot be determined by static analysis. The type will not be available globally in the QML editor. You can add a "// @uri My.Module.Uri" annotation to let the QML editor know about a likely URI. - + Der Modul-URI kann durch statische Analyse nicht ermittelt werden. +Der Typ wird nicht global im QML-Editor verfügbar sein. +Sie können eine Annotation "// @uri My.Module.Uri" hinzufügen, um dem QML-Editor einen mögliche URI mitzuteilen. must be a string literal to be available in the QML editor - muss eine Zeichenkette sein, um im QML-Editor verfügbar zu sein + muss ein Zeichenkettenliteral sein, um im QML-Editor verfügbar zu sein XML error on line %1, col %2: %3 - XML-Fehler in Zeile %1, Spalte %2: %3 + XML-Fehler in Zeile %1, Spalte %2: %3 The <RCC> root element is missing. - Das Wurzelelement (<RCC>) fehlt. + Das Wurzelelement (<RCC>) fehlt. @@ -42626,7 +42641,7 @@ the QML editor know about a likely URI. Add a Comment to Suppress This Message - Fügen Sie einen Kommentar ein, um diese Nachricht zu unterdrücken + Fügen Sie einen Kommentar ein, um diese Nachricht zu unterdrücken Property assignments for %1: @@ -42642,15 +42657,15 @@ the QML editor know about a likely URI. Invalid component name. - + Ungültiger Komponentenname. Invalid path. - + Ungültiger Pfad. Component already exists. - Komponente existiert bereits. + Komponente existiert bereits. Component Name @@ -42706,15 +42721,15 @@ the QML editor know about a likely URI. Use custom command instead of built-in formatter - + Benutzerdefiniertes Kommando anstatt des integrierten Formatierers benutzen Command: - + Kommando: Arguments: - Argumente: + Argumente: Always show Qt Quick Toolbar @@ -42722,23 +42737,23 @@ the QML editor know about a likely URI. Always Ask - Stets fragen + Stets fragen Qt Design Studio - Qt Design Studio + Qt Design Studio Qt Creator - + Qt Creator Use qmlls (EXPERIMENTAL!) - + qmlls benutzen (EXPERIMENTELL!) Always use latest qmlls - + Stets das neueste qmlls benutzen Automatic Formatting on File Save @@ -42746,11 +42761,11 @@ the QML editor know about a likely URI. Open .ui.qml files with: - + .ui.qml-Dateien öffnen mit: Language Server - + Language Server Enable auto format on file save @@ -42810,19 +42825,19 @@ the QML editor know about a likely URI. Library at %1 - Bibliothek bei %1 + Bibliothek bei %1 Dumped plugins successfully. - Plugin-Information erfolgreich bestimmt. + Plugin-Information erfolgreich bestimmt. Read typeinfo files successfully. - typeinfo-Dateien gelesen. + typeinfo-Dateien erfolgreich gelesen. Qmlls (%1) - + Qmlls (%1) @@ -42857,16 +42872,16 @@ the QML editor know about a likely URI. Qml JS Code Style - + QML JS Coding Style &Line length: - + &Zeilenlänge: Global Settings - Global + Global @@ -48403,7 +48418,7 @@ Gibt an, wie sich die Rücktaste bezüglich Einrückung verhält. Pressing Alt displays context-sensitive help or type information as tooltips. - Drücken Sie die Alt-Taste um kontextabhängige Hilfe oder Typinformation als Tooltip anzuzeigen. + Drücken Sie die Alt-Taste, um kontextabhängige Hilfe oder Typinformationen als Tooltip anzuzeigen. Using Select Block Up / Down actions will now provide smarter selections. From 7b17d9cfbd59e11237a88cae79423bbeee141ad8 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 24 Mar 2023 14:22:50 +0100 Subject: [PATCH 25/36] German translation: QmakeProjectManager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I24c8de5f0f6c1bc02669b48a6023f6bc0775a403 Reviewed-by: Reviewed-by: Robert Löhning --- share/qtcreator/translations/qtcreator_de.ts | 62 ++++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/share/qtcreator/translations/qtcreator_de.ts b/share/qtcreator/translations/qtcreator_de.ts index 097371fc242..0125854d3a9 100644 --- a/share/qtcreator/translations/qtcreator_de.ts +++ b/share/qtcreator/translations/qtcreator_de.ts @@ -41132,7 +41132,7 @@ The affected files are: Platform: - Plattform: + Plattform: Library inside "debug" or "release" subfolder @@ -41334,19 +41334,19 @@ Weder der Pfad zur Bibliothek noch der Pfad zu den Headerdateien wird zur .pro-D The process "%1" exited normally. - Der Prozess "%1" wurde normal beendet. + Der Prozess "%1" wurde normal beendet. The process "%1" exited with code %2. - Der Prozess "%1" wurde mit dem Rückgabewert %2 beendet. + Der Prozess "%1" wurde mit dem Rückgabewert %2 beendet. Could not start process "%1" %2. - Der Prozess "%1" %2 konnte nicht gestartet werden. + Der Prozess "%1" %2 konnte nicht gestartet werden. The process "%1" crashed. - Der Prozess "%1" ist abgestürzt. + Der Prozess "%1" ist abgestürzt. ABIs: @@ -41399,19 +41399,19 @@ Weder der Pfad zur Bibliothek noch der Pfad zu den Headerdateien wird zur .pro-D Run - Ausführen + Ausführen Ignore - + Ignorieren Use global setting - + Globale Einstellung verwenden qmake system() behavior when parsing: - + Verhalten von qmake system() beim Auswerten: General @@ -41482,11 +41482,11 @@ Weder der Pfad zur Bibliothek noch der Pfad zu den Headerdateien wird zur .pro-D Cannot parse project "%1": The currently selected kit "%2" does not have a valid Qt. - + Die Auswertung des Projekts "%1" ist fehlgeschlagen: Das ausgewählte Kit "%2" hat keine gültige Qt-Version. Cannot parse project "%1": No kit selected. - + Die Auswertung des Projekts "%1" ist fehlgeschlagen: Kein Kit ausgewählt. No Qt version set in kit. @@ -41506,35 +41506,35 @@ Weder der Pfad zur Bibliothek noch der Pfad zu den Headerdateien wird zur .pro-D Generate Xcode project (via qmake) - + Xcode-Projekt generieren (mittels qmake) Generate Visual Studio project (via qmake) - + Visual Studio-Projekt generieren (mittels qmake) qmake generator failed: %1. - + qmake-Generator fehlgeschlagen: %1. No Qt in kit - + Kein Qt im Kit No valid qmake executable - + Keine gültige ausführbare qmake-Datei No qmake step in active build configuration - + Kein qmake-Build-Schritt in der aktiven Build-Konfiguration Cannot create output directory "%1" - + Das Ausgabeverzeichnis "%1" konnte nicht angelegt werden Running in %1: %2 - Führe in %1 aus: %2 {1:?} + Führe in %1 aus: %2 Build @@ -41656,7 +41656,7 @@ Bitte aktualisieren Sie Ihr Kit (%3) oder wählen Sie eine mkspec für qmake, di The build directory is not at the same level as the source directory, which could be the reason for the build failure. - + Das Build-Verzeichnis liegt nicht auf der gleichen Ebene wie das Quellverzeichnis, was der Grund für den Fehler beim Erstellen sein könnte. Qt mkspec @@ -41680,7 +41680,7 @@ Bitte aktualisieren Sie Ihr Kit (%3) oder wählen Sie eine mkspec für qmake, di Mkspec configured for qmake by the kit. - + Mkspec, die im Kit für qmake konfiguriert ist. Reading Project "%1" @@ -41688,43 +41688,43 @@ Bitte aktualisieren Sie Ihr Kit (%3) oder wählen Sie eine mkspec für qmake, di Warn if a project's source and build directories are not at the same level - + Warnen, wenn das Quell- und das Build-Verzeichnis eines Projekts nicht auf der gleichen Ebene liegen Qmake has subtle bugs that can be triggered if source and build directory are not at the same level. - + In qmake können subtile Fehler ausgelöst werden, wenn das Quell- und das Build-Verzeichnis nicht auf der gleichen Ebene liegen. Run qmake on every build - + qmake bei jedem Erstellen ausführen This option can help to prevent failures on incremental builds, but might slow them down unnecessarily in the general case. - + Diese Einstellung kann Fehler beim inkrementellen Erstellen verhindern, aber das Erstellen im Allgemeinen unnötig verlangsamen. Ignore qmake's system() function when parsing a project - + Qmakes system()-Funktion beim Auswerten eines Projektes ignorieren Checking this option avoids unwanted side effects, but may result in inexact parsing results. - + Diese Einstellung verhindert ungewollte Nebeneffekte, kann aber zu ungenauen Resultaten beim Auswerten führen. Qmake - + Qmake Required Qt features not present. - + Benötigte Qt-Funktionen sind nicht vorhanden. Qt version does not target the expected platform. - + Die Qt-Version unterstützt die erwartete Plattform nicht als Ziel. Qt version does not provide all features. - + Die Qt-Version stellt nicht alle Funktionen zur Verfügung. From a6512861ea1383f1b30733708916e6ab481d0ee9 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 11 Apr 2023 15:32:46 +0200 Subject: [PATCH 26/36] Build: Fix result of ts_ targets Created .ts files with the wrong name. Amends 556e7315f7125be80397e9b5b29c994e5410acd4 Change-Id: I3c0199c564f47dce178a9d8218d5dacf8c75f78a Reviewed-by: Cristian Adam --- cmake/QtCreatorTranslations.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/QtCreatorTranslations.cmake b/cmake/QtCreatorTranslations.cmake index 51f33260232..7c795f65a09 100644 --- a/cmake/QtCreatorTranslations.cmake +++ b/cmake/QtCreatorTranslations.cmake @@ -58,7 +58,7 @@ function(_create_ts_custom_target name) set(_arg_TS_TARGET_PREFIX "ts_") endif() - set(ts_file "${CMAKE_CURRENT_SOURCE_DIR}/${_arg_FILE_PREFIX}_${l}.ts") + set(ts_file "${CMAKE_CURRENT_SOURCE_DIR}/${_arg_FILE_PREFIX}_${name}.ts") set(_sources "${_arg_SOURCES}") list(SORT _sources) From 5089e8400ee30c63ce0f9ee60ba343ab6c410ac2 Mon Sep 17 00:00:00 2001 From: Haowei Hsu Date: Sun, 19 Mar 2023 22:12:19 +0800 Subject: [PATCH 27/36] l10n(zh_TW): Fix translations of 'Enable/Disable' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Enable: 開啟,用,使用 -> 啟用 * Disable: 關閉,停用,禁用 -> 停用 Change-Id: I18ec9d78ba1c104f5016e7f6b3c1e21a2fdc8e33 Reviewed-by: Reviewed-by: Yi-Jyun Pan Reviewed-by: Franklin Weng Reviewed-by: Eike Ziller --- .../qtcreator/translations/qtcreator_zh_TW.ts | 110 +++++++++--------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/share/qtcreator/translations/qtcreator_zh_TW.ts b/share/qtcreator/translations/qtcreator_zh_TW.ts index 7c1e032342f..3c1beded9e6 100644 --- a/share/qtcreator/translations/qtcreator_zh_TW.ts +++ b/share/qtcreator/translations/qtcreator_zh_TW.ts @@ -323,7 +323,7 @@ Please enter the directory in which you want to build your project. Qt Creator recommends to not use the source directory for building. This ensures that the source directory remains clean and enables multiple builds with different settings. - 請輸入您想建置專案的目錄。Qt Creator 建議您不要直接用源碼的目錄來做建置。這樣可以保持源碼目錄的乾淨,並且可以讓您用不同的設定進行多個建置。 + 請輸入您想建置專案的目錄。Qt Creator 建議您不要直接用源碼的目錄來做建置。這樣可以保持源碼目錄的乾淨,並且可以讓您啟用不同的設定進行多個建置。 @@ -1740,7 +1740,7 @@ Enable Doxygen blocks - 開啟 Doxygen 區塊 + 啟用 Doxygen 區塊 Generate a <i>brief</i> command with an initial description for the corresponding declaration @@ -1978,11 +1978,11 @@ For more details, see/etc/sysctl.d/10-ptrace.conf Enabled - 已開啟 + 已啟用 Disabled - 已關閉 + 已停用 , pending @@ -2340,7 +2340,7 @@ For more details, see/etc/sysctl.d/10-ptrace.conf Checking this will enable tooltips for variable values during debugging. Since this can slow down debugging and does not provide reliable information as it does not use scope information, it is switched off by default. - 勾選此選項會在除錯過程中用工具提示來顯示變數的值。它可能會減慢除錯的速度, 同時由於不使用範圍資訊,造成提供的值並不見得正確,所以此選項預設為關閉。 + 勾選此選項會在除錯過程中啟用工具提示來顯示變數的值。它可能會減慢除錯的速度, 同時由於不使用範圍資訊,造成提供的值並不見得正確,所以此選項預設為關閉。 Use Tooltips in Locals View When Debugging @@ -2368,7 +2368,7 @@ For more details, see/etc/sysctl.d/10-ptrace.conf Enable Reverse Debugging - 開啟反向除錯 + 啟用反向除錯 Register For Post-Mortem Debugging @@ -2384,7 +2384,7 @@ For more details, see/etc/sysctl.d/10-ptrace.conf Checking this will enable tooltips in the locals view during debugging. - 勾選此選項會在除錯時於局部變數檢視中使用工具提示。 + 勾選此選項會在除錯時於局部變數檢視中啟用工具提示。 Break on "abort" @@ -2400,7 +2400,7 @@ For more details, see/etc/sysctl.d/10-ptrace.conf Checking this will enable tooltips in the breakpoints view during debugging. - 勾選此選項會在除錯時於中斷點檢視中使用工具提示。 + 勾選此選項會在除錯時於中斷點檢視中啟用工具提示。 Show Address Data in Breakpoints View when Debugging @@ -3060,11 +3060,11 @@ at debugger startup. Enable reverse debugging - 開啟反向除錯 + 啟用反向除錯 <html><head/><body><p>Selecting this enables reverse debugging.</p><.p><b>Note:</b> This feature is very slow and unstable on the GDB side.It exhibits unpredictable behavior when going backwards over system calls and is very likely to destroy your debugging session.</p><body></html> - <html><head/><body><p>這個選項會開啟反向除錯。</p><.p><b>注意:</b>這個功能會造成速度變很慢,並且在 GDB 端會變得不穩定。它在跑回系統呼叫時,行為會變得無法預測,並且可能會毀掉您的除錯工作階段。</p><body></html> + <html><head/><body><p>這個選項會啟用反向除錯。</p><.p><b>注意:</b>這個功能會造成速度變很慢,並且在 GDB 端會變得不穩定。它在跑回系統呼叫時,行為會變得無法預測,並且可能會毀掉您的除錯工作階段。</p><body></html> Additional Startup Commands @@ -6262,7 +6262,7 @@ Add, modify, and remove document filters, which determine the documentation set Skipping disabled step %1. - 略過被關閉的步驟 %1 。 + 略過被停用的步驟 %1 。 Custom Executable @@ -7083,7 +7083,7 @@ Do you want to ignore them? Building '%1' is disabled: %2<br> - 建置 '%1' 已被關閉:%2<br> + 已停用建置 "%1":%2<br> A build is in progress @@ -7092,7 +7092,7 @@ Do you want to ignore them? Building '%1' is disabled: %2 - 建置 '%1' 已被關閉:%2 + 已停用建置 "%1":%2 @@ -7689,7 +7689,7 @@ Preselects a desktop Qt for building the application if available. Enable QML debugging: - 開啟 QML 除錯: + 啟用 QML 除錯: Might make your application vulnerable. Only use in a safe environment. @@ -8513,7 +8513,7 @@ The following encodings are likely to fit: Enable Text &Wrapping - 開啟文字折行(&W) + 啟用文字折行(&W) Ctrl+/ @@ -9204,7 +9204,7 @@ Will not be applied to whitespace in comments and strings. Disabled Code - 關閉的代碼 + 停用的代碼 Code disabled by preprocessor directives. @@ -9579,7 +9579,7 @@ Will not be applied to whitespace in comments and strings. <i>jom</i> is a drop-in replacement for <i>nmake</i> which distributes the compilation process to multiple CPU cores. The latest binary is available at <a href="ftp://ftp.qt.nokia.com/jom/">ftp://ftp.qt.nokia.com/jom/</a>. Disable it if you experience problems with your builds. - <i>jom</i> 是 <i>nmake</i> 的替代品。它會自動將編譯工作分配給多個 CPU。最新版的執行檔可以在 <a href="ftp://ftp.qt.nokia.com/jom/">ftp://ftp.qt.nokia.com/jom/</a>取得。若是您的建置過程出現問題,請試著將它關閉。 + <i>jom</i> 是 <i>nmake</i> 的替代品。它會自動將編譯工作分配給多個 CPU。最新版的執行檔可以在 <a href="ftp://ftp.qt.nokia.com/jom/">ftp://ftp.qt.nokia.com/jom/</a>取得。若是您的建置過程出現問題,請試著將它停用。 Always build project before deploying it @@ -11206,7 +11206,7 @@ Reason: %2 (disabled) - (已關閉) + (已停用) @@ -14670,7 +14670,7 @@ Ids must begin with a lowercase letter. If enabled, the toolbar will remain pinned to an absolute position. - 若開啟此選項,則工具列將被釘在固定位置。 + 若啟用此選項,則工具列將被釘在固定位置。 Pin Qt Quick Toolbar @@ -15128,7 +15128,7 @@ GDB 允許使用 '\n' 來區隔多個命令序列。 &Enabled: - 已開啟(&E): + 已啟用(&E): &Address: @@ -15209,7 +15209,7 @@ This feature is only available for GDB. The CDB debug engine required for %1 is currently disabled. - %1 需要的 CDB 除錯引擎目前已被關閉。 + %1 需要的 CDB 除錯引擎目前已被停用。 The CDB engine does not support start mode %1. @@ -15471,7 +15471,7 @@ This feature is only available for GDB. The application requires the debugger engine '%1', which is disabled. - 應用程式需要除錯工具引擎 "%1",但是被關閉了。 + 應用程式需要除錯工具引擎 "%1",但是被停用了。 Some breakpoints cannot be handled by the debugger languages currently active, and will be ignored. @@ -15479,7 +15479,7 @@ This feature is only available for GDB. The debugger engine '%1' is disabled. - 除錯引擎 '%1' 已關閉。 + 除錯引擎 '%1' 已停用。 The debugger engine '%1' required for debugging binaries of the type '%2' is not configured correctly. @@ -15619,7 +15619,7 @@ Setting breakpoints by file name and line number may fail. Status of '%1' changed to 'enabled'. - '%1' 的狀態轉變為「已開啟」。 + '%1' 的狀態轉變為「已啟用」。 Status of '%1' changed to 'not connected'. @@ -15784,7 +15784,7 @@ instead of its installation directory when run outside git bash. Disable - 關閉 + 停用 Move Down @@ -15995,7 +15995,7 @@ instead of its installation directory when run outside git bash. Disable Live Preview - 關閉即時預覽 + 停用即時預覽 The %1 attribute at line %2, column %3 cannot be changed without reloading the QML application. @@ -18205,11 +18205,11 @@ to version control (%2) Disable Breakpoint %1 - 關閉中斷點 %1 + 停用中斷點 %1 Enable Breakpoint %1 - 開啟中斷點 %1 + 啟用中斷點 %1 Edit Breakpoint %1... @@ -20159,7 +20159,7 @@ a = a + </pre> </body></html> <html><head/><body> -開啟對齊方式類似於 =, += 等. 當選項被禁用時, 標準的續行縮排將會被啟用.<br> +啟用對齊方式類似於 =, += 等. 當選項被停用時, 標準的續行縮排將會被啟用.<br> <br> 有對齊: <pre> @@ -20475,7 +20475,7 @@ With cache simulation, further event counters are enabled: Enable cache simulation - 開啟快取模擬 + 啟用快取模擬 <html><head/><body> @@ -20487,7 +20487,7 @@ With cache simulation, further event counters are enabled: "Bi"/"Bim")</li></ul></body></html> <html><head/><body> <p>做分支預測模擬.</p> -<p>更多項計數將被開啟: </p> +<p>更多項計數將被啟用: </p> <ul><li>有條件的分支和相關的預測將丟失( "Bc"/"Bcm")</li> <li>執行的間接跳轉和相關的跳轉地址預測將丟失( @@ -20495,7 +20495,7 @@ With cache simulation, further event counters are enabled: Enable branch prediction simulation - 開啟分支預測模擬 + 啟用分支預測模擬 Collect information for system call times. @@ -21195,11 +21195,11 @@ Do you want to continue? Disable profiling - 關閉效能分析 + 停用效能分析 Enable profiling - 開啟效能分析 + 啟用效能分析 Could not connect to the in-process QML profiler. @@ -21992,7 +21992,7 @@ In addition, device connectivity will be tested. Enable cycle detection to properly handle recursive or circular function calls. - 開啟循環檢測來正確把握遞歸或循環功能的調用. + 啟用循環檢測來正確把握遞歸或循環功能的調用. This removes template parameter lists when displaying function names. @@ -22787,7 +22787,7 @@ To compile QML Observer, go to the Qt Versions page, select the current Qt versi Enabled - 已開啟 + 已啟用 This property holds whether the item accepts mouse events. @@ -22795,7 +22795,7 @@ To compile QML Observer, go to the Qt Versions page, select the current Qt versi Hover Enabled - 開啟置於其上 + 啟用置於其上 This property holds whether hover events are handled. @@ -24166,7 +24166,7 @@ Filter: %2 QtC::UpdateInfo Could not determine location of maintenance tool. Please check your installation if you did not enable this plugin manually. - 無法決定維護工具所在位置。請檢查您的安裝,確定您是否沒有手動開啟此外掛程式的支援。 + 無法決定維護工具所在位置。請檢查您的安裝,確定您是否沒有手動啟用此外掛程式的支援。 Could not find maintenance tool at '%1'. Check your installation. @@ -24556,7 +24556,7 @@ p, li { white-space: pre-wrap; } Enable LLDB - 開啟 LLDB + 啟用 LLDB Use GDB Python dumpers @@ -24753,7 +24753,7 @@ p, li { white-space: pre-wrap; } Enable touch optimized navigation - 開啟觸摸導航 + 啟用觸摸導航 Touch optimized navigation will make the HTML page flickable and enlarge the area of touch sensitive elements. If you use a JavaScript framework which optimizes the touch interaction, leave the checkbox unchecked. @@ -24781,7 +24781,7 @@ p, li { white-space: pre-wrap; } Enable network access - 開啟網路存取 + 啟用網路存取 Plugin's directory name: @@ -24962,7 +24962,7 @@ p, li { white-space: pre-wrap; } Enable automatic &indentation - 開啟自動縮排(&I) + 啟用自動縮排(&I) Backspace indentation: @@ -25112,15 +25112,15 @@ Specifies how backspace interacts with indentation. Enable &mouse navigation - 開啟滑鼠導覽(&M) + 啟用滑鼠導覽(&M) Enable scroll &wheel zooming - 開啟滑鼠滾輪縮放(&W) + 啟用滑鼠滾輪縮放(&W) Enable built-in camel case &navigation - 開啟內建的駝峰式大小寫導覽(&N) + 啟用內建的駝峰式大小寫導覽(&N) Show help tooltips: @@ -25208,7 +25208,7 @@ Specifies how backspace interacts with indentation. Enable text &wrapping - 開啟文字折行(&W) + 啟用文字折行(&W) Display right &margin at column: @@ -26113,7 +26113,7 @@ should a repository require SSH-authentication (see documentation on SSH and the Please enter the directory in which you want to build your project. Qt Creator recommends to not use the source directory for building. This ensures that the source directory remains clean and enables multiple builds with different settings. - 請輸入您想建置專案的目錄。Qt Creator 建議您不要直接用源碼的目錄來做建置。這樣可以保持源碼目錄的乾淨,並且可以讓您用不同的設定進行多個建置。 + 請輸入您想建置專案的目錄。Qt Creator 建議您不要直接用源碼的目錄來做建置。這樣可以保持源碼目錄的乾淨,並且可以讓您啟用不同的設定進行多個建置。 Build Location @@ -26297,11 +26297,11 @@ should a repository require SSH-authentication (see documentation on SSH and the Enable C++ - 開啟 C++ + 啟用 C++ Enable QML - 開啟 QML + 啟用 QML Debug port: @@ -28832,19 +28832,19 @@ Please choose a valid package name for your application (e.g. "org.example. Disable Selected Breakpoints - 關閉已選擇的中斷點 + 停用已選擇的中斷點 Enable Selected Breakpoints - 開啟已選擇中斷點 + 啟用已選擇中斷點 Disable Breakpoint - 關閉中斷點 + 停用中斷點 Enable Breakpoint - 開啟中斷點 + 啟用中斷點 Add Breakpoint... @@ -29777,7 +29777,7 @@ Stepping into the module or setting breakpoints by file and is expected to work. <html>Qt Creator has set up the following files to enable packaging: %1 Do you want to add them to the project?</html> - <html>Qt Creator 設定了以下的檔案來開啟打包功能: + <html>Qt Creator 設定了以下的檔案來啟用打包功能: %1 您要將它們新增到專案中嗎?</html> @@ -30186,7 +30186,7 @@ Qt Creator 知道一個相似的URI. Enabled - 已開啟 + 已啟用 <b>Deploy packages</b> From e6e9405cc995138a4e439b2560bf4702c9c30c93 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Thu, 13 Apr 2023 08:04:10 +0200 Subject: [PATCH 28/36] TextEditor: remove redundant semicolon Change-Id: Iac82849a858bd567ff1230ec8c0ea48b5ef47e17 Reviewed-by: Christian Stenger --- src/plugins/texteditor/textmark.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/texteditor/textmark.h b/src/plugins/texteditor/textmark.h index 72712557058..fb000da1a44 100644 --- a/src/plugins/texteditor/textmark.h +++ b/src/plugins/texteditor/textmark.h @@ -115,7 +115,7 @@ public: void setActions(const QVector &actions); // Takes ownership void setActionsProvider(const std::function()> &actionsProvider); // Takes ownership - bool isLocationMarker() const;; + bool isLocationMarker() const; void setIsLocationMarker(bool newIsLocationMarker); protected: From ac17e0e2ad47f16c80eb233725c4a603f6053acb Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 22 Feb 2023 10:17:19 +0100 Subject: [PATCH 29/36] Convert Examples model to FilePath Change-Id: I56219d2f9516662b32d45fd9b2108a0ad34113cc Reviewed-by: David Schulz (cherry picked from commit 255afd45bf614f20b5c0ccee092dcf28c50a1827) Reviewed-by: hjk Reviewed-by: Christian Stenger --- src/plugins/qtsupport/exampleslistmodel.cpp | 15 ++- src/plugins/qtsupport/examplesparser.cpp | 96 +++++++++---------- src/plugins/qtsupport/examplesparser.h | 15 +-- .../qtsupport/gettingstartedwelcomepage.cpp | 73 +++++++------- .../qtsupport/gettingstartedwelcomepage.h | 9 +- 5 files changed, 101 insertions(+), 107 deletions(-) diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index 700248e1f97..40196934d46 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -298,14 +298,15 @@ static bool isValidExampleOrDemo(ExampleItem *item) doesn't have any namespace */ QString reason; bool ok = true; - if (!item->hasSourceCode || !QFileInfo::exists(item->projectPath)) { + if (!item->hasSourceCode || !item->projectPath.exists()) { ok = false; - reason = QString::fromLatin1("projectPath \"%1\" empty or does not exist").arg(item->projectPath); + reason = QString::fromLatin1("projectPath \"%1\" empty or does not exist") + .arg(item->projectPath.toUserOutput()); } else if (item->imageUrl.startsWith(invalidPrefix) || !QUrl(item->imageUrl).isValid()) { ok = false; reason = QString::fromLatin1("imageUrl \"%1\" not valid").arg(item->imageUrl); } else if (!item->docUrl.isEmpty() - && (item->docUrl.startsWith(invalidPrefix) || !QUrl(item->docUrl).isValid())) { + && (item->docUrl.startsWith(invalidPrefix) || !QUrl(item->docUrl).isValid())) { ok = false; reason = QString::fromLatin1("docUrl \"%1\" non-empty but not valid").arg(item->docUrl); } @@ -331,13 +332,17 @@ void ExamplesViewController::updateExamples() QList items; for (const QString &exampleSource : sources) { + const auto manifest = FilePath::fromUserInput(exampleSource); if (debugExamples()) { qWarning() << QString::fromLatin1("Reading file \"%1\"...") - .arg(QFileInfo(exampleSource).absoluteFilePath()); + .arg(manifest.absoluteFilePath().toUserOutput()); } const expected_str> result - = parseExamples(exampleSource, examplesInstallPath, demosInstallPath, m_isExamples); + = parseExamples(manifest, + FilePath::fromUserInput(examplesInstallPath), + FilePath::fromUserInput(demosInstallPath), + m_isExamples); if (!result) { if (debugExamples()) { qWarning() << "ERROR: Could not read examples from" << exampleSource << ":" diff --git a/src/plugins/qtsupport/examplesparser.cpp b/src/plugins/qtsupport/examplesparser.cpp index 2bd50bf8102..1d7211b6367 100644 --- a/src/plugins/qtsupport/examplesparser.cpp +++ b/src/plugins/qtsupport/examplesparser.cpp @@ -4,11 +4,9 @@ #include "examplesparser.h" #include +#include #include -#include -#include -#include #include #include @@ -16,16 +14,15 @@ using namespace Utils; namespace QtSupport::Internal { -static QString relativeOrInstallPath(const QString &path, - const QString &manifestPath, - const QString &installPath) +static FilePath relativeOrInstallPath(const FilePath &path, + const FilePath &manifestPath, + const FilePath &installPath) { - const QChar slash = QLatin1Char('/'); - const QString relativeResolvedPath = manifestPath + slash + path; - const QString installResolvedPath = installPath + slash + path; - if (QFile::exists(relativeResolvedPath)) + const FilePath relativeResolvedPath = manifestPath.resolvePath(path); + const FilePath installResolvedPath = installPath.resolvePath(path); + if (relativeResolvedPath.exists()) return relativeResolvedPath; - if (QFile::exists(installResolvedPath)) + if (installResolvedPath.exists()) return installResolvedPath; // doesn't exist, just return relative return relativeResolvedPath; @@ -47,12 +44,11 @@ static QStringList trimStringList(const QStringList &stringlist) } static QList parseExamples(QXmlStreamReader *reader, - const QString &projectsOffset, - const QString &examplesInstallPath) + const FilePath &projectsOffset, + const FilePath &examplesInstallPath) { QList result; std::unique_ptr item; - const QChar slash = QLatin1Char('/'); while (!reader->atEnd()) { switch (reader->readNext()) { case QXmlStreamReader::StartElement: @@ -61,7 +57,8 @@ static QList parseExamples(QXmlStreamReader *reader, item->type = Example; QXmlStreamAttributes attributes = reader->attributes(); item->name = attributes.value(QLatin1String("name")).toString(); - item->projectPath = attributes.value(QLatin1String("projectPath")).toString(); + item->projectPath = FilePath::fromUserInput( + attributes.value(QLatin1String("projectPath")).toString()); item->hasSourceCode = !item->projectPath.isEmpty(); item->projectPath = relativeOrInstallPath(item->projectPath, projectsOffset, @@ -75,9 +72,9 @@ static QList parseExamples(QXmlStreamReader *reader, } else if (reader->name() == QLatin1String("fileToOpen")) { const QString mainFileAttribute = reader->attributes().value(QLatin1String("mainFile")).toString(); - const QString filePath - = relativeOrInstallPath(reader->readElementText( - QXmlStreamReader::ErrorOnUnexpectedElement), + const FilePath filePath + = relativeOrInstallPath(FilePath::fromUserInput(reader->readElementText( + QXmlStreamReader::ErrorOnUnexpectedElement)), projectsOffset, examplesInstallPath); item->filesToOpen.append(filePath); @@ -88,8 +85,8 @@ static QList parseExamples(QXmlStreamReader *reader, reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); } else if (reader->name() == QLatin1String("dependency")) { item->dependencies.append( - projectsOffset + slash - + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); + projectsOffset + / reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); } else if (reader->name() == QLatin1String("tags")) { item->tags = trimStringList( reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement) @@ -115,12 +112,11 @@ static QList parseExamples(QXmlStreamReader *reader, } static QList parseDemos(QXmlStreamReader *reader, - const QString &projectsOffset, - const QString &demosInstallPath) + const FilePath &projectsOffset, + const FilePath &demosInstallPath) { QList result; std::unique_ptr item; - const QChar slash = QLatin1Char('/'); while (!reader->atEnd()) { switch (reader->readNext()) { case QXmlStreamReader::StartElement: @@ -129,7 +125,8 @@ static QList parseDemos(QXmlStreamReader *reader, item->type = Demo; QXmlStreamAttributes attributes = reader->attributes(); item->name = attributes.value(QLatin1String("name")).toString(); - item->projectPath = attributes.value(QLatin1String("projectPath")).toString(); + item->projectPath = FilePath::fromUserInput( + attributes.value(QLatin1String("projectPath")).toString()); item->hasSourceCode = !item->projectPath.isEmpty(); item->projectPath = relativeOrInstallPath(item->projectPath, projectsOffset, @@ -141,8 +138,8 @@ static QList parseDemos(QXmlStreamReader *reader, == QLatin1String("true"); } else if (reader->name() == QLatin1String("fileToOpen")) { item->filesToOpen.append( - relativeOrInstallPath(reader->readElementText( - QXmlStreamReader::ErrorOnUnexpectedElement), + relativeOrInstallPath(FilePath::fromUserInput(reader->readElementText( + QXmlStreamReader::ErrorOnUnexpectedElement)), projectsOffset, demosInstallPath)); } else if (reader->name() == QLatin1String("description")) { @@ -150,8 +147,8 @@ static QList parseDemos(QXmlStreamReader *reader, reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); } else if (reader->name() == QLatin1String("dependency")) { item->dependencies.append( - projectsOffset + slash - + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); + projectsOffset + / reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); } else if (reader->name() == QLatin1String("tags")) { item->tags = reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement) .split(QLatin1Char(',')); @@ -171,11 +168,10 @@ static QList parseDemos(QXmlStreamReader *reader, return result; } -static QList parseTutorials(QXmlStreamReader *reader, const QString &projectsOffset) +static QList parseTutorials(QXmlStreamReader *reader, const FilePath &projectsOffset) { QList result; std::unique_ptr item = std::make_unique(); - const QChar slash = QLatin1Char('/'); while (!reader->atEnd()) { switch (reader->readNext()) { case QXmlStreamReader::StartElement: @@ -184,10 +180,9 @@ static QList parseTutorials(QXmlStreamReader *reader, const QStri item->type = Tutorial; QXmlStreamAttributes attributes = reader->attributes(); item->name = attributes.value(QLatin1String("name")).toString(); - item->projectPath = attributes.value(QLatin1String("projectPath")).toString(); + item->projectPath = projectsOffset + / attributes.value(QLatin1String("projectPath")).toString(); item->hasSourceCode = !item->projectPath.isEmpty(); - item->projectPath.prepend(slash); - item->projectPath.prepend(projectsOffset); item->imageUrl = Utils::StyleHelper::dpiSpecificImageFile( attributes.value(QLatin1String("imageUrl")).toString()); QPixmapCache::remove(item->imageUrl); @@ -198,15 +193,15 @@ static QList parseTutorials(QXmlStreamReader *reader, const QStri item->videoLength = attributes.value(QLatin1String("videoLength")).toString(); } else if (reader->name() == QLatin1String("fileToOpen")) { item->filesToOpen.append( - projectsOffset + slash - + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); + projectsOffset + / reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); } else if (reader->name() == QLatin1String("description")) { item->description = fixStringForTags( reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); } else if (reader->name() == QLatin1String("dependency")) { item->dependencies.append( - projectsOffset + slash - + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); + projectsOffset + / reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); } else if (reader->name() == QLatin1String("tags")) { item->tags = reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement) .split(QLatin1Char(',')); @@ -225,31 +220,28 @@ static QList parseTutorials(QXmlStreamReader *reader, const QStri return result; } -expected_str> parseExamples(const QString &manifest, - const QString &examplesInstallPath, - const QString &demosInstallPath, +expected_str> parseExamples(const FilePath &manifest, + const FilePath &examplesInstallPath, + const FilePath &demosInstallPath, const bool examples) { - QFile exampleFile(manifest); - if (!exampleFile.open(QIODevice::ReadOnly)) - return make_unexpected(QString("Could not open file \"%1\"").arg(manifest)); + const expected_str contents = manifest.fileContents(); + if (!contents) + return make_unexpected(contents.error()); - QFileInfo fi(manifest); - QString offsetPath = fi.path(); - QDir examplesDir(offsetPath); - QDir demosDir(offsetPath); + const FilePath path = manifest.parentDir(); QList items; - QXmlStreamReader reader(&exampleFile); + QXmlStreamReader reader(*contents); while (!reader.atEnd()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement: if (examples && reader.name() == QLatin1String("examples")) - items += parseExamples(&reader, examplesDir.path(), examplesInstallPath); + items += parseExamples(&reader, path, examplesInstallPath); else if (examples && reader.name() == QLatin1String("demos")) - items += parseDemos(&reader, demosDir.path(), demosInstallPath); + items += parseDemos(&reader, path, demosInstallPath); else if (!examples && reader.name() == QLatin1String("tutorials")) - items += parseTutorials(&reader, examplesDir.path()); + items += parseTutorials(&reader, path); break; default: // nothing break; @@ -259,7 +251,7 @@ expected_str> parseExamples(const QString &manifest, if (reader.hasError()) { qDeleteAll(items); return make_unexpected(QString("Could not parse file \"%1\" as XML document: %2:%3: %4") - .arg(manifest) + .arg(manifest.toUserOutput()) .arg(reader.lineNumber()) .arg(reader.columnNumber()) .arg(reader.errorString())); diff --git a/src/plugins/qtsupport/examplesparser.h b/src/plugins/qtsupport/examplesparser.h index d08a8da11bc..494a42b1473 100644 --- a/src/plugins/qtsupport/examplesparser.h +++ b/src/plugins/qtsupport/examplesparser.h @@ -5,6 +5,7 @@ #include #include +#include namespace QtSupport::Internal { @@ -13,11 +14,11 @@ enum InstructionalType { Example = 0, Demo, Tutorial }; class ExampleItem : public Core::ListItem { public: - QString projectPath; + Utils::FilePath projectPath; QString docUrl; - QStringList filesToOpen; - QString mainFile; /* file to be visible after opening filesToOpen */ - QStringList dependencies; + Utils::FilePaths filesToOpen; + Utils::FilePath mainFile; /* file to be visible after opening filesToOpen */ + Utils::FilePaths dependencies; InstructionalType type; int difficulty = 0; bool hasSourceCode = false; @@ -28,9 +29,9 @@ public: QStringList platforms; }; -Utils::expected_str> parseExamples(const QString &manifest, - const QString &examplesInstallPath, - const QString &demosInstallPath, +Utils::expected_str> parseExamples(const Utils::FilePath &manifest, + const Utils::FilePath &examplesInstallPath, + const Utils::FilePath &demosInstallPath, bool examples); } // namespace QtSupport::Internal diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp index fea56880356..bf19233c211 100644 --- a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp +++ b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp @@ -69,16 +69,18 @@ Id ExamplesWelcomePage::id() const return m_showExamples ? "Examples" : "Tutorials"; } -QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileInfo, QStringList &filesToOpen, const QStringList& dependencies) +FilePath ExamplesWelcomePage::copyToAlternativeLocation(const FilePath &proFile, + FilePaths &filesToOpen, + const FilePaths &dependencies) { - const QString projectDir = proFileInfo.canonicalPath(); + const FilePath projectDir = proFile.canonicalPath().parentDir(); QDialog d(ICore::dialogParent()); auto lay = new QGridLayout(&d); auto descrLbl = new QLabel; d.setWindowTitle(Tr::tr("Copy Project to writable Location?")); descrLbl->setTextFormat(Qt::RichText); descrLbl->setWordWrap(false); - const QString nativeProjectDir = QDir::toNativeSeparators(projectDir); + const QString nativeProjectDir = projectDir.toUserOutput(); descrLbl->setText(QString::fromLatin1("
%1
").arg(nativeProjectDir)); descrLbl->setMinimumWidth(descrLbl->sizeHint().width()); descrLbl->setWordWrap(true); @@ -95,9 +97,10 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI txt->setBuddy(chooser); chooser->setExpectedKind(PathChooser::ExistingDirectory); chooser->setHistoryCompleter(QLatin1String("Qt.WritableExamplesDir.History")); - const QString defaultRootDirectory = DocumentManager::projectsDirectory().toString(); + const FilePath defaultRootDirectory = DocumentManager::projectsDirectory(); QtcSettings *settings = ICore::settings(); - chooser->setFilePath(FilePath::fromSettings(settings->value(C_FALLBACK_ROOT, defaultRootDirectory))); + chooser->setFilePath( + FilePath::fromSettings(settings->value(C_FALLBACK_ROOT, defaultRootDirectory.toVariant()))); lay->addWidget(txt, 1, 0); lay->addWidget(chooser, 1, 1); enum { Copy = QDialog::Accepted + 1, Keep = QDialog::Accepted + 2 }; @@ -111,35 +114,32 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI connect(chooser, &PathChooser::validChanged, copyBtn, &QWidget::setEnabled); int code = d.exec(); if (code == Copy) { - QString exampleDirName = proFileInfo.dir().dirName(); - QString destBaseDir = chooser->filePath().toString(); + const QString exampleDirName = projectDir.fileName(); + const FilePath destBaseDir = chooser->filePath(); settings->setValueWithDefault(C_FALLBACK_ROOT, destBaseDir, defaultRootDirectory); - QDir toDirWithExamplesDir(destBaseDir); - if (toDirWithExamplesDir.cd(exampleDirName)) { - toDirWithExamplesDir.cdUp(); // step out, just to not be in the way + const FilePath targetDir = destBaseDir / exampleDirName; + if (targetDir.exists()) { QMessageBox::warning(ICore::dialogParent(), Tr::tr("Cannot Use Location"), Tr::tr("The specified location already exists. " "Please specify a valid location."), QMessageBox::Ok, QMessageBox::NoButton); - return QString(); + return {}; } else { - QString targetDir = destBaseDir + QLatin1Char('/') + exampleDirName; - - expected_str result - = FilePath::fromString(projectDir).copyRecursively(FilePath::fromString(targetDir)); + expected_str result = projectDir.copyRecursively(targetDir); if (result) { // set vars to new location - const QStringList::Iterator end = filesToOpen.end(); - for (QStringList::Iterator it = filesToOpen.begin(); it != end; ++it) - it->replace(projectDir, targetDir); + const FilePaths::Iterator end = filesToOpen.end(); + for (FilePaths::Iterator it = filesToOpen.begin(); it != end; ++it) { + const FilePath relativePath = it->relativeChildPath(projectDir); + *it = targetDir.resolvePath(relativePath); + } - for (const QString &dependency : dependencies) { - const FilePath targetFile = FilePath::fromString(targetDir) - .pathAppended(QDir(dependency).dirName()); - result = FilePath::fromString(dependency).copyRecursively(targetFile); + for (const FilePath &dependency : dependencies) { + const FilePath targetFile = targetDir.pathAppended(dependency.fileName()); + result = dependency.copyRecursively(targetFile); if (!result) { QMessageBox::warning(ICore::dialogParent(), Tr::tr("Cannot Copy Project"), @@ -148,7 +148,7 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI } } - return targetDir + QLatin1Char('/') + proFileInfo.fileName(); + return targetDir / proFile.fileName(); } else { QMessageBox::warning(ICore::dialogParent(), Tr::tr("Cannot Copy Project"), @@ -157,46 +157,43 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI } } if (code == Keep) - return proFileInfo.absoluteFilePath(); - return QString(); + return proFile.absoluteFilePath(); + return {}; } void ExamplesWelcomePage::openProject(const ExampleItem *item) { using namespace ProjectExplorer; - QString proFile = item->projectPath; + FilePath proFile = item->projectPath; if (proFile.isEmpty()) return; - QStringList filesToOpen = item->filesToOpen; + FilePaths filesToOpen = item->filesToOpen; if (!item->mainFile.isEmpty()) { // ensure that the main file is opened on top (i.e. opened last) filesToOpen.removeAll(item->mainFile); filesToOpen.append(item->mainFile); } - QFileInfo proFileInfo(proFile); - if (!proFileInfo.exists()) + if (!proFile.exists()) return; // If the Qt is a distro Qt on Linux, it will not be writable, hence compilation will fail // Same if it is installed in non-writable location for other reasons - const bool needsCopy = withNtfsPermissions([proFileInfo] { - QFileInfo pathInfo(proFileInfo.path()); - return !proFileInfo.isWritable() - || !pathInfo.isWritable() /* path of .pro file */ - || !QFileInfo(pathInfo.path()).isWritable() /* shadow build directory */; + const bool needsCopy = withNtfsPermissions([proFile] { + return !proFile.isWritableFile() + || !proFile.parentDir().isWritableDir() /* path of project file */ + || !proFile.parentDir().parentDir().isWritableDir() /* shadow build directory */; }); if (needsCopy) - proFile = copyToAlternativeLocation(proFileInfo, filesToOpen, item->dependencies); + proFile = copyToAlternativeLocation(proFile, filesToOpen, item->dependencies); // don't try to load help and files if loading the help request is being cancelled if (proFile.isEmpty()) return; - ProjectExplorerPlugin::OpenProjectResult result = - ProjectExplorerPlugin::openProject(FilePath::fromString(proFile)); + ProjectExplorerPlugin::OpenProjectResult result = ProjectExplorerPlugin::openProject(proFile); if (result) { - ICore::openFiles(FileUtils::toFilePathList(filesToOpen)); + ICore::openFiles(filesToOpen); ModeManager::activateMode(Core::Constants::MODE_EDIT); QUrl docUrl = QUrl::fromUserInput(item->docUrl); if (docUrl.isValid()) diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.h b/src/plugins/qtsupport/gettingstartedwelcomepage.h index 2781666a923..aa07f669167 100644 --- a/src/plugins/qtsupport/gettingstartedwelcomepage.h +++ b/src/plugins/qtsupport/gettingstartedwelcomepage.h @@ -4,10 +4,7 @@ #pragma once #include - -QT_BEGIN_NAMESPACE -class QFileInfo; -QT_END_NAMESPACE +#include namespace QtSupport { namespace Internal { @@ -29,7 +26,9 @@ public: static void openProject(const ExampleItem *item); private: - static QString copyToAlternativeLocation(const QFileInfo &fileInfo, QStringList &filesToOpen, const QStringList &dependencies); + static Utils::FilePath copyToAlternativeLocation(const Utils::FilePath &fileInfo, + Utils::FilePaths &filesToOpen, + const Utils::FilePaths &dependencies); const bool m_showExamples; }; From 9144ab75f41d54b907e323586dbc303400dc0327 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 9 Mar 2023 11:30:31 +0100 Subject: [PATCH 30/36] Add test for examples parsing Change-Id: Id2ec8afcdbdff97e12b32b836c955552589081c4 Reviewed-by: Eike Ziller Reviewed-by: Christian Stenger Reviewed-by: (cherry picked from commit 87b5176fd23b749d13fef81e65db09939b446e4f) --- src/plugins/qtsupport/examplesparser.cpp | 14 +- src/plugins/qtsupport/examplesparser.h | 21 ++- tests/auto/CMakeLists.txt | 1 + tests/auto/auto.qbs | 1 + tests/auto/examples/CMakeLists.txt | 5 + tests/auto/examples/examples.qbs | 9 ++ tests/auto/examples/tst_examples.cpp | 156 +++++++++++++++++++++++ 7 files changed, 198 insertions(+), 9 deletions(-) create mode 100644 tests/auto/examples/CMakeLists.txt create mode 100644 tests/auto/examples/examples.qbs create mode 100644 tests/auto/examples/tst_examples.cpp diff --git a/src/plugins/qtsupport/examplesparser.cpp b/src/plugins/qtsupport/examplesparser.cpp index 1d7211b6367..de6a14d8369 100644 --- a/src/plugins/qtsupport/examplesparser.cpp +++ b/src/plugins/qtsupport/examplesparser.cpp @@ -229,10 +229,18 @@ expected_str> parseExamples(const FilePath &manifest, if (!contents) return make_unexpected(contents.error()); - const FilePath path = manifest.parentDir(); + return parseExamples(*contents, manifest, examplesInstallPath, demosInstallPath, examples); +} +expected_str> parseExamples(const QByteArray &manifestData, + const Utils::FilePath &manifestPath, + const FilePath &examplesInstallPath, + const FilePath &demosInstallPath, + const bool examples) +{ + const FilePath path = manifestPath.parentDir(); QList items; - QXmlStreamReader reader(*contents); + QXmlStreamReader reader(manifestData); while (!reader.atEnd()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement: @@ -251,7 +259,7 @@ expected_str> parseExamples(const FilePath &manifest, if (reader.hasError()) { qDeleteAll(items); return make_unexpected(QString("Could not parse file \"%1\" as XML document: %2:%3: %4") - .arg(manifest.toUserOutput()) + .arg(manifestPath.toUserOutput()) .arg(reader.lineNumber()) .arg(reader.columnNumber()) .arg(reader.errorString())); diff --git a/src/plugins/qtsupport/examplesparser.h b/src/plugins/qtsupport/examplesparser.h index 494a42b1473..b133d2c6c8a 100644 --- a/src/plugins/qtsupport/examplesparser.h +++ b/src/plugins/qtsupport/examplesparser.h @@ -3,6 +3,8 @@ #pragma once +#include "qtsupport_global.h" + #include #include #include @@ -11,7 +13,7 @@ namespace QtSupport::Internal { enum InstructionalType { Example = 0, Demo, Tutorial }; -class ExampleItem : public Core::ListItem +class QTSUPPORT_EXPORT ExampleItem : public Core::ListItem { public: Utils::FilePath projectPath; @@ -20,7 +22,6 @@ public: Utils::FilePath mainFile; /* file to be visible after opening filesToOpen */ Utils::FilePaths dependencies; InstructionalType type; - int difficulty = 0; bool hasSourceCode = false; bool isVideo = false; bool isHighlighted = false; @@ -29,10 +30,18 @@ public: QStringList platforms; }; -Utils::expected_str> parseExamples(const Utils::FilePath &manifest, - const Utils::FilePath &examplesInstallPath, - const Utils::FilePath &demosInstallPath, - bool examples); +QTSUPPORT_EXPORT Utils::expected_str> parseExamples( + const Utils::FilePath &manifest, + const Utils::FilePath &examplesInstallPath, + const Utils::FilePath &demosInstallPath, + bool examples); + +QTSUPPORT_EXPORT Utils::expected_str> parseExamples( + const QByteArray &manifestData, + const Utils::FilePath &manifestPath, + const Utils::FilePath &examplesInstallPath, + const Utils::FilePath &demosInstallPath, + bool examples); } // namespace QtSupport::Internal diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt index c71cbafdb2d..98ee3458965 100644 --- a/tests/auto/CMakeLists.txt +++ b/tests/auto/CMakeLists.txt @@ -6,6 +6,7 @@ add_subdirectory(cplusplus) add_subdirectory(debugger) add_subdirectory(diff) add_subdirectory(environment) +add_subdirectory(examples) add_subdirectory(extensionsystem) add_subdirectory(externaltool) add_subdirectory(filesearch) diff --git a/tests/auto/auto.qbs b/tests/auto/auto.qbs index af173fa9f09..2ff98d14097 100644 --- a/tests/auto/auto.qbs +++ b/tests/auto/auto.qbs @@ -12,6 +12,7 @@ Project { "debugger/debugger.qbs", "diff/diff.qbs", "environment/environment.qbs", + "examples/examples.qbs", "extensionsystem/extensionsystem.qbs", "externaltool/externaltool.qbs", "filesearch/filesearch.qbs", diff --git a/tests/auto/examples/CMakeLists.txt b/tests/auto/examples/CMakeLists.txt new file mode 100644 index 00000000000..cf8d1e4191e --- /dev/null +++ b/tests/auto/examples/CMakeLists.txt @@ -0,0 +1,5 @@ +add_qtc_test(tst_examples + DEPENDS Utils Core QtSupport + SOURCES tst_examples.cpp +) + diff --git a/tests/auto/examples/examples.qbs b/tests/auto/examples/examples.qbs new file mode 100644 index 00000000000..39cacc395fa --- /dev/null +++ b/tests/auto/examples/examples.qbs @@ -0,0 +1,9 @@ +import qbs + +QtcAutotest { + name: "Examples autotest" + Depends { name: "Core" } + Depends { name: "QtSupport" } + Depends { name: "Utils" } + files: "tst_examples.cpp" +} diff --git a/tests/auto/examples/tst_examples.cpp b/tests/auto/examples/tst_examples.cpp new file mode 100644 index 00000000000..22236ed4c5d --- /dev/null +++ b/tests/auto/examples/tst_examples.cpp @@ -0,0 +1,156 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#include +#include + +#include + +using namespace Utils; +using namespace QtSupport::Internal; + +class tst_Examples : public QObject +{ + Q_OBJECT + +public: + tst_Examples(); + ~tst_Examples(); + +private slots: + void parsing_data(); + void parsing(); +}; + +tst_Examples::tst_Examples() = default; +tst_Examples::~tst_Examples() = default; + +static ExampleItem fetchItem() +{ + QFETCH(QString, name); + QFETCH(QString, description); + QFETCH(QString, imageUrl); + QFETCH(QStringList, tags); + QFETCH(FilePath, projectPath); + QFETCH(QString, docUrl); + QFETCH(FilePaths, filesToOpen); + QFETCH(FilePath, mainFile); + QFETCH(FilePaths, dependencies); + QFETCH(InstructionalType, type); + QFETCH(bool, hasSourceCode); + QFETCH(bool, isVideo); + QFETCH(bool, isHighlighted); + QFETCH(QString, videoUrl); + QFETCH(QString, videoLength); + QFETCH(QStringList, platforms); + ExampleItem item; + item.name = name; + item.description = description; + item.imageUrl = imageUrl; + item.tags = tags; + item.projectPath = projectPath; + item.docUrl = docUrl; + item.filesToOpen = filesToOpen; + item.mainFile = mainFile; + item.dependencies = dependencies; + item.type = type; + item.hasSourceCode = hasSourceCode; + item.isVideo = isVideo; + item.isHighlighted = isHighlighted; + item.videoUrl = videoUrl; + item.videoLength = videoLength; + item.platforms = platforms; + return item; +} + +void tst_Examples::parsing_data() +{ + QTest::addColumn("data"); + QTest::addColumn("isExamples"); + QTest::addColumn("name"); + QTest::addColumn("description"); + QTest::addColumn("imageUrl"); + QTest::addColumn("tags"); + QTest::addColumn("projectPath"); + QTest::addColumn("docUrl"); + QTest::addColumn("filesToOpen"); + QTest::addColumn("mainFile"); + QTest::addColumn("dependencies"); + QTest::addColumn("type"); + QTest::addColumn("hasSourceCode"); + QTest::addColumn("isVideo"); + QTest::addColumn("isHighlighted"); + QTest::addColumn("videoUrl"); + QTest::addColumn("videoLength"); + QTest::addColumn("platforms"); + + QTest::addRow("example") + << QByteArray(R"raw( + + + + ios,widgets + widgets/widgets/analogclock/main.cpp + widgets/widgets/analogclock/analogclock.h + widgets/widgets/analogclock/analogclock.cpp + + Graphics + widgets + + + + )raw") << /*isExamples=*/true + << "Analog Clock" + << "The Analog Clock example shows how to draw the contents of a custom widget." + << "qthelp://org.qt-project.qtwidgets.660/qtwidgets/images/analogclock-example.png" + << QStringList{"ios", "widgets"} + << FilePath::fromUserInput("manifest/widgets/widgets/analogclock/CMakeLists.txt") + << "qthelp://org.qt-project.qtwidgets.660/qtwidgets/" + "qtwidgets-widgets-analogclock-example.html" + << FilePaths{FilePath::fromUserInput("manifest/widgets/widgets/analogclock/main.cpp"), + FilePath::fromUserInput("manifest/widgets/widgets/analogclock/analogclock.h"), + FilePath::fromUserInput( + "manifest/widgets/widgets/analogclock/analogclock.cpp")} + << FilePath::fromUserInput("manifest/widgets/widgets/analogclock/analogclock.cpp") + << FilePaths() << Example << true << false << false << "" + << "" << QStringList(); +} + +void tst_Examples::parsing() +{ + QFETCH(QByteArray, data); + QFETCH(bool, isExamples); + const ExampleItem expected = fetchItem(); + const expected_str> result + = parseExamples(data, + FilePath("manifest/examples-manifest.xml"), + FilePath("examples"), + FilePath("demos"), + isExamples); + QVERIFY(result); + QCOMPARE(result->size(), 1); + const ExampleItem item = *result->at(0); + QCOMPARE(item.name, expected.name); + QCOMPARE(item.description, expected.description); + QCOMPARE(item.imageUrl, expected.imageUrl); + QCOMPARE(item.tags, expected.tags); + QCOMPARE(item.projectPath, expected.projectPath); + QCOMPARE(item.docUrl, expected.docUrl); + QCOMPARE(item.filesToOpen, expected.filesToOpen); + QCOMPARE(item.mainFile, expected.mainFile); + QCOMPARE(item.dependencies, expected.dependencies); + QCOMPARE(item.type, expected.type); + QCOMPARE(item.hasSourceCode, expected.hasSourceCode); + QCOMPARE(item.isVideo, expected.isVideo); + QCOMPARE(item.isHighlighted, expected.isHighlighted); + QCOMPARE(item.videoUrl, expected.videoUrl); + QCOMPARE(item.videoLength, expected.videoLength); + QCOMPARE(item.platforms, expected.platforms); + qDeleteAll(*result); +} + +QTEST_APPLESS_MAIN(tst_Examples) + +#include "tst_examples.moc" From b542d479071c0ffe3edde326a40b9d885e19ff6a Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 9 Mar 2023 14:00:08 +0100 Subject: [PATCH 31/36] Examples: Read meta data, which includes categories Task-number: QTCREATORBUG-28546 Change-Id: I11505d4f8b8eaef3f525185cd45757b6f41012ec Reviewed-by: Christian Stenger (cherry picked from commit e060f82fa56131436a0c578c5857501b53ef7978) --- src/plugins/qtsupport/examplesparser.cpp | 31 ++++++++++++++++++++++++ src/plugins/qtsupport/examplesparser.h | 1 + tests/auto/examples/tst_examples.cpp | 8 +++++- 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/plugins/qtsupport/examplesparser.cpp b/src/plugins/qtsupport/examplesparser.cpp index de6a14d8369..bdde8e66a0f 100644 --- a/src/plugins/qtsupport/examplesparser.cpp +++ b/src/plugins/qtsupport/examplesparser.cpp @@ -43,6 +43,35 @@ static QStringList trimStringList(const QStringList &stringlist) return Utils::transform(stringlist, [](const QString &str) { return str.trimmed(); }); } +static QHash parseMeta(QXmlStreamReader *reader) +{ + QHash result; + while (!reader->atEnd()) { + switch (reader->readNext()) { + case QXmlStreamReader::StartElement: + if (reader->name() == QLatin1String("entry")) { + const QString key = reader->attributes().value("name").toString(); + if (key.isEmpty()) { + reader->raiseError("Tag \"entry\" requires \"name\" attribute"); + break; + } + const QString value = reader->readElementText( + QXmlStreamReader::ErrorOnUnexpectedElement); + if (!value.isEmpty()) + result[key].append(value); + } + break; + case QXmlStreamReader::EndElement: + if (reader->name() == QLatin1String("meta")) + return result; + break; + default: + break; + } + } + return result; +} + static QList parseExamples(QXmlStreamReader *reader, const FilePath &projectsOffset, const FilePath &examplesInstallPath) @@ -95,6 +124,8 @@ static QList parseExamples(QXmlStreamReader *reader, item->platforms = trimStringList( reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement) .split(QLatin1Char(','), Qt::SkipEmptyParts)); + } else if (reader->name() == QLatin1String("meta")) { + item->metaData = parseMeta(reader); } break; case QXmlStreamReader::EndElement: diff --git a/src/plugins/qtsupport/examplesparser.h b/src/plugins/qtsupport/examplesparser.h index b133d2c6c8a..2d1afa54838 100644 --- a/src/plugins/qtsupport/examplesparser.h +++ b/src/plugins/qtsupport/examplesparser.h @@ -28,6 +28,7 @@ public: QString videoUrl; QString videoLength; QStringList platforms; + QHash metaData; }; QTSUPPORT_EXPORT Utils::expected_str> parseExamples( diff --git a/tests/auto/examples/tst_examples.cpp b/tests/auto/examples/tst_examples.cpp index 22236ed4c5d..5a18f1e4498 100644 --- a/tests/auto/examples/tst_examples.cpp +++ b/tests/auto/examples/tst_examples.cpp @@ -25,6 +25,8 @@ private slots: tst_Examples::tst_Examples() = default; tst_Examples::~tst_Examples() = default; +using MetaData = QHash; + static ExampleItem fetchItem() { QFETCH(QString, name); @@ -43,6 +45,7 @@ static ExampleItem fetchItem() QFETCH(QString, videoUrl); QFETCH(QString, videoLength); QFETCH(QStringList, platforms); + QFETCH(MetaData, metaData); ExampleItem item; item.name = name; item.description = description; @@ -60,6 +63,7 @@ static ExampleItem fetchItem() item.videoUrl = videoUrl; item.videoLength = videoLength; item.platforms = platforms; + item.metaData = metaData; return item; } @@ -83,6 +87,7 @@ void tst_Examples::parsing_data() QTest::addColumn("videoUrl"); QTest::addColumn("videoLength"); QTest::addColumn("platforms"); + QTest::addColumn("metaData"); QTest::addRow("example") << QByteArray(R"raw( @@ -115,7 +120,7 @@ void tst_Examples::parsing_data() "manifest/widgets/widgets/analogclock/analogclock.cpp")} << FilePath::fromUserInput("manifest/widgets/widgets/analogclock/analogclock.cpp") << FilePaths() << Example << true << false << false << "" - << "" << QStringList(); + << "" << QStringList() << MetaData({{"category", {"Graphics"}}, {"tags", {"widgets"}}}); } void tst_Examples::parsing() @@ -148,6 +153,7 @@ void tst_Examples::parsing() QCOMPARE(item.videoUrl, expected.videoUrl); QCOMPARE(item.videoLength, expected.videoLength); QCOMPARE(item.platforms, expected.platforms); + QCOMPARE(item.metaData, expected.metaData); qDeleteAll(*result); } From e6414d99414a7ee943ce43a6f361f720a6f0d455 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 9 Mar 2023 17:02:58 +0100 Subject: [PATCH 32/36] Examples: Optionally parse categories from meta data Optionally parses example categories from the examples manifests, when setting the environment variable QTC_USE_EXAMPLE_CATEGORIES (can be done in Qt Creator's Environment > System > Environment settings). It doesn't make sense to unconditionally enable that yet, because only few examples actually have categories so far, so we will need to wait until some Qt version is suited for enabling this. If an example set does not provide categories, the "highlighted" property is used to provide a "Featured" category, as before. If an example set does provide categories, these are shown instead, sorted alphabetically, and examples with the "highlighted" property are put at the front of the category, overriding the otherwise alphabetical listing inside the categories. Examples without a category are put into a separate "Other" category at the end. Task-number: QTCREATORBUG-28546 Change-Id: I7ca312686eae13e16961def1b4b36ffd7050a447 Reviewed-by: Christian Stenger Reviewed-by: (cherry picked from commit a2de016f64f91c154a222a2216c50f59e9350459) --- src/plugins/qtsupport/exampleslistmodel.cpp | 67 +++++++++++++++++---- 1 file changed, 54 insertions(+), 13 deletions(-) diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index 40196934d46..c567f992e41 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -320,6 +320,56 @@ static bool isValidExampleOrDemo(ExampleItem *item) return ok || debugExamples(); } +static bool sortByHighlightedAndName(ExampleItem *first, ExampleItem *second) +{ + if (first->isHighlighted && !second->isHighlighted) + return true; + if (!first->isHighlighted && second->isHighlighted) + return false; + return first->name.compare(second->name, Qt::CaseInsensitive) < 0; +} + +static QList>> getCategories( + const QList &items) +{ + static const QString otherDisplayName = Tr::tr("Other", "Category for all other examples"); + const bool useCategories = qtcEnvironmentVariableIsSet("QTC_USE_EXAMPLE_CATEGORIES"); + QList other; + QMap> categoryMap; + if (useCategories) { + for (ExampleItem *item : items) { + const QStringList itemCategories = item->metaData.value("category"); + for (const QString &category : itemCategories) + categoryMap[category].append(item); + if (itemCategories.isEmpty()) + other.append(item); + } + } + QList>> categories; + if (categoryMap.isEmpty()) { + // The example set doesn't define categories. Consider the "highlighted" ones as "featured" + QList featured; + QList allOther; + std::tie(featured, allOther) = Utils::partition(items, [](ExampleItem *i) { + return i->isHighlighted; + }); + if (!featured.isEmpty()) + categories.append({Tr::tr("Featured", "Category for highlighted examples"), featured}); + if (!allOther.isEmpty()) + categories.append({otherDisplayName, allOther}); + } else { + const auto end = categoryMap.constKeyValueEnd(); + for (auto it = categoryMap.constKeyValueBegin(); it != end; ++it) + categories.append(*it); + if (!other.isEmpty()) + categories.append({otherDisplayName, other}); + } + const auto end = categories.end(); + for (auto it = categories.begin(); it != end; ++it) + sort(it->second, sortByHighlightedAndName); + return categories; +} + void ExamplesViewController::updateExamples() { QString examplesInstallPath; @@ -363,21 +413,12 @@ void ExamplesViewController::updateExamples() [](ExampleItem *item) { return item->tags.contains("ios"); }); } } - Utils::sort(items, [](ExampleItem *first, ExampleItem *second) { - return first->name.compare(second->name, Qt::CaseInsensitive) < 0; - }); - QList featured; - QList other; - std::tie(featured, other) = Utils::partition(items, - [](ExampleItem *i) { return i->isHighlighted; }); - - if (!featured.isEmpty()) { - m_view->addSection({Tr::tr("Featured", "Category for highlighted examples"), 0}, - static_container_cast(featured)); + const QList>> sections = getCategories(items); + for (int i = 0; i < sections.size(); ++i) { + m_view->addSection({sections.at(i).first, i}, + static_container_cast(sections.at(i).second)); } - m_view->addSection({Tr::tr("Other", "Category for all other examples"), 1}, - static_container_cast(other)); } void ExampleSetModel::updateQtVersionList() From c842b96f77f7d651da5318bb1323403e5ed5d6dc Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 12 Apr 2023 13:28:40 +0200 Subject: [PATCH 33/36] COIN/GitHub: Use Qt 6.4.3 and LLVM 16.0.0 Change-Id: I95ddc7a95b5761d29b111f3eff3fdfc014efaa51 Reviewed-by: Qt CI Bot Reviewed-by: Cristian Adam --- .github/workflows/build_cmake.yml | 8 ++++---- coin/instructions/common_environment.yaml | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 6c14dcfb55a..8a623779f16 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -7,9 +7,9 @@ on: - 'doc/**' env: - QT_VERSION: 6.4.2 + QT_VERSION: 6.4.3 MACOS_DEPLOYMENT_TARGET: 10.14 - CLANG_VERSION: 16.0.0-rc2 + CLANG_VERSION: 16.0.0 ELFUTILS_VERSION: 0.175 CMAKE_VERSION: 3.21.1 NINJA_VERSION: 1.10.2 @@ -189,11 +189,11 @@ jobs: if ("x${{ matrix.config.environment_script }}" STREQUAL "x") set(qt_package_arch_suffix "win64_mingw") set(qt_dir_prefix "${qt_version}/mingw_64") - set(qt_package_suffix "-Windows-Windows_10_21H2-Mingw-Windows-Windows_10_21H2-X86_64") + set(qt_package_suffix "-Windows-Windows_10_22H2-Mingw-Windows-Windows_10_22H2-X86_64") elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat") set(qt_package_arch_suffix "win64_msvc2019_64") set(qt_dir_prefix "${qt_version}/msvc2019_64") - set(qt_package_suffix "-Windows-Windows_10_21H2-MSVC2019-Windows-Windows_10_21H2-X86_64") + set(qt_package_suffix "-Windows-Windows_10_22H2-MSVC2019-Windows-Windows_10_22H2-X86_64") endif() elseif ("${{ runner.os }}" STREQUAL "Linux") set(url_os "linux_x64") diff --git a/coin/instructions/common_environment.yaml b/coin/instructions/common_environment.yaml index 1124788c83b..d3c072f0a94 100644 --- a/coin/instructions/common_environment.yaml +++ b/coin/instructions/common_environment.yaml @@ -7,10 +7,10 @@ instructions: variableValue: "RelWithDebInfo" - type: EnvironmentVariable variableName: LLVM_BASE_URL - variableValue: http://master.qt.io/development_releases/prebuilt/libclang/libclang-release_16.0.0-rc2-based + variableValue: http://master.qt.io/development_releases/prebuilt/libclang/libclang-release_16.0.0-based - type: EnvironmentVariable variableName: QTC_QT_BASE_URL - variableValue: "http://ci-files02-hki.intra.qt.io/packages/jenkins/archive/qt/6.4/6.4.2-released/Qt" + variableValue: "http://ci-files02-hki.intra.qt.io/packages/jenkins/archive/qt/6.4/6.4.3-released/Qt" - type: EnvironmentVariable variableName: QTC_QT_MODULES variableValue: "qt5compat qtbase qtdeclarative qtimageformats qtquick3d qtquickcontrols2 qtquicktimeline qtserialport qtshadertools qtsvg qttools qttranslations qtwebengine" @@ -24,7 +24,7 @@ instructions: instructions: - type: EnvironmentVariable variableName: QTC_QT_POSTFIX - variableValue: "-Windows-Windows_10_21H2-MSVC2019-Windows-Windows_10_21H2-X86_64.7z" + variableValue: "-Windows-Windows_10_22H2-MSVC2019-Windows-Windows_10_22H2-X86_64.7z" - type: EnvironmentVariable variableName: QTC_SDKTOOL_QT_EXT variableValue: ".zip" From 2ffe169a8d90205a02e89844b5e6280daf51c3bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Wed, 5 Apr 2023 23:40:29 +0200 Subject: [PATCH 34/36] SquishTests: Try stabilizing tst_generic_highlighter Change-Id: I12e29f2886d22ce03a1a2eb62d5c776cd894d359 Reviewed-by: Christian Stenger --- tests/system/suite_editors/tst_generic_highlighter/test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/system/suite_editors/tst_generic_highlighter/test.py b/tests/system/suite_editors/tst_generic_highlighter/test.py index 2e822a966f9..ea6c7aee406 100644 --- a/tests/system/suite_editors/tst_generic_highlighter/test.py +++ b/tests/system/suite_editors/tst_generic_highlighter/test.py @@ -99,10 +99,12 @@ def addHighlighterDefinition(*languages): "text='Generic Highlighter'}") clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Generic Highlighter") + test.log("Trying to download definitions...") clickButton("{text='Download Definitions' type='QPushButton' unnamed='1' visible='1'}") updateStatus = "{name='updateStatus' type='QLabel' visible='1'}" waitFor("object.exists(updateStatus)", 5000) - if waitFor('str(findObject(updateStatus).text) == "Download finished"', 5000): + if waitFor('str(findObject(updateStatus).text) == "Download finished"', 20000): + test.log("Received definitions") test.verify(os.path.exists(syntaxDirectory), "Directory for syntax highlighter files exists.") xmlFiles = glob.glob(os.path.join(syntaxDirectory, "*.xml")) From ee4fc5b801ecf1862f8695782e745822b2456766 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Thu, 6 Apr 2023 15:04:05 +0200 Subject: [PATCH 35/36] macOS: Allow debugging Qt Creator Fixes: QTCREATORBUG-29010 Change-Id: I349d2dcd383613661c1faad3104f211d6c6ce028 Reviewed-by: Reviewed-by: Eike Ziller --- dist/installer/mac/entitlements.plist | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dist/installer/mac/entitlements.plist b/dist/installer/mac/entitlements.plist index 8500f2f703f..dadc6bff87e 100644 --- a/dist/installer/mac/entitlements.plist +++ b/dist/installer/mac/entitlements.plist @@ -15,5 +15,8 @@ com.apple.security.cs.allow-dyld-environment-variables + + com.apple.security.get-task-allow + From 02f2a93503a24d2da3b93db2cbfe8463627cf990 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 13 Apr 2023 12:55:37 +0200 Subject: [PATCH 36/36] ClangCodeModel: Let clangd handle cuda sources Fixes: QTCREATORBUG-28984 Change-Id: I7fbf5a671ff6f1d1ecd928d9be1f619dc32563a9 Reviewed-by: David Schulz --- src/plugins/clangcodemodel/clangdclient.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/clangcodemodel/clangdclient.cpp b/src/plugins/clangcodemodel/clangdclient.cpp index 9fa2e792ab6..53a5b967aa0 100644 --- a/src/plugins/clangcodemodel/clangdclient.cpp +++ b/src/plugins/clangcodemodel/clangdclient.cpp @@ -364,8 +364,10 @@ ClangdClient::ClangdClient(Project *project, const Utils::FilePath &jsonDbDir, c { setName(Tr::tr("clangd")); LanguageFilter langFilter; - langFilter.mimeTypes = QStringList{"text/x-chdr", "text/x-csrc", - "text/x-c++hdr", "text/x-c++src", "text/x-objc++src", "text/x-objcsrc"}; + using namespace CppEditor::Constants; + langFilter.mimeTypes = QStringList{C_HEADER_MIMETYPE, C_SOURCE_MIMETYPE, + CPP_HEADER_MIMETYPE, CPP_SOURCE_MIMETYPE, OBJECTIVE_CPP_SOURCE_MIMETYPE, + OBJECTIVE_C_SOURCE_MIMETYPE, CUDA_SOURCE_MIMETYPE}; setSupportedLanguage(langFilter); setActivateDocumentAutomatically(true); setCompletionAssistProvider(new ClangdCompletionAssistProvider(this));