- feature: code reformatter setting dialog
This commit is contained in:
parent
09ef6c8ede
commit
4d16ef70c8
Binary file not shown.
|
@ -1480,211 +1480,392 @@ Are you really want to continue?</source>
|
|||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="449"/>
|
||||
<source>Insert spaces around operators</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>在运算符周围插入空格</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="456"/>
|
||||
<source>Insert spaces after commas</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>在逗号后插入空格</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="463"/>
|
||||
<source>Insert spaces after parenthesis headers ('if','for',...)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>在语句和括号间插入空格('if','for'...)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="470"/>
|
||||
<source>Insert spaces around parenthesis on the outside only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>在括号外侧加入空格</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="477"/>
|
||||
<source>Insert spaces around parenthesis on the inside only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>在括号内侧加入空格</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="484"/>
|
||||
<source>Insert empty lines arround unrelated blocks</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>在代码段之间加入空行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="491"/>
|
||||
<source>Insert empy lines around all blocks</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<source>Insert empty lines around all blocks</source>
|
||||
<oldsource>Insert empy lines around all blocks</oldsource>
|
||||
<translation>在所有代码段之间加入空格</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="498"/>
|
||||
<source>Insert spaces around first parenthesis in a series on the out side only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>在多层嵌套括号的最外侧加入空格</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="505"/>
|
||||
<source>Insert spaces around parenthesis</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>在括号两侧加入空格</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="513"/>
|
||||
<source>Padding 2</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>填充2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="519"/>
|
||||
<source>Remove all empty lines. It will NOT delete lines added by the padding options.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>删除所有空行。不影响填充选项自动插入的空行。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="526"/>
|
||||
<source>Attach a pointer operator to its :</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>将指针运算符('*')放在:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="533"/>
|
||||
<source>Remove all consecutive empty lines. It will NOT delete lines added by the padding options.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>将连续的多个空行合并成一个。不影响填充选项自动插入的空行。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="540"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="547"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="550"/>
|
||||
<source>type(left)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>类型侧(左侧)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="574"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="583"/>
|
||||
<source>Fill empty lines with the white space of the previous lines.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>使用前一行的缩进空格填充空行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="567"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="588"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="573"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="600"/>
|
||||
<source>middle</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>中间</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="61"/>
|
||||
<source><html><head/><body><p>Note for the predefined format style</p></body></html></source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation><html><head/><body><p>预定义排版方案说明</p></body></html></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="581"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="595"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="590"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="610"/>
|
||||
<source>name(right)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>名称侧(右侧)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="602"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="620"/>
|
||||
<source>Remove unnecessary space adding around parenthesis</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>删除括号周围的多余空格</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="609"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="627"/>
|
||||
<source>Attach a reference operator to its :</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="616"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="623"/>
|
||||
<source>none</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="631"/>
|
||||
<source>Other 1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="637"/>
|
||||
<source>Break one line headers ('if','while','else'...) from the statement on the same line</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>将引用运算符('&')放在:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="634"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="644"/>
|
||||
<source>none</source>
|
||||
<translation>不变</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="655"/>
|
||||
<source>Other 1</source>
|
||||
<translation>其它1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="661"/>
|
||||
<source>Break one line headers ('if','while','else'...) from the statement on the same line</source>
|
||||
<translation>对单行条件('if','while','else')语句分行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="668"/>
|
||||
<source>Add one line braces to unbraced one line conditional statements</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>用花括号括起单行条件体</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="651"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="675"/>
|
||||
<source>Break braces before close headers ('else','catch"...)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>对结束语句('else','catch')和它之前的花括号断行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="658"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="682"/>
|
||||
<source>Remove braces from a braced one line conditional statements</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>删除括起单行条件体语句的花括号</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="665"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="689"/>
|
||||
<source>Break 'else if' statements into two lines</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>将'else if'语句断成两行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="672"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="696"/>
|
||||
<source>Add braces to unbraced one line conditional statements</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>对条件和条件体语句在同一行上的,删除括起条件体语句的花括号</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="680"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="704"/>
|
||||
<source>Other 2</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>其它2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="686"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="745"/>
|
||||
<source>Attach return type to the function name in its declaration</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>将函数声明中的函数名和返回值类型放在同一行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="693"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="738"/>
|
||||
<source>Break return type from the function name in its declaration</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>将函数声明中的函数名和返回值类型断成两行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="700"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="710"/>
|
||||
<source>Break return type from the function name in its definition</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>将函数定义中的函数名和返回值类型断成两行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="707"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="724"/>
|
||||
<source>Attach return type to the function name in its definition</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>将函数定义中的函数名和返回值类型放在同一行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="714"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="717"/>
|
||||
<source>Don't break blocks residing completely on one line</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>不对同一行上的多个代码段断行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="721"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="731"/>
|
||||
<source>Don't break multimple statements residing on one line</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>不对同一行上的多条语句断行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="729"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="753"/>
|
||||
<source>Other 3</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>其它3</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="735"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="840"/>
|
||||
<source>Place the logical conditional to the last on the previous line, when break lines</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>在断行时,将逻辑条件放在前一行的末尾</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="742"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="833"/>
|
||||
<source>Close ending angle brackets on template definitions</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>关闭模板定义末尾的尖括号</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="749"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="826"/>
|
||||
<source>Remove the leading '*' prefix on multi-line comments and indent the comment text one line indent.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>删除多行注释前的'*'并缩进注释内容</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="771"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="774"/>
|
||||
<source>Break lines exceeds</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>对超过指定长度的行断行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="778"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.ui" line="781"/>
|
||||
<source>characters</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>字符</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FormatterStyleModel</name>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="204"/>
|
||||
<source>Default</source>
|
||||
<translation>缺省</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="205"/>
|
||||
<source>The opening braces will not be changed and closing braces will be broken from the preceding line.</source>
|
||||
<translation>左花括号不变,右花括号单独一行。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="210"/>
|
||||
<source>Allman</source>
|
||||
<translation>Allman</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="211"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="217"/>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="223"/>
|
||||
<source>Broken braces.</source>
|
||||
<translation>花括号单独一行。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="216"/>
|
||||
<source>Java</source>
|
||||
<translation>Java</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="222"/>
|
||||
<source>K&R</source>
|
||||
<translation>Kernighan & Ritchie</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="228"/>
|
||||
<source>Stroustrup</source>
|
||||
<translation>Kernighan & Ritchie</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="229"/>
|
||||
<source>Linux braces, with broken closing headers.</source>
|
||||
<translation>Linux风格花括号,对条件结束语句(如do-while的while)断行。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="234"/>
|
||||
<source>Whitesmith</source>
|
||||
<translation>Whitesmith</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="235"/>
|
||||
<source>Broken, indented braces.</source>
|
||||
<translation>花括号独立成行,并且缩进。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="237"/>
|
||||
<source>Indented class blocks and switch blocks.</source>
|
||||
<translation>类代码段和switch代码段缩进。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="242"/>
|
||||
<source>VTK</source>
|
||||
<translation>VTK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="243"/>
|
||||
<source>Broken, indented braces except for the opening braces.</source>
|
||||
<translation>除左花括号外,其他花括号独立断行且缩进。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="248"/>
|
||||
<source>Ratliff</source>
|
||||
<translation>Ratliff</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="249"/>
|
||||
<source>Attached, indented braces.</source>
|
||||
<translation>花括号不断行,但是缩进</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="254"/>
|
||||
<source>GNU</source>
|
||||
<translation>GNU</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="255"/>
|
||||
<source>Broken braces, indented blocks.</source>
|
||||
<translation>花括号短号,代码段缩进</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="260"/>
|
||||
<source>Linux</source>
|
||||
<translation>Linux</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="261"/>
|
||||
<source>Linux braces, minimum conditional indent is one-half indent.</source>
|
||||
<translation>Linux风格花括号,最小条件缩进为1.5单位。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="266"/>
|
||||
<source>Horstmann</source>
|
||||
<translation>Horstmann</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="267"/>
|
||||
<source>Run-in braces, indented switches.</source>
|
||||
<translation>Run-in花括号,switch语句缩进</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="272"/>
|
||||
<source>One True Brace</source>
|
||||
<translation>One True Brace</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="273"/>
|
||||
<source>Linux braces, add braces to all conditionals.</source>
|
||||
<translation>Linux封号花括号,所有条件语句条件花括号</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="278"/>
|
||||
<source>Google</source>
|
||||
<translation>Google</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="279"/>
|
||||
<source>Attached braces, indented class modifiers.</source>
|
||||
<translation>花括号不断行,类访问限定符缩进</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="284"/>
|
||||
<source>Mozilla</source>
|
||||
<translation>Mozilla</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="285"/>
|
||||
<source>Linux braces, with broken braces for structs and enums, and attached braces for namespaces.</source>
|
||||
<translation>Linux风格花括号, 结构和枚举的花括号断行, 命名空间的花括号不断行。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="290"/>
|
||||
<source>Webkit</source>
|
||||
<translation>Webkit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="291"/>
|
||||
<source>Linux braces, with attached closing headers.</source>
|
||||
<translation>Linux风格花括号, 条件结束语句(如do-while的while)不断行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="296"/>
|
||||
<source>Pico</source>
|
||||
<translation>Pico</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="297"/>
|
||||
<source>Run-in opening braces and attached closing braces.</source>
|
||||
<translation>Run-in左花括号,右花括号不断行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="299"/>
|
||||
<source>Uses keep one line blocks and keep one line statements.</source>
|
||||
<translation>启用保持单行代码段和保持多语句单行选项。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="304"/>
|
||||
<source>Lisp</source>
|
||||
<translation>Lisp</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="305"/>
|
||||
<source>Attached opening braces and attached closing braces.</source>
|
||||
<translation>花括号不断行。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/formattergeneralwidget.cpp" line="307"/>
|
||||
<source>Uses keep one line statements.</source>
|
||||
<translation>启用保持多语句单行选项。</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -3436,7 +3617,7 @@ Are you really want to continue?</source>
|
|||
<message>
|
||||
<location filename="settingsdialog/settingsdialog.cpp" line="87"/>
|
||||
<source>Code Formatter</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>代码排版</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/settingsdialog.cpp" line="184"/>
|
||||
|
|
|
@ -2814,12 +2814,12 @@ void Settings::CodeFormatter::setIndentNamespaces(bool newIndentNamespaces)
|
|||
mIndentNamespaces = newIndentNamespaces;
|
||||
}
|
||||
|
||||
bool Settings::CodeFormatter::indentContinuation() const
|
||||
int Settings::CodeFormatter::indentContinuation() const
|
||||
{
|
||||
return mIndentContinuation;
|
||||
}
|
||||
|
||||
void Settings::CodeFormatter::setIndentContinuation(bool newIndentContinuation)
|
||||
void Settings::CodeFormatter::setIndentContinuation(int newIndentContinuation)
|
||||
{
|
||||
mIndentContinuation = newIndentContinuation;
|
||||
}
|
||||
|
@ -3184,14 +3184,14 @@ void Settings::CodeFormatter::setRemoveCommentPrefix(bool newRemoveCommentPrefix
|
|||
mRemoveCommentPrefix = newRemoveCommentPrefix;
|
||||
}
|
||||
|
||||
int Settings::CodeFormatter::getMaxCodeLength() const
|
||||
int Settings::CodeFormatter::maxCodeLength() const
|
||||
{
|
||||
return maxCodeLength;
|
||||
return mMaxCodeLength;
|
||||
}
|
||||
|
||||
void Settings::CodeFormatter::setMaxCodeLength(int newMaxCodeLength)
|
||||
{
|
||||
maxCodeLength = newMaxCodeLength;
|
||||
mMaxCodeLength = newMaxCodeLength;
|
||||
}
|
||||
|
||||
bool Settings::CodeFormatter::breakAfterLogical() const
|
||||
|
@ -3224,6 +3224,26 @@ void Settings::CodeFormatter::setBreakMaxCodeLength(bool newBreakMaxCodeLength)
|
|||
mBreakMaxCodeLength = newBreakMaxCodeLength;
|
||||
}
|
||||
|
||||
bool Settings::CodeFormatter::indentAfterParens() const
|
||||
{
|
||||
return mIndentAfterParens;
|
||||
}
|
||||
|
||||
void Settings::CodeFormatter::setIndentAfterParens(bool newIndentAfterParens)
|
||||
{
|
||||
mIndentAfterParens = newIndentAfterParens;
|
||||
}
|
||||
|
||||
bool Settings::CodeFormatter::indentSwitches() const
|
||||
{
|
||||
return mIndentSwitches;
|
||||
}
|
||||
|
||||
void Settings::CodeFormatter::setIndentSwitches(bool newIndentSwitches)
|
||||
{
|
||||
mIndentSwitches = newIndentSwitches;
|
||||
}
|
||||
|
||||
void Settings::CodeFormatter::doSave()
|
||||
{
|
||||
saveValue("brace_style",mBraceStyle);
|
||||
|
@ -3236,8 +3256,10 @@ void Settings::CodeFormatter::doSave()
|
|||
saveValue("attach_closing_while",mAttachClosingWhile);
|
||||
saveValue("indent_classes",mIndentClasses);
|
||||
saveValue("indent_modifiers",mIndentModifiers);
|
||||
saveValue("indent_switches",mIndentSwitches);
|
||||
saveValue("indent_cases",mIndentCases);
|
||||
saveValue("indent_namespaces",mIndentNamespaces);
|
||||
saveValue("indent_after_parents",mIndentAfterParens);
|
||||
saveValue("indent_continuation",mIndentContinuation);
|
||||
saveValue("indent_labels",mIndentLabels);
|
||||
saveValue("indent_preproc_block",mIndentPreprocBlock);
|
||||
|
@ -3277,7 +3299,7 @@ void Settings::CodeFormatter::doSave()
|
|||
saveValue("close_templates",mCloseTemplates);
|
||||
saveValue("remove_comment_prefix",mRemoveCommentPrefix);
|
||||
saveValue("break_max_code_length",mBreakMaxCodeLength);
|
||||
saveValue("max_code_length",maxCodeLength);
|
||||
saveValue("max_code_length",mMaxCodeLength);
|
||||
saveValue("break_after_logical",mBreakAfterLogical);
|
||||
}
|
||||
|
||||
|
@ -3293,8 +3315,10 @@ void Settings::CodeFormatter::doLoad()
|
|||
mAttachClosingWhile = boolValue("attach_closing_while",false);
|
||||
mIndentClasses = boolValue("indent_classes",false);
|
||||
mIndentModifiers = boolValue("indent_modifiers",false);
|
||||
mIndentSwitches = boolValue("indent_switches",false);
|
||||
mIndentCases = boolValue("indent_cases",false);
|
||||
mIndentNamespaces = boolValue("indent_namespaces",false);
|
||||
mIndentAfterParens = boolValue("indent_after_parents",false);
|
||||
mIndentContinuation = boolValue("indent_continuation",false);
|
||||
mIndentLabels = boolValue("indent_labels",false);
|
||||
mIndentPreprocBlock = boolValue("indent_preproc_block",false);
|
||||
|
@ -3334,7 +3358,7 @@ void Settings::CodeFormatter::doLoad()
|
|||
mCloseTemplates = boolValue("close_templates",false);
|
||||
mRemoveCommentPrefix = boolValue("remove_comment_prefix",false);
|
||||
mBreakMaxCodeLength = boolValue("break_max_code_length",false);
|
||||
maxCodeLength = intValue("max_code_length",200);
|
||||
mMaxCodeLength = intValue("max_code_length",200);
|
||||
mBreakAfterLogical = boolValue("break_after_logical",false);
|
||||
}
|
||||
|
||||
|
|
|
@ -493,8 +493,8 @@ public:
|
|||
void setIndentCases(bool newIndentCases);
|
||||
bool indentNamespaces() const;
|
||||
void setIndentNamespaces(bool newIndentNamespaces);
|
||||
bool indentContinuation() const;
|
||||
void setIndentContinuation(bool newIndentContinuation);
|
||||
int indentContinuation() const;
|
||||
void setIndentContinuation(int newIndentContinuation);
|
||||
bool indentLabels() const;
|
||||
void setIndentLabels(bool newIndentLabels);
|
||||
bool indentPreprocBlock() const;
|
||||
|
@ -567,7 +567,7 @@ public:
|
|||
void setCloseTemplates(bool newCloseTemplates);
|
||||
bool removeCommentPrefix() const;
|
||||
void setRemoveCommentPrefix(bool newRemoveCommentPrefix);
|
||||
int getMaxCodeLength() const;
|
||||
int maxCodeLength() const;
|
||||
void setMaxCodeLength(int newMaxCodeLength);
|
||||
bool breakAfterLogical() const;
|
||||
void setBreakAfterLogical(bool newBreakAfterLogical);
|
||||
|
@ -578,6 +578,12 @@ public:
|
|||
bool breakMaxCodeLength() const;
|
||||
void setBreakMaxCodeLength(bool newBreakMaxCodeLength);
|
||||
|
||||
bool indentSwitches() const;
|
||||
void setIndentSwitches(bool newIndentSwitches);
|
||||
|
||||
bool indentAfterParens() const;
|
||||
void setIndentAfterParens(bool newIndentAfterParens);
|
||||
|
||||
private:
|
||||
int mBraceStyle;
|
||||
int mIndentStyle;
|
||||
|
@ -589,9 +595,11 @@ public:
|
|||
bool mAttachClosingWhile;
|
||||
bool mIndentClasses;
|
||||
bool mIndentModifiers;
|
||||
bool mIndentSwitches;
|
||||
bool mIndentCases;
|
||||
bool mIndentNamespaces;
|
||||
bool mIndentContinuation;
|
||||
bool mIndentAfterParens;
|
||||
int mIndentContinuation;
|
||||
bool mIndentLabels;
|
||||
bool mIndentPreprocBlock;
|
||||
bool mIndentPreprocCond;
|
||||
|
@ -630,7 +638,7 @@ public:
|
|||
bool mCloseTemplates;
|
||||
bool mRemoveCommentPrefix;
|
||||
bool mBreakMaxCodeLength;
|
||||
int maxCodeLength;
|
||||
int mMaxCodeLength;
|
||||
bool mBreakAfterLogical;
|
||||
// _Base interface
|
||||
protected:
|
||||
|
|
|
@ -7,6 +7,11 @@ FormatterGeneralWidget::FormatterGeneralWidget(const QString& name, const QStrin
|
|||
ui(new Ui::FormatterGeneralWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->cbBraceStyle->setModel(&mStylesModel);
|
||||
connect(ui->cbBraceStyle, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &FormatterGeneralWidget::onBraceStyleChanged);
|
||||
ui->editDemo->setReadOnly(true);
|
||||
ui->editDemo->lines()->setText("int test;");
|
||||
}
|
||||
|
||||
FormatterGeneralWidget::~FormatterGeneralWidget()
|
||||
|
@ -14,12 +19,346 @@ FormatterGeneralWidget::~FormatterGeneralWidget()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
void FormatterGeneralWidget::onBraceStyleChanged()
|
||||
{
|
||||
PFormatterStyleItem item = mStylesModel.getStyle(ui->cbBraceStyle->currentIndex());
|
||||
if (item) {
|
||||
ui->lblBraceStyle->setText(item->description);
|
||||
}
|
||||
}
|
||||
|
||||
void FormatterGeneralWidget::doLoad()
|
||||
{
|
||||
Settings::CodeFormatter& format = pSettings->codeFormatter();
|
||||
ui->cbBraceStyle->setCurrentIndex(format.braceStyle());
|
||||
if (format.indentStyle() == FormatterIndentType::fitSpace) {
|
||||
ui->rbIndentSpaces->setChecked(true);
|
||||
} else {
|
||||
ui->rbIndentTabs->setChecked(true);
|
||||
}
|
||||
ui->spinTabSize->setValue(format.tabWidth());
|
||||
ui->chkAttachNamespaces->setChecked(format.attachNamespaces());
|
||||
ui->chkAttachClasses->setChecked(format.attachClasses());
|
||||
ui->chkAttachInline->setChecked(format.attachInlines());
|
||||
ui->chkAttachExternC->setChecked(format.attachExternC());
|
||||
ui->chkAttachClosingWhile->setChecked(format.attachClosingWhile());
|
||||
ui->chkIndentClasses->setChecked(format.indentClasses());
|
||||
ui->chkIndentModifiers->setChecked(format.indentModifiers());
|
||||
ui->chkIndentSwiches->setChecked(format.indentSwitches());
|
||||
ui->chkIndentCases->setChecked(format.indentCases());
|
||||
ui->chkIndentNamespaces->setChecked(format.indentNamespaces());
|
||||
ui->chkIndentAfterParens->setChecked(format.indentAfterParens());
|
||||
ui->spinIndentContinuation->setValue(format.indentContinuation());
|
||||
ui->chkIndentLabels->setChecked(format.indentLabels());
|
||||
ui->chkIndentPreprocBlock->setChecked(format.indentPreprocBlock());
|
||||
ui->chkIndentPreprocCond->setChecked(format.indentPreprocCond());
|
||||
ui->chkIndentPreprocDefine->setChecked(format.indentPreprocDefine());
|
||||
ui->chkIndentCol1Comments->setChecked(format.indentCol1Comments());
|
||||
ui->spinMinConditionalIndent->setValue(format.minConditionalIndent());
|
||||
ui->spinMaxContinuationIndent->setValue(format.maxContinuationIndent());
|
||||
ui->chkBreakBlocks->setChecked(format.breakBlocks());
|
||||
ui->chkBreakBlocksAll->setChecked(format.breakBlocksAll());
|
||||
ui->chkPadOper->setChecked(format.padOper());
|
||||
ui->chkPadComma->setChecked(format.padComma());
|
||||
ui->chkPadParen->setChecked(format.padParen());
|
||||
ui->chkPadParenOut->setChecked(format.padParenOut());
|
||||
ui->chkPadFirstParenOut->setChecked(format.padFirstParenOut());
|
||||
ui->chkPadParenIn->setChecked(format.padParenIn());
|
||||
ui->chkPadHeader->setChecked(format.padHeader());
|
||||
ui->chkUnpadParen->setChecked(format.unpadParen());
|
||||
ui->chkDeleteEmptyLines->setChecked(format.deleteEmptyLines());
|
||||
ui->chkDeleteMultipleEmptyLines->setChecked(format.deleteMultipleEmptyLines());
|
||||
ui->chkFillEmptyLines->setChecked(format.fillEmptyLines());
|
||||
switch(format.alignPointerStyle()) {
|
||||
case FormatterOperatorAlign::foaNone:
|
||||
ui->rbAlignPointNone->setChecked(true);
|
||||
break;
|
||||
case FormatterOperatorAlign::foaType:
|
||||
ui->rbAlignPointType->setChecked(true);
|
||||
break;
|
||||
case FormatterOperatorAlign::foaMiddle:
|
||||
ui->rbAlignPointerMiddle->setChecked(true);
|
||||
break;
|
||||
case FormatterOperatorAlign::foaName:
|
||||
ui->rbAlignPointerName->setChecked(true);
|
||||
break;
|
||||
}
|
||||
switch(format.alignReferenceStyle()) {
|
||||
case FormatterOperatorAlign::foaNone:
|
||||
ui->rbAlignReferenceNone->setChecked(true);
|
||||
break;
|
||||
case FormatterOperatorAlign::foaType:
|
||||
ui->rbAlignReferenceType->setChecked(true);
|
||||
break;
|
||||
case FormatterOperatorAlign::foaMiddle:
|
||||
ui->rbAlignReferenceMiddle->setChecked(true);
|
||||
break;
|
||||
case FormatterOperatorAlign::foaName:
|
||||
ui->rbAlignReferenceName->setChecked(true);
|
||||
break;
|
||||
}
|
||||
ui->chkBreakClosingBraces->setChecked(format.breakClosingBraces());
|
||||
ui->chkBreakElseIf->setChecked(format.breakElseIf());
|
||||
ui->chkBreakOneLineHeaders->setChecked(format.breakOneLineHeaders());
|
||||
ui->chkAddBraces->setChecked(format.addBraces());
|
||||
ui->chkAddOneLineBraces->setChecked(format.addOneLineBraces());
|
||||
ui->chkRemoveBraces->setChecked(format.removeBraces());
|
||||
ui->chkBreakReturnType->setChecked(format.breakReturnType());
|
||||
ui->chkBreakReturnTypeDecl->setChecked(format.breakReturnTypeDecl());
|
||||
ui->chkAttachReturnType->setChecked(format.attachReturnType());
|
||||
ui->chkAttachReturnTypeDecl->setChecked(format.attachReturnTypeDecl());
|
||||
ui->chkKeepOneLineBlocks->setChecked(format.keepOneLineBlocks());
|
||||
ui->chkKeepOneLineStatements->setChecked(format.keepOneLineStatements());
|
||||
ui->chkConvertTabs->setChecked(format.convertTabs());
|
||||
ui->chkCloseTemplates->setChecked(format.closeTemplates());
|
||||
ui->chkRemoveCommentPrefix->setChecked(format.removeCommentPrefix());
|
||||
ui->chkBreakMaxCodeLength->setChecked(format.breakMaxCodeLength());
|
||||
ui->spinMaxCodeLength->setValue(format.maxCodeLength());
|
||||
ui->chkBreakAfterLogical->setChecked(format.breakAfterLogical());
|
||||
}
|
||||
|
||||
void FormatterGeneralWidget::doSave()
|
||||
{
|
||||
|
||||
pSettings->codeFormatter().save();
|
||||
Settings::CodeFormatter& format = pSettings->codeFormatter();
|
||||
if (ui->cbBraceStyle->currentIndex()>0)
|
||||
format.setBraceStyle(ui->cbBraceStyle->currentIndex());
|
||||
if (ui->rbIndentSpaces) {
|
||||
format.setIndentStyle(FormatterIndentType::fitSpace);
|
||||
} else {
|
||||
format.setIndentStyle(FormatterIndentType::fitTab);
|
||||
}
|
||||
format.setTabWidth(ui->spinTabSize->value());
|
||||
format.setAttachNamespaces(ui->chkAttachNamespaces->isChecked());
|
||||
format.setAttachClasses(ui->chkAttachClasses->isChecked());
|
||||
format.setAttachInlines(ui->chkAttachInline->isChecked());
|
||||
format.setAttachExternC(ui->chkAttachExternC->isChecked());
|
||||
format.setAttachClosingWhile(ui->chkAttachClosingWhile->isChecked());
|
||||
format.setIndentClasses(ui->chkIndentClasses->isChecked());
|
||||
format.setIndentModifiers(ui->chkIndentModifiers->isChecked());
|
||||
format.setIndentSwitches(ui->chkIndentSwiches->isChecked());
|
||||
format.setIndentCases(ui->chkIndentCases->isChecked());
|
||||
format.setIndentNamespaces(ui->chkIndentNamespaces->isChecked());
|
||||
format.setIndentAfterParens(ui->chkIndentAfterParens->isChecked());
|
||||
format.setIndentContinuation(ui->spinIndentContinuation->value());
|
||||
format.setIndentLabels(ui->chkIndentLabels->isChecked());
|
||||
format.setIndentPreprocBlock(ui->chkIndentPreprocBlock->isChecked());
|
||||
format.setIndentPreprocCond(ui->chkIndentPreprocCond->isChecked());
|
||||
format.setIndentPreprocDefine(ui->chkIndentPreprocDefine->isChecked());
|
||||
format.setIndentCol1Comments(ui->chkIndentCol1Comments->isChecked());
|
||||
format.setMinConditionalIndent(ui->spinMinConditionalIndent->value());
|
||||
format.setMaxContinuationIndent(ui->spinMaxContinuationIndent->value());
|
||||
format.setBreakBlocks(ui->chkBreakBlocks->isChecked());
|
||||
format.setBreakBlocksAll(ui->chkBreakBlocksAll->isChecked());
|
||||
format.setPadOper(ui->chkPadOper->isChecked());
|
||||
format.setPadComma(ui->chkPadComma->isChecked());
|
||||
format.setPadParen(ui->chkPadParen->isChecked());
|
||||
format.setPadParenOut(ui->chkPadParenOut->isChecked());
|
||||
format.setPadFirstParenOut(ui->chkPadFirstParenOut->isChecked());
|
||||
format.setPadParenIn(ui->chkPadParenIn->isChecked());
|
||||
format.setPadHeader(ui->chkPadHeader->isChecked());
|
||||
format.setUnpadParen(ui->chkUnpadParen->isChecked());
|
||||
format.setDeleteEmptyLines(ui->chkDeleteEmptyLines->isChecked());
|
||||
format.setDeleteMultipleEmptyLines(ui->chkDeleteMultipleEmptyLines->isChecked());
|
||||
format.setFillEmptyLines(ui->chkFillEmptyLines->isChecked());
|
||||
if (ui->rbAlignPointNone->isChecked()) {
|
||||
format.setAlignPointerStyle(FormatterOperatorAlign::foaNone);
|
||||
} else if (ui->rbAlignPointType->isChecked()) {
|
||||
format.setAlignPointerStyle(FormatterOperatorAlign::foaType);
|
||||
} else if (ui->rbAlignPointerMiddle->isChecked()) {
|
||||
format.setAlignPointerStyle(FormatterOperatorAlign::foaMiddle);
|
||||
} else if (ui->rbAlignPointerName->isChecked()) {
|
||||
format.setAlignPointerStyle(FormatterOperatorAlign::foaName);
|
||||
}
|
||||
if (ui->rbAlignReferenceNone->isChecked()) {
|
||||
format.setAlignReferenceStyle(FormatterOperatorAlign::foaNone);
|
||||
} else if (ui->rbAlignReferenceType->isChecked()) {
|
||||
format.setAlignReferenceStyle(FormatterOperatorAlign::foaType);
|
||||
} else if (ui->rbAlignReferenceMiddle->isChecked()) {
|
||||
format.setAlignReferenceStyle(FormatterOperatorAlign::foaMiddle);
|
||||
} else if (ui->rbAlignReferenceName->isChecked()) {
|
||||
format.setAlignReferenceStyle(FormatterOperatorAlign::foaName);
|
||||
}
|
||||
format.setBreakClosingBraces(ui->chkBreakClosingBraces->isChecked());
|
||||
format.setBreakElseIf(ui->chkBreakElseIf->isChecked());
|
||||
format.setBreakOneLineHeaders(ui->chkBreakOneLineHeaders->isChecked());
|
||||
format.setAddBraces(ui->chkAddBraces->isChecked());
|
||||
format.setAddOneLineBraces(ui->chkAddOneLineBraces->isChecked());
|
||||
format.setRemoveBraces(ui->chkRemoveBraces->isChecked());
|
||||
format.setBreakReturnType(ui->chkBreakReturnType->isChecked());
|
||||
format.setBreakReturnTypeDecl(ui->chkBreakReturnTypeDecl->isChecked());
|
||||
format.setAttachReturnType(ui->chkAttachReturnType->isChecked());
|
||||
format.setAttachReturnTypeDecl(ui->chkAttachReturnTypeDecl->isChecked());
|
||||
format.setKeepOneLineBlocks(ui->chkKeepOneLineBlocks->isChecked());
|
||||
format.setKeepOneLineStatements(ui->chkKeepOneLineStatements->isChecked());
|
||||
format.setConvertTabs(ui->chkConvertTabs->isChecked());
|
||||
format.setCloseTemplates(ui->chkCloseTemplates->isChecked());
|
||||
format.setRemoveCommentPrefix(ui->chkRemoveCommentPrefix->isChecked());
|
||||
format.setBreakMaxCodeLength(ui->chkBreakMaxCodeLength->isChecked());
|
||||
format.setMaxCodeLength(ui->spinMaxCodeLength->value());
|
||||
format.setBreakAfterLogical(ui->chkBreakAfterLogical->isChecked());
|
||||
format.save();
|
||||
}
|
||||
|
||||
FormatterStyleModel::FormatterStyleModel(QObject *parent):QAbstractListModel(parent)
|
||||
{
|
||||
mStyles.append(
|
||||
std::make_shared<FormatterStyleItem>(
|
||||
tr("Default"),
|
||||
tr("The opening braces will not be changed and closing braces will be broken from the preceding line."),
|
||||
FormatterBraceStyle::fbsDefault)
|
||||
);
|
||||
mStyles.append(
|
||||
std::make_shared<FormatterStyleItem>(
|
||||
tr("Allman"),
|
||||
tr("Broken braces."),
|
||||
FormatterBraceStyle::fbsAllman)
|
||||
);
|
||||
mStyles.append(
|
||||
std::make_shared<FormatterStyleItem>(
|
||||
tr("Java"),
|
||||
tr("Broken braces."),
|
||||
FormatterBraceStyle::fbsJava)
|
||||
);
|
||||
mStyles.append(
|
||||
std::make_shared<FormatterStyleItem>(
|
||||
tr("K&R"),
|
||||
tr("Broken braces."),
|
||||
FormatterBraceStyle::fbsKR)
|
||||
);
|
||||
mStyles.append(
|
||||
std::make_shared<FormatterStyleItem>(
|
||||
tr("Stroustrup"),
|
||||
tr("Linux braces, with broken closing headers."),
|
||||
FormatterBraceStyle::fbsStroustrup)
|
||||
);
|
||||
mStyles.append(
|
||||
std::make_shared<FormatterStyleItem>(
|
||||
tr("Whitesmith"),
|
||||
tr("Broken, indented braces.")
|
||||
+ " "
|
||||
+tr("Indented class blocks and switch blocks."),
|
||||
FormatterBraceStyle::fbsWitesmith)
|
||||
);
|
||||
mStyles.append(
|
||||
std::make_shared<FormatterStyleItem>(
|
||||
tr("VTK"),
|
||||
tr("Broken, indented braces except for the opening braces."),
|
||||
FormatterBraceStyle::fbsVtk)
|
||||
);
|
||||
mStyles.append(
|
||||
std::make_shared<FormatterStyleItem>(
|
||||
tr("Ratliff"),
|
||||
tr("Attached, indented braces."),
|
||||
FormatterBraceStyle::fbsRatliff)
|
||||
);
|
||||
mStyles.append(
|
||||
std::make_shared<FormatterStyleItem>(
|
||||
tr("GNU"),
|
||||
tr("Broken braces, indented blocks."),
|
||||
FormatterBraceStyle::fbsGNU)
|
||||
);
|
||||
mStyles.append(
|
||||
std::make_shared<FormatterStyleItem>(
|
||||
tr("Linux"),
|
||||
tr("Linux braces, minimum conditional indent is one-half indent."),
|
||||
FormatterBraceStyle::fbsLinux)
|
||||
);
|
||||
mStyles.append(
|
||||
std::make_shared<FormatterStyleItem>(
|
||||
tr("Horstmann"),
|
||||
tr("Run-in braces, indented switches."),
|
||||
FormatterBraceStyle::fbsHorstman)
|
||||
);
|
||||
mStyles.append(
|
||||
std::make_shared<FormatterStyleItem>(
|
||||
tr("One True Brace"),
|
||||
tr("Linux braces, add braces to all conditionals."),
|
||||
FormatterBraceStyle::fbs1TBS)
|
||||
);
|
||||
mStyles.append(
|
||||
std::make_shared<FormatterStyleItem>(
|
||||
tr("Google"),
|
||||
tr("Attached braces, indented class modifiers."),
|
||||
FormatterBraceStyle::fbsGoogle)
|
||||
);
|
||||
mStyles.append(
|
||||
std::make_shared<FormatterStyleItem>(
|
||||
tr("Mozilla"),
|
||||
tr("Linux braces, with broken braces for structs and enums, and attached braces for namespaces."),
|
||||
FormatterBraceStyle::fbsMozilla)
|
||||
);
|
||||
mStyles.append(
|
||||
std::make_shared<FormatterStyleItem>(
|
||||
tr("Webkit"),
|
||||
tr("Linux braces, with attached closing headers."),
|
||||
FormatterBraceStyle::fbsWebkit)
|
||||
);
|
||||
mStyles.append(
|
||||
std::make_shared<FormatterStyleItem>(
|
||||
tr("Pico"),
|
||||
tr("Run-in opening braces and attached closing braces.")
|
||||
+" "+
|
||||
tr("Uses keep one line blocks and keep one line statements."),
|
||||
FormatterBraceStyle::fbsPico)
|
||||
);
|
||||
mStyles.append(
|
||||
std::make_shared<FormatterStyleItem>(
|
||||
tr("Lisp"),
|
||||
tr("Attached opening braces and attached closing braces.")
|
||||
+" "+
|
||||
tr("Uses keep one line statements."),
|
||||
FormatterBraceStyle::fbsLisp)
|
||||
);
|
||||
}
|
||||
|
||||
int FormatterStyleModel::rowCount(const QModelIndex &) const
|
||||
{
|
||||
return mStyles.count();
|
||||
}
|
||||
|
||||
QVariant FormatterStyleModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
int row = index.row();
|
||||
if (row<0 || row>=mStyles.count())
|
||||
return QVariant();
|
||||
PFormatterStyleItem item = mStyles[row];
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
return item->name;
|
||||
case Qt::ToolTipRole:
|
||||
return item->description;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
PFormatterStyleItem FormatterStyleModel::getStyle(const QModelIndex &index)
|
||||
{
|
||||
if (index.isValid()) {
|
||||
return getStyle(index.row());
|
||||
} else {
|
||||
return PFormatterStyleItem();
|
||||
}
|
||||
}
|
||||
|
||||
PFormatterStyleItem FormatterStyleModel::getStyle(int index)
|
||||
{
|
||||
if (index<0 || index>=mStyles.count())
|
||||
return PFormatterStyleItem();
|
||||
return mStyles[index];
|
||||
}
|
||||
|
||||
FormatterStyleItem::FormatterStyleItem(const QString &name, const QString &description, FormatterBraceStyle style)
|
||||
{
|
||||
this->name = name;
|
||||
this->description = description;
|
||||
this->style = style;
|
||||
}
|
||||
|
||||
void FormatterGeneralWidget::on_chkBreakMaxCodeLength_stateChanged(int)
|
||||
{
|
||||
ui->spinMaxCodeLength->setEnabled(ui->chkBreakMaxCodeLength->isChecked());
|
||||
ui->chkBreakAfterLogical->setEnabled(ui->chkBreakMaxCodeLength->isChecked());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,39 @@
|
|||
#ifndef FORMATTERGENERALWIDGET_H
|
||||
#define FORMATTERGENERALWIDGET_H
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QWidget>
|
||||
#include "settingswidget.h"
|
||||
#include "../utils.h"
|
||||
|
||||
namespace Ui {
|
||||
class FormatterGeneralWidget;
|
||||
}
|
||||
|
||||
struct FormatterStyleItem {
|
||||
QString name;
|
||||
QString description;
|
||||
FormatterBraceStyle style;
|
||||
explicit FormatterStyleItem(const QString& name,
|
||||
const QString& description,
|
||||
FormatterBraceStyle style);
|
||||
};
|
||||
using PFormatterStyleItem = std::shared_ptr<FormatterStyleItem>;
|
||||
|
||||
class FormatterStyleModel : public QAbstractListModel{
|
||||
Q_OBJECT
|
||||
// QAbstractItemModel interface
|
||||
public:
|
||||
explicit FormatterStyleModel(QObject *parent=nullptr);
|
||||
int rowCount(const QModelIndex &parent) const override;
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
PFormatterStyleItem getStyle(const QModelIndex &index);
|
||||
PFormatterStyleItem getStyle(int index);
|
||||
private:
|
||||
QList<PFormatterStyleItem> mStyles;
|
||||
};
|
||||
|
||||
|
||||
class FormatterGeneralWidget : public SettingsWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -15,9 +41,14 @@ class FormatterGeneralWidget : public SettingsWidget
|
|||
public:
|
||||
explicit FormatterGeneralWidget(const QString& name, const QString& group, QWidget *parent = nullptr);
|
||||
~FormatterGeneralWidget();
|
||||
private slots:
|
||||
void onBraceStyleChanged();
|
||||
|
||||
void on_chkBreakMaxCodeLength_stateChanged(int arg1);
|
||||
|
||||
private:
|
||||
Ui::FormatterGeneralWidget *ui;
|
||||
FormatterStyleModel mStylesModel;
|
||||
|
||||
// SettingsWidget interface
|
||||
protected:
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>881</width>
|
||||
<height>598</height>
|
||||
<height>754</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -68,7 +68,7 @@
|
|||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>7</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
|
@ -388,7 +388,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="chkIdentAfterParens">
|
||||
<widget class="QCheckBox" name="chkIndentAfterParens">
|
||||
<property name="text">
|
||||
<string>Indent after parenthesis '(' or assignment '='</string>
|
||||
</property>
|
||||
|
@ -486,9 +486,9 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="chkBreadBlocksAll">
|
||||
<widget class="QCheckBox" name="chkBreakBlocksAll">
|
||||
<property name="text">
|
||||
<string>Insert empy lines around all blocks</string>
|
||||
<string>Insert empty lines around all blocks</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -539,6 +539,9 @@
|
|||
<property name="text">
|
||||
<string>type(left)</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">referenceBtnGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
|
@ -546,6 +549,9 @@
|
|||
<property name="text">
|
||||
<string>type(left)</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">pointerBtnGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="5">
|
||||
|
@ -566,10 +572,13 @@
|
|||
<property name="text">
|
||||
<string>middle</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">referenceBtnGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="6">
|
||||
<widget class="QCheckBox" name="chkFileEmptyLines">
|
||||
<widget class="QCheckBox" name="chkFillEmptyLines">
|
||||
<property name="text">
|
||||
<string>Fill empty lines with the white space of the previous lines.</string>
|
||||
</property>
|
||||
|
@ -580,6 +589,9 @@
|
|||
<property name="text">
|
||||
<string>name(right)</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">referenceBtnGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
|
@ -587,6 +599,9 @@
|
|||
<property name="text">
|
||||
<string>middle</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">pointerBtnGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="4">
|
||||
|
@ -594,6 +609,9 @@
|
|||
<property name="text">
|
||||
<string>name(right)</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">pointerBtnGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="6">
|
||||
|
@ -615,6 +633,9 @@
|
|||
<property name="text">
|
||||
<string>none</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">pointerBtnGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
|
@ -622,6 +643,9 @@
|
|||
<property name="text">
|
||||
<string>none</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">referenceBtnGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -680,48 +704,48 @@
|
|||
<string>Other 2</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="chkAttachReturnTypeDecl">
|
||||
<property name="text">
|
||||
<string>Attach return type to the function name in its declaration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="chkBreakReturnTypeDecl">
|
||||
<property name="text">
|
||||
<string>Break return type from the function name in its declaration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="chkBreakReturnType">
|
||||
<property name="text">
|
||||
<string>Break return type from the function name in its definition</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="chkAttachReturnType">
|
||||
<property name="text">
|
||||
<string>Attach return type to the function name in its definition</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="chkKeepOneLineBlocks">
|
||||
<property name="text">
|
||||
<string>Don't break blocks residing completely on one line</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="chkAttachReturnType">
|
||||
<property name="text">
|
||||
<string>Attach return type to the function name in its definition</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="chkKeepOneLineStatements">
|
||||
<property name="text">
|
||||
<string>Don't break multimple statements residing on one line</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="chkBreakReturnTypeDecl">
|
||||
<property name="text">
|
||||
<string>Break return type from the function name in its declaration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="chkAttachReturnTypeDecl">
|
||||
<property name="text">
|
||||
<string>Attach return type to the function name in its declaration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_8">
|
||||
|
@ -729,27 +753,6 @@
|
|||
<string>Other 3</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="chkBreakAfterLogical">
|
||||
<property name="text">
|
||||
<string>Place the logical conditional to the last on the previous line, when break lines</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="chkCloseTemplates">
|
||||
<property name="text">
|
||||
<string>Close ending angle brackets on template definitions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="chkRemoveCommentPrefix">
|
||||
<property name="text">
|
||||
<string>Remove the leading '*' prefix on multi-line comments and indent the comment text one line indent.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QWidget" name="widget_6" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
|
@ -804,7 +807,7 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="5" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -817,10 +820,47 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="chkRemoveCommentPrefix">
|
||||
<property name="text">
|
||||
<string>Remove the leading '*' prefix on multi-line comments and indent the comment text one line indent.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="chkCloseTemplates">
|
||||
<property name="text">
|
||||
<string>Close ending angle brackets on template definitions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="chkBreakAfterLogical">
|
||||
<property name="text">
|
||||
<string>Place the logical conditional to the last on the previous line, when break lines</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Editor" name="frame">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
|
@ -839,6 +879,18 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Editor</class>
|
||||
<extends>QFrame</extends>
|
||||
<header location="global">editor.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="pointerBtnGroup"/>
|
||||
<buttongroup name="referenceBtnGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
|
Loading…
Reference in New Issue