Merge remote-tracking branch 'origin/5.0'

Change-Id: If0cbc808d2c466aee81a77b3c078bac7a3d1e4cb
This commit is contained in:
Eike Ziller
2021-07-15 09:48:08 +02:00
39 changed files with 292 additions and 137 deletions

View File

@@ -77,17 +77,25 @@ void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands()
DesignerSupport::polishItems(quickWindow()); DesignerSupport::polishItems(quickWindow());
if (quickWindow() && nodeInstanceClient()->bytesToWrite() < 10000) { if (quickWindow() && nodeInstanceClient()->bytesToWrite() < 10000) {
bool windowDirty = false;
foreach (QQuickItem *item, allItems()) { foreach (QQuickItem *item, allItems()) {
if (item) { 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)) if (DesignerSupport::isDirty(item, DesignerSupport::ContentUpdateMask))
m_dirtyInstanceSet.insert(instanceForObject(item)); m_dirtyInstanceSet.insert(instanceForObject(item));
} else if (DesignerSupport::isDirty(item, DesignerSupport::AllMask)) { } else if (DesignerSupport::isDirty(item, DesignerSupport::AllMask)) {
ServerNodeInstance ancestorInstance = findNodeInstanceForItem(item->parentItem()); ServerNodeInstance ancestorInstance = findNodeInstanceForItem(item->parentItem());
if (ancestorInstance.isValid()) if (ancestorInstance.isValid())
m_dirtyInstanceSet.insert(ancestorInstance); m_dirtyInstanceSet.insert(ancestorInstance);
}
Internal::QuickItemNodeInstance::updateDirtyNode(item);
} }
Internal::QuickItemNodeInstance::updateDirtyNode(item);
} }
} }
@@ -97,7 +105,8 @@ void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands()
/* QQuickItem::grabToImage render path */ /* QQuickItem::grabToImage render path */
/* TODO implement QQuickItem::grabToImage based rendering */ /* TODO implement QQuickItem::grabToImage based rendering */
/* sheduleRootItemRender(); */ /* sheduleRootItemRender(); */
nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand({rootNodeInstance()})); if (windowDirty)
nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand({rootNodeInstance()}));
} else { } else {
if (!m_dirtyInstanceSet.isEmpty()) { if (!m_dirtyInstanceSet.isEmpty()) {
nodeInstanceClient()->pixmapChanged( nodeInstanceClient()->pixmapChanged(

View File

@@ -281,6 +281,12 @@ SecondColumnLayout {
T.Popup { T.Popup {
id: cePopup id: cePopup
WheelHandler {
onWheel: function(event) {
Controller.mainScrollView.flick(0, event.angleDelta.y * 5)
}
}
onOpened: { onOpened: {
if (Controller.mainScrollView === null) if (Controller.mainScrollView === null)
return return

View File

@@ -61,7 +61,7 @@ Item {
extendedFunctionButton.color = StudioTheme.Values.themeInteraction extendedFunctionButton.color = StudioTheme.Values.themeInteraction
} }
} else { } else {
if (backendValue.complexNode !== null if (backendValue.complexNode !== undefined
&& backendValue.complexNode.exists) { && backendValue.complexNode.exists) {
} else { } else {

View File

@@ -42,7 +42,7 @@ Item {
function updatePos() { function updatePos() {
if (root.maximum > root.minimum) { if (root.maximum > root.minimum) {
var pos = (track.width - handle.width) * (root.value - root.minimum) / (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 { } else {
return 0 return 0
} }
@@ -74,20 +74,24 @@ Item {
Rectangle { Rectangle {
id: handle id: handle
width: StudioTheme.Values.hueSliderHandleWidth width: StudioTheme.Values.hueSliderHandleWidth
height: track.height height: track.height - 4
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
smooth: true smooth: true
opacity: 0.9 color: "transparent"
radius: 2 radius: 2
border.color: "black" border.color: "black"
border.width: 1 border.width: 1
x: root.updatePos() x: root.updatePos()
y: 2
z: 1 z: 1
gradient: Gradient { Rectangle {
GradientStop {color: "#2c2c2c" ; position: 0} anchors.fill: parent
GradientStop {color: "#343434" ; position: 0.15} anchors.margins: 1
GradientStop {color: "#373737" ; position: 1.0} color: "transparent"
radius: 1
border.color: "white"
border.width: 1
} }
} }

View File

@@ -43,7 +43,7 @@ Item {
function updatePos() { function updatePos() {
if (root.maximum > root.minimum) { if (root.maximum > root.minimum) {
var pos = (track.width - handle.width) * (root.value - root.minimum) / (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 { } else {
return 0 return 0
} }
@@ -77,20 +77,24 @@ Item {
Rectangle { Rectangle {
id: handle id: handle
width: StudioTheme.Values.hueSliderHandleWidth width: StudioTheme.Values.hueSliderHandleWidth
height: track.height height: track.height - 4
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
smooth: true smooth: true
opacity: 0.9 color: "transparent"
radius: 2 radius: 2
border.color: "black" border.color: "black"
border.width: 1 border.width: 1
x: root.updatePos() x: root.updatePos()
y: 2
z: 1 z: 1
gradient: Gradient { Rectangle {
GradientStop {color: "#2c2c2c" ; position: 0} anchors.fill: parent
GradientStop {color: "#343434" ; position: 0.15} anchors.margins: 1
GradientStop {color: "#373737" ; position: 1.0} color: "transparent"
radius: 1
border.color: "white"
border.width: 1
} }
} }

View File

@@ -214,8 +214,10 @@ TextInput {
} }
onWheel: function(wheel) { onWheel: function(wheel) {
if (!myControl.__wheelEnabled) if (!myControl.__wheelEnabled) {
wheel.accepted = false
return return
}
// Set stepSize according to used modifier key // Set stepSize according to used modifier key
if (wheel.modifiers & Qt.ControlModifier) if (wheel.modifiers & Qt.ControlModifier)

View File

@@ -4,10 +4,10 @@ project(%{TestCaseName} LANGUAGES CXX)
@if "%{TestFrameWork}" == "QtTest" @if "%{TestFrameWork}" == "QtTest"
@if "%{RequireGUI}" == "true" @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) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui Test REQUIRED)
@else @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) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Test REQUIRED)
@endif @endif
@@ -32,7 +32,7 @@ target_link_libraries(%{TestCaseName} PRIVATE Qt${QT_VERSION_MAJOR}::Test)
@endif @endif
@if "%{TestFrameWork}" == "QtQuickTest" @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) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS QuickTest REQUIRED)
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -123,7 +123,7 @@ endif ()
SET(CMAKE_CXX_STANDARD 11) SET(CMAKE_CXX_STANDARD 11)
@if "%{Catch2NeedsQt}" == "true" @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) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui REQUIRED)
@endif @endif

View File

@@ -88,9 +88,8 @@ void FileInProjectFinder::setProjectDirectory(const FilePath &absoluteProjectPat
if (absoluteProjectPath == m_projectDir) if (absoluteProjectPath == m_projectDir)
return; return;
const QFileInfo infoPath = absoluteProjectPath.toFileInfo();
QTC_CHECK(absoluteProjectPath.isEmpty() QTC_CHECK(absoluteProjectPath.isEmpty()
|| (infoPath.exists() && infoPath.isAbsolute())); || (absoluteProjectPath.exists() && absoluteProjectPath.isAbsolutePath()));
m_projectDir = absoluteProjectPath; m_projectDir = absoluteProjectPath;
m_cache.clear(); m_cache.clear();

View File

@@ -388,8 +388,6 @@ bool FilePath::isRelativePath() const
FilePath FilePath::resolvePath(const QString &fileName) const FilePath FilePath::resolvePath(const QString &fileName) const
{ {
if (fileName.isEmpty())
return {}; // FIXME: Isn't this odd?
if (FileUtils::isAbsolutePath(fileName)) if (FileUtils::isAbsolutePath(fileName))
return FilePath::fromString(QDir::cleanPath(fileName)); return FilePath::fromString(QDir::cleanPath(fileName));
return FilePath::fromString(QDir::cleanPath(toString() + QLatin1Char('/') + fileName)); return FilePath::fromString(QDir::cleanPath(toString() + QLatin1Char('/') + fileName));

View File

@@ -582,7 +582,7 @@ bool PathChooser::validatePath(FancyLineEdit *edit, QString *errorMessage) const
} }
break; break;
case PathChooser::Directory: case PathChooser::Directory:
if (filePath.isDir()) { if (filePath.exists() && !filePath.isDir()) {
if (errorMessage) if (errorMessage)
*errorMessage = tr("The path \"%1\" is not a directory.").arg(filePath.toUserOutput()); *errorMessage = tr("The path \"%1\" is not a directory.").arg(filePath.toUserOutput());
return false; return false;

View File

@@ -42,7 +42,7 @@ Utils::FilePath TestOutputReader::constructSourceFilePath(const Utils::FilePath
const QString &file) const QString &file)
{ {
const Utils::FilePath filePath = path.resolvePath(file); const Utils::FilePath filePath = path.resolvePath(file);
return filePath.exists() ? filePath : Utils::FilePath(); return filePath.isReadableFile() ? filePath : Utils::FilePath();
} }
TestOutputReader::TestOutputReader(const QFutureInterface<TestResultPtr> &futureInterface, TestOutputReader::TestOutputReader(const QFutureInterface<TestResultPtr> &futureInterface,

View File

@@ -277,9 +277,10 @@ void CMakeKitAspect::setup(Kit *k)
return; return;
// Look for a suitable auto-detected one: // Look for a suitable auto-detected one:
const QString id = k->autoDetectionSource(); const QString kitSource = k->autoDetectionSource();
for (CMakeTool *tool : CMakeToolManager::cmakeTools()) { for (CMakeTool *tool : CMakeToolManager::cmakeTools()) {
if (tool->detectionSource() == id) { const QString toolSource = tool->detectionSource();
if (!toolSource.isEmpty() && toolSource == kitSource) {
setCMakeTool(k, tool->id()); setCMakeTool(k, tool->id());
return; return;
} }
@@ -1043,8 +1044,6 @@ CMakeConfig CMakeConfigurationKitAspect::defaultConfiguration(const Kit *k)
QVariant CMakeConfigurationKitAspect::defaultValue(const Kit *k) const QVariant CMakeConfigurationKitAspect::defaultValue(const Kit *k) const
{ {
Q_UNUSED(k)
// FIXME: Convert preload scripts // FIXME: Convert preload scripts
CMakeConfig config = defaultConfiguration(k); CMakeConfig config = defaultConfiguration(k);
const QStringList tmp const QStringList tmp

View File

@@ -110,6 +110,7 @@ public:
, m_executable(item->filePath()) , m_executable(item->filePath())
, m_qchFile(item->qchFilePath()) , m_qchFile(item->qchFilePath())
, m_versionDisplay(item->versionDisplay()) , m_versionDisplay(item->versionDisplay())
, m_detectionSource(item->detectionSource())
, m_isAutoRun(item->isAutoRun()) , m_isAutoRun(item->isAutoRun())
, m_autodetected(item->isAutoDetected()) , m_autodetected(item->isAutoDetected())
, m_isSupported(item->hasFileApi()) , m_isSupported(item->hasFileApi())
@@ -145,9 +146,10 @@ public:
cmake.setFilePath(m_executable); cmake.setFilePath(m_executable);
m_isSupported = cmake.hasFileApi(); m_isSupported = cmake.hasFileApi();
m_tooltip = tr("Version: %1<br>Supports fileApi: %2") m_tooltip = tr("Version: %1").arg(cmake.versionDisplay());
.arg(cmake.versionDisplay()) m_tooltip += "<br>" + tr("Supports fileApi: %1").arg(m_isSupported ? tr("yes") : tr("no"));
.arg(cmake.hasFileApi() ? tr("yes") : tr("no")); m_tooltip += "<br>" + tr("Detection source: \"%1\"").arg(m_detectionSource);
m_versionDisplay = cmake.versionDisplay(); m_versionDisplay = cmake.versionDisplay();
} }
@@ -223,6 +225,7 @@ public:
FilePath m_executable; FilePath m_executable;
FilePath m_qchFile; FilePath m_qchFile;
QString m_versionDisplay; QString m_versionDisplay;
QString m_detectionSource;
bool m_isAutoRun = true; bool m_isAutoRun = true;
bool m_pathExists = false; bool m_pathExists = false;
bool m_pathIsFile = false; bool m_pathIsFile = false;
@@ -362,6 +365,7 @@ void CMakeToolItemModel::apply()
cmake->setDisplayName(item->m_name); cmake->setDisplayName(item->m_name);
cmake->setFilePath(item->m_executable); cmake->setFilePath(item->m_executable);
cmake->setQchFilePath(item->m_qchFile); cmake->setQchFilePath(item->m_qchFile);
cmake->setDetectionSource(item->m_detectionSource);
cmake->setAutorun(item->m_isAutoRun); cmake->setAutorun(item->m_isAutoRun);
} else { } else {
toRegister.append(item); toRegister.append(item);
@@ -375,6 +379,7 @@ void CMakeToolItemModel::apply()
cmake->setDisplayName(item->m_name); cmake->setDisplayName(item->m_name);
cmake->setFilePath(item->m_executable); cmake->setFilePath(item->m_executable);
cmake->setQchFilePath(item->m_qchFile); cmake->setQchFilePath(item->m_qchFile);
cmake->setDetectionSource(item->m_detectionSource);
if (!CMakeToolManager::registerCMakeTool(std::move(cmake))) if (!CMakeToolManager::registerCMakeTool(std::move(cmake)))
item->m_changed = true; item->m_changed = true;
} }

View File

@@ -53,6 +53,7 @@ const char CMAKE_INFORMATION_QCH_FILE_PATH[] = "QchFile";
// obsolete since Qt Creator 5. Kept for backward compatibility // obsolete since Qt Creator 5. Kept for backward compatibility
const char CMAKE_INFORMATION_AUTO_CREATE_BUILD_DIRECTORY[] = "AutoCreateBuildDirectory"; const char CMAKE_INFORMATION_AUTO_CREATE_BUILD_DIRECTORY[] = "AutoCreateBuildDirectory";
const char CMAKE_INFORMATION_AUTODETECTED[] = "AutoDetected"; const char CMAKE_INFORMATION_AUTODETECTED[] = "AutoDetected";
const char CMAKE_INFORMATION_DETECTIONSOURCE[] = "DetectionSource";
const char CMAKE_INFORMATION_READERTYPE[] = "ReaderType"; const char CMAKE_INFORMATION_READERTYPE[] = "ReaderType";
bool CMakeTool::Generator::matches(const QString &n, const QString &ex) const 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 //loading a CMakeTool from SDK is always autodetection
if (!fromSdk) if (!fromSdk)
m_isAutoDetected = map.value(CMAKE_INFORMATION_AUTODETECTED, false).toBool(); 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())); setFilePath(FilePath::fromString(map.value(CMAKE_INFORMATION_COMMAND).toString()));
@@ -209,6 +211,7 @@ QVariantMap CMakeTool::toMap() const
data.insert(CMAKE_INFORMATION_READERTYPE, data.insert(CMAKE_INFORMATION_READERTYPE,
Internal::readerTypeToString(m_readerType.value())); Internal::readerTypeToString(m_readerType.value()));
data.insert(CMAKE_INFORMATION_AUTODETECTED, m_isAutoDetected); data.insert(CMAKE_INFORMATION_AUTODETECTED, m_isAutoDetected);
data.insert(CMAKE_INFORMATION_DETECTIONSOURCE, m_detectionSource);
return data; return data;
} }

View File

@@ -122,6 +122,8 @@ private:
void fetchFromCapabilities() const; void fetchFromCapabilities() const;
void parseFromCapabilities(const QString &input) 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; Utils::Id m_id;
QString m_displayName; QString m_displayName;
Utils::FilePath m_executable; Utils::FilePath m_executable;

View File

@@ -184,14 +184,14 @@ void CMakeToolManager::autoDetectCMakeForDevice(const FilePath &deviceRoot,
const QString &detectionSource, const QString &detectionSource,
QString *logMessage) QString *logMessage)
{ {
QStringList messages; QStringList messages{tr("Searching CMake binaries...")};
const FilePaths candidates = {FilePath::fromString("cmake").onDevice(deviceRoot)}; const FilePaths candidates = {FilePath::fromString("cmake").onDevice(deviceRoot)};
const Environment env = deviceRoot.deviceEnvironment(); const Environment env = deviceRoot.deviceEnvironment();
for (const FilePath &candidate : candidates) { for (const FilePath &candidate : candidates) {
const FilePath cmake = candidate.searchOnDevice(env.path()); const FilePath cmake = candidate.searchOnDevice(env.path());
if (!cmake.isEmpty()) { if (!cmake.isEmpty()) {
registerCMakeByPath(cmake, detectionSource); registerCMakeByPath(cmake, detectionSource);
messages.append(tr("Found CMake binary: %1").arg(cmake.toUserOutput())); messages.append(tr("Found \"%1\"").arg(cmake.toUserOutput()));
} }
} }
if (logMessage) if (logMessage)
@@ -209,11 +209,28 @@ void CMakeToolManager::registerCMakeByPath(const FilePath &cmakePath, const QStr
auto newTool = std::make_unique<CMakeTool>(CMakeTool::ManualDetection, id); auto newTool = std::make_unique<CMakeTool>(CMakeTool::ManualDetection, id);
newTool->setFilePath(cmakePath); newTool->setFilePath(cmakePath);
newTool->setDisplayName(cmakePath.toUserOutput());
newTool->setDetectionSource(detectionSource); newTool->setDetectionSource(detectionSource);
newTool->setDisplayName(cmakePath.toUserOutput());
registerCMakeTool(std::move(newTool)); 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) void CMakeToolManager::notifyAboutUpdate(CMakeTool *tool)
{ {
if (!tool || !Utils::contains(d->m_cmakeTools, tool)) if (!tool || !Utils::contains(d->m_cmakeTools, tool))

View File

@@ -68,6 +68,7 @@ public slots:
QString *logMessage); QString *logMessage);
void registerCMakeByPath(const Utils::FilePath &cmakePath, void registerCMakeByPath(const Utils::FilePath &cmakePath,
const QString &detectionSource); const QString &detectionSource);
void removeDetectedCMake(const QString &detectionSource, QString *logMessage);
signals: signals:
void cmakeAdded (const Utils::Id &id); void cmakeAdded (const Utils::Id &id);

View File

@@ -211,9 +211,9 @@ void CMakeToolSettingsAccessor::saveCMakeTools(const QList<CMakeTool *> &cmakeTo
int count = 0; int count = 0;
for (const CMakeTool *item : cmakeTools) { 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(); QVariantMap tmp = item->toMap();
if (tmp.isEmpty()) if (tmp.isEmpty())
continue; continue;
@@ -239,7 +239,7 @@ CMakeToolSettingsAccessor::cmakeTools(const QVariantMap &data, bool fromSdk) con
const QVariantMap dbMap = data.value(key).toMap(); const QVariantMap dbMap = data.value(key).toMap();
auto item = std::make_unique<CMakeTool>(dbMap, fromSdk); auto item = std::make_unique<CMakeTool>(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.") qWarning() << QString::fromLatin1("CMakeTool \"%1\" (%2) dropped since the command is not executable.")
.arg(item->cmakeExecutable().toUserOutput(), item->id().toString()); .arg(item->cmakeExecutable().toUserOutput(), item->id().toString());
continue; continue;

View File

@@ -92,7 +92,9 @@ public:
QVariant registerDebugger(const DebuggerItem &item); QVariant registerDebugger(const DebuggerItem &item);
void readDebuggers(const FilePath &fileName, bool isSystem); void readDebuggers(const FilePath &fileName, bool isSystem);
void autoDetectCdbDebuggers(); void autoDetectCdbDebuggers();
void autoDetectGdbOrLldbDebuggers(const FilePath &deviceRoot, const QString &detectionSource); void autoDetectGdbOrLldbDebuggers(const FilePath &deviceRoot,
const QString &detectionSource,
QString *logMessage = nullptr);
void autoDetectUvscDebuggers(); void autoDetectUvscDebuggers();
QString uniqueDisplayName(const QString &base); QString uniqueDisplayName(const QString &base);
@@ -715,7 +717,8 @@ static Utils::FilePaths searchGdbPathsFromRegistry()
} }
void DebuggerItemManagerPrivate::autoDetectGdbOrLldbDebuggers(const FilePath &deviceRoot, 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", const QStringList filters = {"gdb-i686-pc-mingw32", "gdb-i686-pc-mingw32.exe", "gdb",
"gdb.exe", "lldb", "lldb.exe", "lldb-[1-9]*", "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)); suspects.append(device->directoryEntries(globalPath, filters, QDir::Files | QDir::Executable));
} }
QStringList logMessages{tr("Searching debuggers...")};
for (const FilePath &command : qAsConst(suspects)) { for (const FilePath &command : qAsConst(suspects)) {
const auto commandMatches = [command](const DebuggerTreeItem *titem) { const auto commandMatches = [command](const DebuggerTreeItem *titem) {
return titem->m_item.command() == command; 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"); const QString name = detectionSource.isEmpty() ? tr("System %1 at %2") : tr("Detected %1 at %2");
item.setUnexpandedDisplayName(name.arg(item.engineTypeName()).arg(command.toUserOutput())); item.setUnexpandedDisplayName(name.arg(item.engineTypeName()).arg(command.toUserOutput()));
m_model->addDebugger(item); m_model->addDebugger(item);
logMessages.append(tr("Found: \"%1\"").arg(name));
} }
if (logMessage)
*logMessage = logMessages.join('\n');
} }
void DebuggerItemManagerPrivate::autoDetectUvscDebuggers() void DebuggerItemManagerPrivate::autoDetectUvscDebuggers()
@@ -1030,9 +1037,31 @@ void DebuggerItemManager::deregisterDebugger(const QVariant &id)
} }
void DebuggerItemManager::autoDetectDebuggersForDevice(const FilePath &deviceRoot, 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 } // namespace Debugger

View File

@@ -53,7 +53,9 @@ public:
static void deregisterDebugger(const QVariant &id); static void deregisterDebugger(const QVariant &id);
static void autoDetectDebuggersForDevice(const Utils::FilePath &deviceRoot, 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 *findByCommand(const Utils::FilePath &command);
static const DebuggerItem *findById(const QVariant &id); static const DebuggerItem *findById(const QVariant &id);

View File

@@ -724,6 +724,7 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments)
{ {
qRegisterMetaType<ContextData>("ContextData"); qRegisterMetaType<ContextData>("ContextData");
qRegisterMetaType<DebuggerRunParameters>("DebuggerRunParameters"); qRegisterMetaType<DebuggerRunParameters>("DebuggerRunParameters");
qRegisterMetaType<QString *>();
// Menu groups // Menu groups
ActionContainer *mstart = ActionManager::actionContainer(PE::M_DEBUG_STARTDEBUGGING); ActionContainer *mstart = ActionManager::actionContainer(PE::M_DEBUG_STARTDEBUGGING);
@@ -1747,9 +1748,15 @@ void DebuggerPlugin::getEnginesState(QByteArray *json) const
} }
void DebuggerPlugin::autoDetectDebuggersForDevice(const FilePath &deviceRoot, 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() void DebuggerPluginPrivate::attachToQmlPort()

View File

@@ -59,10 +59,15 @@ private:
Q_SLOT void getEnginesState(QByteArray *json) const; Q_SLOT void getEnginesState(QByteArray *json) const;
// Called from DockerDevice // 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<QObject *> createTestObjects() const override; QVector<QObject *> createTestObjects() const override;
}; };
} // namespace Internal } // namespace Internal
} // namespace Debugger } // namespace Debugger
Q_DECLARE_METATYPE(QString *)

View File

@@ -471,26 +471,54 @@ DockerDeviceData &DockerDevice::data()
void KitDetectorPrivate::undoAutoDetect() const 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()) { for (Kit *kit : KitManager::kits()) {
if (kit->autoDetectionSource() == m_sharedId) { 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); KitManager::deregisterKit(kit);
} }
}; };
emit q->logOutput('\n' + tr("Removing Qt version entries..."));
for (BaseQtVersion *qtVersion : QtVersionManager::versions()) { for (BaseQtVersion *qtVersion : QtVersionManager::versions()) {
if (qtVersion->autodetectionSource() == m_sharedId) { if (qtVersion->detectionSource() == m_sharedId) {
emit q->logOutput(tr("Removing Qt version: %1").arg(qtVersion->displayName())); emit q->logOutput(tr("Removed \"%1\"").arg(qtVersion->displayName()));
QtVersionManager::removeVersion(qtVersion); QtVersionManager::removeVersion(qtVersion);
} }
}; };
emit q->logOutput(tr("Tool chains not removed.")); emit q->logOutput('\n' + tr("Removing toolchain entries..."));
// for (ToolChain *toolChain : ToolChainManager::toolChains()) { for (ToolChain *toolChain : ToolChainManager::toolChains()) {
// if (toolChain->autoDetectionSource() == id.toString()) QString detectionSource = toolChain->detectionSource();
// // FIXME: Implement 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<BaseQtVersion *> KitDetectorPrivate::autoDetectQtVersions() const QList<BaseQtVersion *> KitDetectorPrivate::autoDetectQtVersions() const
@@ -510,7 +538,7 @@ QList<BaseQtVersion *> KitDetectorPrivate::autoDetectQtVersions() const
continue; continue;
qtVersions.append(qtVersion); qtVersions.append(qtVersion);
QtVersionManager::addVersion(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()) if (qtVersions.isEmpty())
emit q->logOutput(tr("No Qt installation found.")); emit q->logOutput(tr("No Qt installation found."));
@@ -521,21 +549,24 @@ QList<ToolChain *> KitDetectorPrivate::autoDetectToolChains()
{ {
const QList<ToolChainFactory *> factories = ToolChainFactory::allToolChainFactories(); const QList<ToolChainFactory *> factories = ToolChainFactory::allToolChainFactories();
QList<ToolChain *> toolChains; QList<ToolChain *> alreadyKnown = ToolChainManager::toolChains();
QList<ToolChain *> allNewToolChains;
QApplication::processEvents(); QApplication::processEvents();
emit q->logOutput('\n' + tr("Searching tool chains...")); emit q->logOutput('\n' + tr("Searching toolchains..."));
for (ToolChainFactory *factory : factories) { for (ToolChainFactory *factory : factories) {
const QList<ToolChain *> newToolChains = factory->autoDetect(toolChains, m_device.constCast<IDevice>()); emit q->logOutput(tr("Searching toolchains of type %1").arg(factory->displayName()));
emit q->logOutput(tr("Searching tool chains of type %1").arg(factory->displayName())); const QList<ToolChain *> newToolChains = factory->autoDetect(alreadyKnown, m_device.constCast<IDevice>());
for (ToolChain *toolChain : newToolChains) { 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); 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() void KitDetectorPrivate::autoDetectCMake()
@@ -544,16 +575,15 @@ void KitDetectorPrivate::autoDetectCMake()
if (!cmakeManager) if (!cmakeManager)
return; return;
emit q->logOutput('\n' + tr("Searching CMake binary..."));
const FilePath deviceRoot = m_device->mapToGlobalPath({}); const FilePath deviceRoot = m_device->mapToGlobalPath({});
QString error; QString logMessage;
const bool res = QMetaObject::invokeMethod(cmakeManager, const bool res = QMetaObject::invokeMethod(cmakeManager,
"autoDetectCMakeForDevice", "autoDetectCMakeForDevice",
Q_ARG(Utils::FilePath, deviceRoot), Q_ARG(Utils::FilePath, deviceRoot),
Q_ARG(QString, m_sharedId), Q_ARG(QString, m_sharedId),
Q_ARG(QString *, &error)); Q_ARG(QString *, &logMessage));
QTC_CHECK(res); QTC_CHECK(res);
emit q->logOutput(error); emit q->logOutput('\n' + logMessage);
} }
void KitDetectorPrivate::autoDetectDebugger() void KitDetectorPrivate::autoDetectDebugger()
@@ -562,13 +592,15 @@ void KitDetectorPrivate::autoDetectDebugger()
if (!debuggerPlugin) if (!debuggerPlugin)
return; return;
emit q->logOutput('\n' + tr("Searching debuggers..."));
const FilePath deviceRoot = m_device->mapToGlobalPath({}); const FilePath deviceRoot = m_device->mapToGlobalPath({});
QString logMessage;
const bool res = QMetaObject::invokeMethod(debuggerPlugin, const bool res = QMetaObject::invokeMethod(debuggerPlugin,
"autoDetectDebuggersForDevice", "autoDetectDebuggersForDevice",
Q_ARG(Utils::FilePath, deviceRoot), Q_ARG(Utils::FilePath, deviceRoot),
Q_ARG(QString, m_sharedId)); Q_ARG(QString, m_sharedId),
Q_ARG(QString *, &logMessage));
QTC_CHECK(res); QTC_CHECK(res);
emit q->logOutput('\n' + logMessage);
} }
void KitDetectorPrivate::autoDetect() void KitDetectorPrivate::autoDetect()
@@ -715,6 +747,15 @@ void DockerDevicePrivate::tryCreateLocalFileAccess()
.arg(m_container, m_mergedDir) .arg(m_container, m_mergedDir)
+ '\n' + tr("Output: '%1'").arg(out) + '\n' + tr("Output: '%1'").arg(out)
+ '\n' + tr("Error: '%1'").arg(proc.stdErr())); + '\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); m_mergedDirWatcher.addPath(m_mergedDir);

View File

@@ -137,21 +137,28 @@ void LanguageClientManager::clientFinished(Client *client)
constexpr int restartTimeoutS = 5; constexpr int restartTimeoutS = 5;
const bool unexpectedFinish = client->state() != Client::Shutdown const bool unexpectedFinish = client->state() != Client::Shutdown
&& client->state() != Client::ShutdownRequested; && client->state() != Client::ShutdownRequested;
if (unexpectedFinish && !managerInstance->m_shuttingDown && client->reset()) {
client->disconnect(managerInstance); if (unexpectedFinish) {
client->log(tr("Unexpectedly finished. Restarting in %1 seconds.").arg(restartTimeoutS)); if (!managerInstance->m_shuttingDown) {
QTimer::singleShot(restartTimeoutS * 1000, client, [client]() { client->start(); }); const QList<TextEditor::TextDocument *> &clientDocs
for (TextEditor::TextDocument *document : managerInstance->m_clientForDocument.keys(client)) = managerInstance->m_clientForDocument.keys(client);
client->deactivateDocument(document); if (client->reset()) {
} else { client->disconnect(managerInstance);
if (unexpectedFinish && !managerInstance->m_shuttingDown) 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.")); client->log(tr("Unexpectedly finished."));
for (TextEditor::TextDocument *document : managerInstance->m_clientForDocument.keys(client)) for (TextEditor::TextDocument *document : clientDocs)
managerInstance->m_clientForDocument.remove(document); managerInstance->m_clientForDocument.remove(document);
deleteClient(client); }
if (managerInstance->m_shuttingDown && managerInstance->m_clients.isEmpty())
emit managerInstance->shutdownFinished();
} }
deleteClient(client);
if (managerInstance->m_shuttingDown && managerInstance->m_clients.isEmpty())
emit managerInstance->shutdownFinished();
} }
Client *LanguageClientManager::startClient(BaseSettings *setting, ProjectExplorer::Project *project) Client *LanguageClientManager::startClient(BaseSettings *setting, ProjectExplorer::Project *project)
@@ -193,6 +200,10 @@ void LanguageClientManager::shutdownClient(Client *client)
{ {
if (!client) if (!client)
return; 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()) if (client->reachable())
client->shutdown(); client->shutdown();
else if (client->state() != Client::Shutdown && client->state() != Client::ShutdownRequested) else if (client->state() != Client::Shutdown && client->state() != Client::ShutdownRequested)

View File

@@ -538,7 +538,7 @@ MessageId LspLogMessage::id() const
QString LspLogMessage::displayText() const QString LspLogMessage::displayText() const
{ {
if (!m_displayText.has_value()) { 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()) if (message.mimeType == JsonRpcMessageHandler::jsonRpcMimeType())
m_displayText->append(json().value(QString{methodKey}).toString(id().toString())); m_displayText->append(json().value(QString{methodKey}).toString(id().toString()));
else else

View File

@@ -851,7 +851,7 @@ bool Project::isKnownFile(const Utils::FilePath &filename) const
} }
const Node *Project::nodeForFilePath(const Utils::FilePath &filePath, const Node *Project::nodeForFilePath(const Utils::FilePath &filePath,
const Project::NodeMatcher &extraMatcher) const Project::NodeMatcher &extraMatcher) const
{ {
const FileNode dummy(filePath, FileType::Unknown); const FileNode dummy(filePath, FileType::Unknown);
const auto range = std::equal_range(d->m_sortedNodeList.cbegin(), d->m_sortedNodeList.cend(), const auto range = std::equal_range(d->m_sortedNodeList.cbegin(), d->m_sortedNodeList.cend(),

View File

@@ -128,7 +128,7 @@ public:
Utils::FilePaths files(const NodeMatcher &matcher) const; Utils::FilePaths files(const NodeMatcher &matcher) const;
bool isKnownFile(const Utils::FilePath &filename) const; bool isKnownFile(const Utils::FilePath &filename) const;
const Node *nodeForFilePath(const Utils::FilePath &filePath, const Node *nodeForFilePath(const Utils::FilePath &filePath,
const NodeMatcher &extraMatcher = {}); const NodeMatcher &extraMatcher = {}) const;
virtual QVariantMap toMap() const; virtual QVariantMap toMap() const;

View File

@@ -458,15 +458,14 @@ Node *ProjectTree::nodeForFile(const FilePath &fileName)
{ {
Node *node = nullptr; Node *node = nullptr;
for (const Project *project : SessionManager::projects()) { for (const Project *project : SessionManager::projects()) {
if (ProjectNode *projectNode = project->rootProjectNode()) { project->nodeForFilePath(fileName, [&](const Node *n) {
projectNode->forEachGenericNode([&](Node *n) { if (!node || (!node->asFileNode() && n->asFileNode()))
if (n->filePath() == fileName) { node = const_cast<Node *>(n);
// prefer file nodes return false;
if (!node || (!node->asFileNode() && n->asFileNode())) });
node = n; // early return:
} if (node && node->asFileNode())
}); return node;
}
} }
return node; return node;
} }

View File

@@ -78,7 +78,7 @@ namespace QtSupport {
namespace Internal { namespace Internal {
const char QTVERSIONAUTODETECTED[] = "isAutodetected"; const char QTVERSIONAUTODETECTED[] = "isAutodetected";
const char QTVERSIONAUTODETECTIONSOURCE[] = "autodetectionSource"; const char QTVERSIONDETECTIONSOURCE[] = "autodetectionSource";
const char QTVERSION_OVERRIDE_FEATURES[] = "overrideFeatures"; const char QTVERSION_OVERRIDE_FEATURES[] = "overrideFeatures";
const char QTVERSIONQMAKEPATH[] = "QMakePath"; const char QTVERSIONQMAKEPATH[] = "QMakePath";
const char QTVERSIONSOURCEPATH[] = "SourcePath"; const char QTVERSIONSOURCEPATH[] = "SourcePath";
@@ -223,7 +223,7 @@ public:
bool m_versionInfoUpToDate = false; bool m_versionInfoUpToDate = false;
bool m_qmakeIsExecutable = true; bool m_qmakeIsExecutable = true;
QString m_autodetectionSource; QString m_detectionSource;
QSet<Utils::Id> m_overrideFeatures; QSet<Utils::Id> m_overrideFeatures;
FilePath m_mkspec; FilePath m_mkspec;
@@ -368,7 +368,7 @@ QString BaseQtVersion::defaultUnexpandedDisplayName() const
} while (!dir.isRoot() && dir.cdUp()); } 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} in PATH (%2)").arg(location) :
QCoreApplication::translate("QtVersion", "Qt %{Qt:Version} (%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_id = QtVersionManager::getUniqueId();
d->m_data.unexpandedDisplayName.fromMap(map, Constants::QTVERSIONNAME); d->m_data.unexpandedDisplayName.fromMap(map, Constants::QTVERSIONNAME);
d->m_isAutodetected = map.value(QTVERSIONAUTODETECTED).toBool(); 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_overrideFeatures = Utils::Id::fromStringList(map.value(QTVERSION_OVERRIDE_FEATURES).toStringList());
d->m_qmakeCommand = FilePath::fromVariant(map.value(QTVERSIONQMAKEPATH)); d->m_qmakeCommand = FilePath::fromVariant(map.value(QTVERSIONQMAKEPATH));
@@ -765,7 +765,7 @@ QVariantMap BaseQtVersion::toMap() const
d->m_data.unexpandedDisplayName.toMap(result, Constants::QTVERSIONNAME); d->m_data.unexpandedDisplayName.toMap(result, Constants::QTVERSIONNAME);
result.insert(QTVERSIONAUTODETECTED, isAutodetected()); result.insert(QTVERSIONAUTODETECTED, isAutodetected());
result.insert(QTVERSIONAUTODETECTIONSOURCE, autodetectionSource()); result.insert(QTVERSIONDETECTIONSOURCE, detectionSource());
if (!d->m_overrideFeatures.isEmpty()) if (!d->m_overrideFeatures.isEmpty())
result.insert(QTVERSION_OVERRIDE_FEATURES, Utils::Id::toStringList(d->m_overrideFeatures)); result.insert(QTVERSION_OVERRIDE_FEATURES, Utils::Id::toStringList(d->m_overrideFeatures));
@@ -885,9 +885,9 @@ bool BaseQtVersion::isAutodetected() const
return d->m_isAutodetected; return d->m_isAutodetected;
} }
QString BaseQtVersion::autodetectionSource() const QString BaseQtVersion::detectionSource() const
{ {
return d->m_autodetectionSource; return d->m_detectionSource;
} }
QString BaseQtVersion::displayName() const QString BaseQtVersion::displayName() const
@@ -2316,7 +2316,7 @@ void BaseQtVersion::resetCache() const
static QList<QtVersionFactory *> g_qtVersionFactories; static QList<QtVersionFactory *> g_qtVersionFactories;
BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath
(const FilePath &qmakePath, bool isAutoDetected, const QString &autoDetectionSource, QString *error) (const FilePath &qmakePath, bool isAutoDetected, const QString &detectionSource, QString *error)
{ {
QHash<ProKey, ProString> versionInfo; QHash<ProKey, ProString> versionInfo;
const Environment env = qmakePath.deviceEnvironment(); const Environment env = qmakePath.deviceEnvironment();
@@ -2353,7 +2353,7 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath
ver->d->m_id = QtVersionManager::getUniqueId(); ver->d->m_id = QtVersionManager::getUniqueId();
QTC_CHECK(ver->d->m_qmakeCommand.isEmpty()); // Should only be used once. QTC_CHECK(ver->d->m_qmakeCommand.isEmpty()); // Should only be used once.
ver->d->m_qmakeCommand = qmakePath; ver->d->m_qmakeCommand = qmakePath;
ver->d->m_autodetectionSource = autoDetectionSource; ver->d->m_detectionSource = detectionSource;
ver->d->m_isAutodetected = isAutoDetected; ver->d->m_isAutodetected = isAutoDetected;
ver->updateDefaultDisplayName(); ver->updateDefaultDisplayName();
ProFileCacheManager::instance()->decRefCount(); ProFileCacheManager::instance()->decRefCount();

View File

@@ -98,7 +98,7 @@ public:
virtual bool equals(BaseQtVersion *other); virtual bool equals(BaseQtVersion *other);
bool isAutodetected() const; bool isAutodetected() const;
QString autodetectionSource() const; QString detectionSource() const;
QString displayName() const; QString displayName() const;
QString unexpandedDisplayName() const; QString unexpandedDisplayName() const;

View File

@@ -184,7 +184,7 @@ void QtKitAspect::setup(Kit *k)
const QList<BaseQtVersion *> &candidates = !exactMatches.empty() ? exactMatches : matches; const QList<BaseQtVersion *> &candidates = !exactMatches.empty() ? exactMatches : matches;
BaseQtVersion * const qtFromPath = QtVersionManager::version( BaseQtVersion * const qtFromPath = QtVersionManager::version(
equal(&BaseQtVersion::autodetectionSource, QString::fromLatin1("PATH"))); equal(&BaseQtVersion::detectionSource, QString::fromLatin1("PATH")));
if (qtFromPath && candidates.contains(qtFromPath)) if (qtFromPath && candidates.contains(qtFromPath))
k->setValue(id(), qtFromPath->uniqueId()); k->setValue(id(), qtFromPath->uniqueId());
else else
@@ -343,7 +343,7 @@ int QtKitAspect::qtVersionId(const Kit *k)
id = -1; id = -1;
} else { } else {
QString source = data.toString(); 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) if (v)
id = v->uniqueId(); id = v->uniqueId();
} }

View File

@@ -271,7 +271,7 @@ void TestQtProjectImporter::deleteDirectoryData(void *directoryData) const
static Utils::FilePath setupQmake(const BaseQtVersion *qt, const QString &path) 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(); const QString qmakeFile = path + "/" + fi.fileName();
if (!QFile::copy(fi.absoluteFilePath(), qmakeFile)) if (!QFile::copy(fi.absoluteFilePath(), qmakeFile))
return Utils::FilePath(); return Utils::FilePath();
@@ -379,12 +379,12 @@ void QtSupportPlugin::testQtProjectImporter_oneProject()
SysRootKitAspect::setSysRoot(kitTemplates[1], Utils::FilePath::fromString("/some/path")); SysRootKitAspect::setSysRoot(kitTemplates[1], Utils::FilePath::fromString("/some/path"));
SysRootKitAspect::setSysRoot(kitTemplates[2], Utils::FilePath::fromString("/some/other/path")); SysRootKitAspect::setSysRoot(kitTemplates[2], Utils::FilePath::fromString("/some/other/path"));
QVector<Utils::FilePath> qmakePaths = {defaultQt->qmakeCommand(), QVector<Utils::FilePath> qmakePaths = {defaultQt->qmakeFilePath(),
setupQmake(defaultQt, tempDir1.path().path()), setupQmake(defaultQt, tempDir1.path().path()),
setupQmake(defaultQt, tempDir2.path().path())}; setupQmake(defaultQt, tempDir2.path().path())};
for (int i = 1; i < qmakePaths.count(); ++i) 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<DirectoryData *> testData; QList<DirectoryData *> testData;
@@ -457,7 +457,7 @@ void QtSupportPlugin::testQtProjectImporter_oneProject()
QVERIFY(newQt); QVERIFY(newQt);
// VALIDATE: Qt has the expected qmakePath // VALIDATE: Qt has the expected qmakePath
QCOMPARE(dd->qmakePath, newQt->qmakeCommand()); QCOMPARE(dd->qmakePath, newQt->qmakeFilePath());
// VALIDATE: All keys are unchanged: // VALIDATE: All keys are unchanged:
QList<Utils::Id> newKitKeys = newKit->allKeys(); QList<Utils::Id> newKitKeys = newKit->allKeys();
@@ -569,7 +569,7 @@ void QtSupportPlugin::testQtProjectImporter_oneProject()
QVERIFY(QtVersionManager::version(qtId)); QVERIFY(QtVersionManager::version(qtId));
// VALIDATE: Qt points to the expected qmake path: // 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 // VALIDATE: Kit uses the expected Qt
QCOMPARE(QtKitAspect::qtVersionId(newKit), qtId); QCOMPARE(QtKitAspect::qtVersionId(newKit), qtId);

View File

@@ -51,10 +51,10 @@ public:
/// the desktop factory claims to handle all paths /// the desktop factory claims to handle all paths
int priority() const { return m_priority; } int priority() const { return m_priority; }
static BaseQtVersion *createQtVersionFromQMakePath( static BaseQtVersion *createQtVersionFromQMakePath(const Utils::FilePath &qmakePath,
const Utils::FilePath &qmakePath, bool isAutoDetected = false, bool isAutoDetected = false,
const QString &autoDetectionSource = QString(), QString *error = nullptr); const QString &detectionSource = {},
QString *error = nullptr);
protected: protected:
struct SetupData struct SetupData
{ {

View File

@@ -265,8 +265,8 @@ void QtVersionManager::updateFromInstaller(bool emitSignal)
if (log().isDebugEnabled()) { if (log().isDebugEnabled()) {
qCDebug(log) << "======= Existing Qt versions ======="; qCDebug(log) << "======= Existing Qt versions =======";
for (BaseQtVersion *version : qAsConst(m_versions)) { for (BaseQtVersion *version : qAsConst(m_versions)) {
qCDebug(log) << version->qmakeFilePath().toString() << "id:"<<version->uniqueId(); qCDebug(log) << version->qmakeFilePath().toUserOutput() << "id:"<<version->uniqueId();
qCDebug(log) << " autodetection source:"<< version->autodetectionSource(); qCDebug(log) << " autodetection source:" << version->detectionSource();
qCDebug(log) << ""; qCDebug(log) << "";
} }
qCDebug(log)<< "======= Adding sdk versions ======="; qCDebug(log)<< "======= Adding sdk versions =======";
@@ -303,7 +303,7 @@ void QtVersionManager::updateFromInstaller(bool emitSignal)
bool restored = false; bool restored = false;
const VersionMap versionsCopy = m_versions; // m_versions is modified in loop const VersionMap versionsCopy = m_versions; // m_versions is modified in loop
for (BaseQtVersion *v : versionsCopy) { for (BaseQtVersion *v : versionsCopy) {
if (v->autodetectionSource() == autoDetectionSource) { if (v->detectionSource() == autoDetectionSource) {
id = v->uniqueId(); id = v->uniqueId();
qCDebug(log) << " Qt version found with same autodetection source" << autoDetectionSource << " => Migrating id:" << id; qCDebug(log) << " Qt version found with same autodetection source" << autoDetectionSource << " => Migrating id:" << id;
m_versions.remove(id); m_versions.remove(id);
@@ -341,16 +341,16 @@ void QtVersionManager::updateFromInstaller(bool emitSignal)
if (log().isDebugEnabled()) { if (log().isDebugEnabled()) {
qCDebug(log) << "======= Before removing outdated sdk versions ======="; qCDebug(log) << "======= Before removing outdated sdk versions =======";
for (BaseQtVersion *version : qAsConst(m_versions)) { for (BaseQtVersion *version : qAsConst(m_versions)) {
qCDebug(log) << version->qmakeFilePath().toString() << "id:"<<version->uniqueId(); qCDebug(log) << version->qmakeFilePath().toUserOutput() << "id:" << version->uniqueId();
qCDebug(log) << " autodetection source:"<< version->autodetectionSource(); qCDebug(log) << " autodetection source:" << version->detectionSource();
qCDebug(log) << ""; qCDebug(log) << "";
} }
} }
const VersionMap versionsCopy = m_versions; // m_versions is modified in loop const VersionMap versionsCopy = m_versions; // m_versions is modified in loop
for (BaseQtVersion *qtVersion : versionsCopy) { for (BaseQtVersion *qtVersion : versionsCopy) {
if (qtVersion->autodetectionSource().startsWith("SDK.")) { if (qtVersion->detectionSource().startsWith("SDK.")) {
if (!sdkVersions.contains(qtVersion->autodetectionSource())) { if (!sdkVersions.contains(qtVersion->detectionSource())) {
qCDebug(log) << " removing version"<<qtVersion->autodetectionSource(); qCDebug(log) << " removing version" << qtVersion->detectionSource();
m_versions.remove(qtVersion->uniqueId()); m_versions.remove(qtVersion->uniqueId());
removed << qtVersion->uniqueId(); removed << qtVersion->uniqueId();
} }
@@ -360,8 +360,8 @@ void QtVersionManager::updateFromInstaller(bool emitSignal)
if (log().isDebugEnabled()) { if (log().isDebugEnabled()) {
qCDebug(log)<< "======= End result ======="; qCDebug(log)<< "======= End result =======";
for (BaseQtVersion *version : qAsConst(m_versions)) { for (BaseQtVersion *version : qAsConst(m_versions)) {
qCDebug(log) << version->qmakeFilePath().toString() << "id:" << version->uniqueId(); qCDebug(log) << version->qmakeFilePath().toUserOutput() << "id:" << version->uniqueId();
qCDebug(log) << " autodetection source:"<< version->autodetectionSource(); qCDebug(log) << " autodetection source:" << version->detectionSource();
qCDebug(log) << ""; qCDebug(log) << "";
} }
} }

View File

@@ -168,6 +168,13 @@ QList<ToolChain *> WebAssemblyToolChainFactory::autoDetect(
if (!WebAssemblyEmSdk::isValid(sdk)) if (!WebAssemblyEmSdk::isValid(sdk))
return {}; 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(); Environment env = sdk.deviceEnvironment();
WebAssemblyEmSdk::addToEnvironment(sdk, env); WebAssemblyEmSdk::addToEnvironment(sdk, env);

View File

@@ -900,7 +900,7 @@ void tst_TestCore::testRewriterImports()
QVERIFY(import.isLibraryImport()); QVERIFY(import.isLibraryImport());
QCOMPARE(import.url(), QString("QtQuick")); QCOMPARE(import.url(), QString("QtQuick"));
QVERIFY(import.hasVersion()); QVERIFY(import.hasVersion());
QCOMPARE(import.version(), QString("1.0")); QCOMPARE(import.version(), QString("2.15"));
QVERIFY(!import.hasAlias()); QVERIFY(!import.hasAlias());
// import "subitems" // import "subitems"

View File

@@ -29,6 +29,8 @@
#include <QtTest> #include <QtTest>
#include <extensionsystem/pluginmanager.h>
class tst_TestCore : public QObject class tst_TestCore : public QObject
{ {
@@ -237,4 +239,7 @@ private slots:
// QMLAnnotations // QMLAnnotations
void writeAnnotations(); void writeAnnotations();
void readAnnotations(); void readAnnotations();
private:
ExtensionSystem::PluginManager pm; // FIXME remove
}; };

View File

@@ -23,7 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
import Qt 4.7 import QtQuick 2.15
import "subitems" import "subitems"
import QtWebKit 1.0 as Web import QtWebKit 1.0 as Web

View File

@@ -897,7 +897,7 @@ void tst_QtcProcess::runBlockingStdOut()
// with interactive cli tools. // with interactive cli tools.
QEXPECT_FAIL("Unterminated stdout lost: early timeout", "", Continue); QEXPECT_FAIL("Unterminated stdout lost: early timeout", "", Continue);
QVERIFY2(sp.result() != QtcProcess::Hang, "Process run did not time out."); 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."); QVERIFY2(readLastLine, "Last line was read.");
} }