ClangFormat: Synchronize ClangFormat settings with CppEditor codestyle

Added synchronization between ClangFormat codestyle settings and
CppEditors codestyle settings. All changes which will be done in
ClangFormat settings tab settings tabs will be automatically
retranslated to CppEditor codestyle settings tabs and vice versa.

Change-Id: I408d726c12552856e3c1b72d3ba09b77fff83321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Artem Sokolovskii
2021-11-01 16:20:08 +01:00
parent 85b5a887e8
commit a997161dd6
11 changed files with 262 additions and 32 deletions

View File

@@ -28,6 +28,10 @@
#include "utils/filepath.h"
#include <clang/Format/Format.h>
namespace CppEditor { class CppCodeStyleSettings; }
namespace ProjectExplorer { class Project; }
namespace TextEditor { class TabSettings; }
namespace ClangFormat {
class ClangFormatFile
@@ -46,6 +50,10 @@ public:
using Field = std::pair<QString, QString>;
QString changeFields(QList<Field> fields);
QString changeField(Field field);
CppEditor::CppCodeStyleSettings toCppCodeStyleSettings(ProjectExplorer::Project *project) const;
TextEditor::TabSettings toTabSettings(ProjectExplorer::Project *project) const;
void fromCppCodeStyleSettings(const CppEditor::CppCodeStyleSettings &settings);
void fromTabSettings(const TextEditor::TabSettings &settings);
private:
void saveNewFormat();
@@ -56,5 +64,4 @@ private:
clang::format::FormatStyle m_style;
};
} // namespace ClangFormat