diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5rendernodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5rendernodeinstanceserver.cpp index bb1aa724450..63dba600d50 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5rendernodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5rendernodeinstanceserver.cpp @@ -77,17 +77,25 @@ void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands() DesignerSupport::polishItems(quickWindow()); if (quickWindow() && nodeInstanceClient()->bytesToWrite() < 10000) { + bool windowDirty = false; foreach (QQuickItem *item, allItems()) { if (item) { - if (hasInstanceForObject(item)) { + if (Internal::QuickItemNodeInstance::unifiedRenderPath()) { + if (DesignerSupport::isDirty(item, DesignerSupport::AllMask)) { + windowDirty = true; + break; + } + } else { + if (hasInstanceForObject(item)) { if (DesignerSupport::isDirty(item, DesignerSupport::ContentUpdateMask)) m_dirtyInstanceSet.insert(instanceForObject(item)); - } else if (DesignerSupport::isDirty(item, DesignerSupport::AllMask)) { - ServerNodeInstance ancestorInstance = findNodeInstanceForItem(item->parentItem()); - if (ancestorInstance.isValid()) - m_dirtyInstanceSet.insert(ancestorInstance); + } else if (DesignerSupport::isDirty(item, DesignerSupport::AllMask)) { + ServerNodeInstance ancestorInstance = findNodeInstanceForItem(item->parentItem()); + if (ancestorInstance.isValid()) + m_dirtyInstanceSet.insert(ancestorInstance); + } + Internal::QuickItemNodeInstance::updateDirtyNode(item); } - Internal::QuickItemNodeInstance::updateDirtyNode(item); } } @@ -97,7 +105,8 @@ void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands() /* QQuickItem::grabToImage render path */ /* TODO implement QQuickItem::grabToImage based rendering */ /* sheduleRootItemRender(); */ - nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand({rootNodeInstance()})); + if (windowDirty) + nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand({rootNodeInstance()})); } else { if (!m_dirtyInstanceSet.isEmpty()) { nodeInstanceClient()->pixmapChanged( diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml index 22f8e340532..19746097d41 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml @@ -281,6 +281,12 @@ SecondColumnLayout { T.Popup { id: cePopup + WheelHandler { + onWheel: function(event) { + Controller.mainScrollView.flick(0, event.angleDelta.y * 5) + } + } + onOpened: { if (Controller.mainScrollView === null) return diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ExtendedFunctionLogic.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ExtendedFunctionLogic.qml index d3b6a9deeca..58b82a7c24d 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ExtendedFunctionLogic.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ExtendedFunctionLogic.qml @@ -61,7 +61,7 @@ Item { extendedFunctionButton.color = StudioTheme.Values.themeInteraction } } else { - if (backendValue.complexNode !== null + if (backendValue.complexNode !== undefined && backendValue.complexNode.exists) { } else { diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/HueSlider.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/HueSlider.qml index 50c930d64b5..a09fc23d7f3 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/HueSlider.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/HueSlider.qml @@ -42,7 +42,7 @@ Item { function updatePos() { if (root.maximum > root.minimum) { var pos = (track.width - handle.width) * (root.value - root.minimum) / (root.maximum - root.minimum) - return Math.min(Math.max(pos, 0), track.width - 8) + return Math.min(Math.max(pos, 0), track.width - handle.width) } else { return 0 } @@ -74,20 +74,24 @@ Item { Rectangle { id: handle width: StudioTheme.Values.hueSliderHandleWidth - height: track.height + height: track.height - 4 anchors.verticalCenter: parent.verticalCenter smooth: true - opacity: 0.9 + color: "transparent" radius: 2 border.color: "black" border.width: 1 x: root.updatePos() + y: 2 z: 1 - gradient: Gradient { - GradientStop {color: "#2c2c2c" ; position: 0} - GradientStop {color: "#343434" ; position: 0.15} - GradientStop {color: "#373737" ; position: 1.0} + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + radius: 1 + border.color: "white" + border.width: 1 } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OpacitySlider.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OpacitySlider.qml index cf1fea7d07b..176b493a19b 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OpacitySlider.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/OpacitySlider.qml @@ -43,7 +43,7 @@ Item { function updatePos() { if (root.maximum > root.minimum) { var pos = (track.width - handle.width) * (root.value - root.minimum) / (root.maximum - root.minimum) - return Math.min(Math.max(pos, 0), track.width - 8) + return Math.min(Math.max(pos, 0), track.width - handle.width) } else { return 0 } @@ -77,20 +77,24 @@ Item { Rectangle { id: handle width: StudioTheme.Values.hueSliderHandleWidth - height: track.height + height: track.height - 4 anchors.verticalCenter: parent.verticalCenter smooth: true - opacity: 0.9 + color: "transparent" radius: 2 border.color: "black" border.width: 1 x: root.updatePos() + y: 2 z: 1 - gradient: Gradient { - GradientStop {color: "#2c2c2c" ; position: 0} - GradientStop {color: "#343434" ; position: 0.15} - GradientStop {color: "#373737" ; position: 1.0} + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + radius: 1 + border.color: "white" + border.width: 1 } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBoxInput.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBoxInput.qml index 8d92d9c94af..abc8568a2d7 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBoxInput.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBoxInput.qml @@ -214,8 +214,10 @@ TextInput { } onWheel: function(wheel) { - if (!myControl.__wheelEnabled) + if (!myControl.__wheelEnabled) { + wheel.accepted = false return + } // Set stepSize according to used modifier key if (wheel.modifiers & Qt.ControlModifier) diff --git a/share/qtcreator/templates/wizards/autotest/files/tst.txt b/share/qtcreator/templates/wizards/autotest/files/tst.txt index 161fd0ff26f..fe8e30e789d 100644 --- a/share/qtcreator/templates/wizards/autotest/files/tst.txt +++ b/share/qtcreator/templates/wizards/autotest/files/tst.txt @@ -4,10 +4,10 @@ project(%{TestCaseName} LANGUAGES CXX) @if "%{TestFrameWork}" == "QtTest" @if "%{RequireGUI}" == "true" -find_package(QT NAMES Qt5 Qt6 COMPONENTS Gui Test REQUIRED) +find_package(QT NAMES Qt6 Qt5 COMPONENTS Gui Test REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui Test REQUIRED) @else -find_package(QT NAMES Qt5 Qt6 COMPONENTS Test REQUIRED) +find_package(QT NAMES Qt6 Qt5 COMPONENTS Test REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Test REQUIRED) @endif @@ -32,7 +32,7 @@ target_link_libraries(%{TestCaseName} PRIVATE Qt${QT_VERSION_MAJOR}::Test) @endif @if "%{TestFrameWork}" == "QtQuickTest" -find_package(QT NAMES Qt5 Qt6 COMPONENTS QuickTest REQUIRED) +find_package(QT NAMES Qt6 Qt5 COMPONENTS QuickTest REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS QuickTest REQUIRED) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -123,7 +123,7 @@ endif () SET(CMAKE_CXX_STANDARD 11) @if "%{Catch2NeedsQt}" == "true" -find_package(QT NAMES Qt5 Qt6 COMPONENTS Gui REQUIRED) +find_package(QT NAMES Qt6 Qt5 COMPONENTS Gui REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui REQUIRED) @endif diff --git a/src/libs/utils/fileinprojectfinder.cpp b/src/libs/utils/fileinprojectfinder.cpp index 0d41433adaa..af95c47ecdd 100644 --- a/src/libs/utils/fileinprojectfinder.cpp +++ b/src/libs/utils/fileinprojectfinder.cpp @@ -88,9 +88,8 @@ void FileInProjectFinder::setProjectDirectory(const FilePath &absoluteProjectPat if (absoluteProjectPath == m_projectDir) return; - const QFileInfo infoPath = absoluteProjectPath.toFileInfo(); QTC_CHECK(absoluteProjectPath.isEmpty() - || (infoPath.exists() && infoPath.isAbsolute())); + || (absoluteProjectPath.exists() && absoluteProjectPath.isAbsolutePath())); m_projectDir = absoluteProjectPath; m_cache.clear(); diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp index ca397b0c0d4..9f8c7f67d5a 100644 --- a/src/libs/utils/fileutils.cpp +++ b/src/libs/utils/fileutils.cpp @@ -388,8 +388,6 @@ bool FilePath::isRelativePath() const FilePath FilePath::resolvePath(const QString &fileName) const { - if (fileName.isEmpty()) - return {}; // FIXME: Isn't this odd? if (FileUtils::isAbsolutePath(fileName)) return FilePath::fromString(QDir::cleanPath(fileName)); return FilePath::fromString(QDir::cleanPath(toString() + QLatin1Char('/') + fileName)); diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index 3f658ea4812..f167cf6c6f0 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -582,7 +582,7 @@ bool PathChooser::validatePath(FancyLineEdit *edit, QString *errorMessage) const } break; case PathChooser::Directory: - if (filePath.isDir()) { + if (filePath.exists() && !filePath.isDir()) { if (errorMessage) *errorMessage = tr("The path \"%1\" is not a directory.").arg(filePath.toUserOutput()); return false; diff --git a/src/plugins/autotest/testoutputreader.cpp b/src/plugins/autotest/testoutputreader.cpp index ada972d094a..f2ad3bff054 100644 --- a/src/plugins/autotest/testoutputreader.cpp +++ b/src/plugins/autotest/testoutputreader.cpp @@ -42,7 +42,7 @@ Utils::FilePath TestOutputReader::constructSourceFilePath(const Utils::FilePath const QString &file) { const Utils::FilePath filePath = path.resolvePath(file); - return filePath.exists() ? filePath : Utils::FilePath(); + return filePath.isReadableFile() ? filePath : Utils::FilePath(); } TestOutputReader::TestOutputReader(const QFutureInterface &futureInterface, diff --git a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp index 1a279e93adc..ea9fa55db01 100644 --- a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp +++ b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp @@ -277,9 +277,10 @@ void CMakeKitAspect::setup(Kit *k) return; // Look for a suitable auto-detected one: - const QString id = k->autoDetectionSource(); + const QString kitSource = k->autoDetectionSource(); for (CMakeTool *tool : CMakeToolManager::cmakeTools()) { - if (tool->detectionSource() == id) { + const QString toolSource = tool->detectionSource(); + if (!toolSource.isEmpty() && toolSource == kitSource) { setCMakeTool(k, tool->id()); return; } @@ -1043,8 +1044,6 @@ CMakeConfig CMakeConfigurationKitAspect::defaultConfiguration(const Kit *k) QVariant CMakeConfigurationKitAspect::defaultValue(const Kit *k) const { - Q_UNUSED(k) - // FIXME: Convert preload scripts CMakeConfig config = defaultConfiguration(k); const QStringList tmp diff --git a/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp b/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp index 0d6430517bf..3e653c51405 100644 --- a/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp +++ b/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp @@ -110,6 +110,7 @@ public: , m_executable(item->filePath()) , m_qchFile(item->qchFilePath()) , m_versionDisplay(item->versionDisplay()) + , m_detectionSource(item->detectionSource()) , m_isAutoRun(item->isAutoRun()) , m_autodetected(item->isAutoDetected()) , m_isSupported(item->hasFileApi()) @@ -145,9 +146,10 @@ public: cmake.setFilePath(m_executable); m_isSupported = cmake.hasFileApi(); - m_tooltip = tr("Version: %1
Supports fileApi: %2") - .arg(cmake.versionDisplay()) - .arg(cmake.hasFileApi() ? tr("yes") : tr("no")); + m_tooltip = tr("Version: %1").arg(cmake.versionDisplay()); + m_tooltip += "
" + tr("Supports fileApi: %1").arg(m_isSupported ? tr("yes") : tr("no")); + m_tooltip += "
" + tr("Detection source: \"%1\"").arg(m_detectionSource); + m_versionDisplay = cmake.versionDisplay(); } @@ -223,6 +225,7 @@ public: FilePath m_executable; FilePath m_qchFile; QString m_versionDisplay; + QString m_detectionSource; bool m_isAutoRun = true; bool m_pathExists = false; bool m_pathIsFile = false; @@ -362,6 +365,7 @@ void CMakeToolItemModel::apply() cmake->setDisplayName(item->m_name); cmake->setFilePath(item->m_executable); cmake->setQchFilePath(item->m_qchFile); + cmake->setDetectionSource(item->m_detectionSource); cmake->setAutorun(item->m_isAutoRun); } else { toRegister.append(item); @@ -375,6 +379,7 @@ void CMakeToolItemModel::apply() cmake->setDisplayName(item->m_name); cmake->setFilePath(item->m_executable); cmake->setQchFilePath(item->m_qchFile); + cmake->setDetectionSource(item->m_detectionSource); if (!CMakeToolManager::registerCMakeTool(std::move(cmake))) item->m_changed = true; } diff --git a/src/plugins/cmakeprojectmanager/cmaketool.cpp b/src/plugins/cmakeprojectmanager/cmaketool.cpp index cf9e83bf1ca..51daa1bb5f3 100644 --- a/src/plugins/cmakeprojectmanager/cmaketool.cpp +++ b/src/plugins/cmakeprojectmanager/cmaketool.cpp @@ -53,6 +53,7 @@ const char CMAKE_INFORMATION_QCH_FILE_PATH[] = "QchFile"; // obsolete since Qt Creator 5. Kept for backward compatibility const char CMAKE_INFORMATION_AUTO_CREATE_BUILD_DIRECTORY[] = "AutoCreateBuildDirectory"; const char CMAKE_INFORMATION_AUTODETECTED[] = "AutoDetected"; +const char CMAKE_INFORMATION_DETECTIONSOURCE[] = "DetectionSource"; const char CMAKE_INFORMATION_READERTYPE[] = "ReaderType"; bool CMakeTool::Generator::matches(const QString &n, const QString &ex) const @@ -132,6 +133,7 @@ CMakeTool::CMakeTool(const QVariantMap &map, bool fromSdk) : //loading a CMakeTool from SDK is always autodetection if (!fromSdk) m_isAutoDetected = map.value(CMAKE_INFORMATION_AUTODETECTED, false).toBool(); + m_detectionSource = map.value(CMAKE_INFORMATION_DETECTIONSOURCE).toString(); setFilePath(FilePath::fromString(map.value(CMAKE_INFORMATION_COMMAND).toString())); @@ -209,6 +211,7 @@ QVariantMap CMakeTool::toMap() const data.insert(CMAKE_INFORMATION_READERTYPE, Internal::readerTypeToString(m_readerType.value())); data.insert(CMAKE_INFORMATION_AUTODETECTED, m_isAutoDetected); + data.insert(CMAKE_INFORMATION_DETECTIONSOURCE, m_detectionSource); return data; } diff --git a/src/plugins/cmakeprojectmanager/cmaketool.h b/src/plugins/cmakeprojectmanager/cmaketool.h index 62b5c9964ce..c45fb7514db 100644 --- a/src/plugins/cmakeprojectmanager/cmaketool.h +++ b/src/plugins/cmakeprojectmanager/cmaketool.h @@ -122,6 +122,8 @@ private: void fetchFromCapabilities() const; void parseFromCapabilities(const QString &input) const; + // Note: New items here need also be handled in CMakeToolItemModel::apply() + // FIXME: Use a saner approach. Utils::Id m_id; QString m_displayName; Utils::FilePath m_executable; diff --git a/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp b/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp index 348b1de7627..55b47891e4a 100644 --- a/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp @@ -184,14 +184,14 @@ void CMakeToolManager::autoDetectCMakeForDevice(const FilePath &deviceRoot, const QString &detectionSource, QString *logMessage) { - QStringList messages; + QStringList messages{tr("Searching CMake binaries...")}; const FilePaths candidates = {FilePath::fromString("cmake").onDevice(deviceRoot)}; const Environment env = deviceRoot.deviceEnvironment(); for (const FilePath &candidate : candidates) { const FilePath cmake = candidate.searchOnDevice(env.path()); if (!cmake.isEmpty()) { registerCMakeByPath(cmake, detectionSource); - messages.append(tr("Found CMake binary: %1").arg(cmake.toUserOutput())); + messages.append(tr("Found \"%1\"").arg(cmake.toUserOutput())); } } if (logMessage) @@ -209,11 +209,28 @@ void CMakeToolManager::registerCMakeByPath(const FilePath &cmakePath, const QStr auto newTool = std::make_unique(CMakeTool::ManualDetection, id); newTool->setFilePath(cmakePath); - newTool->setDisplayName(cmakePath.toUserOutput()); newTool->setDetectionSource(detectionSource); + newTool->setDisplayName(cmakePath.toUserOutput()); registerCMakeTool(std::move(newTool)); } +void CMakeToolManager::removeDetectedCMake(const QString &detectionSource, QString *logMessage) +{ + QStringList logMessages{tr("Removing CMake entries...")}; + while (true) { + auto toRemove = Utils::take(d->m_cmakeTools, Utils::equal(&CMakeTool::detectionSource, detectionSource)); + if (!toRemove.has_value()) + break; + logMessages.append(tr("Removed \"%1\"").arg((*toRemove)->displayName())); + emit m_instance->cmakeRemoved((*toRemove)->id()); + } + + ensureDefaultCMakeToolIsValid(); + updateDocumentation(); + if (logMessage) + *logMessage = logMessages.join('\n'); +} + void CMakeToolManager::notifyAboutUpdate(CMakeTool *tool) { if (!tool || !Utils::contains(d->m_cmakeTools, tool)) diff --git a/src/plugins/cmakeprojectmanager/cmaketoolmanager.h b/src/plugins/cmakeprojectmanager/cmaketoolmanager.h index 9497192873d..3c3dfa8f84f 100644 --- a/src/plugins/cmakeprojectmanager/cmaketoolmanager.h +++ b/src/plugins/cmakeprojectmanager/cmaketoolmanager.h @@ -68,6 +68,7 @@ public slots: QString *logMessage); void registerCMakeByPath(const Utils::FilePath &cmakePath, const QString &detectionSource); + void removeDetectedCMake(const QString &detectionSource, QString *logMessage); signals: void cmakeAdded (const Utils::Id &id); diff --git a/src/plugins/cmakeprojectmanager/cmaketoolsettingsaccessor.cpp b/src/plugins/cmakeprojectmanager/cmaketoolsettingsaccessor.cpp index b1dde077b67..315fc6878dd 100644 --- a/src/plugins/cmakeprojectmanager/cmaketoolsettingsaccessor.cpp +++ b/src/plugins/cmakeprojectmanager/cmaketoolsettingsaccessor.cpp @@ -211,9 +211,9 @@ void CMakeToolSettingsAccessor::saveCMakeTools(const QList &cmakeTo int count = 0; for (const CMakeTool *item : cmakeTools) { - QFileInfo fi = item->cmakeExecutable().toFileInfo(); + Utils::FilePath fi = item->cmakeExecutable(); - if (fi.isExecutable()) { + if (fi.isExecutableFile()) { QVariantMap tmp = item->toMap(); if (tmp.isEmpty()) continue; @@ -239,7 +239,7 @@ CMakeToolSettingsAccessor::cmakeTools(const QVariantMap &data, bool fromSdk) con const QVariantMap dbMap = data.value(key).toMap(); auto item = std::make_unique(dbMap, fromSdk); - if (item->isAutoDetected() && !item->cmakeExecutable().toFileInfo().isExecutable()) { + if (item->isAutoDetected() && !item->cmakeExecutable().isExecutableFile()) { qWarning() << QString::fromLatin1("CMakeTool \"%1\" (%2) dropped since the command is not executable.") .arg(item->cmakeExecutable().toUserOutput(), item->id().toString()); continue; diff --git a/src/plugins/debugger/debuggeritemmanager.cpp b/src/plugins/debugger/debuggeritemmanager.cpp index 33a04cf7c41..fd0bfd91178 100644 --- a/src/plugins/debugger/debuggeritemmanager.cpp +++ b/src/plugins/debugger/debuggeritemmanager.cpp @@ -92,7 +92,9 @@ public: QVariant registerDebugger(const DebuggerItem &item); void readDebuggers(const FilePath &fileName, bool isSystem); void autoDetectCdbDebuggers(); - void autoDetectGdbOrLldbDebuggers(const FilePath &deviceRoot, const QString &detectionSource); + void autoDetectGdbOrLldbDebuggers(const FilePath &deviceRoot, + const QString &detectionSource, + QString *logMessage = nullptr); void autoDetectUvscDebuggers(); QString uniqueDisplayName(const QString &base); @@ -715,7 +717,8 @@ static Utils::FilePaths searchGdbPathsFromRegistry() } void DebuggerItemManagerPrivate::autoDetectGdbOrLldbDebuggers(const FilePath &deviceRoot, - const QString &detectionSource) + const QString &detectionSource, + QString *logMessage) { const QStringList filters = {"gdb-i686-pc-mingw32", "gdb-i686-pc-mingw32.exe", "gdb", "gdb.exe", "lldb", "lldb.exe", "lldb-[1-9]*", @@ -773,6 +776,7 @@ void DebuggerItemManagerPrivate::autoDetectGdbOrLldbDebuggers(const FilePath &de suspects.append(device->directoryEntries(globalPath, filters, QDir::Files | QDir::Executable)); } + QStringList logMessages{tr("Searching debuggers...")}; for (const FilePath &command : qAsConst(suspects)) { const auto commandMatches = [command](const DebuggerTreeItem *titem) { return titem->m_item.command() == command; @@ -796,7 +800,10 @@ void DebuggerItemManagerPrivate::autoDetectGdbOrLldbDebuggers(const FilePath &de const QString name = detectionSource.isEmpty() ? tr("System %1 at %2") : tr("Detected %1 at %2"); item.setUnexpandedDisplayName(name.arg(item.engineTypeName()).arg(command.toUserOutput())); m_model->addDebugger(item); + logMessages.append(tr("Found: \"%1\"").arg(name)); } + if (logMessage) + *logMessage = logMessages.join('\n'); } void DebuggerItemManagerPrivate::autoDetectUvscDebuggers() @@ -1030,9 +1037,31 @@ void DebuggerItemManager::deregisterDebugger(const QVariant &id) } void DebuggerItemManager::autoDetectDebuggersForDevice(const FilePath &deviceRoot, - const QString &detectionSource) + const QString &detectionSource, + QString *logMessage) { - d->autoDetectGdbOrLldbDebuggers(deviceRoot, detectionSource); + d->autoDetectGdbOrLldbDebuggers(deviceRoot, detectionSource, logMessage); +} + +void DebuggerItemManager::removeDetectedDebuggers(const QString &detectionSource, + QString *logMessage) +{ + QStringList logMessages{tr("Removing debugger entries...")}; + d->m_model->forItemsAtLevel<2>([detectionSource, &logMessages](DebuggerTreeItem *titem) { + if (titem->m_item.detectionSource() == detectionSource) { + logMessages.append(tr("Removed \"%1\"").arg(titem->m_item.displayName())); + d->m_model->destroyItem(titem); + return; + } + // FIXME: These items appeared in early docker development. Ok to remove for Creator 7.0. + FilePath filePath = titem->m_item.command(); + if (filePath.scheme() + ':' + filePath.host() == detectionSource) { + logMessages.append(tr("Removed \"%1\"").arg(titem->m_item.displayName())); + d->m_model->destroyItem(titem); + } + }); + if (logMessage) + *logMessage = logMessages.join('\n'); } } // namespace Debugger diff --git a/src/plugins/debugger/debuggeritemmanager.h b/src/plugins/debugger/debuggeritemmanager.h index 221ecf72bdb..e8d8cba42b1 100644 --- a/src/plugins/debugger/debuggeritemmanager.h +++ b/src/plugins/debugger/debuggeritemmanager.h @@ -53,7 +53,9 @@ public: static void deregisterDebugger(const QVariant &id); static void autoDetectDebuggersForDevice(const Utils::FilePath &deviceRoot, - const QString &detectionSource); + const QString &detectionSource, + QString *logMessage); + static void removeDetectedDebuggers(const QString &detectionSource, QString *logMessage); static const DebuggerItem *findByCommand(const Utils::FilePath &command); static const DebuggerItem *findById(const QVariant &id); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index e9a6c2d22ba..442fb2db24e 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -724,6 +724,7 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments) { qRegisterMetaType("ContextData"); qRegisterMetaType("DebuggerRunParameters"); + qRegisterMetaType(); // Menu groups ActionContainer *mstart = ActionManager::actionContainer(PE::M_DEBUG_STARTDEBUGGING); @@ -1747,9 +1748,15 @@ void DebuggerPlugin::getEnginesState(QByteArray *json) const } void DebuggerPlugin::autoDetectDebuggersForDevice(const FilePath &deviceRoot, - const QString &detectionId) + const QString &detectionSource, + QString *logMessage) { - dd->m_debuggerItemManager.autoDetectDebuggersForDevice(deviceRoot, detectionId); + dd->m_debuggerItemManager.autoDetectDebuggersForDevice(deviceRoot, detectionSource, logMessage); +} + +void DebuggerPlugin::removeDetectedDebuggers(const QString &detectionSource, QString *logMessage) +{ + dd->m_debuggerItemManager.removeDetectedDebuggers(detectionSource, logMessage); } void DebuggerPluginPrivate::attachToQmlPort() diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h index 8ef79ed48fd..4d4efda0f38 100644 --- a/src/plugins/debugger/debuggerplugin.h +++ b/src/plugins/debugger/debuggerplugin.h @@ -59,10 +59,15 @@ private: Q_SLOT void getEnginesState(QByteArray *json) const; // Called from DockerDevice - Q_SLOT void autoDetectDebuggersForDevice(const Utils::FilePath &deviceRoot, const QString &detectionId); + Q_SLOT void autoDetectDebuggersForDevice(const Utils::FilePath &deviceRoot, + const QString &detectionId, + QString *logMessage); + Q_SLOT void removeDetectedDebuggers(const QString &detectionId, QString *logMessage); QVector createTestObjects() const override; }; } // namespace Internal } // namespace Debugger + +Q_DECLARE_METATYPE(QString *) diff --git a/src/plugins/docker/dockerdevice.cpp b/src/plugins/docker/dockerdevice.cpp index 67333f75229..b533c67d335 100644 --- a/src/plugins/docker/dockerdevice.cpp +++ b/src/plugins/docker/dockerdevice.cpp @@ -471,26 +471,54 @@ DockerDeviceData &DockerDevice::data() void KitDetectorPrivate::undoAutoDetect() const { + emit q->logOutput(tr("Start removing auto-detected items associated with this docker image.")); + + emit q->logOutput('\n' + tr("Removing kits...")); for (Kit *kit : KitManager::kits()) { if (kit->autoDetectionSource() == m_sharedId) { - emit q->logOutput(tr("Removing kit: %1").arg(kit->displayName())); + emit q->logOutput(tr("Removed \"%1\"").arg(kit->displayName())); KitManager::deregisterKit(kit); } }; + + emit q->logOutput('\n' + tr("Removing Qt version entries...")); for (BaseQtVersion *qtVersion : QtVersionManager::versions()) { - if (qtVersion->autodetectionSource() == m_sharedId) { - emit q->logOutput(tr("Removing Qt version: %1").arg(qtVersion->displayName())); + if (qtVersion->detectionSource() == m_sharedId) { + emit q->logOutput(tr("Removed \"%1\"").arg(qtVersion->displayName())); QtVersionManager::removeVersion(qtVersion); } }; - emit q->logOutput(tr("Tool chains not removed.")); - // for (ToolChain *toolChain : ToolChainManager::toolChains()) { - // if (toolChain->autoDetectionSource() == id.toString()) - // // FIXME: Implement - // }; + emit q->logOutput('\n' + tr("Removing toolchain entries...")); + for (ToolChain *toolChain : ToolChainManager::toolChains()) { + QString detectionSource = toolChain->detectionSource(); + if (toolChain->detectionSource() == m_sharedId) { + emit q->logOutput(tr("Removed \"%1\"").arg(toolChain->displayName())); + ToolChainManager::deregisterToolChain(toolChain); + } + }; - emit q->logOutput(tr("Removal of previously auto-detected kit items finished.") + '\n'); + if (QObject *cmakeManager = ExtensionSystem::PluginManager::getObjectByName("CMakeToolManager")) { + QString logMessage; + const bool res = QMetaObject::invokeMethod(cmakeManager, + "removeDetectedCMake", + Q_ARG(QString, m_sharedId), + Q_ARG(QString *, &logMessage)); + QTC_CHECK(res); + emit q->logOutput('\n' + logMessage); + } + + if (QObject *debuggerPlugin = ExtensionSystem::PluginManager::getObjectByName("DebuggerPlugin")) { + QString logMessage; + const bool res = QMetaObject::invokeMethod(debuggerPlugin, + "removeDetectedDebuggers", + Q_ARG(QString, m_sharedId), + Q_ARG(QString *, &logMessage)); + QTC_CHECK(res); + emit q->logOutput('\n' + logMessage); + } + + emit q->logOutput('\n' + tr("Removal of previously auto-detected kit items finished.") + "\n\n"); } QList KitDetectorPrivate::autoDetectQtVersions() const @@ -510,7 +538,7 @@ QList KitDetectorPrivate::autoDetectQtVersions() const continue; qtVersions.append(qtVersion); QtVersionManager::addVersion(qtVersion); - emit q->logOutput(tr("Found Qt: %1").arg(qtVersion->qmakeFilePath().toUserOutput())); + emit q->logOutput(tr("Found \"%1\"").arg(qtVersion->qmakeFilePath().toUserOutput())); } if (qtVersions.isEmpty()) emit q->logOutput(tr("No Qt installation found.")); @@ -521,21 +549,24 @@ QList KitDetectorPrivate::autoDetectToolChains() { const QList factories = ToolChainFactory::allToolChainFactories(); - QList toolChains; + QList alreadyKnown = ToolChainManager::toolChains(); + QList allNewToolChains; QApplication::processEvents(); - emit q->logOutput('\n' + tr("Searching tool chains...")); + emit q->logOutput('\n' + tr("Searching toolchains...")); for (ToolChainFactory *factory : factories) { - const QList newToolChains = factory->autoDetect(toolChains, m_device.constCast()); - emit q->logOutput(tr("Searching tool chains of type %1").arg(factory->displayName())); + emit q->logOutput(tr("Searching toolchains of type %1").arg(factory->displayName())); + const QList newToolChains = factory->autoDetect(alreadyKnown, m_device.constCast()); for (ToolChain *toolChain : newToolChains) { - emit q->logOutput(tr("Found tool chain: %1").arg(toolChain->compilerCommand().toUserOutput())); + emit q->logOutput(tr("Found \"%1\"").arg(toolChain->compilerCommand().toUserOutput())); + toolChain->setDetectionSource(m_sharedId); ToolChainManager::registerToolChain(toolChain); - toolChains.append(toolChain); + alreadyKnown.append(toolChain); } + allNewToolChains.append(newToolChains); } - emit q->logOutput(tr("%1 new tool chains found.").arg(toolChains.size())); + emit q->logOutput(tr("%1 new toolchains found.").arg(allNewToolChains.size())); - return toolChains; + return allNewToolChains; } void KitDetectorPrivate::autoDetectCMake() @@ -544,16 +575,15 @@ void KitDetectorPrivate::autoDetectCMake() if (!cmakeManager) return; - emit q->logOutput('\n' + tr("Searching CMake binary...")); const FilePath deviceRoot = m_device->mapToGlobalPath({}); - QString error; + QString logMessage; const bool res = QMetaObject::invokeMethod(cmakeManager, "autoDetectCMakeForDevice", Q_ARG(Utils::FilePath, deviceRoot), Q_ARG(QString, m_sharedId), - Q_ARG(QString *, &error)); + Q_ARG(QString *, &logMessage)); QTC_CHECK(res); - emit q->logOutput(error); + emit q->logOutput('\n' + logMessage); } void KitDetectorPrivate::autoDetectDebugger() @@ -562,13 +592,15 @@ void KitDetectorPrivate::autoDetectDebugger() if (!debuggerPlugin) return; - emit q->logOutput('\n' + tr("Searching debuggers...")); const FilePath deviceRoot = m_device->mapToGlobalPath({}); + QString logMessage; const bool res = QMetaObject::invokeMethod(debuggerPlugin, "autoDetectDebuggersForDevice", Q_ARG(Utils::FilePath, deviceRoot), - Q_ARG(QString, m_sharedId)); + Q_ARG(QString, m_sharedId), + Q_ARG(QString *, &logMessage)); QTC_CHECK(res); + emit q->logOutput('\n' + logMessage); } void KitDetectorPrivate::autoDetect() @@ -715,6 +747,15 @@ void DockerDevicePrivate::tryCreateLocalFileAccess() .arg(m_container, m_mergedDir) + '\n' + tr("Output: '%1'").arg(out) + '\n' + tr("Error: '%1'").arg(proc.stdErr())); + if (HostOsInfo::isWindowsHost()) { + // Disabling merged layer access. This is not supported and anything + // related to accessing merged layers on Windows fails due to the need + // of using wsl or a named pipe. + // TODO investigate how to make it possible nevertheless. + m_mergedDir.clear(); + MessageManager::writeSilently(tr("This is expected on Windows.")); + return; + } } m_mergedDirWatcher.addPath(m_mergedDir); diff --git a/src/plugins/languageclient/languageclientmanager.cpp b/src/plugins/languageclient/languageclientmanager.cpp index 24afdaac643..a2ae95a1fad 100644 --- a/src/plugins/languageclient/languageclientmanager.cpp +++ b/src/plugins/languageclient/languageclientmanager.cpp @@ -137,21 +137,28 @@ void LanguageClientManager::clientFinished(Client *client) constexpr int restartTimeoutS = 5; const bool unexpectedFinish = client->state() != Client::Shutdown && client->state() != Client::ShutdownRequested; - if (unexpectedFinish && !managerInstance->m_shuttingDown && client->reset()) { - client->disconnect(managerInstance); - client->log(tr("Unexpectedly finished. Restarting in %1 seconds.").arg(restartTimeoutS)); - QTimer::singleShot(restartTimeoutS * 1000, client, [client]() { client->start(); }); - for (TextEditor::TextDocument *document : managerInstance->m_clientForDocument.keys(client)) - client->deactivateDocument(document); - } else { - if (unexpectedFinish && !managerInstance->m_shuttingDown) + + if (unexpectedFinish) { + if (!managerInstance->m_shuttingDown) { + const QList &clientDocs + = managerInstance->m_clientForDocument.keys(client); + if (client->reset()) { + client->disconnect(managerInstance); + client->log( + tr("Unexpectedly finished. Restarting in %1 seconds.").arg(restartTimeoutS)); + QTimer::singleShot(restartTimeoutS * 1000, client, [client]() { client->start(); }); + for (TextEditor::TextDocument *document : clientDocs) + client->deactivateDocument(document); + return; + } client->log(tr("Unexpectedly finished.")); - for (TextEditor::TextDocument *document : managerInstance->m_clientForDocument.keys(client)) - managerInstance->m_clientForDocument.remove(document); - deleteClient(client); - if (managerInstance->m_shuttingDown && managerInstance->m_clients.isEmpty()) - emit managerInstance->shutdownFinished(); + for (TextEditor::TextDocument *document : clientDocs) + managerInstance->m_clientForDocument.remove(document); + } } + deleteClient(client); + if (managerInstance->m_shuttingDown && managerInstance->m_clients.isEmpty()) + emit managerInstance->shutdownFinished(); } Client *LanguageClientManager::startClient(BaseSettings *setting, ProjectExplorer::Project *project) @@ -193,6 +200,10 @@ void LanguageClientManager::shutdownClient(Client *client) { if (!client) return; + // reset the documents for that client already when requesting the shutdown so they can get + // reassigned to another server right after this request to another server + for (TextEditor::TextDocument *document : managerInstance->m_clientForDocument.keys(client)) + managerInstance->m_clientForDocument.remove(document); if (client->reachable()) client->shutdown(); else if (client->state() != Client::Shutdown && client->state() != Client::ShutdownRequested) diff --git a/src/plugins/languageclient/lspinspector.cpp b/src/plugins/languageclient/lspinspector.cpp index ef112c1c5ec..7ccab6b5450 100644 --- a/src/plugins/languageclient/lspinspector.cpp +++ b/src/plugins/languageclient/lspinspector.cpp @@ -538,7 +538,7 @@ MessageId LspLogMessage::id() const QString LspLogMessage::displayText() const { if (!m_displayText.has_value()) { - m_displayText = time.toString("hh:mm:ss.zzz") + '\n'; + m_displayText = QString(time.toString("hh:mm:ss.zzz") + '\n'); if (message.mimeType == JsonRpcMessageHandler::jsonRpcMimeType()) m_displayText->append(json().value(QString{methodKey}).toString(id().toString())); else diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index 7064e47204a..25fe115afd3 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -851,7 +851,7 @@ bool Project::isKnownFile(const Utils::FilePath &filename) const } const Node *Project::nodeForFilePath(const Utils::FilePath &filePath, - const Project::NodeMatcher &extraMatcher) + const Project::NodeMatcher &extraMatcher) const { const FileNode dummy(filePath, FileType::Unknown); const auto range = std::equal_range(d->m_sortedNodeList.cbegin(), d->m_sortedNodeList.cend(), diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h index 9b783b7127c..7eca3cc0645 100644 --- a/src/plugins/projectexplorer/project.h +++ b/src/plugins/projectexplorer/project.h @@ -128,7 +128,7 @@ public: Utils::FilePaths files(const NodeMatcher &matcher) const; bool isKnownFile(const Utils::FilePath &filename) const; const Node *nodeForFilePath(const Utils::FilePath &filePath, - const NodeMatcher &extraMatcher = {}); + const NodeMatcher &extraMatcher = {}) const; virtual QVariantMap toMap() const; diff --git a/src/plugins/projectexplorer/projecttree.cpp b/src/plugins/projectexplorer/projecttree.cpp index e94dcb602c2..22e0ee88d0c 100644 --- a/src/plugins/projectexplorer/projecttree.cpp +++ b/src/plugins/projectexplorer/projecttree.cpp @@ -458,15 +458,14 @@ Node *ProjectTree::nodeForFile(const FilePath &fileName) { Node *node = nullptr; for (const Project *project : SessionManager::projects()) { - if (ProjectNode *projectNode = project->rootProjectNode()) { - projectNode->forEachGenericNode([&](Node *n) { - if (n->filePath() == fileName) { - // prefer file nodes - if (!node || (!node->asFileNode() && n->asFileNode())) - node = n; - } - }); - } + project->nodeForFilePath(fileName, [&](const Node *n) { + if (!node || (!node->asFileNode() && n->asFileNode())) + node = const_cast(n); + return false; + }); + // early return: + if (node && node->asFileNode()) + return node; } return node; } diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index b82e0e5783e..8b34f3c5b98 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -78,7 +78,7 @@ namespace QtSupport { namespace Internal { const char QTVERSIONAUTODETECTED[] = "isAutodetected"; -const char QTVERSIONAUTODETECTIONSOURCE[] = "autodetectionSource"; +const char QTVERSIONDETECTIONSOURCE[] = "autodetectionSource"; const char QTVERSION_OVERRIDE_FEATURES[] = "overrideFeatures"; const char QTVERSIONQMAKEPATH[] = "QMakePath"; const char QTVERSIONSOURCEPATH[] = "SourcePath"; @@ -223,7 +223,7 @@ public: bool m_versionInfoUpToDate = false; bool m_qmakeIsExecutable = true; - QString m_autodetectionSource; + QString m_detectionSource; QSet m_overrideFeatures; FilePath m_mkspec; @@ -368,7 +368,7 @@ QString BaseQtVersion::defaultUnexpandedDisplayName() const } while (!dir.isRoot() && dir.cdUp()); } - return autodetectionSource() == "PATH" ? + return detectionSource() == "PATH" ? QCoreApplication::translate("QtVersion", "Qt %{Qt:Version} in PATH (%2)").arg(location) : QCoreApplication::translate("QtVersion", "Qt %{Qt:Version} (%2)").arg(location); } @@ -724,7 +724,7 @@ void BaseQtVersion::fromMap(const QVariantMap &map) d->m_id = QtVersionManager::getUniqueId(); d->m_data.unexpandedDisplayName.fromMap(map, Constants::QTVERSIONNAME); d->m_isAutodetected = map.value(QTVERSIONAUTODETECTED).toBool(); - d->m_autodetectionSource = map.value(QTVERSIONAUTODETECTIONSOURCE).toString(); + d->m_detectionSource = map.value(QTVERSIONDETECTIONSOURCE).toString(); d->m_overrideFeatures = Utils::Id::fromStringList(map.value(QTVERSION_OVERRIDE_FEATURES).toStringList()); d->m_qmakeCommand = FilePath::fromVariant(map.value(QTVERSIONQMAKEPATH)); @@ -765,7 +765,7 @@ QVariantMap BaseQtVersion::toMap() const d->m_data.unexpandedDisplayName.toMap(result, Constants::QTVERSIONNAME); result.insert(QTVERSIONAUTODETECTED, isAutodetected()); - result.insert(QTVERSIONAUTODETECTIONSOURCE, autodetectionSource()); + result.insert(QTVERSIONDETECTIONSOURCE, detectionSource()); if (!d->m_overrideFeatures.isEmpty()) result.insert(QTVERSION_OVERRIDE_FEATURES, Utils::Id::toStringList(d->m_overrideFeatures)); @@ -885,9 +885,9 @@ bool BaseQtVersion::isAutodetected() const return d->m_isAutodetected; } -QString BaseQtVersion::autodetectionSource() const +QString BaseQtVersion::detectionSource() const { - return d->m_autodetectionSource; + return d->m_detectionSource; } QString BaseQtVersion::displayName() const @@ -2316,7 +2316,7 @@ void BaseQtVersion::resetCache() const static QList g_qtVersionFactories; BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath - (const FilePath &qmakePath, bool isAutoDetected, const QString &autoDetectionSource, QString *error) + (const FilePath &qmakePath, bool isAutoDetected, const QString &detectionSource, QString *error) { QHash versionInfo; const Environment env = qmakePath.deviceEnvironment(); @@ -2353,7 +2353,7 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath ver->d->m_id = QtVersionManager::getUniqueId(); QTC_CHECK(ver->d->m_qmakeCommand.isEmpty()); // Should only be used once. ver->d->m_qmakeCommand = qmakePath; - ver->d->m_autodetectionSource = autoDetectionSource; + ver->d->m_detectionSource = detectionSource; ver->d->m_isAutodetected = isAutoDetected; ver->updateDefaultDisplayName(); ProFileCacheManager::instance()->decRefCount(); diff --git a/src/plugins/qtsupport/baseqtversion.h b/src/plugins/qtsupport/baseqtversion.h index b722b2fcb86..53e1f98c1c8 100644 --- a/src/plugins/qtsupport/baseqtversion.h +++ b/src/plugins/qtsupport/baseqtversion.h @@ -98,7 +98,7 @@ public: virtual bool equals(BaseQtVersion *other); bool isAutodetected() const; - QString autodetectionSource() const; + QString detectionSource() const; QString displayName() const; QString unexpandedDisplayName() const; diff --git a/src/plugins/qtsupport/qtkitinformation.cpp b/src/plugins/qtsupport/qtkitinformation.cpp index b66efe72bfd..f7614bdb2ef 100644 --- a/src/plugins/qtsupport/qtkitinformation.cpp +++ b/src/plugins/qtsupport/qtkitinformation.cpp @@ -184,7 +184,7 @@ void QtKitAspect::setup(Kit *k) const QList &candidates = !exactMatches.empty() ? exactMatches : matches; BaseQtVersion * const qtFromPath = QtVersionManager::version( - equal(&BaseQtVersion::autodetectionSource, QString::fromLatin1("PATH"))); + equal(&BaseQtVersion::detectionSource, QString::fromLatin1("PATH"))); if (qtFromPath && candidates.contains(qtFromPath)) k->setValue(id(), qtFromPath->uniqueId()); else @@ -343,7 +343,7 @@ int QtKitAspect::qtVersionId(const Kit *k) id = -1; } else { QString source = data.toString(); - BaseQtVersion *v = QtVersionManager::version([source](const BaseQtVersion *v) { return v->autodetectionSource() == source; }); + BaseQtVersion *v = QtVersionManager::version([source](const BaseQtVersion *v) { return v->detectionSource() == source; }); if (v) id = v->uniqueId(); } diff --git a/src/plugins/qtsupport/qtprojectimporter.cpp b/src/plugins/qtsupport/qtprojectimporter.cpp index 2ed2a6ac6bb..19e9054fb43 100644 --- a/src/plugins/qtsupport/qtprojectimporter.cpp +++ b/src/plugins/qtsupport/qtprojectimporter.cpp @@ -271,7 +271,7 @@ void TestQtProjectImporter::deleteDirectoryData(void *directoryData) const static Utils::FilePath setupQmake(const BaseQtVersion *qt, const QString &path) { - const QFileInfo fi = QFileInfo(qt->qmakeCommand().toFileInfo().canonicalFilePath()); + const QFileInfo fi = QFileInfo(qt->qmakeFilePath().toFileInfo().canonicalFilePath()); const QString qmakeFile = path + "/" + fi.fileName(); if (!QFile::copy(fi.absoluteFilePath(), qmakeFile)) return Utils::FilePath(); @@ -379,12 +379,12 @@ void QtSupportPlugin::testQtProjectImporter_oneProject() SysRootKitAspect::setSysRoot(kitTemplates[1], Utils::FilePath::fromString("/some/path")); SysRootKitAspect::setSysRoot(kitTemplates[2], Utils::FilePath::fromString("/some/other/path")); - QVector qmakePaths = {defaultQt->qmakeCommand(), + QVector qmakePaths = {defaultQt->qmakeFilePath(), setupQmake(defaultQt, tempDir1.path().path()), setupQmake(defaultQt, tempDir2.path().path())}; for (int i = 1; i < qmakePaths.count(); ++i) - QVERIFY(!QtVersionManager::version(Utils::equal(&BaseQtVersion::qmakeCommand, qmakePaths.at(i)))); + QVERIFY(!QtVersionManager::version(Utils::equal(&BaseQtVersion::qmakeFilePath, qmakePaths.at(i)))); QList testData; @@ -457,7 +457,7 @@ void QtSupportPlugin::testQtProjectImporter_oneProject() QVERIFY(newQt); // VALIDATE: Qt has the expected qmakePath - QCOMPARE(dd->qmakePath, newQt->qmakeCommand()); + QCOMPARE(dd->qmakePath, newQt->qmakeFilePath()); // VALIDATE: All keys are unchanged: QList newKitKeys = newKit->allKeys(); @@ -569,7 +569,7 @@ void QtSupportPlugin::testQtProjectImporter_oneProject() QVERIFY(QtVersionManager::version(qtId)); // VALIDATE: Qt points to the expected qmake path: - QCOMPARE(QtVersionManager::version(qtId)->qmakeCommand(), dd->qmakePath); + QCOMPARE(QtVersionManager::version(qtId)->qmakeFilePath(), dd->qmakePath); // VALIDATE: Kit uses the expected Qt QCOMPARE(QtKitAspect::qtVersionId(newKit), qtId); diff --git a/src/plugins/qtsupport/qtversionfactory.h b/src/plugins/qtsupport/qtversionfactory.h index 9f055ea1cc9..d3d48d78058 100644 --- a/src/plugins/qtsupport/qtversionfactory.h +++ b/src/plugins/qtsupport/qtversionfactory.h @@ -51,10 +51,10 @@ public: /// the desktop factory claims to handle all paths int priority() const { return m_priority; } - static BaseQtVersion *createQtVersionFromQMakePath( - const Utils::FilePath &qmakePath, bool isAutoDetected = false, - const QString &autoDetectionSource = QString(), QString *error = nullptr); - + static BaseQtVersion *createQtVersionFromQMakePath(const Utils::FilePath &qmakePath, + bool isAutoDetected = false, + const QString &detectionSource = {}, + QString *error = nullptr); protected: struct SetupData { diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp index 7996bebf8bb..8b5c3eefb60 100644 --- a/src/plugins/qtsupport/qtversionmanager.cpp +++ b/src/plugins/qtsupport/qtversionmanager.cpp @@ -265,8 +265,8 @@ void QtVersionManager::updateFromInstaller(bool emitSignal) if (log().isDebugEnabled()) { qCDebug(log) << "======= Existing Qt versions ======="; for (BaseQtVersion *version : qAsConst(m_versions)) { - qCDebug(log) << version->qmakeFilePath().toString() << "id:"<uniqueId(); - qCDebug(log) << " autodetection source:"<< version->autodetectionSource(); + qCDebug(log) << version->qmakeFilePath().toUserOutput() << "id:"<uniqueId(); + qCDebug(log) << " autodetection source:" << version->detectionSource(); qCDebug(log) << ""; } qCDebug(log)<< "======= Adding sdk versions ======="; @@ -303,7 +303,7 @@ void QtVersionManager::updateFromInstaller(bool emitSignal) bool restored = false; const VersionMap versionsCopy = m_versions; // m_versions is modified in loop for (BaseQtVersion *v : versionsCopy) { - if (v->autodetectionSource() == autoDetectionSource) { + if (v->detectionSource() == autoDetectionSource) { id = v->uniqueId(); qCDebug(log) << " Qt version found with same autodetection source" << autoDetectionSource << " => Migrating id:" << id; m_versions.remove(id); @@ -341,16 +341,16 @@ void QtVersionManager::updateFromInstaller(bool emitSignal) if (log().isDebugEnabled()) { qCDebug(log) << "======= Before removing outdated sdk versions ======="; for (BaseQtVersion *version : qAsConst(m_versions)) { - qCDebug(log) << version->qmakeFilePath().toString() << "id:"<uniqueId(); - qCDebug(log) << " autodetection source:"<< version->autodetectionSource(); + qCDebug(log) << version->qmakeFilePath().toUserOutput() << "id:" << version->uniqueId(); + qCDebug(log) << " autodetection source:" << version->detectionSource(); qCDebug(log) << ""; } } const VersionMap versionsCopy = m_versions; // m_versions is modified in loop for (BaseQtVersion *qtVersion : versionsCopy) { - if (qtVersion->autodetectionSource().startsWith("SDK.")) { - if (!sdkVersions.contains(qtVersion->autodetectionSource())) { - qCDebug(log) << " removing version"<autodetectionSource(); + if (qtVersion->detectionSource().startsWith("SDK.")) { + if (!sdkVersions.contains(qtVersion->detectionSource())) { + qCDebug(log) << " removing version" << qtVersion->detectionSource(); m_versions.remove(qtVersion->uniqueId()); removed << qtVersion->uniqueId(); } @@ -360,8 +360,8 @@ void QtVersionManager::updateFromInstaller(bool emitSignal) if (log().isDebugEnabled()) { qCDebug(log)<< "======= End result ======="; for (BaseQtVersion *version : qAsConst(m_versions)) { - qCDebug(log) << version->qmakeFilePath().toString() << "id:" << version->uniqueId(); - qCDebug(log) << " autodetection source:"<< version->autodetectionSource(); + qCDebug(log) << version->qmakeFilePath().toUserOutput() << "id:" << version->uniqueId(); + qCDebug(log) << " autodetection source:" << version->detectionSource(); qCDebug(log) << ""; } } diff --git a/src/plugins/webassembly/webassemblytoolchain.cpp b/src/plugins/webassembly/webassemblytoolchain.cpp index c7755db21eb..276b324ba64 100644 --- a/src/plugins/webassembly/webassemblytoolchain.cpp +++ b/src/plugins/webassembly/webassemblytoolchain.cpp @@ -168,6 +168,13 @@ QList WebAssemblyToolChainFactory::autoDetect( if (!WebAssemblyEmSdk::isValid(sdk)) return {}; + if (device) { + // Only detect toolchains from the emsdk installation device + const FilePath deviceRoot = device->mapToGlobalPath({}); + if (deviceRoot.host() != sdk.host()) + return {}; + } + Environment env = sdk.deviceEnvironment(); WebAssemblyEmSdk::addToEnvironment(sdk, env); diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp index 3d23777eaa9..b3633ff614a 100644 --- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp +++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp @@ -900,7 +900,7 @@ void tst_TestCore::testRewriterImports() QVERIFY(import.isLibraryImport()); QCOMPARE(import.url(), QString("QtQuick")); QVERIFY(import.hasVersion()); - QCOMPARE(import.version(), QString("1.0")); + QCOMPARE(import.version(), QString("2.15")); QVERIFY(!import.hasAlias()); // import "subitems" diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.h b/tests/auto/qml/qmldesigner/coretests/tst_testcore.h index 92d4ac00aa9..51bd8f496d6 100644 --- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.h +++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.h @@ -29,6 +29,8 @@ #include +#include + class tst_TestCore : public QObject { @@ -237,4 +239,7 @@ private slots: // QMLAnnotations void writeAnnotations(); void readAnnotations(); + +private: + ExtensionSystem::PluginManager pm; // FIXME remove }; diff --git a/tests/auto/qml/qmldesigner/data/fx/imports.qml b/tests/auto/qml/qmldesigner/data/fx/imports.qml index f0ba46f2cdd..ebff695aa2a 100644 --- a/tests/auto/qml/qmldesigner/data/fx/imports.qml +++ b/tests/auto/qml/qmldesigner/data/fx/imports.qml @@ -23,7 +23,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 2.15 import "subitems" import QtWebKit 1.0 as Web diff --git a/tests/auto/utils/qtcprocess/tst_qtcprocess.cpp b/tests/auto/utils/qtcprocess/tst_qtcprocess.cpp index bfc19049f60..12f404f5043 100644 --- a/tests/auto/utils/qtcprocess/tst_qtcprocess.cpp +++ b/tests/auto/utils/qtcprocess/tst_qtcprocess.cpp @@ -897,7 +897,7 @@ void tst_QtcProcess::runBlockingStdOut() // with interactive cli tools. QEXPECT_FAIL("Unterminated stdout lost: early timeout", "", Continue); QVERIFY2(sp.result() != QtcProcess::Hang, "Process run did not time out."); - + QEXPECT_FAIL("Unterminated stdout lost: early timeout", "", Continue); QVERIFY2(readLastLine, "Last line was read."); }