Merge remote-tracking branch 'origin/12.0'

Change-Id: I7971dd83798e975d4e10b77a352c9d7ef7b14ec0
This commit is contained in:
Eike Ziller
2023-11-23 10:43:00 +01:00
24 changed files with 115 additions and 44 deletions

View File

@@ -371,6 +371,7 @@ Credits for these changes go to:
-------------------------------- --------------------------------
Aleksei German Aleksei German
Alessandro Portale Alessandro Portale
Alexandre Laurent
Ali Kianian Ali Kianian
Amr Essam Amr Essam
Andre Hartmann Andre Hartmann
@@ -393,6 +394,7 @@ Johanna Vanhatapio
Johnny Jazeix Johnny Jazeix
Jonas Karlsson Jonas Karlsson
Jussi Witick Jussi Witick
Karim Abdelrahman
Knud Dollereder Knud Dollereder
Leena Miettinen Leena Miettinen
Ludovic Le Brun Ludovic Le Brun
@@ -402,6 +404,7 @@ Marcus Tillmanns
Mats Honkamaa Mats Honkamaa
Mehdi Salem Mehdi Salem
Miikka Heikkinen Miikka Heikkinen
Mike Chen
Olivier De Cannière Olivier De Cannière
Olivier Delaune Olivier Delaune
Orgad Shaneh Orgad Shaneh

View File

@@ -838,16 +838,16 @@ void Lexer::scanRawStringLiteral(Token *tok, unsigned char hint)
bool Lexer::scanUntilRawStringLiteralEndPrecise() bool Lexer::scanUntilRawStringLiteralEndPrecise()
{ {
int matchLen = 0; QByteArray slidingWindow;
slidingWindow.reserve(_expectedRawStringSuffix.size());
while (_yychar) { while (_yychar) {
if (_yychar == _expectedRawStringSuffix.at(matchLen)) { slidingWindow.append(_yychar);
if (++matchLen == _expectedRawStringSuffix.length()) { if (slidingWindow.size() > _expectedRawStringSuffix.size())
_expectedRawStringSuffix.clear(); slidingWindow.remove(0, 1);
yyinp(); if (slidingWindow == _expectedRawStringSuffix) {
return true; _expectedRawStringSuffix.clear();
} yyinp();
} else { return true;
matchLen = 0;
} }
yyinp(); yyinp();
} }

View File

@@ -1,6 +1,8 @@
// Copyright (C) 2021 The Qt Company Ltd. // Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include "androiddeviceinfo.h" #include "androiddeviceinfo.h"
namespace Android { namespace Android {

View File

@@ -1,6 +1,8 @@
// Copyright (C) 2016 The Qt Company Ltd. // Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include "cmakeprojectnodes.h" #include "cmakeprojectnodes.h"
#include <utils/filepath.h> #include <utils/filepath.h>

View File

@@ -590,6 +590,12 @@ void CppHighlighterTest::test_data()
<< 38 << 18 << 39 << 3 << C_STRING; << 38 << 18 << 39 << 3 << C_STRING;
QTest::newRow("multi-line user-defined UTF-16 string literal (suffix)") QTest::newRow("multi-line user-defined UTF-16 string literal (suffix)")
<< 39 << 4 << 39 << 5 << C_OPERATOR; << 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() void CppHighlighterTest::test()

View File

@@ -79,12 +79,12 @@ static int skipChars(QTextCursor *tc,
return count; return count;
} }
static int skipCharsForward(QTextCursor *tc, std::function<bool(const QChar &)> skip) static int skipCharsForward(QTextCursor *tc, const std::function<bool(const QChar &)> &skip)
{ {
return skipChars(tc, QTextCursor::NextCharacter, 0, skip); return skipChars(tc, QTextCursor::NextCharacter, 0, skip);
} }
static int skipCharsBackward(QTextCursor *tc, std::function<bool(const QChar &)> skip) static int skipCharsBackward(QTextCursor *tc, const std::function<bool(const QChar &)> &skip)
{ {
return skipChars(tc, QTextCursor::PreviousCharacter, -1, skip); return skipChars(tc, QTextCursor::PreviousCharacter, -1, skip);
} }

View File

@@ -44,3 +44,6 @@ static void parenTest()
/* comment */ \ /* comment */ \
} while (false); } while (false);
} }
const char* s7 = R"(
))";

View File

@@ -481,7 +481,8 @@ void DebuggerRunTool::start()
runControl()->setDisplayName(m_runParameters.displayName); runControl()->setDisplayName(m_runParameters.displayName);
m_engine = createDapEngine(runControl()->runMode()); if (!m_engine)
m_engine = createDapEngine(runControl()->runMode());
if (!m_engine) { if (!m_engine) {
if (m_runParameters.isCppDebugging()) { if (m_runParameters.isCppDebugging()) {

View File

@@ -30,6 +30,7 @@
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <QCoreApplication>
#include <QMessageBox> #include <QMessageBox>
#include <QPushButton> #include <QPushButton>
#include <QRegularExpression> #include <QRegularExpression>
@@ -430,11 +431,17 @@ bool kitIsUpToDate(const Kit *kit,
QList<Kit *> existingKits(const McuTarget *mcuTarget) QList<Kit *> existingKits(const McuTarget *mcuTarget)
{ {
using namespace Constants; 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<QString, QStringList> upgradable_to = {
{"MIMXRT1170-EVK-FREERTOS", {"MIMXRT1170-EVKB-FREERTOS"}}};
return Utils::filtered(KitManager::kits(), [mcuTarget](Kit *kit) { return Utils::filtered(KitManager::kits(), [mcuTarget](Kit *kit) {
return kit->value(KIT_MCUTARGET_KITVERSION_KEY) == KIT_VERSION return kit->value(KIT_MCUTARGET_KITVERSION_KEY) == KIT_VERSION
&& (!mcuTarget && (!mcuTarget
|| (kit->value(KIT_MCUTARGET_VENDOR_KEY) == mcuTarget->platform().vendor || (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_COLORDEPTH_KEY) == mcuTarget->colorDepth()
&& kit->value(KIT_MCUTARGET_OS_KEY).toInt() && kit->value(KIT_MCUTARGET_OS_KEY).toInt()
== static_cast<int>(mcuTarget->os()) == static_cast<int>(mcuTarget->os())
@@ -590,6 +597,9 @@ void upgradeKitsByCreatingNewPackage(const SettingsHandler::Ptr &settingsHandler
if (upgradeOption == UpgradeOption::Replace) { if (upgradeOption == UpgradeOption::Replace) {
for (auto existingKit : kits) for (auto existingKit : kits)
KitManager::deregisterKit(existingKit); 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()) if (target->isValid())

View File

@@ -13,8 +13,8 @@
<file>wizards/qmlproject/DejaVuSansMono.ttf</file> <file>wizards/qmlproject/DejaVuSansMono.ttf</file>
<file>wizards/qmlproject/LICENSE</file> <file>wizards/qmlproject/LICENSE</file>
<file>wizards/qmlproject/translation.nb_NO.ts</file> <file>wizards/qmlproject/translation.nb_NO.ts</file>
<file>wizards/qmlproject/translation.en_US.ts</file>
<file>wizards/qmlproject/BackendObject.h</file> <file>wizards/qmlproject/BackendObject.h</file>
<file>wizards/qmlproject/main_big.qml.tpl</file>
<file>wizards/qmlproject/main.qml.tpl</file> <file>wizards/qmlproject/main.qml.tpl</file>
<file>wizards/qmlproject/project.qmlproject.tpl</file> <file>wizards/qmlproject/project.qmlproject.tpl</file>
<file>wizards/qmlproject/module.qmlproject.tpl</file> <file>wizards/qmlproject/module.qmlproject.tpl</file>

View File

@@ -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 QVersionNumber McuTarget::qulVersion() const
{ {
return m_qulVersion; return m_qulVersion;

View File

@@ -56,6 +56,12 @@ public:
QString desktopCompilerId() const; QString desktopCompilerId() const;
void handlePackageProblems(MessagesList &messages) 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: private:
const QVersionNumber m_qulVersion; const QVersionNumber m_qulVersion;
const Platform m_platform; const Platform m_platform;

View File

@@ -5,7 +5,6 @@ Project {
// importPaths: [] // Alternative API to ModuleFiles for importing modules. // importPaths: [] // Alternative API to ModuleFiles for importing modules.
// projectRootPath: "." // Optional root path relative to qmlproject file path. // projectRootPath: "." // Optional root path relative to qmlproject file path.
mainFile: "%{MainQmlFile}" // The application's entrypoint mainFile: "%{MainQmlFile}" // The application's entrypoint
idBasedTranslations: true // Use qsTrId() instead of qsTr()
MCU.Config { MCU.Config {
controlsStyle: "QtQuick.Controls.StyleDefault" controlsStyle: "QtQuick.Controls.StyleDefault"

View File

@@ -16,10 +16,9 @@ Rectangle {
CustomButton { CustomButton {
anchors.centerIn: parent anchors.centerIn: parent
text: qsTrId("hello-world") text: qsTr("Hello world!")
onClicked: BackendObject.toggle() onClicked: BackendObject.toggle()
} }
BackendObject.onCustomPropertyChanged: Qt.uiLanguage = BackendObject.customProperty ? "en_US" : "nb_NO" BackendObject.onCustomPropertyChanged: Qt.uiLanguage = BackendObject.customProperty ? "en_US" : "nb_NO"
Component.onCompleted: Qt.uiLanguage = "en_US"
} }

View File

@@ -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()
}
}

View File

@@ -5,7 +5,6 @@ Project {
// importPaths: ["imports/CustomModule"] // Alternative API for importing modules. // importPaths: ["imports/CustomModule"] // Alternative API for importing modules.
// projectRootPath: "." // Optional root path relative to qmlproject file path. // projectRootPath: "." // Optional root path relative to qmlproject file path.
mainFile: "%{MainQmlFile}" // The application's entrypoint mainFile: "%{MainQmlFile}" // The application's entrypoint
idBasedTranslations: true // Use qsTrId() instead of qsTr()
/* Global configuration */ /* Global configuration */
MCU.Config { MCU.Config {
@@ -89,11 +88,8 @@ Project {
/* Translations */ /* Translations */
TranslationFiles { TranslationFiles {
files: [ files: ["translations/%{TsFile}"]
"translations/%{TsFileEn}", MCU.omitSourceLanguage: false
"translations/%{TsFileNo}"
]
MCU.omitSourceLanguage: true
} }
FontFiles { FontFiles {

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
<context>
<name>%{CorrectedProjectName}</name>
<message id="hello-world">
<translation>Hello world!</translation>
</message>
</context>
</TS>

View File

@@ -3,7 +3,9 @@
<TS version="2.1" language="nb_NO"> <TS version="2.1" language="nb_NO">
<context> <context>
<name>%{CorrectedProjectName}</name> <name>%{CorrectedProjectName}</name>
<message id="hello-world"> <message>
<location filename="../%{MainQmlFile}" line="37"/>
<source>Hello world!</source>
<translation>Hallo verden!</translation> <translation>Hallo verden!</translation>
</message> </message>
</context> </context>

View File

@@ -21,8 +21,7 @@
{ "key": "ModuleFile", "value": "CustomModule.qmlproject"}, { "key": "ModuleFile", "value": "CustomModule.qmlproject"},
{ "key": "QmlComponent", "value": "CustomButton.qml"}, { "key": "QmlComponent", "value": "CustomButton.qml"},
{ "key": "InterfaceFile", "value": "BackendObject.h"}, { "key": "InterfaceFile", "value": "BackendObject.h"},
{ "key": "TsFileEn", "value": "%{CorrectedProjectName}.en_US.ts"}, { "key": "TsFile", "value": "%{CorrectedProjectName}.nb_NO.ts"}
{ "key": "TsFileNo", "value": "%{CorrectedProjectName}.nb_NO.ts"}
], ],
"pages": "pages":
@@ -104,12 +103,7 @@
}, },
{ {
"source": "translation.nb_NO.ts", "source": "translation.nb_NO.ts",
"target": "%{QmlProjectDirectory}/translations/%{TsFileNo}", "target": "%{QmlProjectDirectory}/translations/%{TsFile}",
"openInEditor": false
},
{
"source": "translation.en_US.ts",
"target": "%{QmlProjectDirectory}/translations/%{TsFileEn}",
"openInEditor": false "openInEditor": false
}, },
{ {

View File

@@ -11,6 +11,7 @@
#include "../projectexplorertr.h" #include "../projectexplorertr.h"
#include "../projecttree.h" #include "../projecttree.h"
#include <coreplugin/editormanager/documentmodel.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h> #include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
@@ -351,6 +352,14 @@ void JsonWizard::accept()
return; return;
} }
const QList<Core::IDocument *> 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); emit preWriteFiles(m_files);
if (!JsonWizardGenerator::writeFiles(this, &m_files, &errorMessage)) { if (!JsonWizardGenerator::writeFiles(this, &m_files, &errorMessage)) {
if (!errorMessage.isEmpty()) if (!errorMessage.isEmpty())

View File

@@ -89,8 +89,8 @@ void PySideInstaller::installPyside(const FilePath &python,
const Utils::QtcSettings *settings = Core::ICore::settings(QSettings::SystemScope); const Utils::QtcSettings *settings = Core::ICore::settings(QSettings::SystemScope);
const FilePaths requirementsList const FilePaths requirementsList
= Utils::transform(settings->value("Python/PySideWheelsRequirements").toList(), = Utils::transform(settings->value("Python/PySideWheelsRequirements").toStringList(),
&FilePath::fromSettings); &FilePath::fromString);
for (const FilePath &requirements : requirementsList) { for (const FilePath &requirements : requirementsList) {
if (requirements.exists()) { if (requirements.exists()) {
auto version = QVersionNumber::fromString(requirements.parentDir().fileName()); auto version = QVersionNumber::fromString(requirements.parentDir().fileName());

View File

@@ -1,6 +1,8 @@
// Copyright (C) 2022 The Qt Company Ltd. // Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include <projectexplorer/jsonwizard/jsonwizard.h> #include <projectexplorer/jsonwizard/jsonwizard.h>
#include <projectexplorer/jsonwizard/jsonwizardpagefactory.h> #include <projectexplorer/jsonwizard/jsonwizardpagefactory.h>
#include <projectexplorer/runconfigurationaspects.h> #include <projectexplorer/runconfigurationaspects.h>

View File

@@ -1,6 +1,8 @@
// Copyright (C) 2017 Przemyslaw Gorszkowski <pgorszkowski@gmail.com>. // Copyright (C) 2017 Przemyslaw Gorszkowski <pgorszkowski@gmail.com>.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include <QObject> #include <QObject>
namespace SilverSearcher { namespace SilverSearcher {

View File

@@ -1,6 +1,8 @@
// Copyright (C) 2016 The Qt Company Ltd. // Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include <QObject> #include <QObject>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE