ClangFormat: Add the logical settings management

Now there are changeable and unchangeable settings,
as it works for usual codestyle settings.
They save parallel with codestyle settings but in another dir.
In general, the behavior became similar to usual codestyle settings.

ToDo: Make indenter use this settings instead standard one and
instead project settings when "override" checkbox is checked.

Change-Id: I639dbda296932bf9b967a11f1cc4fda120415ed9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Artem Sokolovskii
2022-04-04 14:53:05 +02:00
parent ca7a18568c
commit 7574ec3e21
10 changed files with 67 additions and 29 deletions

View File

@@ -37,11 +37,11 @@ namespace ClangFormat {
class ClangFormatFile
{
public:
explicit ClangFormatFile(Utils::FilePath file);
explicit ClangFormatFile(Utils::FilePath file, bool isReadOnly);
clang::format::FormatStyle format();
Utils::FilePath filePath();
void resetStyleToLLVM();
void resetStyleToQtC();
void setBasedOnStyle(QString styleName);
void setStyle(clang::format::FormatStyle style);
QString setStyle(QString style);
@@ -54,6 +54,7 @@ public:
TextEditor::TabSettings toTabSettings(ProjectExplorer::Project *project) const;
void fromCppCodeStyleSettings(const CppEditor::CppCodeStyleSettings &settings);
void fromTabSettings(const TextEditor::TabSettings &settings);
bool isReadOnly() const;
private:
void saveNewFormat();
@@ -62,6 +63,7 @@ private:
private:
Utils::FilePath m_filePath;
clang::format::FormatStyle m_style;
const bool m_isReadOnly;
};
} // namespace ClangFormat