Remove leftover code for header diagnostic info bar

ClangCodeModel used to show an info bar about errors in headers in the
editor, but that was removed. Remove the remaining infrastructure that
was used to show them.

Amends b52fac7148

Change-Id: Id89f2bcb7778245f468923d29c577bf1ca68ee75
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Eike Ziller
2022-05-04 09:04:08 +02:00
parent 2b9ec0c3d9
commit eec77fa67a
8 changed files with 0 additions and 94 deletions

View File

@@ -89,16 +89,12 @@ public:
QString filePath() const { return m_filePath; }
public:
using HeaderErrorDiagnosticWidgetCreator = std::function<QWidget*()>;
signals:
// Signal interface to implement
void projectPartInfoUpdated(const ProjectPartInfo &projectPartInfo);
void codeWarningsUpdated(unsigned revision,
const QList<QTextEdit::ExtraSelection> &selections,
const HeaderErrorDiagnosticWidgetCreator &creator,
const TextEditor::RefactorMarkers &refactorMarkers);
void ifdefedOutBlocksUpdated(unsigned revision,

View File

@@ -318,7 +318,6 @@ void BuiltinEditorDocumentProcessor::onCodeWarningsUpdated(
m_codeWarningsUpdated = true;
emit codeWarningsUpdated(revision(),
m_codeWarnings,
HeaderErrorDiagnosticWidgetCreator(),
TextEditor::RefactorMarkers());
}

View File

@@ -37,7 +37,6 @@ const char CPPEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("OpenWith::Editors", "C+
const char SWITCH_DECLARATION_DEFINITION[] = "CppEditor.SwitchDeclarationDefinition";
const char OPEN_DECLARATION_DEFINITION_IN_NEXT_SPLIT[] = "CppEditor.OpenDeclarationDefinitionInNextSplit";
const char OPEN_PREPROCESSOR_DIALOG[] = "CppEditor.OpenPreprocessorDialog";
const char ERRORS_IN_HEADER_FILES[] = "CppEditor.ErrorsInHeaderFiles";
const char MULTIPLE_PARSE_CONTEXTS_AVAILABLE[] = "CppEditor.MultipleParseContextsAvailable";
const char NO_PROJECT_CONFIGURATION[] = "CppEditor.NoProjectConfiguration";
const char M_REFACTORING_MENU_INSERTION_POINT[] = "CppEditor.RefactorGroup";
@@ -101,7 +100,6 @@ const char CPPEDITOR_SETTINGSGROUP[] = "CppTools";
const char LOWERCASE_CPPFILES_KEY[] = "LowerCaseFiles";
const bool LOWERCASE_CPPFILES_DEFAULT = true;
const char CPPEDITOR_SORT_EDITOR_DOCUMENT_OUTLINE[] = "SortedMethodOverview";
const char CPPEDITOR_SHOW_INFO_BAR_FOR_HEADER_ERRORS[] = "ShowInfoBarForHeaderErrors";
const char CPPEDITOR_SHOW_INFO_BAR_FOR_FOR_NO_PROJECT[] = "ShowInfoBarForNoProject";
const char CPPEDITOR_MODEL_MANAGER_PCH_USAGE[] = "PCHUsage";
const char CPPEDITOR_INTERPRET_AMBIGIUOUS_HEADERS_AS_C_HEADERS[]

View File

@@ -427,10 +427,8 @@ BaseEditorDocumentProcessor *CppEditorDocument::processor()
connect(m_processor.data(), &BaseEditorDocumentProcessor::codeWarningsUpdated,
[this] (unsigned revision,
const QList<QTextEdit::ExtraSelection> selections,
const std::function<QWidget*()> &creator,
const TextEditor::RefactorMarkers &refactorMarkers) {
emit codeWarningsUpdated(revision, selections, refactorMarkers);
m_minimizableInfoBars.processHeaderDiagnostics(creator);
});
connect(m_processor.data(), &BaseEditorDocumentProcessor::ifdefedOutBlocksUpdated,
this, &CppEditorDocument::ifdefedOutBlocksUpdated);

View File

@@ -45,8 +45,6 @@ MinimizableInfoBars::MinimizableInfoBars(InfoBar &infoBar, QObject *parent)
: QObject(parent)
, m_infoBar(infoBar)
{
connect(settings(), &CppToolsSettings::showHeaderErrorInfoBarChanged,
this, &MinimizableInfoBars::updateHeaderErrors);
connect(settings(), &CppToolsSettings::showNoProjectInfoBarChanged,
this, &MinimizableInfoBars::updateNoProjectConfiguration);
}
@@ -68,50 +66,15 @@ MinimizableInfoBars::Actions MinimizableInfoBars::createShowInfoBarActions(
action->setVisible(!settings()->showNoProjectInfoBar());
result.insert(Constants::NO_PROJECT_CONFIGURATION, action);
// Errors in included files
button = new QToolButton();
button->setToolTip(tr("File contains errors in included files."));
button->setIcon(Utils::Icons::WARNING_TOOLBAR.pixmap());
connect(button, &QAbstractButton::clicked, []() {
settings()->setShowHeaderErrorInfoBar(true);
});
action = actionCreator(button);
action->setVisible(!settings()->showHeaderErrorInfoBar());
result.insert(Constants::ERRORS_IN_HEADER_FILES, action);
return result;
}
void MinimizableInfoBars::processHeaderDiagnostics(
const DiagnosticWidgetCreator &diagnosticWidgetCreator)
{
m_diagnosticWidgetCreator = diagnosticWidgetCreator;
updateHeaderErrors();
}
void MinimizableInfoBars::processHasProjectPart(bool hasProjectPart)
{
m_hasProjectPart = hasProjectPart;
updateNoProjectConfiguration();
}
void MinimizableInfoBars::updateHeaderErrors()
{
const Id id(Constants::ERRORS_IN_HEADER_FILES);
m_infoBar.removeInfo(id);
bool show = false;
// Show the info entry only if there is a project configuration.
if (m_hasProjectPart && m_diagnosticWidgetCreator) {
if (settings()->showHeaderErrorInfoBar())
addHeaderErrorEntry(id, m_diagnosticWidgetCreator);
else
show = true;
}
emit showAction(id, show);
}
void MinimizableInfoBars::updateNoProjectConfiguration()
{
const Id id(Constants::NO_PROJECT_CONFIGURATION);
@@ -156,20 +119,5 @@ void MinimizableInfoBars::addNoProjectConfigurationEntry(const Id &id)
}));
}
void MinimizableInfoBars::addHeaderErrorEntry(const Id &id,
const DiagnosticWidgetCreator &diagnosticWidgetCreator)
{
const QString text = tr("<b>Warning</b>: The code model could not parse an included file, "
"which might lead to incorrect code completion and "
"highlighting, for example.");
InfoBarEntry info = createMinimizableInfo(id, text, []() {
settings()->setShowHeaderErrorInfoBar(false);
});
info.setDetailsWidgetCreator(diagnosticWidgetCreator);
m_infoBar.addInfo(info);
}
} // namespace Internal
} // namespace CppEditor

View File

@@ -45,7 +45,6 @@ class MinimizableInfoBars : public QObject
Q_OBJECT
public:
using DiagnosticWidgetCreator = std::function<QWidget *()>;
using ActionCreator = std::function<QAction *(QWidget *widget)>;
using Actions = QHash<Utils::Id, QAction *>;
@@ -54,26 +53,20 @@ public:
public:
explicit MinimizableInfoBars(Utils::InfoBar &infoBar, QObject *parent = nullptr);
// Expected call order: processHasProjectPart(), processHeaderDiagnostics()
void processHasProjectPart(bool hasProjectPart);
void processHeaderDiagnostics(const DiagnosticWidgetCreator &diagnosticWidgetCreator);
signals:
void showAction(const Utils::Id &id, bool show);
private:
void updateNoProjectConfiguration();
void updateHeaderErrors();
void addNoProjectConfigurationEntry(const Utils::Id &id);
void addHeaderErrorEntry(const Utils::Id &id,
const DiagnosticWidgetCreator &diagnosticWidgetCreator);
private:
Utils::InfoBar &m_infoBar;
bool m_hasProjectPart = true;
DiagnosticWidgetCreator m_diagnosticWidgetCreator;
};
} // namespace Internal

View File

@@ -44,7 +44,6 @@
static const char idKey[] = "CppGlobal";
const bool kSortEditorDocumentOutlineDefault = true;
const bool kShowHeaderErrorInfoBarDefault = true;
const bool kShowNoProjectInfoBarDefault = true;
using namespace Core;
@@ -265,28 +264,6 @@ void CppToolsSettings::setSortedEditorDocumentOutline(bool sorted)
emit editorDocumentOutlineSortingChanged(sorted);
}
static QString showHeaderErrorInfoBarKey()
{
return QLatin1String(Constants::CPPEDITOR_SETTINGSGROUP)
+ QLatin1Char('/')
+ QLatin1String(Constants::CPPEDITOR_SHOW_INFO_BAR_FOR_HEADER_ERRORS);
}
bool CppToolsSettings::showHeaderErrorInfoBar() const
{
return ICore::settings()
->value(showHeaderErrorInfoBarKey(), kShowHeaderErrorInfoBarDefault)
.toBool();
}
void CppToolsSettings::setShowHeaderErrorInfoBar(bool show)
{
ICore::settings()->setValueWithDefault(showHeaderErrorInfoBarKey(),
show,
kShowHeaderErrorInfoBarDefault);
emit showHeaderErrorInfoBarChanged(show);
}
static QString showNoProjectInfoBarKey()
{
return QLatin1String(Constants::CPPEDITOR_SETTINGSGROUP)

View File

@@ -58,9 +58,6 @@ public:
bool sortedEditorDocumentOutline() const;
void setSortedEditorDocumentOutline(bool sorted);
bool showHeaderErrorInfoBar() const;
void setShowHeaderErrorInfoBar(bool show);
bool showNoProjectInfoBar() const;
void setShowNoProjectInfoBar(bool show);