ProjectExplorer: Do not auto-remove manually added toolchains

Fixes: QTCREATORBUG-22128
Change-Id: I73dff369542b6918bcb96fb7d028822e5aed2062
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2019-04-02 15:08:28 +02:00
parent 4fff24849d
commit b9ae4c7ad0
2 changed files with 10 additions and 9 deletions

View File

@@ -38,6 +38,7 @@
#include <utils/detailswidget.h> #include <utils/detailswidget.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/treemodel.h> #include <utils/treemodel.h>
#include <utils/utilsicons.h>
#include <QAction> #include <QAction>
#include <QApplication> #include <QApplication>
@@ -84,17 +85,20 @@ public:
if (column == 0) if (column == 0)
return toolChain->displayName(); return toolChain->displayName();
return toolChain->typeDisplayName(); return toolChain->typeDisplayName();
case Qt::FontRole: { case Qt::FontRole: {
QFont font; QFont font;
font.setBold(changed); font.setBold(changed);
return font; return font;
} }
case Qt::ToolTipRole: case Qt::ToolTipRole:
if (!toolChain->isValid())
return ToolChainOptionsPage::tr("This toolchain is no longer valid.");
return ToolChainOptionsPage::tr("<nobr><b>ABI:</b> %1").arg( return ToolChainOptionsPage::tr("<nobr><b>ABI:</b> %1").arg(
changed ? ToolChainOptionsPage::tr("not up-to-date") changed ? ToolChainOptionsPage::tr("not up-to-date")
: toolChain->targetAbi().toString()); : toolChain->targetAbi().toString());
case Qt::DecorationRole:
return column == 0 && !toolChain->isValid()
? Utils::Icons::CRITICAL.icon() : QVariant();
} }
return QVariant(); return QVariant();
} }

View File

@@ -164,12 +164,9 @@ static ToolChainOperations mergeToolChainLists(const QList<ToolChain *> &systemF
const QList<ToolChain *> notRedetectedButValidUserTcs const QList<ToolChain *> notRedetectedButValidUserTcs
= Utils::filtered(notRedetectedUserTcs, &ToolChain::isValid); = Utils::filtered(notRedetectedUserTcs, &ToolChain::isValid);
const QList<ToolChain *> validManualUserTcs
= Utils::filtered(manualUserFileTcs, &ToolChain::isValid);
ToolChainOperations result; ToolChainOperations result;
result.toDemote = notRedetectedButValidUserTcs; result.toDemote = notRedetectedButValidUserTcs;
result.toRegister = stabilizeOrder(systemFileTcs + validManualUserTcs + result.toDemote // manual TCs result.toRegister = stabilizeOrder(systemFileTcs + manualUserFileTcs + result.toDemote // manual TCs
+ redetectedUserTcs + newlyAutodetectedTcs, // auto TCs + redetectedUserTcs + newlyAutodetectedTcs, // auto TCs
userFileTcs); userFileTcs);
@@ -225,7 +222,7 @@ void ToolChainSettingsAccessor::saveToolChains(const QList<ToolChain *> &toolcha
int count = 0; int count = 0;
for (const ToolChain *tc : toolchains) { for (const ToolChain *tc : toolchains) {
if (!tc || !tc->isValid()) if (!tc || (!tc->isValid() && tc->isAutoDetected()))
continue; continue;
const QVariantMap tmp = tc->toMap(); const QVariantMap tmp = tc->toMap();
if (tmp.isEmpty()) if (tmp.isEmpty())
@@ -424,9 +421,9 @@ void ProjectExplorerPlugin::testToolChainMerging_data()
<< (TCList()) << (TCList() << auto3i) << (TCList()) << (TCList()) << (TCList() << auto3i) << (TCList())
<< (TCList()) << (TCList()); << (TCList()) << (TCList());
QTest::newRow("Delete invalid user") QTest::newRow("invalid user")
<< (TCList()) << (TCList() << user3i) << (TCList()) << (TCList()) << (TCList() << user3i) << (TCList())
<< (TCList()) << (TCList()); << (TCList()) << (TCList{user3i});
QTest::newRow("one of everything") QTest::newRow("one of everything")
<< (TCList() << system1) << (TCList() << user1) << (TCList() << auto1) << (TCList() << system1) << (TCList() << user1) << (TCList() << auto1)