remove options "Delete multiple empty lines"
This commit is contained in:
parent
87e39c6564
commit
fa7dc26e2c
|
@ -5117,10 +5117,7 @@ void Editor::reformat(bool doReparse)
|
||||||
// onLinesDeleted(1,lineCount());
|
// onLinesDeleted(1,lineCount());
|
||||||
QByteArray content = text().toUtf8();
|
QByteArray content = text().toUtf8();
|
||||||
QStringList args = pSettings->codeFormatter().getArguments();
|
QStringList args = pSettings->codeFormatter().getArguments();
|
||||||
QByteArray newContent = runAndGetOutput(pSettings->environment().AStylePath(),
|
QByteArray newContent = reformatContentUsingAstyle(content,args);
|
||||||
extractFileDir(pSettings->environment().AStylePath()),
|
|
||||||
args,
|
|
||||||
content);
|
|
||||||
if (newContent.isEmpty())
|
if (newContent.isEmpty())
|
||||||
return;
|
return;
|
||||||
replaceContent(QString::fromUtf8(newContent), doReparse);
|
replaceContent(QString::fromUtf8(newContent), doReparse);
|
||||||
|
|
|
@ -5032,8 +5032,6 @@ QStringList Settings::CodeFormatter::getArguments()
|
||||||
result.append("--unpad-paren");
|
result.append("--unpad-paren");
|
||||||
if (mDeleteEmptyLines)
|
if (mDeleteEmptyLines)
|
||||||
result.append("--delete-empty-lines");
|
result.append("--delete-empty-lines");
|
||||||
if (mDeleteMultipleEmptyLines)
|
|
||||||
result.append("--delete-multiple-empty-lines");
|
|
||||||
if (mFillEmptyLines)
|
if (mFillEmptyLines)
|
||||||
result.append("--fill-empty-lines");
|
result.append("--fill-empty-lines");
|
||||||
switch(mAlignPointerStyle) {
|
switch(mAlignPointerStyle) {
|
||||||
|
@ -5401,16 +5399,6 @@ void Settings::CodeFormatter::setDeleteEmptyLines(bool newDeleteEmptyLines)
|
||||||
mDeleteEmptyLines = newDeleteEmptyLines;
|
mDeleteEmptyLines = newDeleteEmptyLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Settings::CodeFormatter::deleteMultipleEmptyLines() const
|
|
||||||
{
|
|
||||||
return mDeleteMultipleEmptyLines;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Settings::CodeFormatter::setDeleteMultipleEmptyLines(bool newDeleteMultipleEmptyLines)
|
|
||||||
{
|
|
||||||
mDeleteMultipleEmptyLines = newDeleteMultipleEmptyLines;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Settings::CodeFormatter::fillEmptyLines() const
|
bool Settings::CodeFormatter::fillEmptyLines() const
|
||||||
{
|
{
|
||||||
return mFillEmptyLines;
|
return mFillEmptyLines;
|
||||||
|
@ -5676,7 +5664,6 @@ void Settings::CodeFormatter::doSave()
|
||||||
saveValue("pad_header",mPadHeader);
|
saveValue("pad_header",mPadHeader);
|
||||||
saveValue("unpad_paren",mUnpadParen);
|
saveValue("unpad_paren",mUnpadParen);
|
||||||
saveValue("delete_empty_lines",mDeleteEmptyLines);
|
saveValue("delete_empty_lines",mDeleteEmptyLines);
|
||||||
saveValue("delete_multiple_empty_lines",mDeleteMultipleEmptyLines);
|
|
||||||
saveValue("fill_empty_lines",mFillEmptyLines);
|
saveValue("fill_empty_lines",mFillEmptyLines);
|
||||||
saveValue("align_pointer_style",mAlignPointerStyle);
|
saveValue("align_pointer_style",mAlignPointerStyle);
|
||||||
saveValue("align_reference_style",mAlignReferenceStyle);
|
saveValue("align_reference_style",mAlignReferenceStyle);
|
||||||
|
@ -5735,7 +5722,6 @@ void Settings::CodeFormatter::doLoad()
|
||||||
mPadHeader = boolValue("pad_header",true);
|
mPadHeader = boolValue("pad_header",true);
|
||||||
mUnpadParen = boolValue("unpad_paren",false);
|
mUnpadParen = boolValue("unpad_paren",false);
|
||||||
mDeleteEmptyLines = boolValue("delete_empty_lines",false);
|
mDeleteEmptyLines = boolValue("delete_empty_lines",false);
|
||||||
mDeleteMultipleEmptyLines = boolValue("delete_multiple_empty_lines",false);
|
|
||||||
mFillEmptyLines = boolValue("fill_empty_lines",false);
|
mFillEmptyLines = boolValue("fill_empty_lines",false);
|
||||||
mAlignPointerStyle = intValue("align_pointer_style", FormatterOperatorAlign::foaNone);
|
mAlignPointerStyle = intValue("align_pointer_style", FormatterOperatorAlign::foaNone);
|
||||||
mAlignReferenceStyle = intValue("align_reference_style", FormatterOperatorAlign::foaNone);
|
mAlignReferenceStyle = intValue("align_reference_style", FormatterOperatorAlign::foaNone);
|
||||||
|
|
|
@ -764,8 +764,6 @@ public:
|
||||||
void setUnpadParen(bool newUnpadParen);
|
void setUnpadParen(bool newUnpadParen);
|
||||||
bool deleteEmptyLines() const;
|
bool deleteEmptyLines() const;
|
||||||
void setDeleteEmptyLines(bool newDeleteEmptyLines);
|
void setDeleteEmptyLines(bool newDeleteEmptyLines);
|
||||||
bool deleteMultipleEmptyLines() const;
|
|
||||||
void setDeleteMultipleEmptyLines(bool newDeleteMultipleEmptyLines);
|
|
||||||
bool fillEmptyLines() const;
|
bool fillEmptyLines() const;
|
||||||
void setFillEmptyLines(bool newFillEmptyLines);
|
void setFillEmptyLines(bool newFillEmptyLines);
|
||||||
int alignPointerStyle() const;
|
int alignPointerStyle() const;
|
||||||
|
@ -851,7 +849,6 @@ public:
|
||||||
bool mPadHeader;
|
bool mPadHeader;
|
||||||
bool mUnpadParen;
|
bool mUnpadParen;
|
||||||
bool mDeleteEmptyLines;
|
bool mDeleteEmptyLines;
|
||||||
bool mDeleteMultipleEmptyLines;
|
|
||||||
bool mFillEmptyLines;
|
bool mFillEmptyLines;
|
||||||
int mAlignPointerStyle;
|
int mAlignPointerStyle;
|
||||||
int mAlignReferenceStyle;
|
int mAlignReferenceStyle;
|
||||||
|
|
|
@ -97,7 +97,6 @@ void FormatterGeneralWidget::doLoad()
|
||||||
ui->chkPadHeader->setChecked(format.padHeader());
|
ui->chkPadHeader->setChecked(format.padHeader());
|
||||||
ui->chkUnpadParen->setChecked(format.unpadParen());
|
ui->chkUnpadParen->setChecked(format.unpadParen());
|
||||||
ui->chkDeleteEmptyLines->setChecked(format.deleteEmptyLines());
|
ui->chkDeleteEmptyLines->setChecked(format.deleteEmptyLines());
|
||||||
ui->chkDeleteMultipleEmptyLines->setChecked(format.deleteMultipleEmptyLines());
|
|
||||||
ui->chkFillEmptyLines->setChecked(format.fillEmptyLines());
|
ui->chkFillEmptyLines->setChecked(format.fillEmptyLines());
|
||||||
switch(format.alignPointerStyle()) {
|
switch(format.alignPointerStyle()) {
|
||||||
case FormatterOperatorAlign::foaNone:
|
case FormatterOperatorAlign::foaNone:
|
||||||
|
@ -320,6 +319,10 @@ void FormatterGeneralWidget::on_chkBreakMaxCodeLength_stateChanged(int)
|
||||||
|
|
||||||
void FormatterGeneralWidget::updateDemo()
|
void FormatterGeneralWidget::updateDemo()
|
||||||
{
|
{
|
||||||
|
if (!fileExists(pSettings->environment().AStylePath())) {
|
||||||
|
ui->editDemo->document()->setText(Editor::tr("Can't find astyle in \"%1\".").arg(pSettings->environment().AStylePath()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
QFile file(":/codes/formatdemo.cpp");
|
QFile file(":/codes/formatdemo.cpp");
|
||||||
if (!file.open(QFile::ReadOnly))
|
if (!file.open(QFile::ReadOnly))
|
||||||
return;
|
return;
|
||||||
|
@ -327,11 +330,7 @@ void FormatterGeneralWidget::updateDemo()
|
||||||
|
|
||||||
Settings::CodeFormatter formatter(nullptr);
|
Settings::CodeFormatter formatter(nullptr);
|
||||||
updateCodeFormatter(formatter);
|
updateCodeFormatter(formatter);
|
||||||
|
QByteArray newContent = reformatContentUsingAstyle(content, formatter.getArguments());
|
||||||
QByteArray newContent = runAndGetOutput(pSettings->environment().AStylePath(),
|
|
||||||
extractFileDir(pSettings->environment().AStylePath()),
|
|
||||||
formatter.getArguments(),
|
|
||||||
content);
|
|
||||||
ui->editDemo->document()->setText(newContent);
|
ui->editDemo->document()->setText(newContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +375,6 @@ void FormatterGeneralWidget::updateCodeFormatter(Settings::CodeFormatter &format
|
||||||
format.setPadHeader(ui->chkPadHeader->isChecked());
|
format.setPadHeader(ui->chkPadHeader->isChecked());
|
||||||
format.setUnpadParen(ui->chkUnpadParen->isChecked());
|
format.setUnpadParen(ui->chkUnpadParen->isChecked());
|
||||||
format.setDeleteEmptyLines(ui->chkDeleteEmptyLines->isChecked());
|
format.setDeleteEmptyLines(ui->chkDeleteEmptyLines->isChecked());
|
||||||
format.setDeleteMultipleEmptyLines(ui->chkDeleteMultipleEmptyLines->isChecked());
|
|
||||||
format.setFillEmptyLines(ui->chkFillEmptyLines->isChecked());
|
format.setFillEmptyLines(ui->chkFillEmptyLines->isChecked());
|
||||||
if (ui->rbAlignPointNone->isChecked()) {
|
if (ui->rbAlignPointNone->isChecked()) {
|
||||||
format.setAlignPointerStyle(FormatterOperatorAlign::foaNone);
|
format.setAlignPointerStyle(FormatterOperatorAlign::foaNone);
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
@ -362,6 +362,19 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tab_2">
|
<widget class="QWidget" name="tab_2">
|
||||||
|
@ -369,6 +382,27 @@
|
||||||
<string>Indentation 2</string>
|
<string>Indentation 2</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="10" column="0">
|
||||||
|
<widget class="QCheckBox" name="chkIndentCol1Comments">
|
||||||
|
<property name="text">
|
||||||
|
<string>Indent line comments that start in column one</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="1">
|
||||||
|
<widget class="QCheckBox" name="chkIndentPreprocDefine">
|
||||||
|
<property name="text">
|
||||||
|
<string>Indent multi-line preprocessor #define statements</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QCheckBox" name="chkIndentSwiches">
|
||||||
|
<property name="text">
|
||||||
|
<string>Indent switch blocks</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QCheckBox" name="chkIndentLabels">
|
<widget class="QCheckBox" name="chkIndentLabels">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -376,6 +410,34 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="8" column="0">
|
||||||
|
<widget class="QCheckBox" name="chkIndentPreprocCond">
|
||||||
|
<property name="text">
|
||||||
|
<string>Indent preprocessor conditional statements</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QCheckBox" name="chkIndentAfterParens">
|
||||||
|
<property name="text">
|
||||||
|
<string>Indent after parenthesis '(' or assignment '='</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QCheckBox" name="chkIndentModifiers">
|
||||||
|
<property name="text">
|
||||||
|
<string>Indent class access modifiers</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QCheckBox" name="chkIndentCases">
|
||||||
|
<property name="text">
|
||||||
|
<string>Indent cases</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QCheckBox" name="chkIndentClasses">
|
<widget class="QCheckBox" name="chkIndentClasses">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -390,41 +452,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QCheckBox" name="chkIndentModifiers">
|
|
||||||
<property name="text">
|
|
||||||
<string>Indent class access modifiers</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="QCheckBox" name="chkIndentAfterParens">
|
|
||||||
<property name="text">
|
|
||||||
<string>Indent after parenthesis '(' or assignment '='</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="0">
|
|
||||||
<widget class="QCheckBox" name="chkIndentPreprocCond">
|
|
||||||
<property name="text">
|
|
||||||
<string>Indent preprocessor conditional statements</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="1">
|
|
||||||
<widget class="QCheckBox" name="chkIndentPreprocDefine">
|
|
||||||
<property name="text">
|
|
||||||
<string>Indent multi-line preprocessor #define statements</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="10" column="0">
|
|
||||||
<widget class="QCheckBox" name="chkIndentCol1Comments">
|
|
||||||
<property name="text">
|
|
||||||
<string>Indent line comments that start in column one</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
<item row="5" column="1">
|
||||||
<widget class="QCheckBox" name="chkIndentPreprocBlock">
|
<widget class="QCheckBox" name="chkIndentPreprocBlock">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -432,19 +459,18 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="11" column="0">
|
||||||
<widget class="QCheckBox" name="chkIndentSwiches">
|
<spacer name="verticalSpacer_4">
|
||||||
<property name="text">
|
<property name="orientation">
|
||||||
<string>Indent switch blocks</string>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="sizeHint" stdset="0">
|
||||||
</item>
|
<size>
|
||||||
<item row="2" column="1">
|
<width>20</width>
|
||||||
<widget class="QCheckBox" name="chkIndentCases">
|
<height>40</height>
|
||||||
<property name="text">
|
</size>
|
||||||
<string>Indent cases</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -453,10 +479,10 @@
|
||||||
<string>Padding 1</string>
|
<string>Padding 1</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="2" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QCheckBox" name="chkPadOper">
|
<widget class="QCheckBox" name="chkPadParen">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Insert spaces around operators</string>
|
<string>Insert spaces around parenthesis</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -488,10 +514,10 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="10" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="chkBreakBlocks">
|
<widget class="QCheckBox" name="chkPadFirstParenOut">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Insert empty lines arround unrelated blocks</string>
|
<string>Insert spaces around first parenthesis in a series on the out side only</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -502,20 +528,33 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="0" colspan="2">
|
<item row="0" column="0">
|
||||||
<widget class="QCheckBox" name="chkPadFirstParenOut">
|
<widget class="QCheckBox" name="chkBreakBlocks">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Insert spaces around first parenthesis in a series on the out side only</string>
|
<string>Insert empty lines arround unrelated blocks</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QCheckBox" name="chkPadParen">
|
<widget class="QCheckBox" name="chkPadOper">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Insert spaces around parenthesis</string>
|
<string>Insert spaces around operators</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="12" column="0">
|
||||||
|
<spacer name="verticalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tab_5">
|
<widget class="QWidget" name="tab_5">
|
||||||
|
@ -523,38 +562,34 @@
|
||||||
<string>Padding 2</string>
|
<string>Padding 2</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
<item row="1" column="0" colspan="6">
|
<item row="3" column="1">
|
||||||
<widget class="QCheckBox" name="chkDeleteEmptyLines">
|
<widget class="QRadioButton" name="rbAlignPointNone">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Remove all empty lines. It will NOT delete lines added by the padding options.</string>
|
<string>none</string>
|
||||||
</property>
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">pointerBtnGroup</string>
|
||||||
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="4" column="1">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QRadioButton" name="rbAlignReferenceNone">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Attach a pointer operator to its :</string>
|
<string>none</string>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="6">
|
|
||||||
<widget class="QCheckBox" name="chkDeleteMultipleEmptyLines">
|
|
||||||
<property name="text">
|
|
||||||
<string>Remove all consecutive empty lines. It will NOT delete lines added by the padding options.</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="2">
|
|
||||||
<widget class="QRadioButton" name="rbAlignReferenceType">
|
|
||||||
<property name="text">
|
|
||||||
<string>type(left)</string>
|
|
||||||
</property>
|
</property>
|
||||||
<attribute name="buttonGroup">
|
<attribute name="buttonGroup">
|
||||||
<string notr="true">referenceBtnGroup</string>
|
<string notr="true">referenceBtnGroup</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="2">
|
<item row="0" column="0" colspan="6">
|
||||||
|
<widget class="QCheckBox" name="chkUnpadParen">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove unnecessary space adding around parenthesis</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="2">
|
||||||
<widget class="QRadioButton" name="rbAlignPointType">
|
<widget class="QRadioButton" name="rbAlignPointType">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>type(left)</string>
|
<string>type(left)</string>
|
||||||
|
@ -564,7 +599,78 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="5">
|
<item row="3" column="4">
|
||||||
|
<widget class="QRadioButton" name="rbAlignPointerName">
|
||||||
|
<property name="text">
|
||||||
|
<string>name(right)</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">pointerBtnGroup</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="3">
|
||||||
|
<widget class="QRadioButton" name="rbAlignReferenceMiddle">
|
||||||
|
<property name="text">
|
||||||
|
<string>middle</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">referenceBtnGroup</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Attach a pointer operator to its :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="2">
|
||||||
|
<widget class="QRadioButton" name="rbAlignReferenceType">
|
||||||
|
<property name="text">
|
||||||
|
<string>type(left)</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">referenceBtnGroup</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="4">
|
||||||
|
<widget class="QRadioButton" name="rbAlignReferenceName">
|
||||||
|
<property name="text">
|
||||||
|
<string>name(right)</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">referenceBtnGroup</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="6">
|
||||||
|
<widget class="QCheckBox" name="chkDeleteEmptyLines">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove all empty lines. It will NOT delete lines added by the padding options.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="6">
|
||||||
|
<widget class="QCheckBox" name="chkFillEmptyLines">
|
||||||
|
<property name="text">
|
||||||
|
<string>Fill empty lines with the white space of the previous lines.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="3">
|
||||||
|
<widget class="QRadioButton" name="rbAlignPointerMiddle">
|
||||||
|
<property name="text">
|
||||||
|
<string>middle</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">pointerBtnGroup</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="5">
|
||||||
<spacer name="horizontalSpacer_6">
|
<spacer name="horizontalSpacer_6">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
@ -577,86 +683,25 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="3">
|
<item row="4" column="0">
|
||||||
<widget class="QRadioButton" name="rbAlignReferenceMiddle">
|
|
||||||
<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="chkFillEmptyLines">
|
|
||||||
<property name="text">
|
|
||||||
<string>Fill empty lines with the white space of the previous lines.</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="4">
|
|
||||||
<widget class="QRadioButton" name="rbAlignReferenceName">
|
|
||||||
<property name="text">
|
|
||||||
<string>name(right)</string>
|
|
||||||
</property>
|
|
||||||
<attribute name="buttonGroup">
|
|
||||||
<string notr="true">referenceBtnGroup</string>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="3">
|
|
||||||
<widget class="QRadioButton" name="rbAlignPointerMiddle">
|
|
||||||
<property name="text">
|
|
||||||
<string>middle</string>
|
|
||||||
</property>
|
|
||||||
<attribute name="buttonGroup">
|
|
||||||
<string notr="true">pointerBtnGroup</string>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="4">
|
|
||||||
<widget class="QRadioButton" name="rbAlignPointerName">
|
|
||||||
<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">
|
|
||||||
<widget class="QCheckBox" name="chkUnpadParen">
|
|
||||||
<property name="text">
|
|
||||||
<string>Remove unnecessary space adding around parenthesis</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QLabel" name="label_7">
|
<widget class="QLabel" name="label_7">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Attach a reference operator to its :</string>
|
<string>Attach a reference operator to its :</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="5" column="0">
|
||||||
<widget class="QRadioButton" name="rbAlignPointNone">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="text">
|
<property name="orientation">
|
||||||
<string>none</string>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="buttonGroup">
|
<property name="sizeHint" stdset="0">
|
||||||
<string notr="true">pointerBtnGroup</string>
|
<size>
|
||||||
</attribute>
|
<width>20</width>
|
||||||
</widget>
|
<height>40</height>
|
||||||
</item>
|
</size>
|
||||||
<item row="5" column="1">
|
|
||||||
<widget class="QRadioButton" name="rbAlignReferenceNone">
|
|
||||||
<property name="text">
|
|
||||||
<string>none</string>
|
|
||||||
</property>
|
</property>
|
||||||
<attribute name="buttonGroup">
|
</spacer>
|
||||||
<string notr="true">referenceBtnGroup</string>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -665,10 +710,10 @@
|
||||||
<string>Other 1</string>
|
<string>Other 1</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout_5">
|
<layout class="QGridLayout" name="gridLayout_5">
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QCheckBox" name="chkBreakOneLineHeaders">
|
<widget class="QCheckBox" name="chkAddBraces">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Break one line headers ('if','while','else'...) from the statement on the same line</string>
|
<string>Add braces to unbraced one line conditional statements</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -679,10 +724,10 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QCheckBox" name="chkBreakClosingBraces">
|
<widget class="QCheckBox" name="chkBreakOneLineHeaders">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Break braces before close headers ('else','catch"...)</string>
|
<string>Break one line headers ('if','while','else'...) from the statement on the same line</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -693,6 +738,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QCheckBox" name="chkBreakClosingBraces">
|
||||||
|
<property name="text">
|
||||||
|
<string>Break braces before close headers ('else','catch"...)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QCheckBox" name="chkBreakElseIf">
|
<widget class="QCheckBox" name="chkBreakElseIf">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -700,12 +752,18 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QCheckBox" name="chkAddBraces">
|
<spacer name="verticalSpacer_6">
|
||||||
<property name="text">
|
<property name="orientation">
|
||||||
<string>Add braces to unbraced one line conditional statements</string>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -714,10 +772,10 @@
|
||||||
<string>Other 2</string>
|
<string>Other 2</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout_6">
|
<layout class="QGridLayout" name="gridLayout_6">
|
||||||
<item row="2" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QCheckBox" name="chkBreakReturnType">
|
<widget class="QCheckBox" name="chkAttachReturnType">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Break return type from the function name in its definition</string>
|
<string>Attach return type to the function name in its definition</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -728,10 +786,10 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QCheckBox" name="chkAttachReturnType">
|
<widget class="QCheckBox" name="chkBreakReturnType">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Attach return type to the function name in its definition</string>
|
<string>Break return type from the function name in its definition</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -756,6 +814,19 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="8" column="0">
|
||||||
|
<spacer name="verticalSpacer_7">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tab_8">
|
<widget class="QWidget" name="tab_8">
|
||||||
|
@ -924,7 +995,6 @@
|
||||||
<tabstop>chkPadHeader</tabstop>
|
<tabstop>chkPadHeader</tabstop>
|
||||||
<tabstop>chkUnpadParen</tabstop>
|
<tabstop>chkUnpadParen</tabstop>
|
||||||
<tabstop>chkDeleteEmptyLines</tabstop>
|
<tabstop>chkDeleteEmptyLines</tabstop>
|
||||||
<tabstop>chkDeleteMultipleEmptyLines</tabstop>
|
|
||||||
<tabstop>chkFillEmptyLines</tabstop>
|
<tabstop>chkFillEmptyLines</tabstop>
|
||||||
<tabstop>rbAlignPointNone</tabstop>
|
<tabstop>rbAlignPointNone</tabstop>
|
||||||
<tabstop>rbAlignPointType</tabstop>
|
<tabstop>rbAlignPointType</tabstop>
|
||||||
|
|
|
@ -402,7 +402,28 @@ QByteArray runAndGetOutput(const QString &cmd, const QString& workingDir, const
|
||||||
process.closeWriteChannel();
|
process.closeWriteChannel();
|
||||||
process.waitForFinished();
|
process.waitForFinished();
|
||||||
if (errorOccurred) {
|
if (errorOccurred) {
|
||||||
result += process.errorString().toLocal8Bit();
|
switch(process.error()) {
|
||||||
|
case QProcess::FailedToStart:
|
||||||
|
result += "Failed to start process!";
|
||||||
|
break;
|
||||||
|
case QProcess::Crashed:
|
||||||
|
result += "Process crashed!";
|
||||||
|
break;
|
||||||
|
case QProcess::Timedout:
|
||||||
|
result += "Timeout!";
|
||||||
|
break;
|
||||||
|
case QProcess::ReadError:
|
||||||
|
result += "Read Error:";
|
||||||
|
break;
|
||||||
|
case QProcess::WriteError:
|
||||||
|
result += "Write Error:";
|
||||||
|
break;
|
||||||
|
case QProcess::UnknownError:
|
||||||
|
result += "Unknown Error:";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//result += process.errorString().toLocal8Bit();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -744,3 +765,16 @@ std::tuple<QString, QStringList, PNonExclusiveTemporaryFileOwner> wrapCommandFor
|
||||||
{
|
{
|
||||||
return wrapCommandForTerminalEmulator(terminal, parseArguments(argsPattern, Settings::Environment::terminalArgsPatternMagicVariables(), false), payloadArgsWithArgv0);
|
return wrapCommandForTerminalEmulator(terminal, parseArguments(argsPattern, Settings::Environment::terminalArgsPatternMagicVariables(), false), payloadArgsWithArgv0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QByteArray reformatContentUsingAstyle(const QByteArray &content, const QStringList &arguments)
|
||||||
|
{
|
||||||
|
QProcessEnvironment env;
|
||||||
|
env.insert("LANG","en");
|
||||||
|
QByteArray newContent = runAndGetOutput(pSettings->environment().AStylePath(),
|
||||||
|
extractFileDir(pSettings->environment().AStylePath()),
|
||||||
|
arguments,
|
||||||
|
content,
|
||||||
|
false,
|
||||||
|
env);
|
||||||
|
return newContent;
|
||||||
|
}
|
||||||
|
|
|
@ -148,6 +148,8 @@ QByteArray runAndGetOutput(const QString& cmd, const QString& workingDir, const
|
||||||
bool inheritEnvironment = false,
|
bool inheritEnvironment = false,
|
||||||
const QProcessEnvironment& env = QProcessEnvironment() );
|
const QProcessEnvironment& env = QProcessEnvironment() );
|
||||||
|
|
||||||
|
QByteArray reformatContentUsingAstyle(const QByteArray& content, const QStringList& arguments);
|
||||||
|
|
||||||
void openFileFolderInExplorer(const QString& path);
|
void openFileFolderInExplorer(const QString& path);
|
||||||
|
|
||||||
void executeFile(const QString& fileName,
|
void executeFile(const QString& fileName,
|
||||||
|
|
Loading…
Reference in New Issue