A few issues with C++ Code Generation Settings: -Style selection seems to be ignored -None of the General C++ Language Settings are saved when changed. Reproducible: Always Steps to Reproduce: 1. Goto Settings ->Configure Umbrello... 2. Select C++ on General tab 3. Then Code Generation -> Language Settings 4. Change a few settings, including style and some under subtab General 5. Apply & Generate Code Actual Results: Settings aren't actually saved Generated code still uses // comments instead of /* */ when that style is selected. Expected Results: Going back into settings should reflect every change that was previously made. Generated code should use /* */ for document when that style is selected.
Created attachment 96895 [details] A patch to fix part of the issue This patch makes it so the generated C++ commenting style selection actually works now.
(In reply to ryan.niehaus from comment #1) > Created attachment 96895 [details] > A patch to fix part of the issue > This patch makes it so the generated C++ commenting style selection actually > works now. Did a quick review and found a few issues: > Settings aren't actually saved 1. works > Generated code still uses // comments instead of /* */ when that style is selected. 2. The generated comments in // style for example on classes looks like /// /// class SDL_RWops and for methods like /// /// Set the value of type /// @param new_var the new value of type void setType (Uint32 new_var) { in /* */ mode for classes /** * class SDL_RWops */ but for methods /* */ /* Methods */ /* */ which should be /** * Methods */ There may be more issues, which could be verified by opening the code generator test case 'test/test-COG.xmi' from the umbrello source and generating code with it. 2. Please follow topic 12. of CODING-STYLE from the umbrello source eg. if (...) { ... } else { .... } 3. If possible use 'git format-patch' to generate the patch to have a complete patch header, which could be easily applied with 'git am'.
Thank you for the bug report. As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists. If this bug is no longer persisting or relevant please change the status to resolved.
Git commit 5dc9f9c172376a4276eec1c153c2c241125f999c by Oliver Kellogg. Committed on 29/12/2022 at 15:49. Pushed by okellogg into branch 'master'. 1. Apply patch https://bugs.kde.org/attachment.cgi?id=96895 with review comments by Ralf Habacker addressed. 2. Fix generation of section comments: - In umbrello/umbrello.kcfg group "Code Generation" change Bool forceSections to writeSectionComments of type CodeGenerationPolicy::WriteSectionCommentsPolicy. - In umbrello/optionstate.h class CodeGenerationState change member forceSections to writeSectionComments of type CodeGenerationPolicy::WriteSectionCommentsPolicy. - In umbrello/codegenerators/codegenerationpolicy.{h,cpp}, - add enum WriteSectionCommentsPolicy with values None, WhenNonEmpty, Always; - rename accessors {set,get}CodeVerboseSectionComments handling bool argument to {set,get}SectionCommentsPolicy handling arg of type WriteSectionCommentsPolicy, and manipulating Settings::optionState().codeGenerationState.writeSectionComments in lieu of the former forceSections; - change member `bool m_codeVerboseSectionComments` to `WriteSectionCommentsPolicy m_sectionCommentsPolicy`. - In umbrello/codegenerators/codegenerationpolicy.cpp adjust functions setDefaults and writeConfig to the UmbrelloSettings switchover from forceSections() to writeSectionComments(). - In umbrello/codegenwizard/codegenoptionspage.ui change QCheckBox ui_forceSections to QComboBox ui_writeSectionComments with values "None", "When section is non empty", "Always". - In umbrello/codegenwizard/codegenoptionspage.cpp adjust constructor and function apply() to the codegenoptionspage.ui change. - In umbrello/codegenerators/codegenerator.{h,cpp}, - change setForceSections(bool) to setSectionCommentPolicy with arg of type CodeGenerationPolicy::WriteSectionCommentsPolicy calling UMLApp::app()->commonPolicy()->setSectionCommentsPolicy(arg); - at getter forceSections() add TODO remark about changing return type to CodeGenerationPolicy::WriteSectionCommentsPolicy. - In umbrello/codegenerators/cpp/cppwriter.cpp : - Move setting of m_indentLevel from function writeHeaderFile to writeClassDecl so that class level comments are generated without indentation. - In functions writeSourceFile, writeAttributeDecls, writeAttributeMethods, writeConstructorDecls, writeConstructorMethods, - change test of forceDoc() to forceSections() when deciding whether to write section comments; - on generating section comments, change writeComment(QStringLiteral(" "), indnt, stream) to writeBlankLine(stream) in order to avoid ugly empty comments /* */ in multi line comment mode. - In function writeHeaderAttributeAccessorMethods simplify call to writeAttributeMethods() by factoring the effective visibility into local `vis`. M +17 -14 umbrello/codegenerators/codegenerationpolicy.cpp M +4 -3 umbrello/codegenerators/codegenerationpolicy.h M +71 -4 umbrello/codegenerators/codegenerator.cpp M +6 -2 umbrello/codegenerators/codegenerator.h M +57 -51 umbrello/codegenerators/cpp/cppwriter.cpp M +3 -2 umbrello/codegenwizard/codegenoptionspage.cpp M +92 -21 umbrello/codegenwizard/codegenoptionspage.ui M +2 -2 umbrello/optionstate.h M +9 -4 umbrello/umbrello.kcfg https://invent.kde.org/sdk/umbrello/commit/5dc9f9c172376a4276eec1c153c2c241125f999c