forked from qt-creator/qt-creator
Clang: Make some functions available for reuse
Change-Id: I7b85ea104a852c1168578949247efb8387a95f30 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QUuid>
|
||||
|
||||
namespace CppTools {
|
||||
|
||||
@@ -203,11 +204,18 @@ void ClangDiagnosticConfigsModel::removeConfigWithId(const Core::Id &id)
|
||||
m_diagnosticConfigs.removeOne(configWithId(id));
|
||||
}
|
||||
|
||||
ClangDiagnosticConfigs ClangDiagnosticConfigsModel::configs() const
|
||||
ClangDiagnosticConfigs ClangDiagnosticConfigsModel::allConfigs() const
|
||||
{
|
||||
return m_diagnosticConfigs;
|
||||
}
|
||||
|
||||
ClangDiagnosticConfigs ClangDiagnosticConfigsModel::customConfigs() const
|
||||
{
|
||||
return Utils::filtered(allConfigs(), [](const ClangDiagnosticConfig &config) {
|
||||
return !config.isReadOnly();
|
||||
});
|
||||
}
|
||||
|
||||
bool ClangDiagnosticConfigsModel::hasConfigWithId(const Core::Id &id) const
|
||||
{
|
||||
return indexOfConfig(id) != -1;
|
||||
@@ -237,13 +245,24 @@ QVector<Core::Id> ClangDiagnosticConfigsModel::changedOrRemovedConfigs(
|
||||
const int i = newConfigsModel.indexOfConfig(old.id());
|
||||
if (i == -1)
|
||||
changedConfigs.append(old.id()); // Removed
|
||||
else if (newConfigsModel.configs().value(i) != old)
|
||||
else if (newConfigsModel.allConfigs().value(i) != old)
|
||||
changedConfigs.append(old.id()); // Changed
|
||||
}
|
||||
|
||||
return changedConfigs;
|
||||
}
|
||||
|
||||
ClangDiagnosticConfig ClangDiagnosticConfigsModel::createCustomConfig(
|
||||
const ClangDiagnosticConfig &config, const QString &displayName)
|
||||
{
|
||||
ClangDiagnosticConfig copied = config;
|
||||
copied.setId(Core::Id::fromString(QUuid::createUuid().toString()));
|
||||
copied.setDisplayName(displayName);
|
||||
copied.setIsReadOnly(false);
|
||||
|
||||
return copied;
|
||||
}
|
||||
|
||||
QStringList ClangDiagnosticConfigsModel::globalDiagnosticOptions()
|
||||
{
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user