ClangCodeModel: Replace nested ClangCodeModel::Utils namespace

... by the customary ::Internal.

It adds only noise on the user side and conflicts regularly with
the top-level ::Utils namespace.

Remove a (now) duplicated definition of setLastSentDocumentRevision().

Plus minor namespace related fixes.

There are still minor conflicts between Utils::Text and
ClangCodeModel::Text

Change-Id: I2e8df6b3c6c3599192774032822ee7e778355bba
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2020-07-06 15:49:35 +02:00
parent 5671b3a7be
commit f0628cca29
16 changed files with 137 additions and 154 deletions

View File

@@ -71,14 +71,14 @@ bool isWarningOrNote(ClangBackEnd::DiagnosticSeverity severity)
Q_UNREACHABLE();
}
static ::Utils::Id categoryForSeverity(ClangBackEnd::DiagnosticSeverity severity)
static Id categoryForSeverity(ClangBackEnd::DiagnosticSeverity severity)
{
return isWarningOrNote(severity) ? Constants::CLANG_WARNING : Constants::CLANG_ERROR;
}
ProjectExplorer::Project *projectForCurrentEditor()
{
const QString filePath = Utils::currentCppEditorDocumentFilePath();
const QString filePath = currentCppEditorDocumentFilePath();
if (filePath.isEmpty())
return nullptr;
@@ -97,8 +97,8 @@ DiagnosticType diagnosticType(const ClangBackEnd::DiagnosticContainer &diagnosti
if (!diagnostic.disableOption.isEmpty())
return DiagnosticType::Clang;
const Utils::DiagnosticTextInfo textInfo(diagnostic.text);
if (Utils::DiagnosticTextInfo::isClazyOption(textInfo.option()))
const DiagnosticTextInfo textInfo(diagnostic.text);
if (DiagnosticTextInfo::isClazyOption(textInfo.option()))
return DiagnosticType::Clazy;
return DiagnosticType::Tidy;
}
@@ -106,8 +106,6 @@ DiagnosticType diagnosticType(const ClangBackEnd::DiagnosticContainer &diagnosti
void disableDiagnosticInConfig(ClangDiagnosticConfig &config,
const ClangBackEnd::DiagnosticContainer &diagnostic)
{
using namespace ClangCodeModel::Utils;
switch (diagnosticType(diagnostic)) {
case DiagnosticType::Clang:
config.setClangOptions(config.clangOptions() + QStringList(diagnostic.disableOption));
@@ -134,7 +132,7 @@ ClangDiagnosticConfig diagnosticConfig(const ClangProjectSettings &projectSettin
QTC_ASSERT(project, return {});
// Get config id
::Utils::Id currentConfigId = projectSettings.warningConfigId();
Id currentConfigId = projectSettings.warningConfigId();
if (projectSettings.useGlobalConfig())
currentConfigId = globalSettings.clangDiagnosticConfigId();
@@ -202,9 +200,9 @@ void disableDiagnosticInCurrentProjectConfig(const ClangBackEnd::DiagnosticConta
const QString text
= QCoreApplication::translate("ClangDiagnosticConfig",
"Changes applied in Projects Mode > Clang Code Model");
::Utils::FadingIndicator::showText(Core::ICore::mainWindow(),
text,
::Utils::FadingIndicator::SmallText);
FadingIndicator::showText(Core::ICore::mainWindow(),
text,
FadingIndicator::SmallText);
}
} // anonymous namespace
@@ -226,15 +224,15 @@ ClangTextMark::ClangTextMark(const FilePath &fileName,
: TextEditor::TextMark::HighPriority);
updateIcon();
if (fullVisualization) {
setLineAnnotation(Utils::diagnosticCategoryPrefixRemoved(diagnostic.text.toString()));
setColor(warning ? ::Utils::Theme::CodeModel_Warning_TextMarkColor
: ::Utils::Theme::CodeModel_Error_TextMarkColor);
setLineAnnotation(diagnosticCategoryPrefixRemoved(diagnostic.text.toString()));
setColor(warning ? Theme::CodeModel_Warning_TextMarkColor
: Theme::CodeModel_Error_TextMarkColor);
}
// Copy to clipboard action
QVector<QAction *> actions;
QAction *action = new QAction();
action->setIcon(QIcon::fromTheme("edit-copy", ::Utils::Icons::COPY.icon()));
action->setIcon(QIcon::fromTheme("edit-copy", Icons::COPY.icon()));
QObject::connect(action, &QAction::triggered, [diagnostic]() {
const QString text = ClangDiagnosticWidget::createText({diagnostic},
ClangDiagnosticWidget::InfoBar);
@@ -246,7 +244,7 @@ ClangTextMark::ClangTextMark(const FilePath &fileName,
ProjectExplorer::Project *project = projectForCurrentEditor();
if (project && isDiagnosticConfigChangable(project, diagnostic)) {
action = new QAction();
action->setIcon(::Utils::Icons::BROKEN.icon());
action->setIcon(Icons::BROKEN.icon());
QObject::connect(action, &QAction::triggered, [diagnostic]() {
disableDiagnosticInCurrentProjectConfig(diagnostic);
});
@@ -258,7 +256,7 @@ ClangTextMark::ClangTextMark(const FilePath &fileName,
void ClangTextMark::updateIcon(bool valid)
{
using namespace ::Utils::Icons;
using namespace Icons;
if (isWarningOrNote(m_diagnostic.severity))
setIcon(valid ? CODEMODEL_WARNING.icon() : CODEMODEL_DISABLED_WARNING.icon());
else