Merge remote-tracking branch 'origin/9.0'

Change-Id: Ie24672b00aae6c0afa5931d87e6e1c24fb841161
This commit is contained in:
Eike Ziller
2022-11-07 12:59:28 +01:00
30 changed files with 39478 additions and 29718 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -28,9 +28,12 @@ MimeType mimeTypeForFile(const QString &fileName, MimeMatchMode mode)
MimeType mimeTypeForFile(const FilePath &filePath, MimeMatchMode mode) MimeType mimeTypeForFile(const FilePath &filePath, MimeMatchMode mode)
{ {
MimeDatabase mdb; MimeDatabase mdb;
if (filePath.needsDevice()) if (filePath.needsDevice() && mode != MimeMatchMode::MatchDefaultAndRemote)
return mdb.mimeTypeForUrl(filePath.toUrl()); return mdb.mimeTypeForUrl(filePath.toUrl());
return mdb.mimeTypeForFile(filePath.toString(), MimeDatabase::MatchMode(mode)); if (mode == MimeMatchMode::MatchDefaultAndRemote) {
mode = MimeMatchMode::MatchDefault;
}
return mdb.mimeTypeForFile(filePath.toFSPathString(), MimeDatabase::MatchMode(mode));
} }
QList<MimeType> mimeTypesForFileName(const QString &fileName) QList<MimeType> mimeTypesForFileName(const QString &fileName)

View File

@@ -15,7 +15,12 @@ class FilePath;
// Wrapped QMimeDataBase functions // Wrapped QMimeDataBase functions
QTCREATOR_UTILS_EXPORT MimeType mimeTypeForName(const QString &nameOrAlias); QTCREATOR_UTILS_EXPORT MimeType mimeTypeForName(const QString &nameOrAlias);
enum class MimeMatchMode { MatchDefault = 0x0, MatchExtension = 0x1, MatchContent = 0x2 }; enum class MimeMatchMode {
MatchDefault = 0x0,
MatchExtension = 0x1,
MatchContent = 0x2,
MatchDefaultAndRemote = 0x3
};
QTCREATOR_UTILS_EXPORT MimeType mimeTypeForFile(const QString &fileName, QTCREATOR_UTILS_EXPORT MimeType mimeTypeForFile(const QString &fileName,
MimeMatchMode mode = MimeMatchMode::MatchDefault); MimeMatchMode mode = MimeMatchMode::MatchDefault);

View File

@@ -39,7 +39,11 @@ void adjustFormatStyleForLineBreak(clang::format::FormatStyle &style,
// This is a separate pass, don't do it unless it's the full formatting. // This is a separate pass, don't do it unless it's the full formatting.
style.FixNamespaceComments = false; style.FixNamespaceComments = false;
#if LLVM_VERSION_MAJOR >= 16
style.AlignTrailingComments = {clang::format::FormatStyle::TCAS_Never, 0};
#else
style.AlignTrailingComments = false; style.AlignTrailingComments = false;
#endif
if (replacementsToKeep == ReplacementsToKeep::IndentAndBefore) if (replacementsToKeep == ReplacementsToKeep::IndentAndBefore)
return; return;

View File

@@ -49,7 +49,11 @@ clang::format::FormatStyle qtcStyle()
#else #else
style.AlignOperands = true; style.AlignOperands = true;
#endif #endif
#if LLVM_VERSION_MAJOR >= 16
style.AlignTrailingComments = {FormatStyle::TCAS_Always, 0};
#else
style.AlignTrailingComments = true; style.AlignTrailingComments = true;
#endif
style.AllowAllParametersOfDeclarationOnNextLine = true; style.AllowAllParametersOfDeclarationOnNextLine = true;
#if LLVM_VERSION_MAJOR >= 10 #if LLVM_VERSION_MAJOR >= 10
style.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Never; style.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Never;

View File

@@ -739,7 +739,8 @@ bool EditorManagerPrivate::skipOpeningBigTextFile(const FilePath &filePath)
if (!filePath.exists()) if (!filePath.exists())
return false; return false;
const MimeType mimeType = Utils::mimeTypeForFile(filePath); const MimeType mimeType = Utils::mimeTypeForFile(filePath,
MimeMatchMode::MatchDefaultAndRemote);
if (!mimeType.inherits("text/plain")) if (!mimeType.inherits("text/plain"))
return false; return false;

View File

@@ -166,7 +166,8 @@ const EditorTypeList EditorType::defaultEditorTypes(const MimeType &mimeType)
const EditorTypeList EditorType::preferredEditorTypes(const FilePath &filePath) const EditorTypeList EditorType::preferredEditorTypes(const FilePath &filePath)
{ {
// default factories by mime type // default factories by mime type
const Utils::MimeType mimeType = Utils::mimeTypeForFile(filePath); const Utils::MimeType mimeType = Utils::mimeTypeForFile(filePath,
MimeMatchMode::MatchDefaultAndRemote);
EditorTypeList factories = defaultEditorTypes(mimeType); EditorTypeList factories = defaultEditorTypes(mimeType);
// user preferred factory to front // user preferred factory to front
EditorType *userPreferred = Internal::userPreferredEditorTypes().value(mimeType); EditorType *userPreferred = Internal::userPreferredEditorTypes().value(mimeType);

View File

@@ -175,7 +175,9 @@ QList<IWizardFactory*> IWizardFactory::allWizardFactories()
QHash<Id, IWizardFactory *> sanityCheck; QHash<Id, IWizardFactory *> sanityCheck;
for (const FactoryCreator &fc : std::as_const(s_factoryCreators)) { for (const FactoryCreator &fc : std::as_const(s_factoryCreators)) {
IWizardFactory *newFactory = fc(); IWizardFactory *newFactory = fc();
QTC_ASSERT(newFactory, continue); // skip factories referencing wizard page generators provided by plugins not loaded
if (!newFactory)
continue;
IWizardFactory *existingFactory = sanityCheck.value(newFactory->id()); IWizardFactory *existingFactory = sanityCheck.value(newFactory->id());
QTC_ASSERT(existingFactory != newFactory, continue); QTC_ASSERT(existingFactory != newFactory, continue);

View File

@@ -949,7 +949,8 @@ void MainWindow::openFile()
static IDocumentFactory *findDocumentFactory(const QList<IDocumentFactory*> &fileFactories, static IDocumentFactory *findDocumentFactory(const QList<IDocumentFactory*> &fileFactories,
const FilePath &filePath) const FilePath &filePath)
{ {
const QString typeName = Utils::mimeTypeForFile(filePath).name(); const QString typeName = Utils::mimeTypeForFile(filePath, MimeMatchMode::MatchDefaultAndRemote)
.name();
return Utils::findOrDefault(fileFactories, [typeName](IDocumentFactory *f) { return Utils::findOrDefault(fileFactories, [typeName](IDocumentFactory *f) {
return f->mimeTypes().contains(typeName); return f->mimeTypes().contains(typeName);
}); });

View File

@@ -16,6 +16,7 @@
#include <QGuiApplication> #include <QGuiApplication>
#include <QScrollBar> #include <QScrollBar>
#include <QTimer> #include <QTimer>
#include <QToolTip>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QWheelEvent> #include <QWheelEvent>
@@ -100,6 +101,11 @@ LiteHtmlHelpViewer::LiteHtmlHelpViewer(QWidget *parent)
&QLiteHtmlWidget::contextMenuRequested, &QLiteHtmlWidget::contextMenuRequested,
this, this,
&LiteHtmlHelpViewer::showContextMenu); &LiteHtmlHelpViewer::showContextMenu);
connect(m_viewer, &QLiteHtmlWidget::linkHighlighted, this, [this](const QUrl &url) {
m_highlightedLink = url;
if (!url.isValid())
QToolTip::hideText();
});
auto layout = new QVBoxLayout; auto layout = new QVBoxLayout;
setLayout(layout); setLayout(layout);
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
@@ -284,6 +290,12 @@ bool LiteHtmlHelpViewer::eventFilter(QObject *src, QEvent *e)
goForward(1); goForward(1);
return true; return true;
} }
} else if (e->type() == QEvent::ToolTip) {
auto he = static_cast<QHelpEvent *>(e);
if (m_highlightedLink.isValid())
QToolTip::showText(he->globalPos(),
m_highlightedLink.toDisplayString(),
m_viewer->viewport());
} }
return HelpViewer::eventFilter(src, e); return HelpViewer::eventFilter(src, e);
} }

View File

@@ -4,11 +4,11 @@
#pragma once #pragma once
#include "helpviewer.h" #include "helpviewer.h"
#include "openpagesmanager.h"
#include <qlitehtmlwidget.h> #include <qlitehtmlwidget.h>
#include <QTextBrowser> #include <QTextBrowser>
#include <QUrl>
#include <optional> #include <optional>
@@ -68,6 +68,7 @@ private:
QLiteHtmlWidget *m_viewer; QLiteHtmlWidget *m_viewer;
std::vector<HistoryItem> m_backItems; std::vector<HistoryItem> m_backItems;
std::vector<HistoryItem> m_forwardItems; std::vector<HistoryItem> m_forwardItems;
QUrl m_highlightedLink;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -593,6 +593,11 @@ void updatePathsInExistingKits(const SettingsHandler::Ptr &settingsHandler)
for (const auto &target : std::as_const(repo.mcuTargets)) { for (const auto &target : std::as_const(repo.mcuTargets)) {
if (target->isValid()) { if (target->isValid()) {
for (auto *kit : kitsWithMismatchedDependencies(target.get())) { for (auto *kit : kitsWithMismatchedDependencies(target.get())) {
if (kitQulVersion(kit) != target->qulVersion()) {
//Do not update kits made for other Qt for MCUs SDK versions
continue;
}
auto changes = cMakeConfigToMap(CMakeConfigurationKitAspect::configuration(kit)); auto changes = cMakeConfigToMap(CMakeConfigurationKitAspect::configuration(kit));
const auto updateForPackage = [&changes](const McuPackagePtr &package) { const auto updateForPackage = [&changes](const McuPackagePtr &package) {

View File

@@ -30,23 +30,45 @@ using namespace Utils;
namespace McuSupport::Internal { namespace McuSupport::Internal {
static const Utils::FilePath expandWildcards(const Utils::FilePath& path) // Utils::FileFilter do not support globbing with "*" placed in the middle of the path,
// since it is required for paths such as "Microsoft Visual Studio/2019/*/VC/Tools/MSVC/*/bin/Hostx64/x64"
// The filter is applied for each time a wildcard character is found in a path component.
// Returns a pair of the longest path if multiple ones exists and the number of components that were not found.
static const std::pair<Utils::FilePath, int> expandWildcards(
const FilePath path, const QList<QStringView> patternComponents)
{ {
if (!path.fileName().contains("*") && !path.fileName().contains("?")) // Only absolute paths are currently supported
return path; // Call FilePath::cleanPath on the path before calling this function
if (!path.exists() || path.isRelativePath())
return {path, patternComponents.size()};
const FilePath p = path.parentDir(); // All components are found
if (patternComponents.empty())
return {path, patternComponents.size()};
auto entries = p.dirEntries( const QString currentComponent = patternComponents.front().toString();
Utils::FileFilter({path.fileName()}, QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot)); FilePath currentPath = path / currentComponent;
if (entries.isEmpty()) if (!currentComponent.contains("*") && !currentComponent.contains("?") && currentPath.exists())
return path; return expandWildcards(path / currentComponent,
{patternComponents.constBegin() + 1, patternComponents.constEnd()});
auto entries = path.dirEntries(
Utils::FileFilter({currentComponent}, QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot));
std::pair<FilePath, int> retPair = {path, patternComponents.size()};
// Return the last match (can correspond to the latest version)
sort(entries, [](const FilePath &a, const FilePath &b) { return a.fileName() < b.fileName(); }); sort(entries, [](const FilePath &a, const FilePath &b) { return a.fileName() < b.fileName(); });
for (const auto &entry : entries) {
auto [entry_path, remaining_components] = expandWildcards(entry,
{patternComponents.constBegin()
+ 1,
patternComponents.constEnd()});
if (remaining_components <= retPair.second)
retPair = {entry_path, remaining_components};
}
return entries.last(); return retPair;
} }
Macros *McuSdkRepository::globalMacros() Macros *McuSdkRepository::globalMacros()
@@ -60,7 +82,32 @@ void McuSdkRepository::expandVariablesAndWildcards()
for (const auto &target : std::as_const(mcuTargets)) { for (const auto &target : std::as_const(mcuTargets)) {
auto macroExpander = getMacroExpander(*target); auto macroExpander = getMacroExpander(*target);
for (const auto &package : target->packages()) { for (const auto &package : target->packages()) {
package->setPath(expandWildcards(macroExpander->expand(package->path()))); // Expand variables
const auto path = macroExpander->expand(package->path());
//expand wildcards
// Ignore expanding if no wildcards are found
if (!path.path().contains("*") && !path.path().contains("?")) {
package->setPath(path);
continue;
}
QStringList pathComponents = path.cleanPath().path().split("/");
// Path components example on linux: {"", "home", "username"}
// Path components example on windows: {"C:", "Users", "username"}
// 2 for empty_split_entry(linux)|root(windows) + at least one component
if (pathComponents.size() < 2) {
package->setPath(path);
continue;
}
// drop empty_split_entry(linux)|root(windows)
pathComponents.pop_front();
package->setPath(
expandWildcards(FilePath::fromString(QDir::rootPath()),
{pathComponents.constBegin(), pathComponents.constEnd()})
.first);
} }
} }
} }

View File

@@ -362,15 +362,15 @@ McuPackagePtr createStm32CubeProgrammerPackage(const SettingsHandler::Ptr &setti
FilePath defaultPath; FilePath defaultPath;
const QString cubePath = "STMicroelectronics/STM32Cube/STM32CubeProgrammer"; const QString cubePath = "STMicroelectronics/STM32Cube/STM32CubeProgrammer";
if (HostOsInfo::isWindowsHost()) if (HostOsInfo::isWindowsHost())
defaultPath = findInProgramFiles(cubePath) / "bin"; defaultPath = findInProgramFiles(cubePath);
else else
defaultPath = FileUtils::homePath() / cubePath / "bin"; defaultPath = FileUtils::homePath() / cubePath;
if (!defaultPath.exists()) if (!defaultPath.exists())
FilePath defaultPath = {}; FilePath defaultPath = {};
const FilePath detectionPath = FilePath::fromUserInput( const FilePath detectionPath = FilePath::fromUserInput(
QLatin1String(Utils::HostOsInfo::isWindowsHost() ? "STM32_Programmer_CLI.exe" QLatin1String(Utils::HostOsInfo::isWindowsHost() ? "bin/STM32_Programmer_CLI.exe"
: "STM32_Programmer.sh")); : "bin/STM32_Programmer.sh"));
return McuPackagePtr{ return McuPackagePtr{
new McuPackage(settingsHandler, new McuPackage(settingsHandler,

View File

@@ -20,12 +20,12 @@ constexpr auto armgcc_stm32f469i_discovery_baremetal_json = R"(
"type": "path", "type": "path",
"setting": "Stm32CubeProgrammer", "setting": "Stm32CubeProgrammer",
"defaultValue": { "defaultValue": {
"windows": "%{Env:PROGRAMFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin", "windows": "%{Env:PROGRAMFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/",
"linux": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin" "linux": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/"
}, },
"detectionPath": { "detectionPath": {
"windows": "STM32_Programmer_CLI.exe", "windows": "bin/STM32_Programmer_CLI.exe",
"linux": "STM32_Programmer.sh" "linux": "bin/STM32_Programmer.sh"
}, },
"optional": false, "optional": false,
"addToSystemPath": true "addToSystemPath": true

View File

@@ -20,12 +20,12 @@ constexpr auto armgcc_stm32f769i_discovery_baremetal_json = R"(
"type": "path", "type": "path",
"setting": "Stm32CubeProgrammer", "setting": "Stm32CubeProgrammer",
"defaultValue": { "defaultValue": {
"windows": "%{Env:PROGRAMFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin", "windows": "%{Env:PROGRAMFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/",
"linux": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin" "linux": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/"
}, },
"detectionPath": { "detectionPath": {
"windows": "STM32_Programmer_CLI.exe", "windows": "bin/STM32_Programmer_CLI.exe",
"linux": "STM32_Programmer.sh" "linux": "bin/STM32_Programmer.sh"
}, },
"optional": false, "optional": false,
"addToSystemPath": true "addToSystemPath": true

View File

@@ -20,12 +20,12 @@ constexpr auto armgcc_stm32f769i_discovery_freertos_json = R"(
"type": "path", "type": "path",
"setting": "Stm32CubeProgrammer", "setting": "Stm32CubeProgrammer",
"defaultValue": { "defaultValue": {
"windows": "%{Env:PROGRAMFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin", "windows": "%{Env:PROGRAMFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/",
"linux": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin" "linux": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/"
}, },
"detectionPath": { "detectionPath": {
"windows": "STM32_Programmer_CLI.exe", "windows": "bin/STM32_Programmer_CLI.exe",
"linux": "STM32_Programmer.sh" "linux": "bin/STM32_Programmer.sh"
}, },
"optional": false, "optional": false,
"addToSystemPath": true "addToSystemPath": true

View File

@@ -20,12 +20,12 @@ constexpr auto armgcc_stm32h750b_discovery_baremetal_json = R"(
"type": "path", "type": "path",
"setting": "Stm32CubeProgrammer", "setting": "Stm32CubeProgrammer",
"defaultValue": { "defaultValue": {
"windows": "%{Env:PROGRAMFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin", "windows": "%{Env:PROGRAMFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/",
"linux": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin" "linux": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/"
}, },
"detectionPath": { "detectionPath": {
"windows": "STM32_Programmer_CLI.exe", "windows": "bin/STM32_Programmer_CLI.exe",
"linux": "STM32_Programmer.sh" "linux": "bin/STM32_Programmer.sh"
}, },
"optional": false, "optional": false,
"addToSystemPath": true "addToSystemPath": true

View File

@@ -20,12 +20,12 @@ constexpr auto iar_stm32f469i_discovery_baremetal_json = R"(
"type": "path", "type": "path",
"setting": "Stm32CubeProgrammer", "setting": "Stm32CubeProgrammer",
"defaultValue": { "defaultValue": {
"windows": "%{Env:PROGRAMFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin", "windows": "%{Env:PROGRAMFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/",
"linux": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin" "linux": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/"
}, },
"detectionPath": { "detectionPath": {
"windows": "STM32_Programmer_CLI.exe", "windows": "bin/STM32_Programmer_CLI.exe",
"linux": "STM32_Programmer.sh" "linux": "bin/STM32_Programmer.sh"
}, },
"optional": false, "optional": false,
"addToSystemPath": true "addToSystemPath": true

View File

@@ -20,12 +20,12 @@ constexpr auto iar_stm32f769i_discovery_baremetal_json = R"(
"type": "path", "type": "path",
"setting": "Stm32CubeProgrammer", "setting": "Stm32CubeProgrammer",
"defaultValue": { "defaultValue": {
"windows": "%{Env:PROGRAMFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin", "windows": "%{Env:PROGRAMFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/",
"linux": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin" "linux": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/"
}, },
"detectionPath": { "detectionPath": {
"windows": "STM32_Programmer_CLI.exe", "windows": "bin/STM32_Programmer_CLI.exe",
"linux": "STM32_Programmer.sh" "linux": "bin/STM32_Programmer.sh"
}, },
"optional": false, "optional": false,
"addToSystemPath": true "addToSystemPath": true

View File

@@ -20,12 +20,12 @@ constexpr auto iar_stm32f769i_discovery_freertos_json = R"(
"type": "path", "type": "path",
"setting": "Stm32CubeProgrammer", "setting": "Stm32CubeProgrammer",
"defaultValue": { "defaultValue": {
"windows": "%{Env:PROGRAMFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin", "windows": "%{Env:PROGRAMFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/",
"linux": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin" "linux": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/"
}, },
"detectionPath": { "detectionPath": {
"windows": "STM32_Programmer_CLI.exe", "windows": "bin/STM32_Programmer_CLI.exe",
"linux": "STM32_Programmer.sh" "linux": "bin/STM32_Programmer.sh"
}, },
"optional": false, "optional": false,
"addToSystemPath": true "addToSystemPath": true

View File

@@ -20,12 +20,12 @@ constexpr auto iar_stm32h750b_discovery_baremetal_json = R"(
"type": "path", "type": "path",
"setting": "Stm32CubeProgrammer", "setting": "Stm32CubeProgrammer",
"defaultValue": { "defaultValue": {
"windows": "%{Env:PROGRAMFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin", "windows": "%{Env:PROGRAMFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/",
"linux": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin" "linux": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/"
}, },
"detectionPath": { "detectionPath": {
"windows": "STM32_Programmer_CLI.exe", "windows": "bin/STM32_Programmer_CLI.exe",
"linux": "STM32_Programmer.sh" "linux": "bin/STM32_Programmer.sh"
}, },
"optional": false, "optional": false,
"addToSystemPath": true "addToSystemPath": true

View File

@@ -141,10 +141,10 @@ const QString xpressoIdeDetectionPath{
const char stmCubeProgrammerSetting[]{"Stm32CubeProgrammer"}; const char stmCubeProgrammerSetting[]{"Stm32CubeProgrammer"};
const char stmCubeProgrammerLabel[]{"STM32CubeProgrammer"}; const char stmCubeProgrammerLabel[]{"STM32CubeProgrammer"};
const QString stmCubeProgrammerPath{QString{defaultToolPath} + "/bin"}; const QString stmCubeProgrammerPath{defaultToolPath};
const QString stmCubeProgrammerDetectionPath{HostOsInfo::isWindowsHost() const QString stmCubeProgrammerDetectionPath{HostOsInfo::isWindowsHost()
? QString("STM32_Programmer_CLI.exe") ? QString("bin/STM32_Programmer_CLI.exe")
: QString("STM32_Programmer.sh")}; : QString("bin/STM32_Programmer.sh")};
const char renesasProgrammerSetting[]{"RenesasFlashProgrammer"}; const char renesasProgrammerSetting[]{"RenesasFlashProgrammer"};
const char renesasProgrammerCmakeVar[]{"RENESAS_FLASH_PROGRAMMER_PATH"}; const char renesasProgrammerCmakeVar[]{"RENESAS_FLASH_PROGRAMMER_PATH"};
@@ -1703,31 +1703,43 @@ void McuSupportTest::test_addToSystemPathFlag()
void McuSupportTest::test_processWildcards_data() void McuSupportTest::test_processWildcards_data()
{ {
QTest::addColumn<QString>("package_label"); QTest::addColumn<QString>("package_label");
QTest::addColumn<QString>("path"); QTest::addColumn<QString>("expected_path");
QTest::addColumn<bool>("isFile"); QTest::addColumn<QStringList>("paths");
QTest::newRow("\"*\" at the end") << "FAKE_WILDCARD_TEST_1" QTest::newRow("wildcard_at_the_end") << "FAKE_WILDCARD_TEST_1" << "folder-123" << QStringList {"folder-123/" };
<< "folder-123" << false; QTest::newRow("wildcard_in_th_middle") << "FAKE_WILDCARD_TEST_2" << "file-123.exe" << QStringList {"file-123.exe"};
QTest::newRow("\"*\" in the middle") << "FAKE_WILDCARD_TEST_2" QTest::newRow("wildcard_at_the_end") << "FAKE_WILDCARD_TEST_3" << "123-file.exe" << QStringList( "123-file.exe");
<< "file-123.exe" << true; QTest::newRow("multi_wildcards")
QTest::newRow("\"*\" at the start") << "FAKE_WILDCARD_TEST_3" << "FAKE_WILDCARD_TEST_MULTI"
<< "123-file.exe" << true; << "2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64"
<< QStringList{
"2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/",
"2019/Alpha/Beta/Gamma/",
"2019/Community/VC/Tools/MSVC/",
"2019/Community/VC/Tools/MSVC/14.29.30133/bin/",
"2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/",
"2019/Enterprise/VC/Tools/MSVC/",
};
} }
void McuSupportTest::test_processWildcards() void McuSupportTest::test_processWildcards()
{ {
QFETCH(QString, package_label); QFETCH(QString, package_label);
QFETCH(QString, path); QFETCH(QString, expected_path);
QFETCH(bool, isFile); QFETCH(QStringList, paths);
QVERIFY(createFakePath(testing_output_dir / "wildcards" / path, isFile)); for (const auto &path : paths)
QVERIFY(createFakePath(testing_output_dir / "wildcards" / path, !path.endsWith("/")));
auto [targets, packages] = createTestingKitTargetsAndPackages(wildcards_test_kit); auto [targets, packages] = createTestingKitTargetsAndPackages(wildcards_test_kit);
auto testWildcardsPackage = findOrDefault(packages, [&](const McuPackagePtr &pkg) { auto testWildcardsPackage = findOrDefault(packages, [&](const McuPackagePtr &pkg) {
return (pkg->label() == package_label); return (pkg->label() == package_label);
}); });
QVERIFY(testWildcardsPackage != nullptr); QVERIFY(testWildcardsPackage != nullptr);
QCOMPARE(testWildcardsPackage->path().toString(), FilePath(testing_output_dir / "wildcards" / path).toString()); QVERIFY(paths.size() > 0);
// FilePaths with "/" at the end and without it evaluate to different paths.
QCOMPARE(testWildcardsPackage->path(),
FilePath(testing_output_dir / "wildcards" / expected_path));
} }
void McuSupportTest::test_nonemptyVersionDetector() void McuSupportTest::test_nonemptyVersionDetector()

View File

@@ -34,6 +34,13 @@ constexpr auto wildcards_test_kit = R"(
"defaultValue": "%{MCU_TESTING_FOLDER}/wildcards/*-file.exe", "defaultValue": "%{MCU_TESTING_FOLDER}/wildcards/*-file.exe",
"envVar": "", "envVar": "",
"type": "path" "type": "path"
},
{
"label": "FAKE_WILDCARD_TEST_MULTI",
"description": "Assert '*' is replaced by possible values",
"defaultValue": "%{MCU_TESTING_FOLDER}/wildcards/2019/*/VC/Tools/MSVC/*/bin/Hostx64/x64",
"envVar": "",
"type": "path"
} }
] ]
}, },

View File

@@ -732,7 +732,7 @@ Core::IDocument::OpenResult TextDocument::open(QString *errorString,
emit aboutToOpen(filePath, realFilePath); emit aboutToOpen(filePath, realFilePath);
OpenResult success = openImpl(errorString, filePath, realFilePath, /*reload =*/ false); OpenResult success = openImpl(errorString, filePath, realFilePath, /*reload =*/ false);
if (success == OpenResult::Success) { if (success == OpenResult::Success) {
setMimeType(Utils::mimeTypeForFile(filePath).name()); setMimeType(Utils::mimeTypeForFile(filePath, MimeMatchMode::MatchDefaultAndRemote).name());
emit openFinishedSuccessfully(); emit openFinishedSuccessfully();
} }
return success; return success;

View File

@@ -3343,7 +3343,9 @@ void TextEditorWidgetPrivate::updateFileLineEndingVisible()
void TextEditorWidgetPrivate::reconfigure() void TextEditorWidgetPrivate::reconfigure()
{ {
m_document->setMimeType(Utils::mimeTypeForFile(m_document->filePath()).name()); m_document->setMimeType(
Utils::mimeTypeForFile(m_document->filePath(),
MimeMatchMode::MatchDefaultAndRemote).name());
q->configureGenericHighlighter(); q->configureGenericHighlighter();
} }

View File

@@ -14,6 +14,7 @@
:*Qt Creator_Utils::FilterLineEdit {type='Utils::FancyLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator_Utils::FilterLineEdit {type='Utils::FancyLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:*Qt Creator_Utils::IconButton {occurrence='4' type='Utils::IconButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator_Utils::IconButton {occurrence='4' type='Utils::IconButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:About Qt Creator_Core::Internal::VersionDialog {type='Core::Internal::VersionDialog' unnamed='1' visible='1' windowTitle='About Qt Creator'} :About Qt Creator_Core::Internal::VersionDialog {type='Core::Internal::VersionDialog' unnamed='1' visible='1' windowTitle='About Qt Creator'}
:Activate completion:_QComboBox {buddy=':Behavior.Activate completion:_QLabel' type='QComboBox' unnamed='1' visible='1'}
:Add Bookmark.ExpandBookmarksList_QToolButton {text='+' type='QToolButton' unnamed='1' visible='1' window=':Add Bookmark_BookmarkDialog'} :Add Bookmark.ExpandBookmarksList_QToolButton {text='+' type='QToolButton' unnamed='1' visible='1' window=':Add Bookmark_BookmarkDialog'}
:Add Bookmark.New Folder_QPushButton {text='New Folder' type='QPushButton' unnamed='1' visible='1' window=':Add Bookmark_BookmarkDialog'} :Add Bookmark.New Folder_QPushButton {text='New Folder' type='QPushButton' unnamed='1' visible='1' window=':Add Bookmark_BookmarkDialog'}
:Add Bookmark.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Add Bookmark_BookmarkDialog'} :Add Bookmark.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Add Bookmark_BookmarkDialog'}
@@ -26,8 +27,8 @@
:Analyzer Toolbar.Clear_QToolButton {container=':DebugModeWidget.Toolbar_QDockWidget' toolTip='Discard data' type='QToolButton' unnamed='1' visible='1'} :Analyzer Toolbar.Clear_QToolButton {container=':DebugModeWidget.Toolbar_QDockWidget' toolTip='Discard data' type='QToolButton' unnamed='1' visible='1'}
:Analyzer Toolbar.Elapsed:_QLabel {container=':DebugModeWidget.Toolbar_QDockWidget' text~='Elapsed: \\\\d+.\\\\d s' type='QLabel' unnamed='1' visible='1'} :Analyzer Toolbar.Elapsed:_QLabel {container=':DebugModeWidget.Toolbar_QDockWidget' text~='Elapsed: \\\\d+.\\\\d s' type='QLabel' unnamed='1' visible='1'}
:Analyzer Toolbar.Start_QToolButton {container=':DebugModeWidget.Toolbar_QDockWidget' text='Start' type='QToolButton' unnamed='1' visible='1'} :Analyzer Toolbar.Start_QToolButton {container=':DebugModeWidget.Toolbar_QDockWidget' text='Start' type='QToolButton' unnamed='1' visible='1'}
:Behavior.Autocomplete common prefix_QCheckBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' name='partiallyComplete' text='Autocomplete common prefix' type='QCheckBox' visible='1'} :Behavior.Activate completion:_QLabel {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' text='Activate completion:' type='QLabel' unnamed='1' visible='1'}
:Behavior.completionTrigger_QComboBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' name='completionTrigger' type='QComboBox' visible='1'} :Behavior.Autocomplete common prefix_QCheckBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' text='Autocomplete common prefix' type='QCheckBox' unnamed='1' visible='1'}
:Breakpoints_Debugger::Internal::BreakTreeView {container=':Debugger.Docks.BreakDockWidget.Debugger.Docks.Break_QFrame' type='Utils::BaseTreeView' unnamed='1' visible='1'} :Breakpoints_Debugger::Internal::BreakTreeView {container=':Debugger.Docks.BreakDockWidget.Debugger.Docks.Break_QFrame' type='Utils::BaseTreeView' unnamed='1' visible='1'}
:Build and Run.Save all files before build_QCheckBox {container=':Build and Run_QGroupBox' text='Save all files before build' type='QCheckBox' unnamed='1' visible='1'} :Build and Run.Save all files before build_QCheckBox {container=':Build and Run_QGroupBox' text='Save all files before build' type='QCheckBox' unnamed='1' visible='1'}
:Build and Run_QGroupBox {container=':qt_tabwidget_stackedwidget_QScrollArea' name='Build and Run' type='QGroupBox' visible='1'} :Build and Run_QGroupBox {container=':qt_tabwidget_stackedwidget_QScrollArea' name='Build and Run' type='QGroupBox' visible='1'}
@@ -43,7 +44,7 @@
:Core__Internal__GeneralSettings.User Interface_QGroupBox {container=':qt_tabwidget_stackedwidget.Core__Internal__GeneralSettings_QWidget' name='interfaceBox' title='User Interface' type='QGroupBox' visible='1'} :Core__Internal__GeneralSettings.User Interface_QGroupBox {container=':qt_tabwidget_stackedwidget.Core__Internal__GeneralSettings_QWidget' name='interfaceBox' title='User Interface' type='QGroupBox' visible='1'}
:CppCompiler:_QComboBox {container=':qt_tabwidget_stackedwidget_QWidget' leftWidget=':CppCompiler:_QLabel' type='QComboBox' unnamed='1' visible='1'} :CppCompiler:_QComboBox {container=':qt_tabwidget_stackedwidget_QWidget' leftWidget=':CppCompiler:_QLabel' type='QComboBox' unnamed='1' visible='1'}
:CppCompiler:_QLabel {container=':qt_tabwidget_stackedwidget_QWidget' text='C++:' type='QLabel' unnamed='1' visible='1'} :CppCompiler:_QLabel {container=':qt_tabwidget_stackedwidget_QWidget' text='C++:' type='QLabel' unnamed='1' visible='1'}
:CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox {container=':qt_tabwidget_stackedwidget_QScrollArea' name='groupBox' title='Behavior' type='QGroupBox' visible='1'} :CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox {container=':qt_tabwidget_stackedwidget_QScrollArea' name='Behavior' type='QGroupBox' visible='1'}
:DebugModeWidget.Debugger Log_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='GlobalLogDockWidget' type='QDockWidget' visible='1'} :DebugModeWidget.Debugger Log_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='GlobalLogDockWidget' type='QDockWidget' visible='1'}
:DebugModeWidget.Debugger.Docks.BreakDockWidget_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.BreakpointManagerDockWidget' type='QDockWidget' visible='1'} :DebugModeWidget.Debugger.Docks.BreakDockWidget_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.BreakpointManagerDockWidget' type='QDockWidget' visible='1'}
:DebugModeWidget.Debugger.Docks.LocalsAndInspectorDockWidget_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name~='Debugger\\\\.Dock\\\\.LocalsAndInspector\\\\.\\\\d+DockWidget' type='QDockWidget' visible='1'} :DebugModeWidget.Debugger.Docks.LocalsAndInspectorDockWidget_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name~='Debugger\\\\.Dock\\\\.LocalsAndInspector\\\\.\\\\d+DockWidget' type='QDockWidget' visible='1'}

View File

@@ -44,7 +44,7 @@ def changeAutocompleteToManual(toManual=True):
activateCompletion = "Always" activateCompletion = "Always"
if toManual: if toManual:
activateCompletion = "Manually" activateCompletion = "Manually"
selectFromCombo(":Behavior.completionTrigger_QComboBox", activateCompletion) selectFromCombo(":Activate completion:_QComboBox", activateCompletion)
verifyEnabled(":Options.OK_QPushButton") verifyEnabled(":Options.OK_QPushButton")
clickButton(waitForObject(":Options.OK_QPushButton")) clickButton(waitForObject(":Options.OK_QPushButton"))

View File

@@ -53,6 +53,6 @@ def main():
type(editorWidget, "<Ctrl+Shift+u>") type(editorWidget, "<Ctrl+Shift+u>")
# wait until search finished and verify search results # wait until search finished and verify search results
waitForSearchResults() waitForSearchResults()
validateSearchResult(5 if JIRA.isBugStillOpen(2863) else 3) validateSearchResult(3 if useClang else 5)
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
waitForCleanShutdown() waitForCleanShutdown()