From d47a72e26c1dab55289b50ca4d12cea4ad6260e0 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 18 Oct 2022 15:09:40 +0200 Subject: [PATCH 1/8] CMake: Use the OS of the source directory as ${hostSystemName} In case of building on a remote system CMake considers this remote system as host. Change-Id: Ifb9d0b2a2c4c49ba4ee009795f5b432c7b951e0d Reviewed-by: Cristian Adam --- .../cmakeprojectmanager/presetsmacros.cpp | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/presetsmacros.cpp b/src/plugins/cmakeprojectmanager/presetsmacros.cpp index 2623a0cfed1..37896bfb700 100644 --- a/src/plugins/cmakeprojectmanager/presetsmacros.cpp +++ b/src/plugins/cmakeprojectmanager/presetsmacros.cpp @@ -10,10 +10,8 @@ namespace CMakeProjectManager::Internal::CMakePresets::Macros { -QString getHostSystemName() +static QString getHostSystemName(Utils::OsType osType) { - Utils::OsType osType = Utils::HostOsInfo::hostOs(); - switch (osType) { case Utils::OsTypeWindows: return "Windows"; @@ -29,9 +27,9 @@ QString getHostSystemName() return "Other"; } -void expandAllButEnv(const PresetsDetails::ConfigurePreset &preset, - const Utils::FilePath &sourceDirectory, - QString &value) +static void expandAllButEnv(const PresetsDetails::ConfigurePreset &preset, + const Utils::FilePath &sourceDirectory, + QString &value) { value.replace("${dollar}", "$"); @@ -43,12 +41,12 @@ void expandAllButEnv(const PresetsDetails::ConfigurePreset &preset, if (preset.generator) value.replace("${generator}", preset.generator.value()); - value.replace("${hostSystemName}", getHostSystemName()); + value.replace("${hostSystemName}", getHostSystemName(sourceDirectory.osType())); } -void expandAllButEnv(const PresetsDetails::BuildPreset &preset, - const Utils::FilePath &sourceDirectory, - QString &value) +static void expandAllButEnv(const PresetsDetails::BuildPreset &preset, + const Utils::FilePath &sourceDirectory, + QString &value) { value.replace("${dollar}", "$"); @@ -59,9 +57,9 @@ void expandAllButEnv(const PresetsDetails::BuildPreset &preset, value.replace("${presetName}", preset.name); } -QString expandMacroEnv(const QString ¯oPrefix, - const QString &value, - const std::function &op) +static QString expandMacroEnv(const QString ¯oPrefix, + const QString &value, + const std::function &op) { const QString startToken = QString("$%1{").arg(macroPrefix); const QString endToken = QString("}"); From 54f7ebf001351f8b1d9fc0ea5153b7a789d82740 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 13 Oct 2022 13:03:01 +0200 Subject: [PATCH 2/8] Utils: Fix missing DetailsWidget outline On some systems, QPalette::Midlight can have the same color as the background color. So instead of using QPalette::Midlight on non-macOS, mix our own color with 15% text color intensity, to visually match what Qt Creator < 9.0 did. Change-Id: I40848b5e16344c07f42c20415194f893641d5f70 Reviewed-by: hjk --- src/libs/utils/detailsbutton.cpp | 16 +++++++++++----- src/libs/utils/detailsbutton.h | 1 + src/libs/utils/detailswidget.cpp | 7 ++----- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/libs/utils/detailsbutton.cpp b/src/libs/utils/detailsbutton.cpp index d5ab48238f8..32182d8ecf4 100644 --- a/src/libs/utils/detailsbutton.cpp +++ b/src/libs/utils/detailsbutton.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -81,6 +82,14 @@ QSize DetailsButton::sizeHint() const spacing + fontMetrics().height() + spacing); } +QColor DetailsButton::outlineColor() +{ + return HostOsInfo::isMacHost() + ? QGuiApplication::palette().color(QPalette::Mid) + : StyleHelper::mergedColors(creatorTheme()->color(Theme::TextColorNormal), + creatorTheme()->color(Theme::BackgroundColorNormal), 15); +} + void DetailsButton::paintEvent(QPaintEvent *e) { Q_UNUSED(e) @@ -93,11 +102,8 @@ void DetailsButton::paintEvent(QPaintEvent *e) p.restore(); } - if (!creatorTheme()->flag(Theme::FlatProjectsMode)) { - const QColor outlineColor = palette().color(HostOsInfo::isMacHost() ? QPalette::Mid - : QPalette::Midlight); - qDrawPlainRect(&p, rect(), outlineColor); - } + if (!creatorTheme()->flag(Theme::FlatProjectsMode)) + qDrawPlainRect(&p, rect(), outlineColor()); const QRect textRect(spacing + 3, 0, width(), height()); p.drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, text()); diff --git a/src/libs/utils/detailsbutton.h b/src/libs/utils/detailsbutton.h index 8895418f805..844c9e13c20 100644 --- a/src/libs/utils/detailsbutton.h +++ b/src/libs/utils/detailsbutton.h @@ -49,6 +49,7 @@ class QTCREATOR_UTILS_EXPORT DetailsButton : public ExpandButton public: DetailsButton(QWidget *parent = nullptr); QSize sizeHint() const override; + static QColor outlineColor(); private: void paintEvent(QPaintEvent *e) override; diff --git a/src/libs/utils/detailswidget.cpp b/src/libs/utils/detailswidget.cpp index e1ad8c19489..6b60bac0d87 100644 --- a/src/libs/utils/detailswidget.cpp +++ b/src/libs/utils/detailswidget.cpp @@ -227,11 +227,8 @@ void DetailsWidget::paintEvent(QPaintEvent *paintEvent) : palette().color(QPalette::Window); p.fillRect(rect(), bgColor); } - if (!creatorTheme()->flag(Theme::FlatProjectsMode)) { - const QColor outlineColor = palette().color(HostOsInfo::isMacHost() ? QPalette::Mid - : QPalette::Midlight); - qDrawPlainRect(&p, rect(), outlineColor); - } + if (!creatorTheme()->flag(Theme::FlatProjectsMode)) + qDrawPlainRect(&p, rect(), DetailsButton::outlineColor()); } void DetailsWidget::enterEvent(QEnterEvent *event) From 4266f612e6757c67e84564f87e78073f9cbab550 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 18 Oct 2022 14:38:29 +0200 Subject: [PATCH 3/8] Utils: Rename FilePath::relativePath() to relativePathFrom() Hopefully less confusion about the direction. Change-Id: I61727d6c4d19e0dfe46f24ff24f5d90f9835d05c Reviewed-by: Christian Kandeler --- src/libs/utils/filepath.cpp | 4 ++-- src/libs/utils/filepath.h | 2 +- src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp | 4 ++-- src/plugins/gitlab/gitlabclonedialog.cpp | 2 +- .../projectexplorer/jsonwizard/jsonwizardscannergenerator.cpp | 4 ++-- .../components/propertyeditor/propertyeditorvalue.cpp | 2 +- src/plugins/qmljstools/qmljsmodelmanager.cpp | 2 +- .../qmlprojectmanager/cmakegen/cmakegeneratordialog.cpp | 2 +- src/plugins/vcsbase/vcsbaseplugin.cpp | 4 ++-- tests/auto/utils/fileutils/tst_fileutils.cpp | 4 ++-- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/libs/utils/filepath.cpp b/src/libs/utils/filepath.cpp index d8123608cd8..d52bcdf9d42 100644 --- a/src/libs/utils/filepath.cpp +++ b/src/libs/utils/filepath.cpp @@ -966,7 +966,7 @@ FilePath FilePath::relativeChildPath(const FilePath &parent) const return res; } -/// \returns the relativePath of FilePath to given \a anchor. +/// \returns the relativePath of FilePath from a given \a anchor. /// Both, FilePath and anchor may be files or directories. /// Example usage: /// @@ -978,7 +978,7 @@ FilePath FilePath::relativeChildPath(const FilePath &parent) const /// /// The debug output will be "../b/ar/file.txt". /// -FilePath FilePath::relativePath(const FilePath &anchor) const +FilePath FilePath::relativePathFrom(const FilePath &anchor) const { QTC_ASSERT(isSameDevice(anchor), return *this); diff --git a/src/libs/utils/filepath.h b/src/libs/utils/filepath.h index 9bb65be2935..f7ba8631bcb 100644 --- a/src/libs/utils/filepath.h +++ b/src/libs/utils/filepath.h @@ -153,7 +153,7 @@ public: [[nodiscard]] FilePath resolveSymlinks() const; [[nodiscard]] FilePath withExecutableSuffix() const; [[nodiscard]] FilePath relativeChildPath(const FilePath &parent) const; - [[nodiscard]] FilePath relativePath(const FilePath &anchor) const; + [[nodiscard]] FilePath relativePathFrom(const FilePath &anchor) const; [[nodiscard]] FilePath searchInDirectories(const FilePaths &dirs) const; [[nodiscard]] Environment deviceEnvironment() const; [[nodiscard]] FilePath onDevice(const FilePath &deviceTemplate) const; diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index 7c3db2c7403..0cf89fd241a 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -67,7 +67,7 @@ static void copySourcePathsToClipboard(const FilePaths &srcPaths, const ProjectN QClipboard *clip = QGuiApplication::clipboard(); QString data = Utils::transform(srcPaths, [projDir = node->filePath()](const FilePath &path) { - return path.relativePath(projDir).cleanPath().toString(); + return path.relativePathFrom(projDir).cleanPath().toString(); }).join(" "); clip->setText(data); } @@ -301,7 +301,7 @@ FilePaths CMakeBuildSystem::filesGeneratedFrom(const FilePath &sourceFile) const baseDirectory = baseDirectory.parentDir(); } - const FilePath relativePath = baseDirectory.relativePath(project); + const FilePath relativePath = baseDirectory.relativePathFrom(project); FilePath generatedFilePath = buildConfiguration()->buildDirectory().resolvePath(relativePath); if (sourceFile.suffix() == "ui") { diff --git a/src/plugins/gitlab/gitlabclonedialog.cpp b/src/plugins/gitlab/gitlabclonedialog.cpp index 669a587c14e..7616e53fb47 100644 --- a/src/plugins/gitlab/gitlabclonedialog.cpp +++ b/src/plugins/gitlab/gitlabclonedialog.cpp @@ -221,7 +221,7 @@ void GitLabCloneDialog::cloneFinished(bool success) accept(); } else { const QStringList pFiles = Utils::transform(filesWeMayOpen, [base](const FilePath &f) { - return f.relativePath(base).toUserOutput(); + return f.relativePathFrom(base).toUserOutput(); }); bool ok = false; const QString fileToOpen diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardscannergenerator.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardscannergenerator.cpp index d0bf834fea4..2370e068783 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardscannergenerator.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardscannergenerator.cpp @@ -77,7 +77,7 @@ Core::GeneratedFiles JsonWizardScannerGenerator::fileList(Utils::MacroExpander * [](const Utils::FilePath &filePath) { return int(filePath.path().count('/')); }; int minDepth = std::numeric_limits::max(); for (auto it = result.begin(); it != result.end(); ++it) { - const Utils::FilePath relPath = it->filePath().relativePath(projectDir); + const Utils::FilePath relPath = it->filePath().relativePathFrom(projectDir); it->setBinary(binaryPattern.match(relPath.toString()).hasMatch()); bool found = ProjectManager::canOpenProjectForMimeType(Utils::mimeTypeForFile(relPath)); if (found) { @@ -119,7 +119,7 @@ Core::GeneratedFiles JsonWizardScannerGenerator::scan(const Utils::FilePath &dir const Utils::FilePaths entries = dir.dirEntries({{}, QDir::AllEntries | QDir::NoDotAndDotDot}, QDir::DirsLast | QDir::Name); for (const Utils::FilePath &fi : entries) { - const Utils::FilePath relativePath = fi.relativePath(base); + const Utils::FilePath relativePath = fi.relativePathFrom(base); if (fi.isDir() && matchesSubdirectoryPattern(relativePath)) { result += scan(fi, base); } else { diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp index be62ce4684c..37015295a05 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp @@ -515,7 +515,7 @@ void PropertyEditorValue::commitDrop(const QString &path) Utils::FilePath imagePath = Utils::FilePath::fromString(path); Utils::FilePath currFilePath = QmlDesigner::DocumentManager::currentFilePath(); QmlDesigner::VariantProperty srcProp = texture.variantProperty("source"); - srcProp.setValue(imagePath.relativePath(currFilePath).toUrl()); + srcProp.setValue(imagePath.relativePathFrom(currFilePath).toUrl()); // assign the texture to the property setExpressionWithEmit(texture.id()); diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 19fc3aa4a67..bbed26eb41a 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -113,7 +113,7 @@ ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfoForProject( auto addAppDir = [&baseDir, &projectInfo](const FilePath &mdir) { auto dir = mdir.cleanPath(); if (!baseDir.path().isEmpty()) { - auto rDir = dir.relativePath(baseDir); + auto rDir = dir.relativePathFrom(baseDir); // do not add directories outside the build directory // this might happen for example when we think an executable path belongs to // a bundle, and we need to remove extra directories, but that was not the case diff --git a/src/plugins/qmlprojectmanager/cmakegen/cmakegeneratordialog.cpp b/src/plugins/qmlprojectmanager/cmakegen/cmakegeneratordialog.cpp index 2b1b3382974..306133445f6 100644 --- a/src/plugins/qmlprojectmanager/cmakegen/cmakegeneratordialog.cpp +++ b/src/plugins/qmlprojectmanager/cmakegen/cmakegeneratordialog.cpp @@ -142,7 +142,7 @@ void CmakeGeneratorDialog::refreshNotificationText() continue; if (node->toFilePath().exists() && node->isChecked()) { - QString relativePath = node->toFilePath().relativePath(m_rootDir).toString(); + QString relativePath = node->toFilePath().relativePathFrom(m_rootDir).toString(); cursor.insertImage(iformat); cursor.insertText(QString(FILE_OVERWRITE_NOTIFICATION).arg(relativePath)); } diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp index 689de58428e..426ad149bda 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.cpp +++ b/src/plugins/vcsbase/vcsbaseplugin.cpp @@ -372,7 +372,7 @@ FilePath VcsBasePluginState::currentFileDirectory() const QString VcsBasePluginState::relativeCurrentFile() const { QTC_ASSERT(hasFile(), return {}); - return data->m_state.currentFile.relativePath(data->m_state.currentFileTopLevel).toString(); + return data->m_state.currentFile.relativePathFrom(data->m_state.currentFileTopLevel).toString(); } QString VcsBasePluginState::currentPatchFile() const @@ -405,7 +405,7 @@ QString VcsBasePluginState::relativeCurrentProject() const QTC_ASSERT(hasProject(), return QString()); if (data->m_state.currentProjectTopLevel == data->m_state.currentProjectPath) return {}; - return data->m_state.currentProjectPath.relativePath(data->m_state.currentProjectTopLevel).toString(); + return data->m_state.currentProjectPath.relativePathFrom(data->m_state.currentProjectTopLevel).toString(); } bool VcsBasePluginState::hasTopLevel() const diff --git a/tests/auto/utils/fileutils/tst_fileutils.cpp b/tests/auto/utils/fileutils/tst_fileutils.cpp index 4d600a68c2f..d4cd46965cf 100644 --- a/tests/auto/utils/fileutils/tst_fileutils.cpp +++ b/tests/auto/utils/fileutils/tst_fileutils.cpp @@ -294,7 +294,7 @@ void tst_fileutils::calcRelativePath() void tst_fileutils::relativePath_specials() { - QString path = FilePath("").relativePath("").toString(); + QString path = FilePath("").relativePathFrom("").toString(); QCOMPARE(path, ""); } @@ -320,7 +320,7 @@ void tst_fileutils::relativePath() QFETCH(QString, anchor); QFETCH(QString, result); FilePath actualPath = FilePath::fromString(rootPath + "/" + relative) - .relativePath(FilePath::fromString(rootPath + "/" + anchor)); + .relativePathFrom(FilePath::fromString(rootPath + "/" + anchor)); QCOMPARE(actualPath.toString(), result); } From f7a2132598e61ae2c4a547416ccf157ed6f6389d Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Mon, 17 Oct 2022 13:28:59 +0200 Subject: [PATCH 4/8] CMake: Don't filter out new keys Previously, if you have a filter set in the CMake Settings variable list, adding a new one would immediately hide it, as the text filter hides the "" key. This made it look like the adding failed. With this change, new Variables are always shown so they stay editable to user. Change-Id: I9c2eb7f9983b23e1cd3aa50f589142551caaf56f Reviewed-by: Cristian Adam --- src/libs/utils/categorysortfiltermodel.cpp | 20 +++++++++++++++++++ src/libs/utils/categorysortfiltermodel.h | 6 ++++++ .../cmakebuildconfiguration.cpp | 1 + .../cmakeprojectmanager/configmodel.cpp | 3 +++ src/plugins/cmakeprojectmanager/configmodel.h | 3 ++- 5 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/libs/utils/categorysortfiltermodel.cpp b/src/libs/utils/categorysortfiltermodel.cpp index 8d3b1899ffb..f3b5e8e6e02 100644 --- a/src/libs/utils/categorysortfiltermodel.cpp +++ b/src/libs/utils/categorysortfiltermodel.cpp @@ -12,6 +12,12 @@ CategorySortFilterModel::CategorySortFilterModel(QObject *parent) { } +void CategorySortFilterModel::setNewItemRole(int role) +{ + m_newItemRole = role; + invalidate(); +} + bool CategorySortFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { @@ -21,6 +27,12 @@ bool CategorySortFilterModel::filterAcceptsRow(int source_row, const QModelIndex &categoryIndex = sourceModel()->index(source_row, 0, source_parent); if (regexp.match(sourceModel()->data(categoryIndex, filterRole()).toString()).hasMatch()) return true; + + if (m_newItemRole != -1 && categoryIndex.isValid()) { + if (categoryIndex.data(m_newItemRole).toBool()) + return true; + } + const int rowCount = sourceModel()->rowCount(categoryIndex); for (int row = 0; row < rowCount; ++row) { if (filterAcceptsRow(row, categoryIndex)) @@ -28,6 +40,14 @@ bool CategorySortFilterModel::filterAcceptsRow(int source_row, } return false; } + + if (m_newItemRole != -1) { + const QModelIndex &idx = sourceModel()->index(source_row, 0, source_parent); + if (idx.data(m_newItemRole).toBool()) + return true; + } + + return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); } diff --git a/src/libs/utils/categorysortfiltermodel.h b/src/libs/utils/categorysortfiltermodel.h index 405419dedf3..f9f787b352f 100644 --- a/src/libs/utils/categorysortfiltermodel.h +++ b/src/libs/utils/categorysortfiltermodel.h @@ -14,8 +14,14 @@ class QTCREATOR_UTILS_EXPORT CategorySortFilterModel : public QSortFilterProxyMo public: CategorySortFilterModel(QObject *parent = nullptr); + // "New" items will always be accepted, regardless of the filter. + void setNewItemRole(int role); + protected: bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; + +private: + int m_newItemRole = -1; }; } // Utils diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp index 3dc13248b41..c48fdadea6c 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp @@ -236,6 +236,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildSystem *bs) : m_configTextFilterModel->setSourceModel(m_configFilterModel); m_configTextFilterModel->setSortRole(Qt::DisplayRole); m_configTextFilterModel->setFilterKeyColumn(-1); + m_configTextFilterModel->setNewItemRole(ConfigModel::ItemIsUserNew); connect(m_configTextFilterModel, &QAbstractItemModel::layoutChanged, this, [this]() { QModelIndex selectedIdx = m_configView->currentIndex(); diff --git a/src/plugins/cmakeprojectmanager/configmodel.cpp b/src/plugins/cmakeprojectmanager/configmodel.cpp index 084d917ffa8..43fb28d7d06 100644 --- a/src/plugins/cmakeprojectmanager/configmodel.cpp +++ b/src/plugins/cmakeprojectmanager/configmodel.cpp @@ -546,6 +546,9 @@ QVariant ConfigModelTreeItem::data(int column, int role) const if (role == ConfigModel::ItemIsInitialRole) { return dataItem->isInitial ? "1" : "0"; } + if (role == ConfigModel::ItemIsUserNew) { + return dataItem->isUserNew ? "1" : "0"; + } auto fontRole = [this]() -> QFont { QFont font; diff --git a/src/plugins/cmakeprojectmanager/configmodel.h b/src/plugins/cmakeprojectmanager/configmodel.h index 2d235a30aa9..71b4db5a347 100644 --- a/src/plugins/cmakeprojectmanager/configmodel.h +++ b/src/plugins/cmakeprojectmanager/configmodel.h @@ -18,7 +18,8 @@ class ConfigModel : public Utils::TreeModel<> public: enum Roles { ItemIsAdvancedRole = Qt::UserRole, - ItemIsInitialRole + ItemIsInitialRole, + ItemIsUserNew, }; struct DataItem { From 5c7c3a410df005c9da732990a220ebb4aa067452 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Tue, 18 Oct 2022 17:00:36 +0200 Subject: [PATCH 5/8] ProjectExplorer: Use device env when inspecting gcc Previously the host environment would be used while inspecting a gcc / g++ compiler. When doing so on a Windows Host against a Docker target, this would fail. Change-Id: I0e7b392101cee23e17813fa07f6c04bb9d3999c9 Reviewed-by: hjk --- src/plugins/projectexplorer/gcctoolchain.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index bdce4800105..41ec7c6b92b 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -445,7 +445,7 @@ static QStringList filteredFlags(const QStringList &allFlags, bool considerSysro ToolChain::MacroInspectionRunner GccToolChain::createMacroInspectionRunner() const { // Using a clean environment breaks ccache/distcc/etc. - Environment env = Environment::systemEnvironment(); + Environment env = compilerCommand().deviceEnvironment(); addToEnvironment(env); const QStringList platformCodeGenFlags = m_platformCodeGenFlags; OptionsReinterpreter reinterpretOptions = m_optionsReinterpreter; @@ -852,7 +852,7 @@ void GccToolChain::setOptionsReinterpreter(const OptionsReinterpreter &optionsRe GccToolChain::DetectedAbisResult GccToolChain::detectSupportedAbis() const { - Environment env = Environment::systemEnvironment(); + Environment env = compilerCommand().deviceEnvironment(); addToEnvironment(env); ProjectExplorer::Macros macros = createMacroInspectionRunner()({}).macros; return guessGccAbi(findLocalCompiler(compilerCommand(), env), @@ -863,7 +863,7 @@ GccToolChain::DetectedAbisResult GccToolChain::detectSupportedAbis() const QString GccToolChain::detectVersion() const { - Environment env = Environment::systemEnvironment(); + Environment env = compilerCommand().deviceEnvironment(); addToEnvironment(env); return gccVersion(findLocalCompiler(compilerCommand(), env), env, filteredFlags(platformCodeGenFlags(), true)); @@ -871,7 +871,7 @@ QString GccToolChain::detectVersion() const Utils::FilePath GccToolChain::detectInstallDir() const { - Environment env = Environment::systemEnvironment(); + Environment env = compilerCommand().deviceEnvironment(); addToEnvironment(env); return gccInstallDir(findLocalCompiler(compilerCommand(), env), env, filteredFlags(platformCodeGenFlags(), true)); From d85dd1962bfe96c1f4e6cfb24bef4a3766c69158 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 17 Oct 2022 14:57:19 +0200 Subject: [PATCH 6/8] QtcProcess: Disconnect from ProcessInterface signals ... on destruction. Change-Id: I6751e1ba2999f506e85ebb697a8a1c7152ea9abb Reviewed-by: Reviewed-by: David Schulz Reviewed-by: hjk --- src/libs/utils/qtcprocess.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libs/utils/qtcprocess.cpp b/src/libs/utils/qtcprocess.cpp index e2e67b7d8da..e6dffa0e786 100644 --- a/src/libs/utils/qtcprocess.cpp +++ b/src/libs/utils/qtcprocess.cpp @@ -634,6 +634,8 @@ public: void setProcessInterface(ProcessInterface *process) { + if (m_process) + m_process->disconnect(); m_process.reset(process); m_process->setParent(this); connect(m_process.get(), &ProcessInterface::started, @@ -805,6 +807,14 @@ GeneralProcessBlockingImpl::GeneralProcessBlockingImpl(QtcProcessPrivate *parent // In order to move the process interface into another thread together with handle parent->m_process.get()->setParent(m_processHandler.get()); m_processHandler->setParent(this); + // So the hierarchy looks like: + // QtcProcessPrivate + // | + // +- GeneralProcessBlockingImpl + // | + // +- ProcessInterfaceHandler + // | + // +- ProcessInterface } bool GeneralProcessBlockingImpl::waitForSignal(ProcessSignalType newSignal, int msecs) @@ -995,6 +1005,8 @@ QtcProcess::~QtcProcess() { QTC_ASSERT(!d->m_guard.isLocked(), qWarning("Deleting QtcProcess instance directly from " "one of its signal handlers will lead to crash!")); + if (d->m_process) + d->m_process->disconnect(); delete d; } From 0dd8d64060083ded0b499aba8a617f5ca12f90cd Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 18 Oct 2022 23:57:43 +0300 Subject: [PATCH 7/8] Revert "ProjectExplorer: Simplify node creation" It breaks the project tree, at least for Qt Creator CMake project. This reverts commit d1284570d6fe0712b1cc6fe4d0471d2871889af1. Change-Id: Ic5fe14cd4da476ca421551968e67fb8688433bbf Reviewed-by: Marcus Tillmanns Reviewed-by: hjk --- src/plugins/projectexplorer/projectnodes.cpp | 39 +++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/src/plugins/projectexplorer/projectnodes.cpp b/src/plugins/projectexplorer/projectnodes.cpp index 9245f7645ff..1b7c0546fe7 100644 --- a/src/plugins/projectexplorer/projectnodes.cpp +++ b/src/plugins/projectexplorer/projectnodes.cpp @@ -39,24 +39,37 @@ static FolderNode *recursiveFindOrCreateFolderNode(FolderNode *folder, const FilePath &overrideBaseDir, const FolderNode::FolderNodeFactory &factory) { - QList paths; - const Utils::FilePath basePath = overrideBaseDir.isEmpty() ? folder->filePath() - : overrideBaseDir; - Utils::FilePath path = basePath.isEmpty() ? directory : basePath.relativeChildPath(directory); + Utils::FilePath path = overrideBaseDir.isEmpty() ? folder->filePath() : overrideBaseDir; - while (!path.isEmpty()) { - paths.append(path); - path = path.parentDir(); + Utils::FilePath directoryWithoutPrefix; + bool isRelative = false; + + if (path.isEmpty() || path.isRootPath()) { + directoryWithoutPrefix = directory; + isRelative = false; + } else { + if (directory.isChildOf(path) || directory == path) { + isRelative = true; + directoryWithoutPrefix = directory.relativeChildPath(path); + } else { + isRelative = false; + path.clear(); + directoryWithoutPrefix = directory; + } } - std::reverse(std::begin(paths), std::end(paths)); + QStringList parts = directoryWithoutPrefix.path().split('/', Qt::SkipEmptyParts); + if (directory.osType() != OsTypeWindows && !isRelative && !parts.isEmpty()) + parts[0].prepend('/'); - FolderNode *parent = folder; - for (const auto ¤tPath : paths) { - FolderNode *next = parent->folderNode(currentPath); + ProjectExplorer::FolderNode *parent = folder; + for (const QString &part : std::as_const(parts)) { + path = path.pathAppended(part); + // Find folder in subFolders + FolderNode *next = parent->folderNode(path); if (!next) { // No FolderNode yet, so create it - auto tmp = factory(currentPath); - tmp->setDisplayName(currentPath.fileName()); + auto tmp = factory(path); + tmp->setDisplayName(part); next = tmp.get(); parent->addNode(std::move(tmp)); } From ada6989079aec2b533774cfff045220392641d31 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 13 Oct 2022 16:36:48 +0200 Subject: [PATCH 8/8] RemoteLinux: Allow use as build device unconditionally Works out-of-the box for plain C++ "Hello World" & CMake. Change-Id: I696886582ad2db98e40dd31ad5d9bf8f7d30aabb Reviewed-by: Eike Ziller Reviewed-by: --- src/plugins/remotelinux/linuxdevice.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index 6aee5591945..bb506b64cdd 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -1046,8 +1046,7 @@ DeviceEnvironmentFetcher::Ptr LinuxDevice::environmentFetcher() const bool LinuxDevice::usableAsBuildDevice() const { - const bool isUsable = qtcEnvironmentVariableIntValue("QTC_ALLOW_REMOTE_LINUX_BUILD_DEVICES"); - return isUsable; + return true; } QString LinuxDevice::userAtHost() const