forked from qt-creator/qt-creator
Editor: Simplify text marks
Moving defaultToolTip and color from TextMarkRegistry to TextMark. Allowing every instance of a TextMark object to define these information. Change-Id: Iec1794372cf902b34d343402074e3999e7f9faf7 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -46,20 +46,6 @@ namespace Internal {
|
||||
|
||||
namespace {
|
||||
|
||||
void initializeTextMarks()
|
||||
{
|
||||
TextEditor::TextMark::setCategoryColor(Core::Id(Constants::CLANG_WARNING),
|
||||
Utils::Theme::ClangCodeModel_Warning_TextMarkColor);
|
||||
TextEditor::TextMark::setCategoryColor(Core::Id(Constants::CLANG_ERROR),
|
||||
Utils::Theme::ClangCodeModel_Error_TextMarkColor);
|
||||
TextEditor::TextMark::setDefaultToolTip(Core::Id(Constants::CLANG_WARNING),
|
||||
QApplication::translate("Clang Code Model Marks",
|
||||
"Code Model Warning"));
|
||||
TextEditor::TextMark::setDefaultToolTip(Core::Id(Constants::CLANG_ERROR),
|
||||
QApplication::translate("Clang Code Model Marks",
|
||||
"Code Model Error"));
|
||||
}
|
||||
|
||||
void addProjectPanelWidget()
|
||||
{
|
||||
auto panelFactory = new ProjectExplorer::ProjectPanelFactory();
|
||||
@@ -85,7 +71,6 @@ bool ClangCodeModelPlugin::initialize(const QStringList &arguments, QString *err
|
||||
|
||||
CppTools::CppModelManager::instance()->activateClangCodeModel(&m_modelManagerSupportProvider);
|
||||
|
||||
initializeTextMarks();
|
||||
addProjectPanelWidget();
|
||||
|
||||
return true;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/theme/theme.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QLayout>
|
||||
#include <QString>
|
||||
|
||||
@@ -70,7 +71,13 @@ ClangTextMark::ClangTextMark(const QString &fileName,
|
||||
, m_diagnostic(diagnostic)
|
||||
, m_removedFromEditorHandler(removedHandler)
|
||||
{
|
||||
setPriority(TextEditor::TextMark::HighPriority);
|
||||
const bool warning = isWarningOrNote(diagnostic.severity());
|
||||
setColor(warning ? Utils::Theme::ClangCodeModel_Warning_TextMarkColor
|
||||
: Utils::Theme::ClangCodeModel_Error_TextMarkColor);
|
||||
setDefaultToolTip(warning ? QApplication::translate("Clang Code Model Marks", "Code Model Warning")
|
||||
: QApplication::translate("Clang Code Model Marks", "Code Model Error"));
|
||||
setPriority(warning ? TextEditor::TextMark::NormalPriority
|
||||
: TextEditor::TextMark::HighPriority);
|
||||
setIcon(diagnostic.severity());
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ public:
|
||||
|
||||
private:
|
||||
void setIcon(ClangBackEnd::DiagnosticSeverity severity);
|
||||
|
||||
bool addToolTipContent(QLayout *target) override;
|
||||
void removedFromEditor() override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user