diff --git a/src/plugins/cppeditor/cppeditorwidget.cpp b/src/plugins/cppeditor/cppeditorwidget.cpp index 3950da53c08..20c3f596ce1 100644 --- a/src/plugins/cppeditor/cppeditorwidget.cpp +++ b/src/plugins/cppeditor/cppeditorwidget.cpp @@ -340,8 +340,7 @@ static bool trySplitComment(TextEditor::TextEditorWidget *editorWidget, DoxygenGenerator doxygen; doxygen.setStyle(style); - doxygen.setAddLeadingAsterisks(settings.leadingAsterisks); - doxygen.setGenerateBrief(settings.generateBrief); + doxygen.setSettings(settings); // Move until we reach any possibly meaningful content. while (textDocument->characterAt(cursor.position()).isSpace() diff --git a/src/plugins/cppeditor/doxygengenerator.cpp b/src/plugins/cppeditor/doxygengenerator.cpp index ae83e0e23d4..ac79cb0d839 100644 --- a/src/plugins/cppeditor/doxygengenerator.cpp +++ b/src/plugins/cppeditor/doxygengenerator.cpp @@ -24,21 +24,6 @@ namespace CppEditor::Internal { DoxygenGenerator::DoxygenGenerator() = default; -void DoxygenGenerator::setStyle(DocumentationStyle style) -{ - m_style = style; -} - -void DoxygenGenerator::setGenerateBrief(bool get) -{ - m_generateBrief = get; -} - -void DoxygenGenerator::setAddLeadingAsterisks(bool add) -{ - m_addLeadingAsterisks = add; -} - QString DoxygenGenerator::generate(QTextCursor cursor, const CPlusPlus::Snapshot &snapshot, const Utils::FilePath &documentFilePath) @@ -139,7 +124,7 @@ QString DoxygenGenerator::generate(QTextCursor cursor, DeclarationAST *decl) && decltr->core_declarator->asDeclaratorId() && decltr->core_declarator->asDeclaratorId()->name) { CoreDeclaratorAST *coreDecl = decltr->core_declarator; - if (m_generateBrief) + if (m_settings.generateBrief) writeBrief(&comment, m_printer.prettyName(coreDecl->asDeclaratorId()->name->name)); else writeNewLine(&comment); @@ -177,7 +162,7 @@ QString DoxygenGenerator::generate(QTextCursor cursor, DeclarationAST *decl) writeCommand(&comment, ReturnCommand); } } - } else if (spec && m_generateBrief) { + } else if (spec && m_settings.generateBrief) { bool briefWritten = false; if (ClassSpecifierAST *classSpec = spec->asClassSpecifier()) { if (classSpec->name) { @@ -248,7 +233,7 @@ void DoxygenGenerator::writeContinuation(QString *comment) const comment->append(offsetString() + "///"); else if (m_style == CppStyleB) comment->append(offsetString() + "//!"); - else if (m_addLeadingAsterisks) + else if (m_settings.leadingAsterisks) comment->append(offsetString() + " *"); else comment->append(offsetString() + " "); diff --git a/src/plugins/cppeditor/doxygengenerator.h b/src/plugins/cppeditor/doxygengenerator.h index 32d23945bb2..4bb11f72892 100644 --- a/src/plugins/cppeditor/doxygengenerator.h +++ b/src/plugins/cppeditor/doxygengenerator.h @@ -3,6 +3,8 @@ #pragma once +#include + #include QT_FORWARD_DECLARE_CLASS(QTextCursor) @@ -25,9 +27,8 @@ public: CppStyleB ///< CppStyle comment variant B: //! }; - void setStyle(DocumentationStyle style); - void setGenerateBrief(bool gen); - void setAddLeadingAsterisks(bool add); + void setStyle(DocumentationStyle style) { m_style = style; } + void setSettings(const TextEditor::CommentsSettings::Data &settings) { m_settings = settings; } QString generate(QTextCursor cursor, const CPlusPlus::Snapshot &snapshot, @@ -58,11 +59,10 @@ private: void assignCommentOffset(QTextCursor cursor); QString offsetString() const; - bool m_addLeadingAsterisks = true; - bool m_generateBrief = true; - DocumentationStyle m_style = QtStyle; + TextEditor::CommentsSettings::Data m_settings; CPlusPlus::Overview m_printer; QString m_commentOffset; + DocumentationStyle m_style = QtStyle; }; } // namespace CppEditor::Internal