diff --git a/dist/changelog/changes-12.0.0.md b/dist/changelog/changes-12.0.0.md index 3d8608f2da9..84110f0ad81 100644 --- a/dist/changelog/changes-12.0.0.md +++ b/dist/changelog/changes-12.0.0.md @@ -371,6 +371,7 @@ Credits for these changes go to: -------------------------------- Aleksei German Alessandro Portale +Alexandre Laurent Ali Kianian Amr Essam Andre Hartmann @@ -393,6 +394,7 @@ Johanna Vanhatapio Johnny Jazeix Jonas Karlsson Jussi Witick +Karim Abdelrahman Knud Dollereder Leena Miettinen Ludovic Le Brun @@ -402,6 +404,7 @@ Marcus Tillmanns Mats Honkamaa Mehdi Salem Miikka Heikkinen +Mike Chen Olivier De Cannière Olivier Delaune Orgad Shaneh diff --git a/src/libs/3rdparty/cplusplus/Lexer.cpp b/src/libs/3rdparty/cplusplus/Lexer.cpp index deafe432b6a..92cfc5d6ecf 100644 --- a/src/libs/3rdparty/cplusplus/Lexer.cpp +++ b/src/libs/3rdparty/cplusplus/Lexer.cpp @@ -838,16 +838,16 @@ void Lexer::scanRawStringLiteral(Token *tok, unsigned char hint) bool Lexer::scanUntilRawStringLiteralEndPrecise() { - int matchLen = 0; + QByteArray slidingWindow; + slidingWindow.reserve(_expectedRawStringSuffix.size()); while (_yychar) { - if (_yychar == _expectedRawStringSuffix.at(matchLen)) { - if (++matchLen == _expectedRawStringSuffix.length()) { - _expectedRawStringSuffix.clear(); - yyinp(); - return true; - } - } else { - matchLen = 0; + slidingWindow.append(_yychar); + if (slidingWindow.size() > _expectedRawStringSuffix.size()) + slidingWindow.remove(0, 1); + if (slidingWindow == _expectedRawStringSuffix) { + _expectedRawStringSuffix.clear(); + yyinp(); + return true; } yyinp(); } diff --git a/src/plugins/android/avdmanageroutputparser.h b/src/plugins/android/avdmanageroutputparser.h index ac65fce02bb..b3a74f8fc8e 100644 --- a/src/plugins/android/avdmanageroutputparser.h +++ b/src/plugins/android/avdmanageroutputparser.h @@ -1,6 +1,8 @@ // Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +#pragma once + #include "androiddeviceinfo.h" namespace Android { diff --git a/src/plugins/cmakeprojectmanager/projecttreehelper.h b/src/plugins/cmakeprojectmanager/projecttreehelper.h index aa655492d4a..08707360ed4 100644 --- a/src/plugins/cmakeprojectmanager/projecttreehelper.h +++ b/src/plugins/cmakeprojectmanager/projecttreehelper.h @@ -1,6 +1,8 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +#pragma once + #include "cmakeprojectnodes.h" #include diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp index f562d9afece..142b2b296c9 100644 --- a/src/plugins/cppeditor/cpphighlighter.cpp +++ b/src/plugins/cppeditor/cpphighlighter.cpp @@ -590,6 +590,12 @@ void CppHighlighterTest::test_data() << 38 << 18 << 39 << 3 << C_STRING; QTest::newRow("multi-line user-defined UTF-16 string literal (suffix)") << 39 << 4 << 39 << 5 << C_OPERATOR; + QTest::newRow("multi-line raw string literal with consecutive closing parens (prefix)") + << 48 << 18 << 48 << 20 << C_KEYWORD; + QTest::newRow("multi-line raw string literal with consecutive closing parens (content)") + << 49 << 1 << 49 << 1 << C_STRING; + QTest::newRow("multi-line raw string literal with consecutive closing parens (suffix)") + << 49 << 2 << 49 << 3 << C_KEYWORD; } void CppHighlighterTest::test() diff --git a/src/plugins/cppeditor/cpptoolsreuse.cpp b/src/plugins/cppeditor/cpptoolsreuse.cpp index 26627b6c66a..c8ab16c3228 100644 --- a/src/plugins/cppeditor/cpptoolsreuse.cpp +++ b/src/plugins/cppeditor/cpptoolsreuse.cpp @@ -79,12 +79,12 @@ static int skipChars(QTextCursor *tc, return count; } -static int skipCharsForward(QTextCursor *tc, std::function skip) +static int skipCharsForward(QTextCursor *tc, const std::function &skip) { return skipChars(tc, QTextCursor::NextCharacter, 0, skip); } -static int skipCharsBackward(QTextCursor *tc, std::function skip) +static int skipCharsBackward(QTextCursor *tc, const std::function &skip) { return skipChars(tc, QTextCursor::PreviousCharacter, -1, skip); } diff --git a/src/plugins/cppeditor/testcases/highlightingtestcase.cpp b/src/plugins/cppeditor/testcases/highlightingtestcase.cpp index d1ec061aa29..a9102ce4578 100644 --- a/src/plugins/cppeditor/testcases/highlightingtestcase.cpp +++ b/src/plugins/cppeditor/testcases/highlightingtestcase.cpp @@ -44,3 +44,6 @@ static void parenTest() /* comment */ \ } while (false); } + +const char* s7 = R"( +))"; diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index d797586d793..a12c8cec40d 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -481,7 +481,8 @@ void DebuggerRunTool::start() runControl()->setDisplayName(m_runParameters.displayName); - m_engine = createDapEngine(runControl()->runMode()); + if (!m_engine) + m_engine = createDapEngine(runControl()->runMode()); if (!m_engine) { if (m_runParameters.isCppDebugging()) { diff --git a/src/plugins/mcusupport/mcukitmanager.cpp b/src/plugins/mcusupport/mcukitmanager.cpp index 39e13f80892..2cc2311e693 100644 --- a/src/plugins/mcusupport/mcukitmanager.cpp +++ b/src/plugins/mcusupport/mcukitmanager.cpp @@ -30,6 +30,7 @@ #include +#include #include #include #include @@ -430,11 +431,17 @@ bool kitIsUpToDate(const Kit *kit, QList existingKits(const McuTarget *mcuTarget) { using namespace Constants; + // some models have compatible name changes that refere to the same supported board across versions. + // name changes are tracked here to recognize the corresponding kits as upgradable. + static QMap upgradable_to = { + {"MIMXRT1170-EVK-FREERTOS", {"MIMXRT1170-EVKB-FREERTOS"}}}; return Utils::filtered(KitManager::kits(), [mcuTarget](Kit *kit) { return kit->value(KIT_MCUTARGET_KITVERSION_KEY) == KIT_VERSION && (!mcuTarget || (kit->value(KIT_MCUTARGET_VENDOR_KEY) == mcuTarget->platform().vendor - && kit->value(KIT_MCUTARGET_MODEL_KEY) == mcuTarget->platform().name + && (kit->value(KIT_MCUTARGET_MODEL_KEY) == mcuTarget->platform().name + || upgradable_to[kit->value(KIT_MCUTARGET_MODEL_KEY).toString()].contains( + mcuTarget->platform().name)) && kit->value(KIT_MCUTARGET_COLORDEPTH_KEY) == mcuTarget->colorDepth() && kit->value(KIT_MCUTARGET_OS_KEY).toInt() == static_cast(mcuTarget->os()) @@ -590,6 +597,9 @@ void upgradeKitsByCreatingNewPackage(const SettingsHandler::Ptr &settingsHandler if (upgradeOption == UpgradeOption::Replace) { for (auto existingKit : kits) KitManager::deregisterKit(existingKit); + // Reset cached values that are not valid after an update + // Exp: a board sdk version that was dropped in newer releases + target->resetInvalidPathsToDefault(); } if (target->isValid()) diff --git a/src/plugins/mcusupport/mcusupport.qrc b/src/plugins/mcusupport/mcusupport.qrc index f6e5c151332..dc64ac1ca2f 100644 --- a/src/plugins/mcusupport/mcusupport.qrc +++ b/src/plugins/mcusupport/mcusupport.qrc @@ -13,8 +13,8 @@ wizards/qmlproject/DejaVuSansMono.ttf wizards/qmlproject/LICENSE wizards/qmlproject/translation.nb_NO.ts - wizards/qmlproject/translation.en_US.ts wizards/qmlproject/BackendObject.h + wizards/qmlproject/main_big.qml.tpl wizards/qmlproject/main.qml.tpl wizards/qmlproject/project.qmlproject.tpl wizards/qmlproject/module.qmlproject.tpl diff --git a/src/plugins/mcusupport/mcutarget.cpp b/src/plugins/mcusupport/mcutarget.cpp index d7a3b0fe397..faef32b61ba 100644 --- a/src/plugins/mcusupport/mcutarget.cpp +++ b/src/plugins/mcusupport/mcutarget.cpp @@ -113,6 +113,19 @@ void McuTarget::handlePackageProblems(MessagesList &messages) const } } +void McuTarget::resetInvalidPathsToDefault() +{ + + for (McuPackagePtr package : std::as_const(m_packages)) { + if (!package) + continue; + if (package->isValidStatus()) + continue; + package->setPath(package->defaultPath()); + package->writeToSettings(); + } +} + QVersionNumber McuTarget::qulVersion() const { return m_qulVersion; diff --git a/src/plugins/mcusupport/mcutarget.h b/src/plugins/mcusupport/mcutarget.h index 8ee19f54ab0..ce715c8c6f7 100644 --- a/src/plugins/mcusupport/mcutarget.h +++ b/src/plugins/mcusupport/mcutarget.h @@ -56,6 +56,12 @@ public: QString desktopCompilerId() const; void handlePackageProblems(MessagesList &messages) const; + // Used when updating to new version of QtMCUs + // Paths that is not valid in the new version, + // and were valid in the old version. have the possibility be valid if + // reset to the default value without user intervention + void resetInvalidPathsToDefault(); + private: const QVersionNumber m_qulVersion; const Platform m_platform; diff --git a/src/plugins/mcusupport/wizards/qmlproject-empty/project.qmlproject.tpl b/src/plugins/mcusupport/wizards/qmlproject-empty/project.qmlproject.tpl index ead4e315a36..ab85861a5ec 100644 --- a/src/plugins/mcusupport/wizards/qmlproject-empty/project.qmlproject.tpl +++ b/src/plugins/mcusupport/wizards/qmlproject-empty/project.qmlproject.tpl @@ -5,7 +5,6 @@ Project { // importPaths: [] // Alternative API to ModuleFiles for importing modules. // projectRootPath: "." // Optional root path relative to qmlproject file path. mainFile: "%{MainQmlFile}" // The application's entrypoint - idBasedTranslations: true // Use qsTrId() instead of qsTr() MCU.Config { controlsStyle: "QtQuick.Controls.StyleDefault" diff --git a/src/plugins/mcusupport/wizards/qmlproject/main.qml.tpl b/src/plugins/mcusupport/wizards/qmlproject/main.qml.tpl index 5097435e099..44f4788740c 100644 --- a/src/plugins/mcusupport/wizards/qmlproject/main.qml.tpl +++ b/src/plugins/mcusupport/wizards/qmlproject/main.qml.tpl @@ -16,10 +16,9 @@ Rectangle { CustomButton { anchors.centerIn: parent - text: qsTrId("hello-world") + text: qsTr("Hello world!") onClicked: BackendObject.toggle() } BackendObject.onCustomPropertyChanged: Qt.uiLanguage = BackendObject.customProperty ? "en_US" : "nb_NO" - Component.onCompleted: Qt.uiLanguage = "en_US" } diff --git a/src/plugins/mcusupport/wizards/qmlproject/main_big.qml.tpl b/src/plugins/mcusupport/wizards/qmlproject/main_big.qml.tpl new file mode 100644 index 00000000000..60f77144499 --- /dev/null +++ b/src/plugins/mcusupport/wizards/qmlproject/main_big.qml.tpl @@ -0,0 +1,30 @@ +import QtQuick 2.0 +import CustomModule + +Rectangle { + // Component.onCompleted: Qt.uiLanguage = "nb_NO" // Uncomment to change the UI language //TODO: Is this the "official" method of setting ui language? + + Row { + visible: CustomObject.customProperty + Image { + anchors.centerIn: parent + id: icon + source: "assets/icon.png" + } + Text { + anchors.centerIn: parent + font.pixelSize: 28 + id: title + text: " for MCUs" + } + } + + CustomComponent { + anchors.centerIn: parent + } + + MouseArea { + anchors.fill: parent + onClicked: CustomObject.toggle() + } +} diff --git a/src/plugins/mcusupport/wizards/qmlproject/project.qmlproject.tpl b/src/plugins/mcusupport/wizards/qmlproject/project.qmlproject.tpl index 113cd1f07a7..0c879ccfb0d 100644 --- a/src/plugins/mcusupport/wizards/qmlproject/project.qmlproject.tpl +++ b/src/plugins/mcusupport/wizards/qmlproject/project.qmlproject.tpl @@ -5,7 +5,6 @@ Project { // importPaths: ["imports/CustomModule"] // Alternative API for importing modules. // projectRootPath: "." // Optional root path relative to qmlproject file path. mainFile: "%{MainQmlFile}" // The application's entrypoint - idBasedTranslations: true // Use qsTrId() instead of qsTr() /* Global configuration */ MCU.Config { @@ -89,11 +88,8 @@ Project { /* Translations */ TranslationFiles { - files: [ - "translations/%{TsFileEn}", - "translations/%{TsFileNo}" - ] - MCU.omitSourceLanguage: true + files: ["translations/%{TsFile}"] + MCU.omitSourceLanguage: false } FontFiles { diff --git a/src/plugins/mcusupport/wizards/qmlproject/translation.en_US.ts b/src/plugins/mcusupport/wizards/qmlproject/translation.en_US.ts deleted file mode 100644 index f4f94ed311c..00000000000 --- a/src/plugins/mcusupport/wizards/qmlproject/translation.en_US.ts +++ /dev/null @@ -1,10 +0,0 @@ - - - - - %{CorrectedProjectName} - - Hello world! - - - diff --git a/src/plugins/mcusupport/wizards/qmlproject/translation.nb_NO.ts b/src/plugins/mcusupport/wizards/qmlproject/translation.nb_NO.ts index 10bdd92d377..2cd70a44edd 100644 --- a/src/plugins/mcusupport/wizards/qmlproject/translation.nb_NO.ts +++ b/src/plugins/mcusupport/wizards/qmlproject/translation.nb_NO.ts @@ -3,7 +3,9 @@ %{CorrectedProjectName} - + + + Hello world! Hallo verden! diff --git a/src/plugins/mcusupport/wizards/qmlproject/wizard.json b/src/plugins/mcusupport/wizards/qmlproject/wizard.json index 8375cfb212b..4a5f582d432 100644 --- a/src/plugins/mcusupport/wizards/qmlproject/wizard.json +++ b/src/plugins/mcusupport/wizards/qmlproject/wizard.json @@ -21,8 +21,7 @@ { "key": "ModuleFile", "value": "CustomModule.qmlproject"}, { "key": "QmlComponent", "value": "CustomButton.qml"}, { "key": "InterfaceFile", "value": "BackendObject.h"}, - { "key": "TsFileEn", "value": "%{CorrectedProjectName}.en_US.ts"}, - { "key": "TsFileNo", "value": "%{CorrectedProjectName}.nb_NO.ts"} + { "key": "TsFile", "value": "%{CorrectedProjectName}.nb_NO.ts"} ], "pages": @@ -104,12 +103,7 @@ }, { "source": "translation.nb_NO.ts", - "target": "%{QmlProjectDirectory}/translations/%{TsFileNo}", - "openInEditor": false - }, - { - "source": "translation.en_US.ts", - "target": "%{QmlProjectDirectory}/translations/%{TsFileEn}", + "target": "%{QmlProjectDirectory}/translations/%{TsFile}", "openInEditor": false }, { diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp index b7207ce45ef..17fc1e736c0 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp @@ -11,6 +11,7 @@ #include "../projectexplorertr.h" #include "../projecttree.h" +#include #include #include #include @@ -351,6 +352,14 @@ void JsonWizard::accept() return; } + const QList documentsToClose + = transform(m_files, [](const GeneratorFile &file) -> Core::IDocument * { + if ((file.file.attributes() & Core::GeneratedFile::OpenEditorAttribute) == 0) + return nullptr; + return Core::DocumentModel::documentForFilePath(file.file.filePath()); + }); + Core::EditorManager::closeDocuments(documentsToClose, /*askAboutModifiedEditors=*/false); + emit preWriteFiles(m_files); if (!JsonWizardGenerator::writeFiles(this, &m_files, &errorMessage)) { if (!errorMessage.isEmpty()) diff --git a/src/plugins/python/pyside.cpp b/src/plugins/python/pyside.cpp index a17ae89dca8..b2483c7cac6 100644 --- a/src/plugins/python/pyside.cpp +++ b/src/plugins/python/pyside.cpp @@ -89,8 +89,8 @@ void PySideInstaller::installPyside(const FilePath &python, const Utils::QtcSettings *settings = Core::ICore::settings(QSettings::SystemScope); const FilePaths requirementsList - = Utils::transform(settings->value("Python/PySideWheelsRequirements").toList(), - &FilePath::fromSettings); + = Utils::transform(settings->value("Python/PySideWheelsRequirements").toStringList(), + &FilePath::fromString); for (const FilePath &requirements : requirementsList) { if (requirements.exists()) { auto version = QVersionNumber::fromString(requirements.parentDir().fileName()); diff --git a/src/plugins/python/pythonwizardpage.h b/src/plugins/python/pythonwizardpage.h index 6cf8a130c59..9691e767524 100644 --- a/src/plugins/python/pythonwizardpage.h +++ b/src/plugins/python/pythonwizardpage.h @@ -1,6 +1,8 @@ // Copyright (C) 2022 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 #include diff --git a/src/plugins/silversearcher/silversearcherparser_test.h b/src/plugins/silversearcher/silversearcherparser_test.h index 6d85cd21981..4278fb95159 100644 --- a/src/plugins/silversearcher/silversearcherparser_test.h +++ b/src/plugins/silversearcher/silversearcherparser_test.h @@ -1,6 +1,8 @@ // Copyright (C) 2017 Przemyslaw Gorszkowski . // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +#pragma once + #include namespace SilverSearcher { diff --git a/src/tools/buildoutputparser/outputprocessor.h b/src/tools/buildoutputparser/outputprocessor.h index 4a34a5203e5..d0ca1616fb8 100644 --- a/src/tools/buildoutputparser/outputprocessor.h +++ b/src/tools/buildoutputparser/outputprocessor.h @@ -1,6 +1,8 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +#pragma once + #include QT_BEGIN_NAMESPACE