forked from qt-creator/qt-creator
ProjectExplorer: Add convenience method ToolChain::isSdkProvided()
Change-Id: I4f8bfcfbd5baef8210a41f6ccc878b0454e4697b Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -100,6 +100,7 @@ public:
|
|||||||
void setDisplayName(const QString &name);
|
void setDisplayName(const QString &name);
|
||||||
|
|
||||||
bool isAutoDetected() const;
|
bool isAutoDetected() const;
|
||||||
|
bool isSdkProvided() const { return detection() == AutoDetectionFromSdk; }
|
||||||
Detection detection() const;
|
Detection detection() const;
|
||||||
QString detectionSource() const;
|
QString detectionSource() const;
|
||||||
|
|
||||||
|
@@ -222,7 +222,7 @@ public:
|
|||||||
if (item->level() != 3)
|
if (item->level() != 3)
|
||||||
return;
|
return;
|
||||||
const auto tcItem = static_cast<ToolChainTreeItem *>(item);
|
const auto tcItem = static_cast<ToolChainTreeItem *>(item);
|
||||||
if (tcItem->toolChain->detection() != ToolChain::AutoDetectionFromSdk)
|
if (!tcItem->toolChain->isSdkProvided())
|
||||||
itemsToRemove << tcItem;
|
itemsToRemove << tcItem;
|
||||||
});
|
});
|
||||||
for (ToolChainTreeItem * const tcItem : qAsConst(itemsToRemove))
|
for (ToolChainTreeItem * const tcItem : qAsConst(itemsToRemove))
|
||||||
@@ -403,12 +403,10 @@ void ToolChainOptionsWidget::redetectToolchains()
|
|||||||
if (item->level() != 3)
|
if (item->level() != 3)
|
||||||
return;
|
return;
|
||||||
const auto tcItem = static_cast<ToolChainTreeItem *>(item);
|
const auto tcItem = static_cast<ToolChainTreeItem *>(item);
|
||||||
if (tcItem->toolChain->isAutoDetected()
|
if (tcItem->toolChain->isAutoDetected() && !tcItem->toolChain->isSdkProvided())
|
||||||
&& tcItem->toolChain->detection() != ToolChain::AutoDetectionFromSdk) {
|
|
||||||
itemsToRemove << tcItem;
|
itemsToRemove << tcItem;
|
||||||
} else {
|
else
|
||||||
knownTcs << tcItem->toolChain;
|
knownTcs << tcItem->toolChain;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
Toolchains toAdd;
|
Toolchains toAdd;
|
||||||
QSet<ToolChain *> toDelete;
|
QSet<ToolChain *> toDelete;
|
||||||
@@ -551,7 +549,7 @@ void ToolChainOptionsWidget::updateState()
|
|||||||
if (ToolChainTreeItem *item = currentTreeItem()) {
|
if (ToolChainTreeItem *item = currentTreeItem()) {
|
||||||
ToolChain *tc = item->toolChain;
|
ToolChain *tc = item->toolChain;
|
||||||
canCopy = tc->isValid();
|
canCopy = tc->isValid();
|
||||||
canDelete = tc->detection() != ToolChain::AutoDetectionFromSdk;
|
canDelete = !tc->isSdkProvided();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_cloneButton->setEnabled(canCopy);
|
m_cloneButton->setEnabled(canCopy);
|
||||||
|
Reference in New Issue
Block a user