From 8002b1a94c027fe3550a9158cd6d22f0822e12e4 Mon Sep 17 00:00:00 2001 From: Roberto Raggi <roberto.raggi@nokia.com> Date: Fri, 20 Feb 2009 12:08:34 +0100 Subject: [PATCH] Customizable doxy formats. --- src/plugins/cppeditor/cppeditor.cpp | 4 +++- src/plugins/cppeditor/cppeditorenums.h | 2 ++ src/plugins/cppeditor/cpphighlighter.cpp | 6 ++---- src/plugins/texteditor/texteditorconstants.h | 3 +++ src/plugins/texteditor/texteditorsettings.cpp | 2 ++ 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index b0eb63ffe35..a9f88d03cc4 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -740,7 +740,9 @@ void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs) << QLatin1String(TextEditor::Constants::C_OPERATOR) << QLatin1String(TextEditor::Constants::C_PREPROCESSOR) << QLatin1String(TextEditor::Constants::C_LABEL) - << QLatin1String(TextEditor::Constants::C_COMMENT); + << QLatin1String(TextEditor::Constants::C_COMMENT) + << QLatin1String(TextEditor::Constants::C_DOXYGEN_COMMENT) + << QLatin1String(TextEditor::Constants::C_DOXYGEN_TAG); } const QVector<QTextCharFormat> formats = fs.toTextCharFormats(categories); diff --git a/src/plugins/cppeditor/cppeditorenums.h b/src/plugins/cppeditor/cppeditorenums.h index 9b4ce75c0d7..5bca558ebfa 100644 --- a/src/plugins/cppeditor/cppeditorenums.h +++ b/src/plugins/cppeditor/cppeditorenums.h @@ -51,6 +51,8 @@ enum CppFormats { CppPreprocessorFormat, CppLabelFormat, CppCommentFormat, + CppDoxygenCommentFormat, + CppDoxygenTagFormat, NumCppFormats }; diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp index a02d3fe0900..657967a3ce0 100644 --- a/src/plugins/cppeditor/cpphighlighter.cpp +++ b/src/plugins/cppeditor/cpphighlighter.cpp @@ -329,10 +329,8 @@ void CppHighlighter::highlightDoxygenComment(const QString &text, int position, const QChar *uc = text.unicode(); const QChar *it = uc + position; - QTextCharFormat format = m_formats[CppCommentFormat]; - QTextCharFormat kwFormat = format; - kwFormat.setFontWeight(QFont::Bold); - kwFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline); + const QTextCharFormat &format = m_formats[CppDoxygenCommentFormat]; + const QTextCharFormat &kwFormat = m_formats[CppDoxygenTagFormat]; while (! it->isNull()) { if (it->unicode() == QLatin1Char('\\') || diff --git a/src/plugins/texteditor/texteditorconstants.h b/src/plugins/texteditor/texteditorconstants.h index 7db120f144a..0dfbf8fb5e1 100644 --- a/src/plugins/texteditor/texteditorconstants.h +++ b/src/plugins/texteditor/texteditorconstants.h @@ -84,6 +84,9 @@ const char * const C_OPERATOR = "Operator"; const char * const C_PREPROCESSOR = "Preprocessor"; const char * const C_LABEL = "Label"; const char * const C_COMMENT = "Comment"; +const char * const C_DOXYGEN_COMMENT = "Doxygen.Comment"; +const char * const C_DOXYGEN_TAG = "Doxygen.Tag"; + const char * const C_DISABLED_CODE = "DisabledCode"; const char * const C_ADDED_LINE = "AddedLine"; diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp index a8f6019597d..ff28af347c6 100644 --- a/src/plugins/texteditor/texteditorsettings.cpp +++ b/src/plugins/texteditor/texteditorsettings.cpp @@ -84,6 +84,8 @@ TextEditorSettings::TextEditorSettings(QObject *parent) formatDescriptions.push_back(FormatDescription(QLatin1String(C_PREPROCESSOR), tr("Preprocessor"), Qt::darkBlue)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_LABEL), tr("Label"), Qt::darkRed)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_COMMENT), tr("Comment"), Qt::darkGreen)); + formatDescriptions.push_back(FormatDescription(QLatin1String(C_DOXYGEN_COMMENT), tr("Doxygen Comment"), Qt::darkBlue)); + formatDescriptions.push_back(FormatDescription(QLatin1String(C_DOXYGEN_TAG), tr("Doxygen Tag"), Qt::blue)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_DISABLED_CODE), tr("Disabled Code"), Qt::gray)); // Diff categories -- GitLab