diff options
20 files changed, 289 insertions, 1893 deletions
diff --git a/scripts/generateClangFormatChecksLayout.py b/scripts/generateClangFormatChecksLayout.py deleted file mode 100755 index 85bd82257c..0000000000 --- a/scripts/generateClangFormatChecksLayout.py +++ /dev/null @@ -1,229 +0,0 @@ -#!/usr/bin/env python3.10 -# Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -import argparse -import os -# for installing use pip3 install robotpy-cppheaderparse -import CppHeaderParser - -def parse_arguments(): - parser = argparse.ArgumentParser(description='Clang-Format checks header file \ - generator') - parser.add_argument('--clang-format-header-file', help='path to \ - Format.h usually /usr/lib/llvm-x/include/clang/Format/Format.h', - default=None, dest='options_header', required=True) - return parser.parse_args() - - -def full_header_content(header_code): - return '''// Copyright (C) 2023 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -// THIS FILE IS AUTOMATICALLY GENERATED by generateClangFormatChecksLayout. DO NOT EDIT! - -#pragma once - -#include <QWidget> - -QT_BEGIN_NAMESPACE -class QCheckBox; -class QComboBox; -class QLabel; -class QLineEdit; -class QPlainTextEdit; -class QPushButton; -class QWidget; -QT_END_NAMESPACE - -namespace ClangFormat { - -class ClangFormatChecks : public QWidget -{ - Q_OBJECT -public: - ClangFormatChecks(QWidget *parent = nullptr); - -private: -''' + header_code + ''' -}; - -} //ClangFormat -''' - - -def full_source_content(source_code, layout_code): - return '''// Copyright (C) 2023 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -// THIS FILE IS AUTOMATICALLY GENERATED by generateClangFormatChecksLayout. DO NOT EDIT! - -#include "clangformatchecks.h" - -#include <utils/layoutbuilder.h> - -#include <QCheckBox> -#include <QComboBox> -#include <QLabel> -#include <QLineEdit> -#include <QPlainTextEdit> -#include <QPushButton> -#include <QWidget> - -using namespace ClangFormat; - -ClangFormatChecks::ClangFormatChecks(QWidget *parent) - : QWidget(parent) -{ -''' + source_code + ''' - using namespace Layouting; - - Grid { -''' + layout_code + ''' }.attachTo(this); -} -''' - -# Combobox UI -def combobox_header(name): - header = " QComboBox *m_" + name + " = nullptr;\n" - return header - -def combobox_source(name, values, offset): - source = "" - source += " m_" + name + " = new QComboBox(this);\n" - - list = "" - for value in values: - list += "\"" + value + "\"," - - source += " m_" + name + "->addItems({" + list + "});\n" - source += " m_" + name + "->setObjectName(\"" + name + "\");\n\n" - return source - -def combobox_source_bool(name, offset): - return combobox_source(name, ["Default", "true", "false"], offset) - -def combobox_layout(name, field_name, offset): - layout = " new QLabel(\"" + offset + field_name + "\"), m_" + name + ", br,\n" - return layout - -# String UI -def string_header(name): - header = " QLineEdit *m_" + name + " = nullptr;\n" - header += " QPushButton *m_set" + name + " = nullptr;\n" - return header - -def string_source(name, offset): - source = "" - source += " m_" + name + " = new QLineEdit(this);\n" - source += " m_" + name + "->setObjectName(\"" + name + "\");\n" - source += " m_set" + name + " = new QPushButton(\"Set\", this);\n\n" - source += " m_set" + name + "->setObjectName(\"set" + name + "\");\n" - return source - -def string_layout(name, field_name, offset): - layout = " new QLabel(\"" + offset + field_name + "\"), Row {m_" + name + ", m_set" + name + "}, br,\n" - return layout - -# Vector UI -def vector_header(name): - header = " QPlainTextEdit *m_" + name + " = nullptr;\n" - header += " QPushButton *m_set" + name + " = nullptr;\n" - return header - -def vector_source(name, offset): - source = "" - source += " m_" + name + " = new QPlainTextEdit(this);\n" - source += " m_" + name + "->setObjectName(\"" + name + "\");\n" - source += " m_" + name + "->setFixedHeight(100);\n" - source += " m_set" + name + " = new QPushButton(\"Set\", this);\n\n" - source += " m_set" + name + "->setObjectName(\"set" + name + "\");\n" -# source += "m_" + name + "->setObjectName(\"" + offset + name + "\");\n\n" - return source - -def vector_layout(name, field_name, offset): - layout = " new QLabel(\"" + offset + field_name + "\"), Row {m_" + name + ", m_set" + name + "}, br,\n" - return layout - -# Struct Layout -def struct_layout(name, offset): - layout = " new QLabel(\"" + offset + name + "\"), br,\n" - return layout - - -def in_list(list, type): - for element in list: - if element["name"] == type: - return element; - return - -def create_private_variables(variables, enums, structs, offset = "", parent_name = ""): - header = "" - source = "" - layout = "" - - # create BasedOnStyle combobox ussually not presented in FormatStyle struct - if offset == "": - header += combobox_header("BasedOnStyle") - source += combobox_source("BasedOnStyle", ["LLVM", "Google", "Chromium", "Mozilla", "WebKit", "Microsoft", "GNU"], offset) - layout += combobox_layout("BasedOnStyle", "BasedOnStyle", offset) - - for variable in variables: - if "doxygen" in variable.keys(): - if ("**deprecated**" in variable['doxygen']): - continue; - - type = variable["type"] - field_name = variable["name"] - variable_name = parent_name + variable["name"] - enum = in_list(enums, type) - struct = in_list(structs, type) - if enum: - header += combobox_header(variable_name) - source += combobox_source(variable_name, [value["name"].split("_")[1] for value in enum["values"]], offset) - layout += combobox_layout(variable_name, field_name, offset) - elif struct: - layout += struct_layout(variable_name, offset) - header_tmp, source_tmp, layout_tmp = create_private_variables(struct["properties"]["public"], enums, structs, " ", variable_name) - header += header_tmp - source += source_tmp - layout += layout_tmp - elif "std::string" == type or "unsigned" == type or "int" == type: - header += string_header(variable_name) - source += string_source(variable_name, offset) - layout += string_layout(variable_name, field_name, offset) - elif "std::vector<std::string>" == type: - header += vector_header(variable_name) - source += vector_source(variable_name, offset) - layout += vector_layout(variable_name, field_name, offset) - elif "bool" == type: - header += combobox_header(variable_name) - source += combobox_source_bool(variable_name, offset) - layout += combobox_layout(variable_name, field_name, offset); - return header, source, layout - - -def main(): - arguments = parse_arguments() - header = CppHeaderParser.CppHeader(arguments.options_header) - - enums = header.classes["FormatStyle"]["enums"]["public"] - structs = header.classes["FormatStyle"]["nested_classes"] - variables = header.classes["FormatStyle"]["properties"]["public"] - - current_path = os.path.dirname(os.path.abspath(__file__)) - source_path = os.path.abspath(os.path.join(current_path, '..', 'src', - 'plugins', 'clangformat', 'clangformatchecks.cpp')) - header_path = os.path.abspath(os.path.join(current_path, '..', 'src', - 'plugins', 'clangformat', 'clangformatchecks.h')) - - header, source, layout = create_private_variables(variables, enums, structs) - with open(source_path, 'w') as f: - f.write(full_source_content(source, layout)) - - with open(header_path, 'w') as f: - f.write(full_header_content(header)) - - -if __name__ == "__main__": - main() diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index e19c0ed834..34671d290f 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -46,7 +46,6 @@ add_subdirectory(vcsbase) add_subdirectory(autotoolsprojectmanager) add_subdirectory(bazaar) add_subdirectory(beautifier) -add_subdirectory(clangformat) add_subdirectory(clearcase) add_subdirectory(cmakeprojectmanager) add_subdirectory(cvs) @@ -79,6 +78,7 @@ if (WITH_QMLDESIGNER) add_subdirectory(qmlprojectmanager) endif() add_subdirectory(python) +add_subdirectory(clangformat) # Level 7: add_subdirectory(android) diff --git a/src/plugins/clangformat/CMakeLists.txt b/src/plugins/clangformat/CMakeLists.txt index 3a25e5bd04..f1dc569333 100644 --- a/src/plugins/clangformat/CMakeLists.txt +++ b/src/plugins/clangformat/CMakeLists.txt @@ -4,7 +4,6 @@ add_qtc_plugin(ClangFormat PLUGIN_DEPENDS Core TextEditor CppEditor ProjectExplorer SOURCES clangformatbaseindenter.cpp clangformatbaseindenter.h - clangformatchecks.cpp clangformatchecks.h clangformatconfigwidget.cpp clangformatconfigwidget.h clangformatglobalconfigwidget.cpp clangformatglobalconfigwidget.h clangformatconstants.h diff --git a/src/plugins/clangformat/clangformat.qbs b/src/plugins/clangformat/clangformat.qbs index 57f39bc5b1..786176cc01 100644 --- a/src/plugins/clangformat/clangformat.qbs +++ b/src/plugins/clangformat/clangformat.qbs @@ -34,8 +34,6 @@ QtcPlugin { files: [ "clangformatbaseindenter.h", "clangformatbaseindenter.cpp", - "clangformatchecks.cpp", - "clangformatchecks.h", "clangformatconfigwidget.cpp", "clangformatconfigwidget.h", "clangformatconstants.h", diff --git a/src/plugins/clangformat/clangformatbaseindenter.cpp b/src/plugins/clangformat/clangformatbaseindenter.cpp index 5cb40cae9b..9f9ea8ac94 100644 --- a/src/plugins/clangformat/clangformatbaseindenter.cpp +++ b/src/plugins/clangformat/clangformatbaseindenter.cpp @@ -539,6 +539,7 @@ public: clang::format::FormatStyle customSettingsStyle(const FilePath &fileName) const; ICodeStylePreferences *m_overriddenPreferences = nullptr; + clang::format::FormatStyle m_overriddenStyle = clang::format::getNoStyle(); }; ClangFormatBaseIndenter::ClangFormatBaseIndenter(QTextDocument *doc) @@ -870,6 +871,9 @@ const clang::format::FormatStyle &ClangFormatBaseIndenterPrivate::styleForFile() { static const milliseconds cacheTimeout = getCacheTimeout(); + if (!(m_overriddenStyle == clang::format::getNoStyle())) + return m_overriddenStyle; + QDateTime time = QDateTime::currentDateTime(); if (m_cachedStyle.expirationTime > time && !(m_cachedStyle.style == clang::format::getNoStyle())) return m_cachedStyle.style; @@ -907,4 +911,9 @@ void ClangFormatBaseIndenter::setOverriddenPreferences(ICodeStylePreferences *pr d->m_overriddenPreferences = preferences; } +void ClangFormatBaseIndenter::setOverriddenStyle(const clang::format::FormatStyle &style) +{ + d->m_overriddenStyle = style; +} + } // namespace ClangFormat diff --git a/src/plugins/clangformat/clangformatbaseindenter.h b/src/plugins/clangformat/clangformatbaseindenter.h index 15bcb50c63..cb8041cf43 100644 --- a/src/plugins/clangformat/clangformatbaseindenter.h +++ b/src/plugins/clangformat/clangformatbaseindenter.h @@ -49,6 +49,7 @@ public: const clang::format::FormatStyle &styleForFile() const; void setOverriddenPreferences(TextEditor::ICodeStylePreferences *preferences); + void setOverriddenStyle(const clang::format::FormatStyle &style); protected: virtual bool formatCodeInsteadOfIndent() const { return false; } diff --git a/src/plugins/clangformat/clangformatchecks.cpp b/src/plugins/clangformat/clangformatchecks.cpp deleted file mode 100644 index 41bd75caa2..0000000000 --- a/src/plugins/clangformat/clangformatchecks.cpp +++ /dev/null @@ -1,1023 +0,0 @@ -// Copyright (C) 2023 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -// THIS FILE IS AUTOMATICALLY GENERATED by generateClangFormatChecksLayout. DO NOT EDIT! - -#include "clangformatchecks.h" - -#include <utils/layoutbuilder.h> - -#include <QCheckBox> -#include <QComboBox> -#include <QLabel> -#include <QLineEdit> -#include <QPlainTextEdit> -#include <QPushButton> -#include <QWidget> - -using namespace ClangFormat; - -ClangFormatChecks::ClangFormatChecks(QWidget *parent) - : QWidget(parent) -{ - m_BasedOnStyle = new QComboBox(this); - m_BasedOnStyle->addItems({"LLVM","Google","Chromium","Mozilla","WebKit","Microsoft","GNU",}); - m_BasedOnStyle->setObjectName("BasedOnStyle"); - - m_InheritsParentConfig = new QComboBox(this); - m_InheritsParentConfig->addItems({"Default","true","false",}); - m_InheritsParentConfig->setObjectName("InheritsParentConfig"); - - m_AccessModifierOffset = new QLineEdit(this); - m_AccessModifierOffset->setObjectName("AccessModifierOffset"); - m_setAccessModifierOffset = new QPushButton("Set", this); - - m_setAccessModifierOffset->setObjectName("setAccessModifierOffset"); - m_AlignAfterOpenBracket = new QComboBox(this); - m_AlignAfterOpenBracket->addItems({"Align","DontAlign","AlwaysBreak","BlockIndent",}); - m_AlignAfterOpenBracket->setObjectName("AlignAfterOpenBracket"); - - m_AlignArrayOfStructures = new QComboBox(this); - m_AlignArrayOfStructures->addItems({"Left","Right","None",}); - m_AlignArrayOfStructures->setObjectName("AlignArrayOfStructures"); - - m_AlignConsecutiveMacrosEnabled = new QComboBox(this); - m_AlignConsecutiveMacrosEnabled->addItems({"Default","true","false",}); - m_AlignConsecutiveMacrosEnabled->setObjectName("AlignConsecutiveMacrosEnabled"); - - m_AlignConsecutiveMacrosAcrossEmptyLines = new QComboBox(this); - m_AlignConsecutiveMacrosAcrossEmptyLines->addItems({"Default","true","false",}); - m_AlignConsecutiveMacrosAcrossEmptyLines->setObjectName("AlignConsecutiveMacrosAcrossEmptyLines"); - - m_AlignConsecutiveMacrosAcrossComments = new QComboBox(this); - m_AlignConsecutiveMacrosAcrossComments->addItems({"Default","true","false",}); - m_AlignConsecutiveMacrosAcrossComments->setObjectName("AlignConsecutiveMacrosAcrossComments"); - - m_AlignConsecutiveMacrosAlignCompound = new QComboBox(this); - m_AlignConsecutiveMacrosAlignCompound->addItems({"Default","true","false",}); - m_AlignConsecutiveMacrosAlignCompound->setObjectName("AlignConsecutiveMacrosAlignCompound"); - - m_AlignConsecutiveMacrosPadOperators = new QComboBox(this); - m_AlignConsecutiveMacrosPadOperators->addItems({"Default","true","false",}); - m_AlignConsecutiveMacrosPadOperators->setObjectName("AlignConsecutiveMacrosPadOperators"); - - m_AlignConsecutiveAssignmentsEnabled = new QComboBox(this); - m_AlignConsecutiveAssignmentsEnabled->addItems({"Default","true","false",}); - m_AlignConsecutiveAssignmentsEnabled->setObjectName("AlignConsecutiveAssignmentsEnabled"); - - m_AlignConsecutiveAssignmentsAcrossEmptyLines = new QComboBox(this); - m_AlignConsecutiveAssignmentsAcrossEmptyLines->addItems({"Default","true","false",}); - m_AlignConsecutiveAssignmentsAcrossEmptyLines->setObjectName("AlignConsecutiveAssignmentsAcrossEmptyLines"); - - m_AlignConsecutiveAssignmentsAcrossComments = new QComboBox(this); - m_AlignConsecutiveAssignmentsAcrossComments->addItems({"Default","true","false",}); - m_AlignConsecutiveAssignmentsAcrossComments->setObjectName("AlignConsecutiveAssignmentsAcrossComments"); - - m_AlignConsecutiveAssignmentsAlignCompound = new QComboBox(this); - m_AlignConsecutiveAssignmentsAlignCompound->addItems({"Default","true","false",}); - m_AlignConsecutiveAssignmentsAlignCompound->setObjectName("AlignConsecutiveAssignmentsAlignCompound"); - - m_AlignConsecutiveAssignmentsPadOperators = new QComboBox(this); - m_AlignConsecutiveAssignmentsPadOperators->addItems({"Default","true","false",}); - m_AlignConsecutiveAssignmentsPadOperators->setObjectName("AlignConsecutiveAssignmentsPadOperators"); - - m_AlignConsecutiveBitFieldsEnabled = new QComboBox(this); - m_AlignConsecutiveBitFieldsEnabled->addItems({"Default","true","false",}); - m_AlignConsecutiveBitFieldsEnabled->setObjectName("AlignConsecutiveBitFieldsEnabled"); - - m_AlignConsecutiveBitFieldsAcrossEmptyLines = new QComboBox(this); - m_AlignConsecutiveBitFieldsAcrossEmptyLines->addItems({"Default","true","false",}); - m_AlignConsecutiveBitFieldsAcrossEmptyLines->setObjectName("AlignConsecutiveBitFieldsAcrossEmptyLines"); - - m_AlignConsecutiveBitFieldsAcrossComments = new QComboBox(this); - m_AlignConsecutiveBitFieldsAcrossComments->addItems({"Default","true","false",}); - m_AlignConsecutiveBitFieldsAcrossComments->setObjectName("AlignConsecutiveBitFieldsAcrossComments"); - - m_AlignConsecutiveBitFieldsAlignCompound = new QComboBox(this); - m_AlignConsecutiveBitFieldsAlignCompound->addItems({"Default","true","false",}); - m_AlignConsecutiveBitFieldsAlignCompound->setObjectName("AlignConsecutiveBitFieldsAlignCompound"); - - m_AlignConsecutiveBitFieldsPadOperators = new QComboBox(this); - m_AlignConsecutiveBitFieldsPadOperators->addItems({"Default","true","false",}); - m_AlignConsecutiveBitFieldsPadOperators->setObjectName("AlignConsecutiveBitFieldsPadOperators"); - - m_AlignConsecutiveDeclarationsEnabled = new QComboBox(this); - m_AlignConsecutiveDeclarationsEnabled->addItems({"Default","true","false",}); - m_AlignConsecutiveDeclarationsEnabled->setObjectName("AlignConsecutiveDeclarationsEnabled"); - - m_AlignConsecutiveDeclarationsAcrossEmptyLines = new QComboBox(this); - m_AlignConsecutiveDeclarationsAcrossEmptyLines->addItems({"Default","true","false",}); - m_AlignConsecutiveDeclarationsAcrossEmptyLines->setObjectName("AlignConsecutiveDeclarationsAcrossEmptyLines"); - - m_AlignConsecutiveDeclarationsAcrossComments = new QComboBox(this); - m_AlignConsecutiveDeclarationsAcrossComments->addItems({"Default","true","false",}); - m_AlignConsecutiveDeclarationsAcrossComments->setObjectName("AlignConsecutiveDeclarationsAcrossComments"); - - m_AlignConsecutiveDeclarationsAlignCompound = new QComboBox(this); - m_AlignConsecutiveDeclarationsAlignCompound->addItems({"Default","true","false",}); - m_AlignConsecutiveDeclarationsAlignCompound->setObjectName("AlignConsecutiveDeclarationsAlignCompound"); - - m_AlignConsecutiveDeclarationsPadOperators = new QComboBox(this); - m_AlignConsecutiveDeclarationsPadOperators->addItems({"Default","true","false",}); - m_AlignConsecutiveDeclarationsPadOperators->setObjectName("AlignConsecutiveDeclarationsPadOperators"); - - m_AlignConsecutiveShortCaseStatementsEnabled = new QComboBox(this); - m_AlignConsecutiveShortCaseStatementsEnabled->addItems({"Default","true","false",}); - m_AlignConsecutiveShortCaseStatementsEnabled->setObjectName("AlignConsecutiveShortCaseStatementsEnabled"); - - m_AlignConsecutiveShortCaseStatementsAcrossEmptyLines = new QComboBox(this); - m_AlignConsecutiveShortCaseStatementsAcrossEmptyLines->addItems({"Default","true","false",}); - m_AlignConsecutiveShortCaseStatementsAcrossEmptyLines->setObjectName("AlignConsecutiveShortCaseStatementsAcrossEmptyLines"); - - m_AlignConsecutiveShortCaseStatementsAcrossComments = new QComboBox(this); - m_AlignConsecutiveShortCaseStatementsAcrossComments->addItems({"Default","true","false",}); - m_AlignConsecutiveShortCaseStatementsAcrossComments->setObjectName("AlignConsecutiveShortCaseStatementsAcrossComments"); - - m_AlignConsecutiveShortCaseStatementsAlignCaseColons = new QComboBox(this); - m_AlignConsecutiveShortCaseStatementsAlignCaseColons->addItems({"Default","true","false",}); - m_AlignConsecutiveShortCaseStatementsAlignCaseColons->setObjectName("AlignConsecutiveShortCaseStatementsAlignCaseColons"); - - m_AlignEscapedNewlines = new QComboBox(this); - m_AlignEscapedNewlines->addItems({"DontAlign","Left","Right",}); - m_AlignEscapedNewlines->setObjectName("AlignEscapedNewlines"); - - m_AlignOperands = new QComboBox(this); - m_AlignOperands->addItems({"DontAlign","Align","AlignAfterOperator",}); - m_AlignOperands->setObjectName("AlignOperands"); - - m_AlignTrailingCommentsKind = new QComboBox(this); - m_AlignTrailingCommentsKind->addItems({"Leave","Always","Never",}); - m_AlignTrailingCommentsKind->setObjectName("AlignTrailingCommentsKind"); - - m_AlignTrailingCommentsOverEmptyLines = new QLineEdit(this); - m_AlignTrailingCommentsOverEmptyLines->setObjectName("AlignTrailingCommentsOverEmptyLines"); - m_setAlignTrailingCommentsOverEmptyLines = new QPushButton("Set", this); - - m_setAlignTrailingCommentsOverEmptyLines->setObjectName("setAlignTrailingCommentsOverEmptyLines"); - m_AllowAllArgumentsOnNextLine = new QComboBox(this); - m_AllowAllArgumentsOnNextLine->addItems({"Default","true","false",}); - m_AllowAllArgumentsOnNextLine->setObjectName("AllowAllArgumentsOnNextLine"); - - m_AllowShortBlocksOnASingleLine = new QComboBox(this); - m_AllowShortBlocksOnASingleLine->addItems({"Never","Empty","Always",}); - m_AllowShortBlocksOnASingleLine->setObjectName("AllowShortBlocksOnASingleLine"); - - m_AllowShortCaseLabelsOnASingleLine = new QComboBox(this); - m_AllowShortCaseLabelsOnASingleLine->addItems({"Default","true","false",}); - m_AllowShortCaseLabelsOnASingleLine->setObjectName("AllowShortCaseLabelsOnASingleLine"); - - m_AllowShortEnumsOnASingleLine = new QComboBox(this); - m_AllowShortEnumsOnASingleLine->addItems({"Default","true","false",}); - m_AllowShortEnumsOnASingleLine->setObjectName("AllowShortEnumsOnASingleLine"); - - m_AllowShortFunctionsOnASingleLine = new QComboBox(this); - m_AllowShortFunctionsOnASingleLine->addItems({"None","InlineOnly","Empty","Inline","All",}); - m_AllowShortFunctionsOnASingleLine->setObjectName("AllowShortFunctionsOnASingleLine"); - - m_AllowShortIfStatementsOnASingleLine = new QComboBox(this); - m_AllowShortIfStatementsOnASingleLine->addItems({"Never","WithoutElse","OnlyFirstIf","AllIfsAndElse",}); - m_AllowShortIfStatementsOnASingleLine->setObjectName("AllowShortIfStatementsOnASingleLine"); - - m_AllowShortLambdasOnASingleLine = new QComboBox(this); - m_AllowShortLambdasOnASingleLine->addItems({"None","Empty","Inline","All",}); - m_AllowShortLambdasOnASingleLine->setObjectName("AllowShortLambdasOnASingleLine"); - - m_AllowShortLoopsOnASingleLine = new QComboBox(this); - m_AllowShortLoopsOnASingleLine->addItems({"Default","true","false",}); - m_AllowShortLoopsOnASingleLine->setObjectName("AllowShortLoopsOnASingleLine"); - - m_AlwaysBreakAfterReturnType = new QComboBox(this); - m_AlwaysBreakAfterReturnType->addItems({"None","All","TopLevel","AllDefinitions","TopLevelDefinitions",}); - m_AlwaysBreakAfterReturnType->setObjectName("AlwaysBreakAfterReturnType"); - - m_AlwaysBreakBeforeMultilineStrings = new QComboBox(this); - m_AlwaysBreakBeforeMultilineStrings->addItems({"Default","true","false",}); - m_AlwaysBreakBeforeMultilineStrings->setObjectName("AlwaysBreakBeforeMultilineStrings"); - - m_AlwaysBreakTemplateDeclarations = new QComboBox(this); - m_AlwaysBreakTemplateDeclarations->addItems({"No","MultiLine","Yes",}); - m_AlwaysBreakTemplateDeclarations->setObjectName("AlwaysBreakTemplateDeclarations"); - - m_AttributeMacros = new QPlainTextEdit(this); - m_AttributeMacros->setObjectName("AttributeMacros"); - m_AttributeMacros->setFixedHeight(100); - m_setAttributeMacros = new QPushButton("Set", this); - - m_setAttributeMacros->setObjectName("setAttributeMacros"); - m_BinPackArguments = new QComboBox(this); - m_BinPackArguments->addItems({"Default","true","false",}); - m_BinPackArguments->setObjectName("BinPackArguments"); - - m_BinPackParameters = new QComboBox(this); - m_BinPackParameters->addItems({"Default","true","false",}); - m_BinPackParameters->setObjectName("BinPackParameters"); - - m_BitFieldColonSpacing = new QComboBox(this); - m_BitFieldColonSpacing->addItems({"Both","None","Before","After",}); - m_BitFieldColonSpacing->setObjectName("BitFieldColonSpacing"); - - m_BraceWrappingAfterCaseLabel = new QComboBox(this); - m_BraceWrappingAfterCaseLabel->addItems({"Default","true","false",}); - m_BraceWrappingAfterCaseLabel->setObjectName("BraceWrappingAfterCaseLabel"); - - m_BraceWrappingAfterClass = new QComboBox(this); - m_BraceWrappingAfterClass->addItems({"Default","true","false",}); - m_BraceWrappingAfterClass->setObjectName("BraceWrappingAfterClass"); - - m_BraceWrappingAfterControlStatement = new QComboBox(this); - m_BraceWrappingAfterControlStatement->addItems({"Never","MultiLine","Always",}); - m_BraceWrappingAfterControlStatement->setObjectName("BraceWrappingAfterControlStatement"); - - m_BraceWrappingAfterEnum = new QComboBox(this); - m_BraceWrappingAfterEnum->addItems({"Default","true","false",}); - m_BraceWrappingAfterEnum->setObjectName("BraceWrappingAfterEnum"); - - m_BraceWrappingAfterFunction = new QComboBox(this); - m_BraceWrappingAfterFunction->addItems({"Default","true","false",}); - m_BraceWrappingAfterFunction->setObjectName("BraceWrappingAfterFunction"); - - m_BraceWrappingAfterNamespace = new QComboBox(this); - m_BraceWrappingAfterNamespace->addItems({"Default","true","false",}); - m_BraceWrappingAfterNamespace->setObjectName("BraceWrappingAfterNamespace"); - - m_BraceWrappingAfterObjCDeclaration = new QComboBox(this); - m_BraceWrappingAfterObjCDeclaration->addItems({"Default","true","false",}); - m_BraceWrappingAfterObjCDeclaration->setObjectName("BraceWrappingAfterObjCDeclaration"); - - m_BraceWrappingAfterStruct = new QComboBox(this); - m_BraceWrappingAfterStruct->addItems({"Default","true","false",}); - m_BraceWrappingAfterStruct->setObjectName("BraceWrappingAfterStruct"); - - m_BraceWrappingAfterUnion = new QComboBox(this); - m_BraceWrappingAfterUnion->addItems({"Default","true","false",}); - m_BraceWrappingAfterUnion->setObjectName("BraceWrappingAfterUnion"); - - m_BraceWrappingAfterExternBlock = new QComboBox(this); - m_BraceWrappingAfterExternBlock->addItems({"Default","true","false",}); - m_BraceWrappingAfterExternBlock->setObjectName("BraceWrappingAfterExternBlock"); - - m_BraceWrappingBeforeCatch = new QComboBox(this); - m_BraceWrappingBeforeCatch->addItems({"Default","true","false",}); - m_BraceWrappingBeforeCatch->setObjectName("BraceWrappingBeforeCatch"); - - m_BraceWrappingBeforeElse = new QComboBox(this); - m_BraceWrappingBeforeElse->addItems({"Default","true","false",}); - m_BraceWrappingBeforeElse->setObjectName("BraceWrappingBeforeElse"); - - m_BraceWrappingBeforeLambdaBody = new QComboBox(this); - m_BraceWrappingBeforeLambdaBody->addItems({"Default","true","false",}); - m_BraceWrappingBeforeLambdaBody->setObjectName("BraceWrappingBeforeLambdaBody"); - - m_BraceWrappingBeforeWhile = new QComboBox(this); - m_BraceWrappingBeforeWhile->addItems({"Default","true","false",}); - m_BraceWrappingBeforeWhile->setObjectName("BraceWrappingBeforeWhile"); - - m_BraceWrappingIndentBraces = new QComboBox(this); - m_BraceWrappingIndentBraces->addItems({"Default","true","false",}); - m_BraceWrappingIndentBraces->setObjectName("BraceWrappingIndentBraces"); - - m_BraceWrappingSplitEmptyFunction = new QComboBox(this); - m_BraceWrappingSplitEmptyFunction->addItems({"Default","true","false",}); - m_BraceWrappingSplitEmptyFunction->setObjectName("BraceWrappingSplitEmptyFunction"); - - m_BraceWrappingSplitEmptyRecord = new QComboBox(this); - m_BraceWrappingSplitEmptyRecord->addItems({"Default","true","false",}); - m_BraceWrappingSplitEmptyRecord->setObjectName("BraceWrappingSplitEmptyRecord"); - - m_BraceWrappingSplitEmptyNamespace = new QComboBox(this); - m_BraceWrappingSplitEmptyNamespace->addItems({"Default","true","false",}); - m_BraceWrappingSplitEmptyNamespace->setObjectName("BraceWrappingSplitEmptyNamespace"); - - m_BreakAfterAttributes = new QComboBox(this); - m_BreakAfterAttributes->addItems({"Always","Leave","Never",}); - m_BreakAfterAttributes->setObjectName("BreakAfterAttributes"); - - m_BreakArrays = new QComboBox(this); - m_BreakArrays->addItems({"Default","true","false",}); - m_BreakArrays->setObjectName("BreakArrays"); - - m_BreakBeforeBinaryOperators = new QComboBox(this); - m_BreakBeforeBinaryOperators->addItems({"None","NonAssignment","All",}); - m_BreakBeforeBinaryOperators->setObjectName("BreakBeforeBinaryOperators"); - - m_BreakBeforeBraces = new QComboBox(this); - m_BreakBeforeBraces->addItems({"Attach","Linux","Mozilla","Stroustrup","Allman","Whitesmiths","GNU","WebKit","Custom",}); - m_BreakBeforeBraces->setObjectName("BreakBeforeBraces"); - - m_BreakBeforeConceptDeclarations = new QComboBox(this); - m_BreakBeforeConceptDeclarations->addItems({"Never","Allowed","Always",}); - m_BreakBeforeConceptDeclarations->setObjectName("BreakBeforeConceptDeclarations"); - - m_BreakBeforeInlineASMColon = new QComboBox(this); - m_BreakBeforeInlineASMColon->addItems({"Never","OnlyMultiline","Always",}); - m_BreakBeforeInlineASMColon->setObjectName("BreakBeforeInlineASMColon"); - - m_BreakBeforeTernaryOperators = new QComboBox(this); - m_BreakBeforeTernaryOperators->addItems({"Default","true","false",}); - m_BreakBeforeTernaryOperators->setObjectName("BreakBeforeTernaryOperators"); - - m_BreakConstructorInitializers = new QComboBox(this); - m_BreakConstructorInitializers->addItems({"BeforeColon","BeforeComma","AfterColon",}); - m_BreakConstructorInitializers->setObjectName("BreakConstructorInitializers"); - - m_BreakAfterJavaFieldAnnotations = new QComboBox(this); - m_BreakAfterJavaFieldAnnotations->addItems({"Default","true","false",}); - m_BreakAfterJavaFieldAnnotations->setObjectName("BreakAfterJavaFieldAnnotations"); - - m_BreakStringLiterals = new QComboBox(this); - m_BreakStringLiterals->addItems({"Default","true","false",}); - m_BreakStringLiterals->setObjectName("BreakStringLiterals"); - - m_ColumnLimit = new QLineEdit(this); - m_ColumnLimit->setObjectName("ColumnLimit"); - m_setColumnLimit = new QPushButton("Set", this); - - m_setColumnLimit->setObjectName("setColumnLimit"); - m_CommentPragmas = new QLineEdit(this); - m_CommentPragmas->setObjectName("CommentPragmas"); - m_setCommentPragmas = new QPushButton("Set", this); - - m_setCommentPragmas->setObjectName("setCommentPragmas"); - m_BreakInheritanceList = new QComboBox(this); - m_BreakInheritanceList->addItems({"BeforeColon","BeforeComma","AfterColon","AfterComma",}); - m_BreakInheritanceList->setObjectName("BreakInheritanceList"); - - m_CompactNamespaces = new QComboBox(this); - m_CompactNamespaces->addItems({"Default","true","false",}); - m_CompactNamespaces->setObjectName("CompactNamespaces"); - - m_ContinuationIndentWidth = new QLineEdit(this); - m_ContinuationIndentWidth->setObjectName("ContinuationIndentWidth"); - m_setContinuationIndentWidth = new QPushButton("Set", this); - - m_setContinuationIndentWidth->setObjectName("setContinuationIndentWidth"); - m_Cpp11BracedListStyle = new QComboBox(this); - m_Cpp11BracedListStyle->addItems({"Default","true","false",}); - m_Cpp11BracedListStyle->setObjectName("Cpp11BracedListStyle"); - - m_DisableFormat = new QComboBox(this); - m_DisableFormat->addItems({"Default","true","false",}); - m_DisableFormat->setObjectName("DisableFormat"); - - m_EmptyLineAfterAccessModifier = new QComboBox(this); - m_EmptyLineAfterAccessModifier->addItems({"Never","Leave","Always",}); - m_EmptyLineAfterAccessModifier->setObjectName("EmptyLineAfterAccessModifier"); - - m_EmptyLineBeforeAccessModifier = new QComboBox(this); - m_EmptyLineBeforeAccessModifier->addItems({"Never","Leave","LogicalBlock","Always",}); - m_EmptyLineBeforeAccessModifier->setObjectName("EmptyLineBeforeAccessModifier"); - - m_ExperimentalAutoDetectBinPacking = new QComboBox(this); - m_ExperimentalAutoDetectBinPacking->addItems({"Default","true","false",}); - m_ExperimentalAutoDetectBinPacking->setObjectName("ExperimentalAutoDetectBinPacking"); - - m_FixNamespaceComments = new QComboBox(this); - m_FixNamespaceComments->addItems({"Default","true","false",}); - m_FixNamespaceComments->setObjectName("FixNamespaceComments"); - - m_ForEachMacros = new QPlainTextEdit(this); - m_ForEachMacros->setObjectName("ForEachMacros"); - m_ForEachMacros->setFixedHeight(100); - m_setForEachMacros = new QPushButton("Set", this); - - m_setForEachMacros->setObjectName("setForEachMacros"); - m_IfMacros = new QPlainTextEdit(this); - m_IfMacros->setObjectName("IfMacros"); - m_IfMacros->setFixedHeight(100); - m_setIfMacros = new QPushButton("Set", this); - - m_setIfMacros->setObjectName("setIfMacros"); - m_IndentAccessModifiers = new QComboBox(this); - m_IndentAccessModifiers->addItems({"Default","true","false",}); - m_IndentAccessModifiers->setObjectName("IndentAccessModifiers"); - - m_IndentCaseBlocks = new QComboBox(this); - m_IndentCaseBlocks->addItems({"Default","true","false",}); - m_IndentCaseBlocks->setObjectName("IndentCaseBlocks"); - - m_IndentCaseLabels = new QComboBox(this); - m_IndentCaseLabels->addItems({"Default","true","false",}); - m_IndentCaseLabels->setObjectName("IndentCaseLabels"); - - m_IndentGotoLabels = new QComboBox(this); - m_IndentGotoLabels->addItems({"Default","true","false",}); - m_IndentGotoLabels->setObjectName("IndentGotoLabels"); - - m_IndentExternBlock = new QComboBox(this); - m_IndentExternBlock->addItems({"AfterExternBlock","NoIndent","Indent",}); - m_IndentExternBlock->setObjectName("IndentExternBlock"); - - m_IndentPPDirectives = new QComboBox(this); - m_IndentPPDirectives->addItems({"None","AfterHash","BeforeHash",}); - m_IndentPPDirectives->setObjectName("IndentPPDirectives"); - - m_IndentRequiresClause = new QComboBox(this); - m_IndentRequiresClause->addItems({"Default","true","false",}); - m_IndentRequiresClause->setObjectName("IndentRequiresClause"); - - m_IndentWidth = new QLineEdit(this); - m_IndentWidth->setObjectName("IndentWidth"); - m_setIndentWidth = new QPushButton("Set", this); - - m_setIndentWidth->setObjectName("setIndentWidth"); - m_IndentWrappedFunctionNames = new QComboBox(this); - m_IndentWrappedFunctionNames->addItems({"Default","true","false",}); - m_IndentWrappedFunctionNames->setObjectName("IndentWrappedFunctionNames"); - - m_InsertBraces = new QComboBox(this); - m_InsertBraces->addItems({"Default","true","false",}); - m_InsertBraces->setObjectName("InsertBraces"); - - m_InsertNewlineAtEOF = new QComboBox(this); - m_InsertNewlineAtEOF->addItems({"Default","true","false",}); - m_InsertNewlineAtEOF->setObjectName("InsertNewlineAtEOF"); - - m_InsertTrailingCommas = new QComboBox(this); - m_InsertTrailingCommas->addItems({"None","Wrapped",}); - m_InsertTrailingCommas->setObjectName("InsertTrailingCommas"); - - m_JavaImportGroups = new QPlainTextEdit(this); - m_JavaImportGroups->setObjectName("JavaImportGroups"); - m_JavaImportGroups->setFixedHeight(100); - m_setJavaImportGroups = new QPushButton("Set", this); - - m_setJavaImportGroups->setObjectName("setJavaImportGroups"); - m_JavaScriptQuotes = new QComboBox(this); - m_JavaScriptQuotes->addItems({"Leave","Single","Double",}); - m_JavaScriptQuotes->setObjectName("JavaScriptQuotes"); - - m_JavaScriptWrapImports = new QComboBox(this); - m_JavaScriptWrapImports->addItems({"Default","true","false",}); - m_JavaScriptWrapImports->setObjectName("JavaScriptWrapImports"); - - m_KeepEmptyLinesAtEOF = new QComboBox(this); - m_KeepEmptyLinesAtEOF->addItems({"Default","true","false",}); - m_KeepEmptyLinesAtEOF->setObjectName("KeepEmptyLinesAtEOF"); - - m_KeepEmptyLinesAtTheStartOfBlocks = new QComboBox(this); - m_KeepEmptyLinesAtTheStartOfBlocks->addItems({"Default","true","false",}); - m_KeepEmptyLinesAtTheStartOfBlocks->setObjectName("KeepEmptyLinesAtTheStartOfBlocks"); - - m_LambdaBodyIndentation = new QComboBox(this); - m_LambdaBodyIndentation->addItems({"Signature","OuterScope",}); - m_LambdaBodyIndentation->setObjectName("LambdaBodyIndentation"); - - m_Language = new QComboBox(this); - m_Language->addItems({"None","Cpp","CSharp","Java","JavaScript","Json","ObjC","Proto","TableGen","TextProto","Verilog",}); - m_Language->setObjectName("Language"); - - m_LineEnding = new QComboBox(this); - m_LineEnding->addItems({"LF","CRLF","DeriveLF","DeriveCRLF",}); - m_LineEnding->setObjectName("LineEnding"); - - m_MacroBlockBegin = new QLineEdit(this); - m_MacroBlockBegin->setObjectName("MacroBlockBegin"); - m_setMacroBlockBegin = new QPushButton("Set", this); - - m_setMacroBlockBegin->setObjectName("setMacroBlockBegin"); - m_MacroBlockEnd = new QLineEdit(this); - m_MacroBlockEnd->setObjectName("MacroBlockEnd"); - m_setMacroBlockEnd = new QPushButton("Set", this); - - m_setMacroBlockEnd->setObjectName("setMacroBlockEnd"); - m_Macros = new QPlainTextEdit(this); - m_Macros->setObjectName("Macros"); - m_Macros->setFixedHeight(100); - m_setMacros = new QPushButton("Set", this); - - m_setMacros->setObjectName("setMacros"); - m_MaxEmptyLinesToKeep = new QLineEdit(this); - m_MaxEmptyLinesToKeep->setObjectName("MaxEmptyLinesToKeep"); - m_setMaxEmptyLinesToKeep = new QPushButton("Set", this); - - m_setMaxEmptyLinesToKeep->setObjectName("setMaxEmptyLinesToKeep"); - m_NamespaceIndentation = new QComboBox(this); - m_NamespaceIndentation->addItems({"None","Inner","All",}); - m_NamespaceIndentation->setObjectName("NamespaceIndentation"); - - m_NamespaceMacros = new QPlainTextEdit(this); - m_NamespaceMacros->setObjectName("NamespaceMacros"); - m_NamespaceMacros->setFixedHeight(100); - m_setNamespaceMacros = new QPushButton("Set", this); - - m_setNamespaceMacros->setObjectName("setNamespaceMacros"); - m_ObjCBinPackProtocolList = new QComboBox(this); - m_ObjCBinPackProtocolList->addItems({"Auto","Always","Never",}); - m_ObjCBinPackProtocolList->setObjectName("ObjCBinPackProtocolList"); - - m_ObjCBlockIndentWidth = new QLineEdit(this); - m_ObjCBlockIndentWidth->setObjectName("ObjCBlockIndentWidth"); - m_setObjCBlockIndentWidth = new QPushButton("Set", this); - - m_setObjCBlockIndentWidth->setObjectName("setObjCBlockIndentWidth"); - m_ObjCBreakBeforeNestedBlockParam = new QComboBox(this); - m_ObjCBreakBeforeNestedBlockParam->addItems({"Default","true","false",}); - m_ObjCBreakBeforeNestedBlockParam->setObjectName("ObjCBreakBeforeNestedBlockParam"); - - m_ObjCSpaceAfterProperty = new QComboBox(this); - m_ObjCSpaceAfterProperty->addItems({"Default","true","false",}); - m_ObjCSpaceAfterProperty->setObjectName("ObjCSpaceAfterProperty"); - - m_ObjCSpaceBeforeProtocolList = new QComboBox(this); - m_ObjCSpaceBeforeProtocolList->addItems({"Default","true","false",}); - m_ObjCSpaceBeforeProtocolList->setObjectName("ObjCSpaceBeforeProtocolList"); - - m_PackConstructorInitializers = new QComboBox(this); - m_PackConstructorInitializers->addItems({"Never","BinPack","CurrentLine","NextLine","NextLineOnly",}); - m_PackConstructorInitializers->setObjectName("PackConstructorInitializers"); - - m_PenaltyBreakAssignment = new QLineEdit(this); - m_PenaltyBreakAssignment->setObjectName("PenaltyBreakAssignment"); - m_setPenaltyBreakAssignment = new QPushButton("Set", this); - - m_setPenaltyBreakAssignment->setObjectName("setPenaltyBreakAssignment"); - m_PenaltyBreakBeforeFirstCallParameter = new QLineEdit(this); - m_PenaltyBreakBeforeFirstCallParameter->setObjectName("PenaltyBreakBeforeFirstCallParameter"); - m_setPenaltyBreakBeforeFirstCallParameter = new QPushButton("Set", this); - - m_setPenaltyBreakBeforeFirstCallParameter->setObjectName("setPenaltyBreakBeforeFirstCallParameter"); - m_PenaltyBreakComment = new QLineEdit(this); - m_PenaltyBreakComment->setObjectName("PenaltyBreakComment"); - m_setPenaltyBreakComment = new QPushButton("Set", this); - - m_setPenaltyBreakComment->setObjectName("setPenaltyBreakComment"); - m_PenaltyBreakFirstLessLess = new QLineEdit(this); - m_PenaltyBreakFirstLessLess->setObjectName("PenaltyBreakFirstLessLess"); - m_setPenaltyBreakFirstLessLess = new QPushButton("Set", this); - - m_setPenaltyBreakFirstLessLess->setObjectName("setPenaltyBreakFirstLessLess"); - m_PenaltyBreakOpenParenthesis = new QLineEdit(this); - m_PenaltyBreakOpenParenthesis->setObjectName("PenaltyBreakOpenParenthesis"); - m_setPenaltyBreakOpenParenthesis = new QPushButton("Set", this); - - m_setPenaltyBreakOpenParenthesis->setObjectName("setPenaltyBreakOpenParenthesis"); - m_PenaltyBreakString = new QLineEdit(this); - m_PenaltyBreakString->setObjectName("PenaltyBreakString"); - m_setPenaltyBreakString = new QPushButton("Set", this); - - m_setPenaltyBreakString->setObjectName("setPenaltyBreakString"); - m_PenaltyBreakTemplateDeclaration = new QLineEdit(this); - m_PenaltyBreakTemplateDeclaration->setObjectName("PenaltyBreakTemplateDeclaration"); - m_setPenaltyBreakTemplateDeclaration = new QPushButton("Set", this); - - m_setPenaltyBreakTemplateDeclaration->setObjectName("setPenaltyBreakTemplateDeclaration"); - m_PenaltyExcessCharacter = new QLineEdit(this); - m_PenaltyExcessCharacter->setObjectName("PenaltyExcessCharacter"); - m_setPenaltyExcessCharacter = new QPushButton("Set", this); - - m_setPenaltyExcessCharacter->setObjectName("setPenaltyExcessCharacter"); - m_PenaltyIndentedWhitespace = new QLineEdit(this); - m_PenaltyIndentedWhitespace->setObjectName("PenaltyIndentedWhitespace"); - m_setPenaltyIndentedWhitespace = new QPushButton("Set", this); - - m_setPenaltyIndentedWhitespace->setObjectName("setPenaltyIndentedWhitespace"); - m_PenaltyReturnTypeOnItsOwnLine = new QLineEdit(this); - m_PenaltyReturnTypeOnItsOwnLine->setObjectName("PenaltyReturnTypeOnItsOwnLine"); - m_setPenaltyReturnTypeOnItsOwnLine = new QPushButton("Set", this); - - m_setPenaltyReturnTypeOnItsOwnLine->setObjectName("setPenaltyReturnTypeOnItsOwnLine"); - m_PointerAlignment = new QComboBox(this); - m_PointerAlignment->addItems({"Left","Right","Middle",}); - m_PointerAlignment->setObjectName("PointerAlignment"); - - m_PPIndentWidth = new QLineEdit(this); - m_PPIndentWidth->setObjectName("PPIndentWidth"); - m_setPPIndentWidth = new QPushButton("Set", this); - - m_setPPIndentWidth->setObjectName("setPPIndentWidth"); - m_QualifierAlignment = new QComboBox(this); - m_QualifierAlignment->addItems({"Leave","Left","Right","Custom",}); - m_QualifierAlignment->setObjectName("QualifierAlignment"); - - m_QualifierOrder = new QPlainTextEdit(this); - m_QualifierOrder->setObjectName("QualifierOrder"); - m_QualifierOrder->setFixedHeight(100); - m_setQualifierOrder = new QPushButton("Set", this); - - m_setQualifierOrder->setObjectName("setQualifierOrder"); - m_ReferenceAlignment = new QComboBox(this); - m_ReferenceAlignment->addItems({"Pointer","Left","Right","Middle",}); - m_ReferenceAlignment->setObjectName("ReferenceAlignment"); - - m_ReflowComments = new QComboBox(this); - m_ReflowComments->addItems({"Default","true","false",}); - m_ReflowComments->setObjectName("ReflowComments"); - - m_RemoveBracesLLVM = new QComboBox(this); - m_RemoveBracesLLVM->addItems({"Default","true","false",}); - m_RemoveBracesLLVM->setObjectName("RemoveBracesLLVM"); - - m_RemoveParentheses = new QComboBox(this); - m_RemoveParentheses->addItems({"Leave","MultipleParentheses","ReturnStatement",}); - m_RemoveParentheses->setObjectName("RemoveParentheses"); - - m_RemoveSemicolon = new QComboBox(this); - m_RemoveSemicolon->addItems({"Default","true","false",}); - m_RemoveSemicolon->setObjectName("RemoveSemicolon"); - - m_RequiresClausePosition = new QComboBox(this); - m_RequiresClausePosition->addItems({"OwnLine","WithPreceding","WithFollowing","SingleLine",}); - m_RequiresClausePosition->setObjectName("RequiresClausePosition"); - - m_RequiresExpressionIndentation = new QComboBox(this); - m_RequiresExpressionIndentation->addItems({"OuterScope","Keyword",}); - m_RequiresExpressionIndentation->setObjectName("RequiresExpressionIndentation"); - - m_SeparateDefinitionBlocks = new QComboBox(this); - m_SeparateDefinitionBlocks->addItems({"Leave","Always","Never",}); - m_SeparateDefinitionBlocks->setObjectName("SeparateDefinitionBlocks"); - - m_ShortNamespaceLines = new QLineEdit(this); - m_ShortNamespaceLines->setObjectName("ShortNamespaceLines"); - m_setShortNamespaceLines = new QPushButton("Set", this); - - m_setShortNamespaceLines->setObjectName("setShortNamespaceLines"); - m_SortIncludes = new QComboBox(this); - m_SortIncludes->addItems({"Never","CaseSensitive","CaseInsensitive",}); - m_SortIncludes->setObjectName("SortIncludes"); - - m_SortJavaStaticImport = new QComboBox(this); - m_SortJavaStaticImport->addItems({"Before","After",}); - m_SortJavaStaticImport->setObjectName("SortJavaStaticImport"); - - m_SortUsingDeclarations = new QComboBox(this); - m_SortUsingDeclarations->addItems({"Never","Lexicographic","LexicographicNumeric",}); - m_SortUsingDeclarations->setObjectName("SortUsingDeclarations"); - - m_SpaceAfterCStyleCast = new QComboBox(this); - m_SpaceAfterCStyleCast->addItems({"Default","true","false",}); - m_SpaceAfterCStyleCast->setObjectName("SpaceAfterCStyleCast"); - - m_SpaceAfterLogicalNot = new QComboBox(this); - m_SpaceAfterLogicalNot->addItems({"Default","true","false",}); - m_SpaceAfterLogicalNot->setObjectName("SpaceAfterLogicalNot"); - - m_SpaceAfterTemplateKeyword = new QComboBox(this); - m_SpaceAfterTemplateKeyword->addItems({"Default","true","false",}); - m_SpaceAfterTemplateKeyword->setObjectName("SpaceAfterTemplateKeyword"); - - m_SpaceAroundPointerQualifiers = new QComboBox(this); - m_SpaceAroundPointerQualifiers->addItems({"Default","Before","After","Both",}); - m_SpaceAroundPointerQualifiers->setObjectName("SpaceAroundPointerQualifiers"); - - m_SpaceBeforeAssignmentOperators = new QComboBox(this); - m_SpaceBeforeAssignmentOperators->addItems({"Default","true","false",}); - m_SpaceBeforeAssignmentOperators->setObjectName("SpaceBeforeAssignmentOperators"); - - m_SpaceBeforeCaseColon = new QComboBox(this); - m_SpaceBeforeCaseColon->addItems({"Default","true","false",}); - m_SpaceBeforeCaseColon->setObjectName("SpaceBeforeCaseColon"); - - m_SpaceBeforeCpp11BracedList = new QComboBox(this); - m_SpaceBeforeCpp11BracedList->addItems({"Default","true","false",}); - m_SpaceBeforeCpp11BracedList->setObjectName("SpaceBeforeCpp11BracedList"); - - m_SpaceBeforeCtorInitializerColon = new QComboBox(this); - m_SpaceBeforeCtorInitializerColon->addItems({"Default","true","false",}); - m_SpaceBeforeCtorInitializerColon->setObjectName("SpaceBeforeCtorInitializerColon"); - - m_SpaceBeforeInheritanceColon = new QComboBox(this); - m_SpaceBeforeInheritanceColon->addItems({"Default","true","false",}); - m_SpaceBeforeInheritanceColon->setObjectName("SpaceBeforeInheritanceColon"); - - m_SpaceBeforeJsonColon = new QComboBox(this); - m_SpaceBeforeJsonColon->addItems({"Default","true","false",}); - m_SpaceBeforeJsonColon->setObjectName("SpaceBeforeJsonColon"); - - m_SpaceBeforeParens = new QComboBox(this); - m_SpaceBeforeParens->addItems({"Never","ControlStatements","ControlStatementsExceptControlMacros","NonEmptyParentheses","Always","Custom",}); - m_SpaceBeforeParens->setObjectName("SpaceBeforeParens"); - - m_SpaceBeforeParensOptionsAfterControlStatements = new QComboBox(this); - m_SpaceBeforeParensOptionsAfterControlStatements->addItems({"Default","true","false",}); - m_SpaceBeforeParensOptionsAfterControlStatements->setObjectName("SpaceBeforeParensOptionsAfterControlStatements"); - - m_SpaceBeforeParensOptionsAfterForeachMacros = new QComboBox(this); - m_SpaceBeforeParensOptionsAfterForeachMacros->addItems({"Default","true","false",}); - m_SpaceBeforeParensOptionsAfterForeachMacros->setObjectName("SpaceBeforeParensOptionsAfterForeachMacros"); - - m_SpaceBeforeParensOptionsAfterFunctionDeclarationName = new QComboBox(this); - m_SpaceBeforeParensOptionsAfterFunctionDeclarationName->addItems({"Default","true","false",}); - m_SpaceBeforeParensOptionsAfterFunctionDeclarationName->setObjectName("SpaceBeforeParensOptionsAfterFunctionDeclarationName"); - - m_SpaceBeforeParensOptionsAfterFunctionDefinitionName = new QComboBox(this); - m_SpaceBeforeParensOptionsAfterFunctionDefinitionName->addItems({"Default","true","false",}); - m_SpaceBeforeParensOptionsAfterFunctionDefinitionName->setObjectName("SpaceBeforeParensOptionsAfterFunctionDefinitionName"); - - m_SpaceBeforeParensOptionsAfterIfMacros = new QComboBox(this); - m_SpaceBeforeParensOptionsAfterIfMacros->addItems({"Default","true","false",}); - m_SpaceBeforeParensOptionsAfterIfMacros->setObjectName("SpaceBeforeParensOptionsAfterIfMacros"); - - m_SpaceBeforeParensOptionsAfterOverloadedOperator = new QComboBox(this); - m_SpaceBeforeParensOptionsAfterOverloadedOperator->addItems({"Default","true","false",}); - m_SpaceBeforeParensOptionsAfterOverloadedOperator->setObjectName("SpaceBeforeParensOptionsAfterOverloadedOperator"); - - m_SpaceBeforeParensOptionsAfterRequiresInClause = new QComboBox(this); - m_SpaceBeforeParensOptionsAfterRequiresInClause->addItems({"Default","true","false",}); - m_SpaceBeforeParensOptionsAfterRequiresInClause->setObjectName("SpaceBeforeParensOptionsAfterRequiresInClause"); - - m_SpaceBeforeParensOptionsAfterRequiresInExpression = new QComboBox(this); - m_SpaceBeforeParensOptionsAfterRequiresInExpression->addItems({"Default","true","false",}); - m_SpaceBeforeParensOptionsAfterRequiresInExpression->setObjectName("SpaceBeforeParensOptionsAfterRequiresInExpression"); - - m_SpaceBeforeParensOptionsBeforeNonEmptyParentheses = new QComboBox(this); - m_SpaceBeforeParensOptionsBeforeNonEmptyParentheses->addItems({"Default","true","false",}); - m_SpaceBeforeParensOptionsBeforeNonEmptyParentheses->setObjectName("SpaceBeforeParensOptionsBeforeNonEmptyParentheses"); - - m_SpaceBeforeSquareBrackets = new QComboBox(this); - m_SpaceBeforeSquareBrackets->addItems({"Default","true","false",}); - m_SpaceBeforeSquareBrackets->setObjectName("SpaceBeforeSquareBrackets"); - - m_SpaceBeforeRangeBasedForLoopColon = new QComboBox(this); - m_SpaceBeforeRangeBasedForLoopColon->addItems({"Default","true","false",}); - m_SpaceBeforeRangeBasedForLoopColon->setObjectName("SpaceBeforeRangeBasedForLoopColon"); - - m_SpaceInEmptyBlock = new QComboBox(this); - m_SpaceInEmptyBlock->addItems({"Default","true","false",}); - m_SpaceInEmptyBlock->setObjectName("SpaceInEmptyBlock"); - - m_SpacesInAngles = new QComboBox(this); - m_SpacesInAngles->addItems({"Never","Always","Leave",}); - m_SpacesInAngles->setObjectName("SpacesInAngles"); - - m_SpacesInLineCommentPrefixMinimum = new QLineEdit(this); - m_SpacesInLineCommentPrefixMinimum->setObjectName("SpacesInLineCommentPrefixMinimum"); - m_setSpacesInLineCommentPrefixMinimum = new QPushButton("Set", this); - - m_setSpacesInLineCommentPrefixMinimum->setObjectName("setSpacesInLineCommentPrefixMinimum"); - m_SpacesInLineCommentPrefixMaximum = new QLineEdit(this); - m_SpacesInLineCommentPrefixMaximum->setObjectName("SpacesInLineCommentPrefixMaximum"); - m_setSpacesInLineCommentPrefixMaximum = new QPushButton("Set", this); - - m_setSpacesInLineCommentPrefixMaximum->setObjectName("setSpacesInLineCommentPrefixMaximum"); - m_SpacesInParensOptionsInConditionalStatements = new QComboBox(this); - m_SpacesInParensOptionsInConditionalStatements->addItems({"Default","true","false",}); - m_SpacesInParensOptionsInConditionalStatements->setObjectName("SpacesInParensOptionsInConditionalStatements"); - - m_SpacesInParensOptionsInCStyleCasts = new QComboBox(this); - m_SpacesInParensOptionsInCStyleCasts->addItems({"Default","true","false",}); - m_SpacesInParensOptionsInCStyleCasts->setObjectName("SpacesInParensOptionsInCStyleCasts"); - - m_SpacesInParensOptionsInEmptyParentheses = new QComboBox(this); - m_SpacesInParensOptionsInEmptyParentheses->addItems({"Default","true","false",}); - m_SpacesInParensOptionsInEmptyParentheses->setObjectName("SpacesInParensOptionsInEmptyParentheses"); - - m_SpacesInParensOptionsOther = new QComboBox(this); - m_SpacesInParensOptionsOther->addItems({"Default","true","false",}); - m_SpacesInParensOptionsOther->setObjectName("SpacesInParensOptionsOther"); - - m_SpacesInSquareBrackets = new QComboBox(this); - m_SpacesInSquareBrackets->addItems({"Default","true","false",}); - m_SpacesInSquareBrackets->setObjectName("SpacesInSquareBrackets"); - - m_Standard = new QComboBox(this); - m_Standard->addItems({"Cpp03","Cpp11","Cpp14","Cpp17","Cpp20","Latest","Auto",}); - m_Standard->setObjectName("Standard"); - - m_StatementAttributeLikeMacros = new QPlainTextEdit(this); - m_StatementAttributeLikeMacros->setObjectName("StatementAttributeLikeMacros"); - m_StatementAttributeLikeMacros->setFixedHeight(100); - m_setStatementAttributeLikeMacros = new QPushButton("Set", this); - - m_setStatementAttributeLikeMacros->setObjectName("setStatementAttributeLikeMacros"); - m_StatementMacros = new QPlainTextEdit(this); - m_StatementMacros->setObjectName("StatementMacros"); - m_StatementMacros->setFixedHeight(100); - m_setStatementMacros = new QPushButton("Set", this); - - m_setStatementMacros->setObjectName("setStatementMacros"); - m_TabWidth = new QLineEdit(this); - m_TabWidth->setObjectName("TabWidth"); - m_setTabWidth = new QPushButton("Set", this); - - m_setTabWidth->setObjectName("setTabWidth"); - m_TypeNames = new QPlainTextEdit(this); - m_TypeNames->setObjectName("TypeNames"); - m_TypeNames->setFixedHeight(100); - m_setTypeNames = new QPushButton("Set", this); - - m_setTypeNames->setObjectName("setTypeNames"); - m_TypenameMacros = new QPlainTextEdit(this); - m_TypenameMacros->setObjectName("TypenameMacros"); - m_TypenameMacros->setFixedHeight(100); - m_setTypenameMacros = new QPushButton("Set", this); - - m_setTypenameMacros->setObjectName("setTypenameMacros"); - m_UseTab = new QComboBox(this); - m_UseTab->addItems({"Never","ForIndentation","ForContinuationAndIndentation","AlignWithSpaces","Always",}); - m_UseTab->setObjectName("UseTab"); - - m_VerilogBreakBetweenInstancePorts = new QComboBox(this); - m_VerilogBreakBetweenInstancePorts->addItems({"Default","true","false",}); - m_VerilogBreakBetweenInstancePorts->setObjectName("VerilogBreakBetweenInstancePorts"); - - m_WhitespaceSensitiveMacros = new QPlainTextEdit(this); - m_WhitespaceSensitiveMacros->setObjectName("WhitespaceSensitiveMacros"); - m_WhitespaceSensitiveMacros->setFixedHeight(100); - m_setWhitespaceSensitiveMacros = new QPushButton("Set", this); - - m_setWhitespaceSensitiveMacros->setObjectName("setWhitespaceSensitiveMacros"); - - using namespace Layouting; - - Grid { - new QLabel("BasedOnStyle"), m_BasedOnStyle, br, - new QLabel("InheritsParentConfig"), m_InheritsParentConfig, br, - new QLabel("AccessModifierOffset"), Row {m_AccessModifierOffset, m_setAccessModifierOffset}, br, - new QLabel("AlignAfterOpenBracket"), m_AlignAfterOpenBracket, br, - new QLabel("AlignArrayOfStructures"), m_AlignArrayOfStructures, br, - new QLabel("AlignConsecutiveMacros"), br, - new QLabel(" Enabled"), m_AlignConsecutiveMacrosEnabled, br, - new QLabel(" AcrossEmptyLines"), m_AlignConsecutiveMacrosAcrossEmptyLines, br, - new QLabel(" AcrossComments"), m_AlignConsecutiveMacrosAcrossComments, br, - new QLabel(" AlignCompound"), m_AlignConsecutiveMacrosAlignCompound, br, - new QLabel(" PadOperators"), m_AlignConsecutiveMacrosPadOperators, br, - new QLabel("AlignConsecutiveAssignments"), br, - new QLabel(" Enabled"), m_AlignConsecutiveAssignmentsEnabled, br, - new QLabel(" AcrossEmptyLines"), m_AlignConsecutiveAssignmentsAcrossEmptyLines, br, - new QLabel(" AcrossComments"), m_AlignConsecutiveAssignmentsAcrossComments, br, - new QLabel(" AlignCompound"), m_AlignConsecutiveAssignmentsAlignCompound, br, - new QLabel(" PadOperators"), m_AlignConsecutiveAssignmentsPadOperators, br, - new QLabel("AlignConsecutiveBitFields"), br, - new QLabel(" Enabled"), m_AlignConsecutiveBitFieldsEnabled, br, - new QLabel(" AcrossEmptyLines"), m_AlignConsecutiveBitFieldsAcrossEmptyLines, br, - new QLabel(" AcrossComments"), m_AlignConsecutiveBitFieldsAcrossComments, br, - new QLabel(" AlignCompound"), m_AlignConsecutiveBitFieldsAlignCompound, br, - new QLabel(" PadOperators"), m_AlignConsecutiveBitFieldsPadOperators, br, - new QLabel("AlignConsecutiveDeclarations"), br, - new QLabel(" Enabled"), m_AlignConsecutiveDeclarationsEnabled, br, - new QLabel(" AcrossEmptyLines"), m_AlignConsecutiveDeclarationsAcrossEmptyLines, br, - new QLabel(" AcrossComments"), m_AlignConsecutiveDeclarationsAcrossComments, br, - new QLabel(" AlignCompound"), m_AlignConsecutiveDeclarationsAlignCompound, br, - new QLabel(" PadOperators"), m_AlignConsecutiveDeclarationsPadOperators, br, - new QLabel("AlignConsecutiveShortCaseStatements"), br, - new QLabel(" Enabled"), m_AlignConsecutiveShortCaseStatementsEnabled, br, - new QLabel(" AcrossEmptyLines"), m_AlignConsecutiveShortCaseStatementsAcrossEmptyLines, br, - new QLabel(" AcrossComments"), m_AlignConsecutiveShortCaseStatementsAcrossComments, br, - new QLabel(" AlignCaseColons"), m_AlignConsecutiveShortCaseStatementsAlignCaseColons, br, - new QLabel("AlignEscapedNewlines"), m_AlignEscapedNewlines, br, - new QLabel("AlignOperands"), m_AlignOperands, br, - new QLabel("AlignTrailingComments"), br, - new QLabel(" Kind"), m_AlignTrailingCommentsKind, br, - new QLabel(" OverEmptyLines"), Row {m_AlignTrailingCommentsOverEmptyLines, m_setAlignTrailingCommentsOverEmptyLines}, br, - new QLabel("AllowAllArgumentsOnNextLine"), m_AllowAllArgumentsOnNextLine, br, - new QLabel("AllowShortBlocksOnASingleLine"), m_AllowShortBlocksOnASingleLine, br, - new QLabel("AllowShortCaseLabelsOnASingleLine"), m_AllowShortCaseLabelsOnASingleLine, br, - new QLabel("AllowShortEnumsOnASingleLine"), m_AllowShortEnumsOnASingleLine, br, - new QLabel("AllowShortFunctionsOnASingleLine"), m_AllowShortFunctionsOnASingleLine, br, - new QLabel("AllowShortIfStatementsOnASingleLine"), m_AllowShortIfStatementsOnASingleLine, br, - new QLabel("AllowShortLambdasOnASingleLine"), m_AllowShortLambdasOnASingleLine, br, - new QLabel("AllowShortLoopsOnASingleLine"), m_AllowShortLoopsOnASingleLine, br, - new QLabel("AlwaysBreakAfterReturnType"), m_AlwaysBreakAfterReturnType, br, - new QLabel("AlwaysBreakBeforeMultilineStrings"), m_AlwaysBreakBeforeMultilineStrings, br, - new QLabel("AlwaysBreakTemplateDeclarations"), m_AlwaysBreakTemplateDeclarations, br, - new QLabel("AttributeMacros"), Row {m_AttributeMacros, m_setAttributeMacros}, br, - new QLabel("BinPackArguments"), m_BinPackArguments, br, - new QLabel("BinPackParameters"), m_BinPackParameters, br, - new QLabel("BitFieldColonSpacing"), m_BitFieldColonSpacing, br, - new QLabel("BraceWrapping"), br, - new QLabel(" AfterCaseLabel"), m_BraceWrappingAfterCaseLabel, br, - new QLabel(" AfterClass"), m_BraceWrappingAfterClass, br, - new QLabel(" AfterControlStatement"), m_BraceWrappingAfterControlStatement, br, - new QLabel(" AfterEnum"), m_BraceWrappingAfterEnum, br, - new QLabel(" AfterFunction"), m_BraceWrappingAfterFunction, br, - new QLabel(" AfterNamespace"), m_BraceWrappingAfterNamespace, br, - new QLabel(" AfterObjCDeclaration"), m_BraceWrappingAfterObjCDeclaration, br, - new QLabel(" AfterStruct"), m_BraceWrappingAfterStruct, br, - new QLabel(" AfterUnion"), m_BraceWrappingAfterUnion, br, - new QLabel(" AfterExternBlock"), m_BraceWrappingAfterExternBlock, br, - new QLabel(" BeforeCatch"), m_BraceWrappingBeforeCatch, br, - new QLabel(" BeforeElse"), m_BraceWrappingBeforeElse, br, - new QLabel(" BeforeLambdaBody"), m_BraceWrappingBeforeLambdaBody, br, - new QLabel(" BeforeWhile"), m_BraceWrappingBeforeWhile, br, - new QLabel(" IndentBraces"), m_BraceWrappingIndentBraces, br, - new QLabel(" SplitEmptyFunction"), m_BraceWrappingSplitEmptyFunction, br, - new QLabel(" SplitEmptyRecord"), m_BraceWrappingSplitEmptyRecord, br, - new QLabel(" SplitEmptyNamespace"), m_BraceWrappingSplitEmptyNamespace, br, - new QLabel("BreakAfterAttributes"), m_BreakAfterAttributes, br, - new QLabel("BreakArrays"), m_BreakArrays, br, - new QLabel("BreakBeforeBinaryOperators"), m_BreakBeforeBinaryOperators, br, - new QLabel("BreakBeforeBraces"), m_BreakBeforeBraces, br, - new QLabel("BreakBeforeConceptDeclarations"), m_BreakBeforeConceptDeclarations, br, - new QLabel("BreakBeforeInlineASMColon"), m_BreakBeforeInlineASMColon, br, - new QLabel("BreakBeforeTernaryOperators"), m_BreakBeforeTernaryOperators, br, - new QLabel("BreakConstructorInitializers"), m_BreakConstructorInitializers, br, - new QLabel("BreakAfterJavaFieldAnnotations"), m_BreakAfterJavaFieldAnnotations, br, - new QLabel("BreakStringLiterals"), m_BreakStringLiterals, br, - new QLabel("ColumnLimit"), Row {m_ColumnLimit, m_setColumnLimit}, br, - new QLabel("CommentPragmas"), Row {m_CommentPragmas, m_setCommentPragmas}, br, - new QLabel("BreakInheritanceList"), m_BreakInheritanceList, br, - new QLabel("CompactNamespaces"), m_CompactNamespaces, br, - new QLabel("ContinuationIndentWidth"), Row {m_ContinuationIndentWidth, m_setContinuationIndentWidth}, br, - new QLabel("Cpp11BracedListStyle"), m_Cpp11BracedListStyle, br, - new QLabel("DisableFormat"), m_DisableFormat, br, - new QLabel("EmptyLineAfterAccessModifier"), m_EmptyLineAfterAccessModifier, br, - new QLabel("EmptyLineBeforeAccessModifier"), m_EmptyLineBeforeAccessModifier, br, - new QLabel("ExperimentalAutoDetectBinPacking"), m_ExperimentalAutoDetectBinPacking, br, - new QLabel("FixNamespaceComments"), m_FixNamespaceComments, br, - new QLabel("ForEachMacros"), Row {m_ForEachMacros, m_setForEachMacros}, br, - new QLabel("IfMacros"), Row {m_IfMacros, m_setIfMacros}, br, - new QLabel("IndentAccessModifiers"), m_IndentAccessModifiers, br, - new QLabel("IndentCaseBlocks"), m_IndentCaseBlocks, br, - new QLabel("IndentCaseLabels"), m_IndentCaseLabels, br, - new QLabel("IndentGotoLabels"), m_IndentGotoLabels, br, - new QLabel("IndentExternBlock"), m_IndentExternBlock, br, - new QLabel("IndentPPDirectives"), m_IndentPPDirectives, br, - new QLabel("IndentRequiresClause"), m_IndentRequiresClause, br, - new QLabel("IndentWidth"), Row {m_IndentWidth, m_setIndentWidth}, br, - new QLabel("IndentWrappedFunctionNames"), m_IndentWrappedFunctionNames, br, - new QLabel("InsertBraces"), m_InsertBraces, br, - new QLabel("InsertNewlineAtEOF"), m_InsertNewlineAtEOF, br, - new QLabel("InsertTrailingCommas"), m_InsertTrailingCommas, br, - new QLabel("IntegerLiteralSeparator"), br, - new QLabel("JavaImportGroups"), Row {m_JavaImportGroups, m_setJavaImportGroups}, br, - new QLabel("JavaScriptQuotes"), m_JavaScriptQuotes, br, - new QLabel("JavaScriptWrapImports"), m_JavaScriptWrapImports, br, - new QLabel("KeepEmptyLinesAtEOF"), m_KeepEmptyLinesAtEOF, br, - new QLabel("KeepEmptyLinesAtTheStartOfBlocks"), m_KeepEmptyLinesAtTheStartOfBlocks, br, - new QLabel("LambdaBodyIndentation"), m_LambdaBodyIndentation, br, - new QLabel("Language"), m_Language, br, - new QLabel("LineEnding"), m_LineEnding, br, - new QLabel("MacroBlockBegin"), Row {m_MacroBlockBegin, m_setMacroBlockBegin}, br, - new QLabel("MacroBlockEnd"), Row {m_MacroBlockEnd, m_setMacroBlockEnd}, br, - new QLabel("Macros"), Row {m_Macros, m_setMacros}, br, - new QLabel("MaxEmptyLinesToKeep"), Row {m_MaxEmptyLinesToKeep, m_setMaxEmptyLinesToKeep}, br, - new QLabel("NamespaceIndentation"), m_NamespaceIndentation, br, - new QLabel("NamespaceMacros"), Row {m_NamespaceMacros, m_setNamespaceMacros}, br, - new QLabel("ObjCBinPackProtocolList"), m_ObjCBinPackProtocolList, br, - new QLabel("ObjCBlockIndentWidth"), Row {m_ObjCBlockIndentWidth, m_setObjCBlockIndentWidth}, br, - new QLabel("ObjCBreakBeforeNestedBlockParam"), m_ObjCBreakBeforeNestedBlockParam, br, - new QLabel("ObjCSpaceAfterProperty"), m_ObjCSpaceAfterProperty, br, - new QLabel("ObjCSpaceBeforeProtocolList"), m_ObjCSpaceBeforeProtocolList, br, - new QLabel("PackConstructorInitializers"), m_PackConstructorInitializers, br, - new QLabel("PenaltyBreakAssignment"), Row {m_PenaltyBreakAssignment, m_setPenaltyBreakAssignment}, br, - new QLabel("PenaltyBreakBeforeFirstCallParameter"), Row {m_PenaltyBreakBeforeFirstCallParameter, m_setPenaltyBreakBeforeFirstCallParameter}, br, - new QLabel("PenaltyBreakComment"), Row {m_PenaltyBreakComment, m_setPenaltyBreakComment}, br, - new QLabel("PenaltyBreakFirstLessLess"), Row {m_PenaltyBreakFirstLessLess, m_setPenaltyBreakFirstLessLess}, br, - new QLabel("PenaltyBreakOpenParenthesis"), Row {m_PenaltyBreakOpenParenthesis, m_setPenaltyBreakOpenParenthesis}, br, - new QLabel("PenaltyBreakString"), Row {m_PenaltyBreakString, m_setPenaltyBreakString}, br, - new QLabel("PenaltyBreakTemplateDeclaration"), Row {m_PenaltyBreakTemplateDeclaration, m_setPenaltyBreakTemplateDeclaration}, br, - new QLabel("PenaltyExcessCharacter"), Row {m_PenaltyExcessCharacter, m_setPenaltyExcessCharacter}, br, - new QLabel("PenaltyIndentedWhitespace"), Row {m_PenaltyIndentedWhitespace, m_setPenaltyIndentedWhitespace}, br, - new QLabel("PenaltyReturnTypeOnItsOwnLine"), Row {m_PenaltyReturnTypeOnItsOwnLine, m_setPenaltyReturnTypeOnItsOwnLine}, br, - new QLabel("PointerAlignment"), m_PointerAlignment, br, - new QLabel("PPIndentWidth"), Row {m_PPIndentWidth, m_setPPIndentWidth}, br, - new QLabel("QualifierAlignment"), m_QualifierAlignment, br, - new QLabel("QualifierOrder"), Row {m_QualifierOrder, m_setQualifierOrder}, br, - new QLabel("ReferenceAlignment"), m_ReferenceAlignment, br, - new QLabel("ReflowComments"), m_ReflowComments, br, - new QLabel("RemoveBracesLLVM"), m_RemoveBracesLLVM, br, - new QLabel("RemoveParentheses"), m_RemoveParentheses, br, - new QLabel("RemoveSemicolon"), m_RemoveSemicolon, br, - new QLabel("RequiresClausePosition"), m_RequiresClausePosition, br, - new QLabel("RequiresExpressionIndentation"), m_RequiresExpressionIndentation, br, - new QLabel("SeparateDefinitionBlocks"), m_SeparateDefinitionBlocks, br, - new QLabel("ShortNamespaceLines"), Row {m_ShortNamespaceLines, m_setShortNamespaceLines}, br, - new QLabel("SortIncludes"), m_SortIncludes, br, - new QLabel("SortJavaStaticImport"), m_SortJavaStaticImport, br, - new QLabel("SortUsingDeclarations"), m_SortUsingDeclarations, br, - new QLabel("SpaceAfterCStyleCast"), m_SpaceAfterCStyleCast, br, - new QLabel("SpaceAfterLogicalNot"), m_SpaceAfterLogicalNot, br, - new QLabel("SpaceAfterTemplateKeyword"), m_SpaceAfterTemplateKeyword, br, - new QLabel("SpaceAroundPointerQualifiers"), m_SpaceAroundPointerQualifiers, br, - new QLabel("SpaceBeforeAssignmentOperators"), m_SpaceBeforeAssignmentOperators, br, - new QLabel("SpaceBeforeCaseColon"), m_SpaceBeforeCaseColon, br, - new QLabel("SpaceBeforeCpp11BracedList"), m_SpaceBeforeCpp11BracedList, br, - new QLabel("SpaceBeforeCtorInitializerColon"), m_SpaceBeforeCtorInitializerColon, br, - new QLabel("SpaceBeforeInheritanceColon"), m_SpaceBeforeInheritanceColon, br, - new QLabel("SpaceBeforeJsonColon"), m_SpaceBeforeJsonColon, br, - new QLabel("SpaceBeforeParens"), m_SpaceBeforeParens, br, - new QLabel("SpaceBeforeParensOptions"), br, - new QLabel(" AfterControlStatements"), m_SpaceBeforeParensOptionsAfterControlStatements, br, - new QLabel(" AfterForeachMacros"), m_SpaceBeforeParensOptionsAfterForeachMacros, br, - new QLabel(" AfterFunctionDeclarationName"), m_SpaceBeforeParensOptionsAfterFunctionDeclarationName, br, - new QLabel(" AfterFunctionDefinitionName"), m_SpaceBeforeParensOptionsAfterFunctionDefinitionName, br, - new QLabel(" AfterIfMacros"), m_SpaceBeforeParensOptionsAfterIfMacros, br, - new QLabel(" AfterOverloadedOperator"), m_SpaceBeforeParensOptionsAfterOverloadedOperator, br, - new QLabel(" AfterRequiresInClause"), m_SpaceBeforeParensOptionsAfterRequiresInClause, br, - new QLabel(" AfterRequiresInExpression"), m_SpaceBeforeParensOptionsAfterRequiresInExpression, br, - new QLabel(" BeforeNonEmptyParentheses"), m_SpaceBeforeParensOptionsBeforeNonEmptyParentheses, br, - new QLabel("SpaceBeforeSquareBrackets"), m_SpaceBeforeSquareBrackets, br, - new QLabel("SpaceBeforeRangeBasedForLoopColon"), m_SpaceBeforeRangeBasedForLoopColon, br, - new QLabel("SpaceInEmptyBlock"), m_SpaceInEmptyBlock, br, - new QLabel("SpacesInAngles"), m_SpacesInAngles, br, - new QLabel("SpacesInLineCommentPrefix"), br, - new QLabel(" Minimum"), Row {m_SpacesInLineCommentPrefixMinimum, m_setSpacesInLineCommentPrefixMinimum}, br, - new QLabel(" Maximum"), Row {m_SpacesInLineCommentPrefixMaximum, m_setSpacesInLineCommentPrefixMaximum}, br, - new QLabel("SpacesInParensOptions"), br, - new QLabel(" InConditionalStatements"), m_SpacesInParensOptionsInConditionalStatements, br, - new QLabel(" InCStyleCasts"), m_SpacesInParensOptionsInCStyleCasts, br, - new QLabel(" InEmptyParentheses"), m_SpacesInParensOptionsInEmptyParentheses, br, - new QLabel(" Other"), m_SpacesInParensOptionsOther, br, - new QLabel("SpacesInSquareBrackets"), m_SpacesInSquareBrackets, br, - new QLabel("Standard"), m_Standard, br, - new QLabel("StatementAttributeLikeMacros"), Row {m_StatementAttributeLikeMacros, m_setStatementAttributeLikeMacros}, br, - new QLabel("StatementMacros"), Row {m_StatementMacros, m_setStatementMacros}, br, - new QLabel("TabWidth"), Row {m_TabWidth, m_setTabWidth}, br, - new QLabel("TypeNames"), Row {m_TypeNames, m_setTypeNames}, br, - new QLabel("TypenameMacros"), Row {m_TypenameMacros, m_setTypenameMacros}, br, - new QLabel("UseTab"), m_UseTab, br, - new QLabel("VerilogBreakBetweenInstancePorts"), m_VerilogBreakBetweenInstancePorts, br, - new QLabel("WhitespaceSensitiveMacros"), Row {m_WhitespaceSensitiveMacros, m_setWhitespaceSensitiveMacros}, br, - }.attachTo(this); -} diff --git a/src/plugins/clangformat/clangformatchecks.h b/src/plugins/clangformat/clangformatchecks.h deleted file mode 100644 index b0f8a8d862..0000000000 --- a/src/plugins/clangformat/clangformatchecks.h +++ /dev/null @@ -1,256 +0,0 @@ -// Copyright (C) 2023 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -// THIS FILE IS AUTOMATICALLY GENERATED by generateClangFormatChecksLayout. DO NOT EDIT! - -#pragma once - -#include <QWidget> - -QT_BEGIN_NAMESPACE -class QCheckBox; -class QComboBox; -class QLabel; -class QLineEdit; -class QPlainTextEdit; -class QPushButton; -class QWidget; -QT_END_NAMESPACE - -namespace ClangFormat { - -class ClangFormatChecks : public QWidget -{ - Q_OBJECT -public: - ClangFormatChecks(QWidget *parent = nullptr); - -private: - QComboBox *m_BasedOnStyle = nullptr; - QComboBox *m_InheritsParentConfig = nullptr; - QLineEdit *m_AccessModifierOffset = nullptr; - QPushButton *m_setAccessModifierOffset = nullptr; - QComboBox *m_AlignAfterOpenBracket = nullptr; - QComboBox *m_AlignArrayOfStructures = nullptr; - QComboBox *m_AlignConsecutiveMacrosEnabled = nullptr; - QComboBox *m_AlignConsecutiveMacrosAcrossEmptyLines = nullptr; - QComboBox *m_AlignConsecutiveMacrosAcrossComments = nullptr; - QComboBox *m_AlignConsecutiveMacrosAlignCompound = nullptr; - QComboBox *m_AlignConsecutiveMacrosPadOperators = nullptr; - QComboBox *m_AlignConsecutiveAssignmentsEnabled = nullptr; - QComboBox *m_AlignConsecutiveAssignmentsAcrossEmptyLines = nullptr; - QComboBox *m_AlignConsecutiveAssignmentsAcrossComments = nullptr; - QComboBox *m_AlignConsecutiveAssignmentsAlignCompound = nullptr; - QComboBox *m_AlignConsecutiveAssignmentsPadOperators = nullptr; - QComboBox *m_AlignConsecutiveBitFieldsEnabled = nullptr; - QComboBox *m_AlignConsecutiveBitFieldsAcrossEmptyLines = nullptr; - QComboBox *m_AlignConsecutiveBitFieldsAcrossComments = nullptr; - QComboBox *m_AlignConsecutiveBitFieldsAlignCompound = nullptr; - QComboBox *m_AlignConsecutiveBitFieldsPadOperators = nullptr; - QComboBox *m_AlignConsecutiveDeclarationsEnabled = nullptr; - QComboBox *m_AlignConsecutiveDeclarationsAcrossEmptyLines = nullptr; - QComboBox *m_AlignConsecutiveDeclarationsAcrossComments = nullptr; - QComboBox *m_AlignConsecutiveDeclarationsAlignCompound = nullptr; - QComboBox *m_AlignConsecutiveDeclarationsPadOperators = nullptr; - QComboBox *m_AlignConsecutiveShortCaseStatementsEnabled = nullptr; - QComboBox *m_AlignConsecutiveShortCaseStatementsAcrossEmptyLines = nullptr; - QComboBox *m_AlignConsecutiveShortCaseStatementsAcrossComments = nullptr; - QComboBox *m_AlignConsecutiveShortCaseStatementsAlignCaseColons = nullptr; - QComboBox *m_AlignEscapedNewlines = nullptr; - QComboBox *m_AlignOperands = nullptr; - QComboBox *m_AlignTrailingCommentsKind = nullptr; - QLineEdit *m_AlignTrailingCommentsOverEmptyLines = nullptr; - QPushButton *m_setAlignTrailingCommentsOverEmptyLines = nullptr; - QComboBox *m_AllowAllArgumentsOnNextLine = nullptr; - QComboBox *m_AllowShortBlocksOnASingleLine = nullptr; - QComboBox *m_AllowShortCaseLabelsOnASingleLine = nullptr; - QComboBox *m_AllowShortEnumsOnASingleLine = nullptr; - QComboBox *m_AllowShortFunctionsOnASingleLine = nullptr; - QComboBox *m_AllowShortIfStatementsOnASingleLine = nullptr; - QComboBox *m_AllowShortLambdasOnASingleLine = nullptr; - QComboBox *m_AllowShortLoopsOnASingleLine = nullptr; - QComboBox *m_AlwaysBreakAfterReturnType = nullptr; - QComboBox *m_AlwaysBreakBeforeMultilineStrings = nullptr; - QComboBox *m_AlwaysBreakTemplateDeclarations = nullptr; - QPlainTextEdit *m_AttributeMacros = nullptr; - QPushButton *m_setAttributeMacros = nullptr; - QComboBox *m_BinPackArguments = nullptr; - QComboBox *m_BinPackParameters = nullptr; - QComboBox *m_BitFieldColonSpacing = nullptr; - QComboBox *m_BraceWrappingAfterCaseLabel = nullptr; - QComboBox *m_BraceWrappingAfterClass = nullptr; - QComboBox *m_BraceWrappingAfterControlStatement = nullptr; - QComboBox *m_BraceWrappingAfterEnum = nullptr; - QComboBox *m_BraceWrappingAfterFunction = nullptr; - QComboBox *m_BraceWrappingAfterNamespace = nullptr; - QComboBox *m_BraceWrappingAfterObjCDeclaration = nullptr; - QComboBox *m_BraceWrappingAfterStruct = nullptr; - QComboBox *m_BraceWrappingAfterUnion = nullptr; - QComboBox *m_BraceWrappingAfterExternBlock = nullptr; - QComboBox *m_BraceWrappingBeforeCatch = nullptr; - QComboBox *m_BraceWrappingBeforeElse = nullptr; - QComboBox *m_BraceWrappingBeforeLambdaBody = nullptr; - QComboBox *m_BraceWrappingBeforeWhile = nullptr; - QComboBox *m_BraceWrappingIndentBraces = nullptr; - QComboBox *m_BraceWrappingSplitEmptyFunction = nullptr; - QComboBox *m_BraceWrappingSplitEmptyRecord = nullptr; - QComboBox *m_BraceWrappingSplitEmptyNamespace = nullptr; - QComboBox *m_BreakAfterAttributes = nullptr; - QComboBox *m_BreakArrays = nullptr; - QComboBox *m_BreakBeforeBinaryOperators = nullptr; - QComboBox *m_BreakBeforeBraces = nullptr; - QComboBox *m_BreakBeforeConceptDeclarations = nullptr; - QComboBox *m_BreakBeforeInlineASMColon = nullptr; - QComboBox *m_BreakBeforeTernaryOperators = nullptr; - QComboBox *m_BreakConstructorInitializers = nullptr; - QComboBox *m_BreakAfterJavaFieldAnnotations = nullptr; - QComboBox *m_BreakStringLiterals = nullptr; - QLineEdit *m_ColumnLimit = nullptr; - QPushButton *m_setColumnLimit = nullptr; - QLineEdit *m_CommentPragmas = nullptr; - QPushButton *m_setCommentPragmas = nullptr; - QComboBox *m_BreakInheritanceList = nullptr; - QComboBox *m_CompactNamespaces = nullptr; - QLineEdit *m_ContinuationIndentWidth = nullptr; - QPushButton *m_setContinuationIndentWidth = nullptr; - QComboBox *m_Cpp11BracedListStyle = nullptr; - QComboBox *m_DisableFormat = nullptr; - QComboBox *m_EmptyLineAfterAccessModifier = nullptr; - QComboBox *m_EmptyLineBeforeAccessModifier = nullptr; - QComboBox *m_ExperimentalAutoDetectBinPacking = nullptr; - QComboBox *m_FixNamespaceComments = nullptr; - QPlainTextEdit *m_ForEachMacros = nullptr; - QPushButton *m_setForEachMacros = nullptr; - QPlainTextEdit *m_IfMacros = nullptr; - QPushButton *m_setIfMacros = nullptr; - QComboBox *m_IndentAccessModifiers = nullptr; - QComboBox *m_IndentCaseBlocks = nullptr; - QComboBox *m_IndentCaseLabels = nullptr; - QComboBox *m_IndentGotoLabels = nullptr; - QComboBox *m_IndentExternBlock = nullptr; - QComboBox *m_IndentPPDirectives = nullptr; - QComboBox *m_IndentRequiresClause = nullptr; - QLineEdit *m_IndentWidth = nullptr; - QPushButton *m_setIndentWidth = nullptr; - QComboBox *m_IndentWrappedFunctionNames = nullptr; - QComboBox *m_InsertBraces = nullptr; - QComboBox *m_InsertNewlineAtEOF = nullptr; - QComboBox *m_InsertTrailingCommas = nullptr; - QPlainTextEdit *m_JavaImportGroups = nullptr; - QPushButton *m_setJavaImportGroups = nullptr; - QComboBox *m_JavaScriptQuotes = nullptr; - QComboBox *m_JavaScriptWrapImports = nullptr; - QComboBox *m_KeepEmptyLinesAtEOF = nullptr; - QComboBox *m_KeepEmptyLinesAtTheStartOfBlocks = nullptr; - QComboBox *m_LambdaBodyIndentation = nullptr; - QComboBox *m_Language = nullptr; - QComboBox *m_LineEnding = nullptr; - QLineEdit *m_MacroBlockBegin = nullptr; - QPushButton *m_setMacroBlockBegin = nullptr; - QLineEdit *m_MacroBlockEnd = nullptr; - QPushButton *m_setMacroBlockEnd = nullptr; - QPlainTextEdit *m_Macros = nullptr; - QPushButton *m_setMacros = nullptr; - QLineEdit *m_MaxEmptyLinesToKeep = nullptr; - QPushButton *m_setMaxEmptyLinesToKeep = nullptr; - QComboBox *m_NamespaceIndentation = nullptr; - QPlainTextEdit *m_NamespaceMacros = nullptr; - QPushButton *m_setNamespaceMacros = nullptr; - QComboBox *m_ObjCBinPackProtocolList = nullptr; - QLineEdit *m_ObjCBlockIndentWidth = nullptr; - QPushButton *m_setObjCBlockIndentWidth = nullptr; - QComboBox *m_ObjCBreakBeforeNestedBlockParam = nullptr; - QComboBox *m_ObjCSpaceAfterProperty = nullptr; - QComboBox *m_ObjCSpaceBeforeProtocolList = nullptr; - QComboBox *m_PackConstructorInitializers = nullptr; - QLineEdit *m_PenaltyBreakAssignment = nullptr; - QPushButton *m_setPenaltyBreakAssignment = nullptr; - QLineEdit *m_PenaltyBreakBeforeFirstCallParameter = nullptr; - QPushButton *m_setPenaltyBreakBeforeFirstCallParameter = nullptr; - QLineEdit *m_PenaltyBreakComment = nullptr; - QPushButton *m_setPenaltyBreakComment = nullptr; - QLineEdit *m_PenaltyBreakFirstLessLess = nullptr; - QPushButton *m_setPenaltyBreakFirstLessLess = nullptr; - QLineEdit *m_PenaltyBreakOpenParenthesis = nullptr; - QPushButton *m_setPenaltyBreakOpenParenthesis = nullptr; - QLineEdit *m_PenaltyBreakString = nullptr; - QPushButton *m_setPenaltyBreakString = nullptr; - QLineEdit *m_PenaltyBreakTemplateDeclaration = nullptr; - QPushButton *m_setPenaltyBreakTemplateDeclaration = nullptr; - QLineEdit *m_PenaltyExcessCharacter = nullptr; - QPushButton *m_setPenaltyExcessCharacter = nullptr; - QLineEdit *m_PenaltyIndentedWhitespace = nullptr; - QPushButton *m_setPenaltyIndentedWhitespace = nullptr; - QLineEdit *m_PenaltyReturnTypeOnItsOwnLine = nullptr; - QPushButton *m_setPenaltyReturnTypeOnItsOwnLine = nullptr; - QComboBox *m_PointerAlignment = nullptr; - QLineEdit *m_PPIndentWidth = nullptr; - QPushButton *m_setPPIndentWidth = nullptr; - QComboBox *m_QualifierAlignment = nullptr; - QPlainTextEdit *m_QualifierOrder = nullptr; - QPushButton *m_setQualifierOrder = nullptr; - QComboBox *m_ReferenceAlignment = nullptr; - QComboBox *m_ReflowComments = nullptr; - QComboBox *m_RemoveBracesLLVM = nullptr; - QComboBox *m_RemoveParentheses = nullptr; - QComboBox *m_RemoveSemicolon = nullptr; - QComboBox *m_RequiresClausePosition = nullptr; - QComboBox *m_RequiresExpressionIndentation = nullptr; - QComboBox *m_SeparateDefinitionBlocks = nullptr; - QLineEdit *m_ShortNamespaceLines = nullptr; - QPushButton *m_setShortNamespaceLines = nullptr; - QComboBox *m_SortIncludes = nullptr; - QComboBox *m_SortJavaStaticImport = nullptr; - QComboBox *m_SortUsingDeclarations = nullptr; - QComboBox *m_SpaceAfterCStyleCast = nullptr; - QComboBox *m_SpaceAfterLogicalNot = nullptr; - QComboBox *m_SpaceAfterTemplateKeyword = nullptr; - QComboBox *m_SpaceAroundPointerQualifiers = nullptr; - QComboBox *m_SpaceBeforeAssignmentOperators = nullptr; - QComboBox *m_SpaceBeforeCaseColon = nullptr; - QComboBox *m_SpaceBeforeCpp11BracedList = nullptr; - QComboBox *m_SpaceBeforeCtorInitializerColon = nullptr; - QComboBox *m_SpaceBeforeInheritanceColon = nullptr; - QComboBox *m_SpaceBeforeJsonColon = nullptr; - QComboBox *m_SpaceBeforeParens = nullptr; - QComboBox *m_SpaceBeforeParensOptionsAfterControlStatements = nullptr; - QComboBox *m_SpaceBeforeParensOptionsAfterForeachMacros = nullptr; - QComboBox *m_SpaceBeforeParensOptionsAfterFunctionDeclarationName = nullptr; - QComboBox *m_SpaceBeforeParensOptionsAfterFunctionDefinitionName = nullptr; - QComboBox *m_SpaceBeforeParensOptionsAfterIfMacros = nullptr; - QComboBox *m_SpaceBeforeParensOptionsAfterOverloadedOperator = nullptr; - QComboBox *m_SpaceBeforeParensOptionsAfterRequiresInClause = nullptr; - QComboBox *m_SpaceBeforeParensOptionsAfterRequiresInExpression = nullptr; - QComboBox *m_SpaceBeforeParensOptionsBeforeNonEmptyParentheses = nullptr; - QComboBox *m_SpaceBeforeSquareBrackets = nullptr; - QComboBox *m_SpaceBeforeRangeBasedForLoopColon = nullptr; - QComboBox *m_SpaceInEmptyBlock = nullptr; - QComboBox *m_SpacesInAngles = nullptr; - QLineEdit *m_SpacesInLineCommentPrefixMinimum = nullptr; - QPushButton *m_setSpacesInLineCommentPrefixMinimum = nullptr; - QLineEdit *m_SpacesInLineCommentPrefixMaximum = nullptr; - QPushButton *m_setSpacesInLineCommentPrefixMaximum = nullptr; - QComboBox *m_SpacesInParensOptionsInConditionalStatements = nullptr; - QComboBox *m_SpacesInParensOptionsInCStyleCasts = nullptr; - QComboBox *m_SpacesInParensOptionsInEmptyParentheses = nullptr; - QComboBox *m_SpacesInParensOptionsOther = nullptr; - QComboBox *m_SpacesInSquareBrackets = nullptr; - QComboBox *m_Standard = nullptr; - QPlainTextEdit *m_StatementAttributeLikeMacros = nullptr; - QPushButton *m_setStatementAttributeLikeMacros = nullptr; - QPlainTextEdit *m_StatementMacros = nullptr; - QPushButton *m_setStatementMacros = nullptr; - QLineEdit *m_TabWidth = nullptr; - QPushButton *m_setTabWidth = nullptr; - QPlainTextEdit *m_TypeNames = nullptr; - QPushButton *m_setTypeNames = nullptr; - QPlainTextEdit *m_TypenameMacros = nullptr; - QPushButton *m_setTypenameMacros = nullptr; - QComboBox *m_UseTab = nullptr; - QComboBox *m_VerilogBreakBetweenInstancePorts = nullptr; - QPlainTextEdit *m_WhitespaceSensitiveMacros = nullptr; - QPushButton *m_setWhitespaceSensitiveMacros = nullptr; - -}; - -} //ClangFormat diff --git a/src/plugins/clangformat/clangformatconfigwidget.cpp b/src/plugins/clangformat/clangformatconfigwidget.cpp index cba028342e..7f3a871919 100644 --- a/src/plugins/clangformat/clangformatconfigwidget.cpp +++ b/src/plugins/clangformat/clangformatconfigwidget.cpp @@ -3,15 +3,16 @@ #include "clangformatconfigwidget.h" -// the file below was generated by scripts/generateClangFormatChecksLayout.py -#include "clangformatchecks.h" #include "clangformatconstants.h" #include "clangformatfile.h" #include "clangformatindenter.h" #include "clangformattr.h" #include "clangformatutils.h" +#include <coreplugin/editormanager/ieditor.h> +#include <coreplugin/editormanager/ieditorfactory.h> #include <coreplugin/icore.h> +#include <coreplugin/idocument.h> #include <cppeditor/cppcodestylepreferences.h> #include <cppeditor/cppcodestylesettings.h> @@ -20,6 +21,8 @@ #include <cppeditor/cpphighlighter.h> #include <cppeditor/cpptoolssettings.h> +#include <extensionsystem/pluginmanager.h> + #include <projectexplorer/editorconfiguration.h> #include <projectexplorer/project.h> @@ -27,6 +30,7 @@ #include <texteditor/icodestylepreferences.h> #include <texteditor/snippets/snippeteditor.h> #include <texteditor/textdocument.h> +#include <texteditor/texteditor.h> #include <texteditor/texteditorsettings.h> #include <utils/guard.h> @@ -37,26 +41,43 @@ #include <QComboBox> #include <QLabel> #include <QLineEdit> +#include <QMessageBox> #include <QPushButton> #include <QScrollArea> +#include <QShortcut> #include <QVBoxLayout> #include <memory> -#include <sstream> using namespace ProjectExplorer; using namespace Utils; namespace ClangFormat { +static QObject *languageClientPlugin() +{ + return ExtensionSystem::PluginManager::getObjectByName("LanguageClient"); +} + class ClangFormatConfigWidget final : public TextEditor::CodeStyleEditorWidget { public: ClangFormatConfigWidget(TextEditor::ICodeStylePreferences *codeStyle, Project *project, QWidget *parent); + + ~ClangFormatConfigWidget() + { + auto doc = qobject_cast<TextEditor::TextDocument *>(m_editor->document()); + QMetaObject::invokeMethod(languageClientPlugin(), + "closeClientForDocument", + Q_ARG(TextEditor::TextDocument *, doc)); + QMetaObject::invokeMethod(languageClientPlugin(), + "closeDocument", + Q_ARG(Core::IDocument *, doc)); + } + void apply() final; - void finish() final; private: bool eventFilter(QObject *object, QEvent *event) final; @@ -64,28 +85,28 @@ private: FilePath globalPath(); FilePath projectPath(); void createStyleFileIfNeeded(bool isGlobal); - void showOrHideWidgets(); - void initChecksAndPreview(); - void connectChecks(); - void fillTable(); - std::string readFile(const QString &path); - void saveChanges(QObject *sender); + void initPreview(TextEditor::ICodeStylePreferences *codeStyle); + void initEditor(TextEditor::ICodeStylePreferences *codeStyle); + + void reopenClangFormatDocument(); void updatePreview(); void slotCodeStyleChanged(TextEditor::ICodeStylePreferences *currentPreferences); ProjectExplorer::Project *m_project = nullptr; - QWidget *m_checksWidget = nullptr; - QScrollArea *m_checksScrollArea = nullptr; + QWidget *m_editorWidget = nullptr; + QScrollArea *m_editorScrollArea = nullptr; TextEditor::SnippetEditorWidget *m_preview = nullptr; + Core::IEditor *m_editor = nullptr; + std::unique_ptr<ClangFormatFile> m_config; - clang::format::FormatStyle m_style; + Guard m_ignoreChanges; - QLabel *m_fallbackConfig; QLabel *m_clangVersion; - QLabel *m_clangWarningText; - QLabel *m_clangWarningIcon; + QLabel *m_clangFileIsCorrectText; + QLabel *m_clangFileIsCorrectIcon; + ClangFormatIndenter *m_indenter; }; bool ClangFormatConfigWidget::eventFilter(QObject *object, QEvent *event) @@ -105,75 +126,32 @@ ClangFormatConfigWidget::ClangFormatConfigWidget(TextEditor::ICodeStylePreferenc m_project = project; m_config = std::make_unique<ClangFormatFile>(codeStyle->currentPreferences()); - m_fallbackConfig = new QLabel(Tr::tr("Clang-Format Style")); - m_checksScrollArea = new QScrollArea(); - m_checksWidget = new ClangFormatChecks(); - - m_checksScrollArea->setWidget(m_checksWidget); - m_checksScrollArea->setWidgetResizable(true); - m_checksWidget->setEnabled(!codeStyle->isReadOnly() && !codeStyle->isTemporarilyReadOnly() - && codeStyle->isAdditionalTabVisible()); - - - static const int expectedMajorVersion = 17; - m_clangVersion = new QLabel(Tr::tr("Current ClangFormat version: %1.").arg(LLVM_VERSION_STRING), - this); - m_clangWarningText - = new QLabel(Tr::tr("The widget was generated for ClangFormat %1. " - "If you use a different version, the widget may work incorrectly.") - .arg(expectedMajorVersion), - this); - - QPalette palette = m_clangWarningText->palette(); - palette.setColor(QPalette::WindowText, Qt::red); - m_clangWarningText->setPalette(palette); - - m_clangWarningIcon = new QLabel(this); - m_clangWarningIcon->setPixmap(Icons::WARNING.icon().pixmap(16, 16)); - - if (LLVM_VERSION_MAJOR == expectedMajorVersion) { - m_clangWarningText->hide(); - m_clangWarningIcon->hide(); - } - - FilePath fileName; - if (m_project) - fileName = m_project->projectFilePath().pathAppended("snippet.cpp"); - else - fileName = Core::ICore::userResourcePath("snippet.cpp"); + createStyleFileIfNeeded(!m_project); - m_preview = new TextEditor::SnippetEditorWidget(this); - TextEditor::DisplaySettings displaySettings = m_preview->displaySettings(); - displaySettings.m_visualizeWhitespace = true; - m_preview->setDisplaySettings(displaySettings); - m_preview->setPlainText(QLatin1String(CppEditor::Constants::DEFAULT_CODE_STYLE_SNIPPETS[0])); - auto *indenter = new ClangFormatIndenter(m_preview->document()); - indenter->setOverriddenPreferences(codeStyle); - m_preview->textDocument()->setIndenter(indenter); - m_preview->textDocument()->setFontSettings(TextEditor::TextEditorSettings::fontSettings()); - m_preview->textDocument()->resetSyntaxHighlighter( - [] { return new CppEditor::CppHighlighter(); }); - m_preview->textDocument()->indenter()->setFileName(fileName); + initPreview(codeStyle); + initEditor(codeStyle); using namespace Layouting; Column { - m_fallbackConfig, - Row {m_clangWarningIcon, m_clangWarningText, st}, m_clangVersion, - Row { m_checksScrollArea, m_preview }, + Row { m_editorScrollArea, m_preview }, + Row {m_clangFileIsCorrectIcon, m_clangFileIsCorrectText, st} }.attachTo(this); connect(codeStyle, &TextEditor::ICodeStylePreferences::currentPreferencesChanged, this, &ClangFormatConfigWidget::slotCodeStyleChanged); + connect(codeStyle, &TextEditor::ICodeStylePreferences::aboutToBeRemoved, + this, &ClangFormatFile::removeClangFormatFileForStylePreferences); + + connect(codeStyle, &TextEditor::ICodeStylePreferences::aboutToBeCopied, + this, &ClangFormatFile::copyClangFormatFileBasedOnStylePreferences); + slotCodeStyleChanged(codeStyle->currentPreferences()); - showOrHideWidgets(); - fillTable(); + reopenClangFormatDocument(); updatePreview(); - - connectChecks(); } void ClangFormatConfigWidget::slotCodeStyleChanged( @@ -183,35 +161,112 @@ void ClangFormatConfigWidget::slotCodeStyleChanged( return; m_config.reset(new ClangFormatFile(codeStyle)); m_config->setIsReadOnly(codeStyle->isReadOnly()); - m_style = m_config->style(); - m_checksWidget->setEnabled(!codeStyle->isReadOnly() && !codeStyle->isTemporarilyReadOnly() + m_editorWidget->setEnabled(!codeStyle->isReadOnly() && !codeStyle->isTemporarilyReadOnly() && codeStyle->isAdditionalTabVisible()); - fillTable(); + reopenClangFormatDocument(); updatePreview(); } -void ClangFormatConfigWidget::connectChecks() +void ClangFormatConfigWidget::initEditor(TextEditor::ICodeStylePreferences *codeStyle) { - auto doSaveChanges = [this](QObject *sender) { - if (!m_ignoreChanges.isLocked()) - saveChanges(sender); - }; + m_editorScrollArea = new QScrollArea(); + Core::EditorFactories factories = Core::IEditorFactory::preferredEditorTypes( + m_config->filePath()); + Core::IEditorFactory *factory = factories.takeFirst(); + m_editor = factory->createEditor(); + + QString errorString; + m_editor->document()->open(&errorString, m_config->filePath(), m_config->filePath()); + m_editor->widget()->adjustSize(); + + QMetaObject::invokeMethod(languageClientPlugin(), + "openDocument", + Q_ARG(Core::IDocument *, m_editor->document())); + QMetaObject::invokeMethod(languageClientPlugin(), + "openEditor", + Q_ARG(Core::IEditor *, m_editor)); + + m_editorWidget = m_editor->widget(); + m_editorWidget->setEnabled(!codeStyle->isReadOnly() && !codeStyle->isTemporarilyReadOnly() + && codeStyle->isAdditionalTabVisible()); + + m_editorScrollArea->setWidget(m_editor->widget()); + m_editorScrollArea->setWidgetResizable(true); + + m_clangFileIsCorrectText = new QLabel(Tr::tr("Clang-Format is configured correctly.")); + QPalette paletteCorrect = m_clangFileIsCorrectText->palette(); + paletteCorrect.setColor(QPalette::WindowText, Qt::darkGreen); + m_clangFileIsCorrectText->setPalette(paletteCorrect); + + m_clangFileIsCorrectIcon = new QLabel(this); + m_clangFileIsCorrectIcon->setPixmap(Icons::OK.icon().pixmap(16, 16)); - for (QObject *child : m_checksWidget->children()) { - auto comboBox = qobject_cast<QComboBox *>(child); - if (comboBox != nullptr) { - connect(comboBox, &QComboBox::currentIndexChanged, - this, std::bind(doSaveChanges, comboBox)); - comboBox->installEventFilter(this); - continue; + m_clangVersion = new QLabel(Tr::tr("Current ClangFormat version: %1.").arg(LLVM_VERSION_STRING), + this); + + connect(m_editor->document(), &TextEditor::TextDocument::contentsChanged, this, [this] { + clang::format::FormatStyle currentSettingsStyle; + const bool success + = parseConfigurationContent(m_editor->document()->contents().toStdString(), + currentSettingsStyle); + + QString text = ""; + Qt::GlobalColor currentColor; + QPixmap pixmap; + if (success) { + text = Tr::tr("Clang-Format is configured correctly."); + currentColor = Qt::darkGreen; + pixmap = Icons::OK.icon().pixmap(16, 16); + } else { + text = Tr::tr("Clang-Format is not configured correctly."); + currentColor = Qt::red; + pixmap = Icons::WARNING.icon().pixmap(16, 16); } - const auto button = qobject_cast<QPushButton *>(child); - if (button != nullptr) - connect(button, &QPushButton::clicked, this, std::bind(doSaveChanges, button)); - } + m_clangFileIsCorrectText->setText(text); + QPalette paletteCorrect = m_clangFileIsCorrectText->palette(); + paletteCorrect.setColor(QPalette::WindowText, currentColor); + m_clangFileIsCorrectText->setPalette(paletteCorrect); + m_clangFileIsCorrectIcon->setPixmap(pixmap); + + if (!success) + return; + m_indenter->setOverriddenStyle(currentSettingsStyle); + updatePreview(); + }); + + QShortcut *completionSC = new QShortcut(QKeySequence("Ctrl+Space"), this); + connect(completionSC, &QShortcut::activated, this, [this] { + if (auto *editor = qobject_cast<TextEditor::BaseTextEditor *>(m_editor)) + editor->editorWidget()->invokeAssist(TextEditor::Completion); + }); + + QShortcut *saveSC = new QShortcut(QKeySequence("Ctrl+S"), this); + connect(saveSC, &QShortcut::activated, this, [this] { apply(); }); + + m_editorScrollArea->show(); +} + +void ClangFormatConfigWidget::initPreview(TextEditor::ICodeStylePreferences *codeStyle) +{ + FilePath fileName = m_project ? m_project->projectFilePath().pathAppended("snippet.cpp") + : Core::ICore::userResourcePath("snippet.cpp"); + + m_preview = new TextEditor::SnippetEditorWidget(this); + TextEditor::DisplaySettings displaySettings = m_preview->displaySettings(); + displaySettings.m_visualizeWhitespace = true; + m_preview->setDisplaySettings(displaySettings); + m_preview->setPlainText(QLatin1String(CppEditor::Constants::DEFAULT_CODE_STYLE_SNIPPETS[0])); + m_indenter = new ClangFormatIndenter(m_preview->document()); + m_indenter->setOverriddenPreferences(codeStyle); + m_preview->textDocument()->setIndenter(m_indenter); + m_preview->textDocument()->setFontSettings(TextEditor::TextEditorSettings::fontSettings()); + m_preview->textDocument()->resetSyntaxHighlighter( + [] { return new CppEditor::CppHighlighter(); }); + m_preview->textDocument()->indenter()->setFileName(fileName); + m_preview->show(); } static clang::format::FormatStyle constructStyle(const QByteArray &baseStyle = QByteArray()) @@ -257,7 +312,7 @@ void ClangFormatConfigWidget::createStyleFileIfNeeded(bool isGlobal) FilePath possibleProjectConfig = m_project->rootProjectDirectory() / Constants::SETTINGS_FILE_NAME; if (possibleProjectConfig.exists()) { - // Just copy th .clang-format if current project has one. + // Just copy the .clang-format if current project has one. possibleProjectConfig.copyFile(configFile); return; } @@ -267,21 +322,6 @@ void ClangFormatConfigWidget::createStyleFileIfNeeded(bool isGlobal) configFile.writeFileContents(QByteArray::fromStdString(config)); } -void ClangFormatConfigWidget::showOrHideWidgets() -{ - auto verticalLayout = qobject_cast<QVBoxLayout *>(layout()); - QTC_ASSERT(verticalLayout, return); - - QLayoutItem *lastItem = verticalLayout->itemAt(verticalLayout->count() - 1); - if (lastItem->spacerItem()) - verticalLayout->removeItem(lastItem); - - createStyleFileIfNeeded(!m_project); - m_fallbackConfig->show(); - m_checksScrollArea->show(); - m_preview->show(); -} - void ClangFormatConfigWidget::updatePreview() { QTextCursor cursor(m_preview->document()); @@ -290,208 +330,51 @@ void ClangFormatConfigWidget::updatePreview() m_preview->textDocument()->autoFormatOrIndent(cursor); } -std::string ClangFormatConfigWidget::readFile(const QString &path) -{ - const std::string defaultStyle = clang::format::configurationAsText(qtcStyle()); - - QFile file(path); - if (!file.open(QFile::ReadOnly)) - return defaultStyle; - - const std::string content = file.readAll().toStdString(); - file.close(); - - clang::format::FormatStyle style; - bool success = parseConfigurationFile(FilePath::fromString(path), style); - QTC_ASSERT(success, return defaultStyle); - - addQtcStatementMacros(style); - std::string settings = clang::format::configurationAsText(style); - - // Needed workaround because parseConfiguration remove BasedOnStyle field - // ToDo: standardize this behavior for future - const size_t index = content.find("BasedOnStyle"); - if (index != std::string::npos) { - const size_t size = content.find("\n", index) - index; - const size_t insert_index = settings.find("\n"); - settings.insert(insert_index, "\n" + content.substr(index, size)); - } - - return settings; -} - -static std::map<QString, QString> getMapFromString(const QString &text) -{ - std::map<QString, QString> objectNameMap; - - QString parentName; - for (QString line : text.split('\n')) { - if (line.isEmpty()) - continue; - - QStringList list = line.split(':'); - QString key = !list.isEmpty() ? list[0] : ""; - QString value = line.mid(key.size() + 1).trimmed(); - - if (line.contains(':') && value.isEmpty()) { - parentName = key; - continue; - } - - if (!value.isEmpty() && !line.startsWith(" ")) - parentName = ""; - - if (line.startsWith(" - ") || line.startsWith(" ")) { - line.remove(0, 2); - if (objectNameMap.find(parentName) == objectNameMap.end()) - objectNameMap[parentName] = line + "\n"; - else - objectNameMap[parentName] += line + "\n"; - continue; - } - - if (line.startsWith(" ")) { - key.remove(0, 2); - key = parentName + key; - objectNameMap.insert(std::make_pair(key, value)); - continue; - } - - objectNameMap.insert(std::make_pair(key, value)); - } - - return objectNameMap; -} - -void ClangFormatConfigWidget::fillTable() +void ClangFormatConfigWidget::reopenClangFormatDocument() { GuardLocker locker(m_ignoreChanges); - const QString configText = QString::fromStdString(readFile(m_config->filePath().path())); - std::map<QString, QString> objectNameMap = getMapFromString(configText); - - for (QObject *child : m_checksWidget->children()) { - if (!qobject_cast<QComboBox *>(child) && !qobject_cast<QLineEdit *>(child) - && !qobject_cast<QPlainTextEdit *>(child)) { - continue; - } - - if (objectNameMap.find(child->objectName()) == objectNameMap.end()) - continue; - - if (QPlainTextEdit *plainText = qobject_cast<QPlainTextEdit *>(child)) { - plainText->setPlainText(objectNameMap[child->objectName()]); - continue; - } - - if (QComboBox *comboBox = qobject_cast<QComboBox *>(child)) { - if (comboBox->findText(objectNameMap[child->objectName()]) == -1) { - comboBox->setCurrentIndex(0); - } else { - comboBox->setCurrentText(objectNameMap[child->objectName()]); - } - continue; - } - - if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(child)) { - lineEdit->setText(objectNameMap[child->objectName()]); - continue; - } - } -} - -void ClangFormatConfigWidget::saveChanges(QObject *sender) -{ - if (sender->objectName() == "BasedOnStyle") { - const auto *basedOnStyle = m_checksWidget->findChild<QComboBox *>("BasedOnStyle"); - m_config->setBasedOnStyle(basedOnStyle->currentText()); - } else { - QList<ClangFormatFile::Field> fields; - QString parentName; - - for (QObject *child : m_checksWidget->children()) { - if (child->objectName() == "BasedOnStyle") - continue; - auto *label = qobject_cast<QLabel *>(child); - if (!label) - continue; - - // reset parent name if label starts without " " - if (!label->text().startsWith(" ")) - parentName = ""; - - QList<QWidget *> valueWidgets = m_checksWidget->findChildren<QWidget *>( - parentName + label->text().trimmed()); - - if (valueWidgets.empty()) { - // Currently BraceWrapping only. - fields.append({label->text(), ""}); - // save parent name - parentName = label->text().trimmed(); - continue; - } - - QWidget *valueWidget = valueWidgets.first(); - if (valueWidgets.size() > 1) { - for (QWidget *w : valueWidgets) { - if (w->objectName() == parentName + label->text().trimmed()) { - valueWidget = w; - break; - } - } - } - - if (!qobject_cast<QComboBox *>(valueWidget) && !qobject_cast<QLineEdit *>(valueWidget) - && !qobject_cast<QPlainTextEdit *>(valueWidget)) { - continue; - } - - auto *plainText = qobject_cast<QPlainTextEdit *>(valueWidget); - if (plainText) { - if (plainText->toPlainText().trimmed().isEmpty()) - continue; - - std::stringstream content; - QStringList list = plainText->toPlainText().split('\n'); - for (const QString &line : list) - content << "\n " << line.toStdString(); - - fields.append({label->text(), QString::fromStdString(content.str())}); - } else { - QString text; - if (auto *comboBox = qobject_cast<QComboBox *>(valueWidget)) { - text = comboBox->currentText(); - } else { - auto *lineEdit = qobject_cast<QLineEdit *>(valueWidget); - QTC_ASSERT(lineEdit, continue;); - text = lineEdit->text(); - } - - if (!text.isEmpty() && text != "Default") - fields.append({label->text(), text}); - } - } - m_config->changeFields(fields); + QString errorString; + if (m_editor->document()->open(&errorString, m_config->filePath(), m_config->filePath()) + == Core::IDocument::OpenResult::Success) { + QMetaObject::invokeMethod(languageClientPlugin(), + "openDocument", + Q_ARG(Core::IDocument *, m_editor->document())); } - - fillTable(); - updatePreview(); } void ClangFormatConfigWidget::apply() { - if (!m_checksWidget->isVisible() && !m_checksWidget->isEnabled()) + if (!m_editorWidget->isEnabled()) return; - m_style = m_config->style(); -} + clang::format::FormatStyle currentSettingsStyle; + const bool success = parseConfigurationContent(m_editor->document()->contents().toStdString(), + currentSettingsStyle); -void ClangFormatConfigWidget::finish() -{ - if (!m_checksWidget->isVisible() && !m_checksWidget->isEnabled()) + auto saveSettings = [this] { + QString errorString; + m_editor->document()->save(&errorString, m_config->filePath()); + }; + + if (success) { + saveSettings(); return; + } - m_config->setStyle(m_style); + QMessageBox mBox; + mBox.setText(Tr::tr("The current settings are not valid. Are you sure you want to apply them?")); + mBox.setStandardButtons(QMessageBox::No | QMessageBox::Yes); + mBox.setDefaultButton(QMessageBox::No); + int ret = mBox.exec(); + switch (ret) { + case QMessageBox::Yes: + saveSettings(); + break; + case QMessageBox::No: + default: + break; + } } TextEditor::CodeStyleEditorWidget *createClangFormatConfigWidget( diff --git a/src/plugins/clangformat/clangformatfile.cpp b/src/plugins/clangformat/clangformatfile.cpp index 700d18f711..b984c78662 100644 --- a/src/plugins/clangformat/clangformatfile.cpp +++ b/src/plugins/clangformat/clangformatfile.cpp @@ -2,7 +2,6 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "clangformatfile.h" -#include "clangformatsettings.h" #include "clangformatutils.h" #include <cppeditor/cppcodestylepreferences.h> @@ -15,30 +14,27 @@ #include <utils/qtcassert.h> -#include <sstream> - using namespace ClangFormat; ClangFormatFile::ClangFormatFile(const TextEditor::ICodeStylePreferences *preferences) : m_filePath(filePathToCurrentSettings(preferences)) { - if (!m_filePath.exists()) { - // create file and folder - m_filePath.parentDir().createDir(); - std::fstream newStyleFile(m_filePath.path().toStdString(), std::fstream::out); - if (newStyleFile.is_open()) { - newStyleFile.close(); - } - resetStyleToQtC(preferences); + if (m_filePath.exists()) return; - } - if (!parseConfigurationFile(m_filePath, m_style)) - resetStyleToQtC(preferences); -} + // create file and folder + m_filePath.parentDir().createDir(); + std::fstream newStyleFile(m_filePath.path().toStdString(), std::fstream::out); + if (newStyleFile.is_open()) + newStyleFile.close(); + + if (preferences->displayName() == "GNU") { // For build-in GNU style + m_style = clang::format::getGNUStyle(); + saveStyleToFile(m_style, m_filePath); + return; + } -clang::format::FormatStyle ClangFormatFile::style() { - return m_style; + resetStyleToQtC(preferences); } Utils::FilePath ClangFormatFile::filePath() @@ -46,12 +42,6 @@ Utils::FilePath ClangFormatFile::filePath() return m_filePath; } -void ClangFormatFile::setStyle(clang::format::FormatStyle style) -{ - m_style = style; - saveNewFormat(); -} - bool ClangFormatFile::isReadOnly() const { return m_isReadOnly; @@ -68,56 +58,6 @@ void ClangFormatFile::resetStyleToQtC(const TextEditor::ICodeStylePreferences *p saveStyleToFile(m_style, m_filePath); } -void ClangFormatFile::setBasedOnStyle(QString styleName) -{ - changeField({"BasedOnStyle", styleName}); - saveNewFormat(); -} - -QString ClangFormatFile::setStyle(QString style) -{ - const std::error_code error = clang::format::parseConfiguration(style.toStdString(), &m_style); - if (error.value() != static_cast<int>(clang::format::ParseError::Success)) { - return QString::fromStdString(error.message()); - } - - saveNewFormat(style.toUtf8()); - return ""; -} - -QString ClangFormatFile::changeField(Field field) -{ - return changeFields({field}); -} - -QString ClangFormatFile::changeFields(QList<Field> fields) -{ - std::stringstream content; - content << "---" << "\n"; - - for (const auto &field : fields) { - content << field.first.toStdString() << ": " << field.second.toStdString() << "\n"; - } - - return setStyle(QString::fromStdString(content.str())); -} - -void ClangFormatFile::saveNewFormat() -{ - if (m_isReadOnly) - return; - - saveStyleToFile(m_style, m_filePath); -} - -void ClangFormatFile::saveNewFormat(QByteArray style) -{ - if (m_isReadOnly) - return; - - m_filePath.writeFileContents(style); -} - void ClangFormatFile::saveStyleToFile(clang::format::FormatStyle style, Utils::FilePath filePath) { std::string styleStr = clang::format::configurationAsText(style); @@ -127,5 +67,27 @@ void ClangFormatFile::saveStyleToFile(clang::format::FormatStyle style, Utils::F if (pos != int(std::string::npos)) styleStr.erase(pos, 2); styleStr.append("\n"); + styleStr + .insert(0, + "# yaml-language-server: $schema=https://json.schemastore.org/clang-format.json\n"); filePath.writeFileContents(QByteArray::fromStdString(styleStr)); } + +void ClangFormatFile::removeClangFormatFileForStylePreferences( + const TextEditor::ICodeStylePreferences *preferences) +{ + filePathToCurrentSettings(preferences).parentDir().removeRecursively(); +} + +void ClangFormatFile::copyClangFormatFileBasedOnStylePreferences( + const TextEditor::ICodeStylePreferences *current, + const TextEditor::ICodeStylePreferences *target) +{ + Utils::FilePath currentFP = filePathToCurrentSettings(current); + if (!currentFP.exists()) + return; + + Utils::FilePath targetFP = filePathToCurrentSettings(target); + targetFP.parentDir().createDir(); + currentFP.copyFile(targetFP); +} diff --git a/src/plugins/clangformat/clangformatfile.h b/src/plugins/clangformat/clangformatfile.h index 547f1f6ab2..6725e266b2 100644 --- a/src/plugins/clangformat/clangformatfile.h +++ b/src/plugins/clangformat/clangformatfile.h @@ -24,20 +24,17 @@ public: Utils::FilePath filePath(); void resetStyleToQtC(const TextEditor::ICodeStylePreferences *codeStyle); - void setBasedOnStyle(QString styleName); - void setStyle(clang::format::FormatStyle style); - QString setStyle(QString style); - void clearBasedOnStyle(); - - using Field = std::pair<QString, QString>; - QString changeFields(QList<Field> fields); - QString changeField(Field field); + bool isReadOnly() const; void setIsReadOnly(bool isReadOnly); + static void removeClangFormatFileForStylePreferences( + const TextEditor::ICodeStylePreferences *preferences); + static void copyClangFormatFileBasedOnStylePreferences( + const TextEditor::ICodeStylePreferences *current, + const TextEditor::ICodeStylePreferences *target); + private: - void saveNewFormat(); - void saveNewFormat(QByteArray style); void saveStyleToFile(clang::format::FormatStyle style, Utils::FilePath filePath); private: diff --git a/src/plugins/clangformat/clangformatutils.cpp b/src/plugins/clangformat/clangformatutils.cpp index 5022325c5d..b1e8090ece 100644 --- a/src/plugins/clangformat/clangformatutils.cpp +++ b/src/plugins/clangformat/clangformatutils.cpp @@ -417,13 +417,18 @@ Utils::FilePath filePathToCurrentSettings(const TextEditor::ICodeStylePreference / QLatin1String(Constants::SETTINGS_FILE_NAME); } -bool parseConfigurationFile(const Utils::FilePath &filePath, clang::format::FormatStyle &style) +bool parseConfigurationContent(const std::string &fileContent, clang::format::FormatStyle &style) { style.Language = clang::format::FormatStyle::LK_Cpp; - const std::error_code error - = parseConfiguration(filePath.fileContents().value_or(QByteArray()).toStdString(), &style); + const std::error_code error = parseConfiguration(fileContent, &style); return error.value() == static_cast<int>(ParseError::Success); } +bool parseConfigurationFile(const Utils::FilePath &filePath, clang::format::FormatStyle &style) +{ + return parseConfigurationContent(filePath.fileContents().value_or(QByteArray()).toStdString(), + style); +} + } // namespace ClangFormat diff --git a/src/plugins/clangformat/clangformatutils.h b/src/plugins/clangformat/clangformatutils.h index 931385dc7c..a4ff429b3e 100644 --- a/src/plugins/clangformat/clangformatutils.h +++ b/src/plugins/clangformat/clangformatutils.h @@ -48,6 +48,7 @@ clang::format::FormatStyle currentQtStyle(const TextEditor::ICodeStylePreference Utils::FilePath filePathToCurrentSettings(const TextEditor::ICodeStylePreferences *codeStyle); +bool parseConfigurationContent(const std::string &fileContent, clang::format::FormatStyle &style); bool parseConfigurationFile(const Utils::FilePath &filePath, clang::format::FormatStyle &style); } // ClangFormat diff --git a/src/plugins/languageclient/languageclientmanager.cpp b/src/plugins/languageclient/languageclientmanager.cpp index 7ad251da46..78e4c884f7 100644 --- a/src/plugins/languageclient/languageclientmanager.cpp +++ b/src/plugins/languageclient/languageclientmanager.cpp @@ -537,6 +537,21 @@ void LanguageClientManager::editorOpened(Core::IEditor *editor) } } +void LanguageClientManager::openEditor(Core::IEditor *editor) +{ + instance()->editorOpened(editor); +} + +void LanguageClientManager::openDocument(Core::IDocument *document) +{ + instance()->documentOpened(document); +} + +void LanguageClientManager::closeDocument(Core::IDocument *document) +{ + instance()->documentClosed(document); +} + static QList<BaseSettings *> sortedSettingsForDocument(Core::IDocument *document) { const QList<BaseSettings *> prefilteredSettings diff --git a/src/plugins/languageclient/languageclientmanager.h b/src/plugins/languageclient/languageclientmanager.h index 039fb6324e..9bbe39741b 100644 --- a/src/plugins/languageclient/languageclientmanager.h +++ b/src/plugins/languageclient/languageclientmanager.h @@ -76,6 +76,9 @@ public: const LanguageServerProtocol::JsonRpcMessage &message); static void showInspector(); + static void openDocument(Core::IDocument *document); + static void closeDocument(Core::IDocument *document); + static void openEditor(Core::IEditor *editor); signals: void clientAdded(Client *client); diff --git a/src/plugins/languageclient/languageclientplugin.cpp b/src/plugins/languageclient/languageclientplugin.cpp index 90cc408fe0..7e26b0f63c 100644 --- a/src/plugins/languageclient/languageclientplugin.cpp +++ b/src/plugins/languageclient/languageclientplugin.cpp @@ -12,6 +12,7 @@ #include <coreplugin/actionmanager/actionmanager.h> #include <extensionsystem/iplugin.h> +#include <extensionsystem/pluginmanager.h> #include <QAction> #include <QMenu> @@ -26,6 +27,7 @@ class LanguageClientPlugin final : public ExtensionSystem::IPlugin public: LanguageClientPlugin() { + setObjectName("LanguageClient"); qRegisterMetaType<LanguageServerProtocol::JsonRpcMessage>(); } @@ -34,6 +36,24 @@ private: void extensionsInitialized() final; ShutdownFlag aboutToShutdown() final; + Q_SLOT void openDocument(Core::IDocument *document) + { + LanguageClientManager::openDocument(document); + } + + Q_SLOT void closeDocument(Core::IDocument *document) + { + LanguageClientManager::closeDocument(document); + } + + Q_SLOT void openEditor(Core::IEditor *editor) { LanguageClientManager::openEditor(editor); } + + Q_SLOT void closeClientForDocument(TextEditor::TextDocument *document) + { + if (auto client = LanguageClientManager::clientForDocument(document)) + client->closeDocument(document); + } + LanguageClientOutlineWidgetFactory m_outlineFactory; }; @@ -57,6 +77,8 @@ void LanguageClientPlugin::initialize() inspectAction.setText(Tr::tr("Inspect Language Clients...")); inspectAction.addToContainer(Core::Constants::M_TOOLS_DEBUG); inspectAction.addOnTriggered(this, &LanguageClientManager::showInspector); + + ExtensionSystem::PluginManager::addObject(this); } void LanguageClientPlugin::extensionsInitialized() @@ -66,6 +88,7 @@ void LanguageClientPlugin::extensionsInitialized() ExtensionSystem::IPlugin::ShutdownFlag LanguageClientPlugin::aboutToShutdown() { + ExtensionSystem::PluginManager::removeObject(this); LanguageClientManager::shutdown(); if (LanguageClientManager::isShutdownFinished()) return ExtensionSystem::IPlugin::SynchronousShutdown; diff --git a/src/plugins/texteditor/codestyleselectorwidget.cpp b/src/plugins/texteditor/codestyleselectorwidget.cpp index a219be271a..ddeea0a74e 100644 --- a/src/plugins/texteditor/codestyleselectorwidget.cpp +++ b/src/plugins/texteditor/codestyleselectorwidget.cpp @@ -165,6 +165,7 @@ void CodeStyleSelectorWidget::slotCopyClicked() ICodeStylePreferences *copy = codeStylePool->cloneCodeStyle(currentPreferences); if (copy) { copy->setDisplayName(newName); + emit m_codeStyle->aboutToBeCopied(currentPreferences, copy); m_codeStyle->setCurrentDelegate(copy); } } diff --git a/src/plugins/texteditor/icodestylepreferences.cpp b/src/plugins/texteditor/icodestylepreferences.cpp index d7547d430e..82a478e697 100644 --- a/src/plugins/texteditor/icodestylepreferences.cpp +++ b/src/plugins/texteditor/icodestylepreferences.cpp @@ -241,6 +241,8 @@ void ICodeStylePreferences::fromMap(const Store &map) void ICodeStylePreferences::codeStyleRemoved(ICodeStylePreferences *preferences) { if (currentDelegate() == preferences) { + emit aboutToBeRemoved(preferences); + CodeStylePool *pool = delegatingPool(); QList<ICodeStylePreferences *> codeStyles = pool->codeStyles(); const int idx = codeStyles.indexOf(preferences); diff --git a/src/plugins/texteditor/icodestylepreferences.h b/src/plugins/texteditor/icodestylepreferences.h index 7239411b5c..451ac669cc 100644 --- a/src/plugins/texteditor/icodestylepreferences.h +++ b/src/plugins/texteditor/icodestylepreferences.h @@ -80,6 +80,9 @@ signals: void currentDelegateChanged(TextEditor::ICodeStylePreferences *currentDelegate); void currentPreferencesChanged(TextEditor::ICodeStylePreferences *currentPreferences); void displayNameChanged(const QString &newName); + void aboutToBeRemoved(TextEditor::ICodeStylePreferences *preferences); + void aboutToBeCopied(TextEditor::ICodeStylePreferences *current, + TextEditor::ICodeStylePreferences *target); private: void codeStyleRemoved(ICodeStylePreferences *preferences); diff --git a/src/plugins/texteditor/textdocument.cpp b/src/plugins/texteditor/textdocument.cpp index 025720a9d3..5ea17e1097 100644 --- a/src/plugins/texteditor/textdocument.cpp +++ b/src/plugins/texteditor/textdocument.cpp @@ -292,6 +292,8 @@ TextDocument *TextDocument::currentTextDocument() TextDocument *TextDocument::textDocumentForFilePath(const Utils::FilePath &filePath) { + if (filePath.isEmpty()) + return nullptr; return qobject_cast<TextDocument *>(DocumentModel::documentForFilePath(filePath)); } |