forked from qt-creator/qt-creator
ProjectExplorer: Filter kit aspects by build device
That is, do not offer toolchains, debuggers etc that do not match the kit's build device. Change-Id: I041ba9fd18ab553d9b2219116d87493e30f60aac Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -163,29 +163,18 @@ private:
|
||||
IDeviceConstPtr device = BuildDeviceKitAspect::device(kit());
|
||||
const FilePath rootPath = device->rootPath();
|
||||
|
||||
const auto list = CMakeToolManager::cmakeTools();
|
||||
const QList<CMakeTool *> toolsForBuildDevice
|
||||
= Utils::filtered(CMakeToolManager::cmakeTools(), [rootPath](CMakeTool *item) {
|
||||
return item->cmakeExecutable().isSameDevice(rootPath);
|
||||
});
|
||||
|
||||
m_comboBox->setEnabled(!list.isEmpty());
|
||||
|
||||
if (list.isEmpty()) {
|
||||
m_comboBox->setEnabled(!toolsForBuildDevice.isEmpty());
|
||||
if (toolsForBuildDevice.isEmpty()) {
|
||||
m_comboBox->addItem(Tr::tr("<No CMake Tool available>"), Id().toSetting());
|
||||
return;
|
||||
}
|
||||
|
||||
const QList<CMakeTool *> same = Utils::filtered(list, [rootPath](CMakeTool *item) {
|
||||
return item->cmakeExecutable().isSameDevice(rootPath);
|
||||
});
|
||||
const QList<CMakeTool *> other = Utils::filtered(list, [rootPath](CMakeTool *item) {
|
||||
return !item->cmakeExecutable().isSameDevice(rootPath);
|
||||
});
|
||||
|
||||
for (CMakeTool *item : same)
|
||||
m_comboBox->addItem(item->displayName(), item->id().toSetting());
|
||||
|
||||
if (!same.isEmpty() && !other.isEmpty())
|
||||
m_comboBox->insertSeparator(m_comboBox->count());
|
||||
|
||||
for (CMakeTool *item : other)
|
||||
for (CMakeTool *item : toolsForBuildDevice)
|
||||
m_comboBox->addItem(item->displayName(), item->id().toSetting());
|
||||
|
||||
CMakeTool *tool = CMakeKitAspect::cmakeTool(m_kit);
|
||||
|
@@ -86,22 +86,12 @@ private:
|
||||
|
||||
IDeviceConstPtr device = BuildDeviceKitAspect::device(kit());
|
||||
const Utils::FilePath path = device->rootPath();
|
||||
const QList<DebuggerItem> list = DebuggerItemManager::debuggers();
|
||||
|
||||
const QList<DebuggerItem> same = Utils::filtered(list, [path](const DebuggerItem &item) {
|
||||
const QList<DebuggerItem> debuggersForBuildDevice
|
||||
= Utils::filtered(DebuggerItemManager::debuggers(), [path](const DebuggerItem &item) {
|
||||
return item.command().isSameDevice(path);
|
||||
});
|
||||
const QList<DebuggerItem> other = Utils::filtered(list, [path](const DebuggerItem &item) {
|
||||
return !item.command().isSameDevice(path);
|
||||
});
|
||||
|
||||
for (const DebuggerItem &item : same)
|
||||
m_comboBox->addItem(item.displayName(), item.id());
|
||||
|
||||
if (!same.isEmpty() && !other.isEmpty())
|
||||
m_comboBox->insertSeparator(m_comboBox->count());
|
||||
|
||||
for (const DebuggerItem &item : other)
|
||||
for (const DebuggerItem &item : debuggersForBuildDevice)
|
||||
m_comboBox->addItem(item.displayName(), item.id());
|
||||
|
||||
const DebuggerItem *item = DebuggerKitAspect::debugger(m_kit);
|
||||
|
@@ -264,24 +264,13 @@ private:
|
||||
cb->clear();
|
||||
cb->addItem(Tr::tr("<No compiler>"), QByteArray());
|
||||
|
||||
const QList<Toolchain *> same = Utils::filtered(ltcList, [device](Toolchain *tc) {
|
||||
const QList<Toolchain *> toolchainsForBuildDevice
|
||||
= Utils::filtered(ltcList, [device](Toolchain *tc) {
|
||||
return tc->compilerCommand().isSameDevice(device->rootPath());
|
||||
});
|
||||
const QList<Toolchain *> other = Utils::filtered(ltcList, [device](Toolchain *tc) {
|
||||
return !tc->compilerCommand().isSameDevice(device->rootPath());
|
||||
});
|
||||
|
||||
const QList<ToolchainBundle> sameBundles
|
||||
= ToolchainBundle::collectBundles(same, ToolchainBundle::AutoRegister::On);
|
||||
const QList<ToolchainBundle> otherBundles
|
||||
= ToolchainBundle::collectBundles(other, ToolchainBundle::AutoRegister::On);
|
||||
for (const ToolchainBundle &b : sameBundles)
|
||||
cb->addItem(b.displayName(), b.bundleId().toSetting());
|
||||
|
||||
if (!sameBundles.isEmpty() && !otherBundles.isEmpty())
|
||||
cb->insertSeparator(cb->count());
|
||||
|
||||
for (const ToolchainBundle &b : otherBundles)
|
||||
const QList<ToolchainBundle> bundlesForBuildDevice = ToolchainBundle::collectBundles(
|
||||
toolchainsForBuildDevice, ToolchainBundle::AutoRegister::On);
|
||||
for (const ToolchainBundle &b : bundlesForBuildDevice)
|
||||
cb->addItem(b.displayName(), b.bundleId().toSetting());
|
||||
|
||||
cb->setEnabled(cb->count() > 1 && !m_isReadOnly);
|
||||
@@ -290,14 +279,11 @@ private:
|
||||
Toolchain * const currentTc = ToolchainKitAspect::toolchain(m_kit, lang);
|
||||
if (!currentTc)
|
||||
continue;
|
||||
for (const QList<ToolchainBundle> &bundles : {sameBundles, otherBundles})
|
||||
for (const ToolchainBundle &b : bundles) {
|
||||
for (const ToolchainBundle &b : bundlesForBuildDevice) {
|
||||
if (b.bundleId() == currentTc->bundleId()) {
|
||||
currentBundleId = b.bundleId();
|
||||
break;
|
||||
}
|
||||
if (currentBundleId.isValid())
|
||||
break;
|
||||
}
|
||||
if (currentBundleId.isValid())
|
||||
break;
|
||||
|
@@ -77,24 +77,13 @@ private:
|
||||
IDeviceConstPtr device = BuildDeviceKitAspect::device(kit());
|
||||
const FilePath deviceRoot = device->rootPath();
|
||||
|
||||
const QtVersions versions = QtVersionManager::versions();
|
||||
|
||||
const QList<QtVersion *> same = Utils::filtered(versions, [device](QtVersion *qt) {
|
||||
const QList<QtVersion *> versionsForBuildDevice
|
||||
= Utils::filtered(QtVersionManager::versions(), [device](QtVersion *qt) {
|
||||
return qt->qmakeFilePath().isSameDevice(device->rootPath());
|
||||
});
|
||||
const QList<QtVersion *> other = Utils::filtered(versions, [device](QtVersion *qt) {
|
||||
return !qt->qmakeFilePath().isSameDevice(device->rootPath());
|
||||
});
|
||||
|
||||
for (QtVersion *item : same)
|
||||
for (QtVersion *item : versionsForBuildDevice)
|
||||
m_combo->addItem(item->displayName(), item->uniqueId());
|
||||
|
||||
if (!same.isEmpty() && !other.isEmpty())
|
||||
m_combo->insertSeparator(m_combo->count());
|
||||
|
||||
for (QtVersion *item : other)
|
||||
m_combo->addItem(item->displayName(), item->uniqueId());
|
||||
|
||||
m_combo->setCurrentIndex(findQtVersion(QtKitAspect::qtVersionId(m_kit)));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user