ClangFormat: Rename override checkbox

It improves the UX design of CodeStyle page.

Change-Id: I4458896d6787df462de18025d292bdb481d03c89
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Artem Sokolovskii
2024-01-02 14:54:11 +01:00
parent 2c8f15ba6c
commit f2cb979aa3
10 changed files with 100 additions and 61 deletions

View File

@@ -772,7 +772,7 @@ void ClangFormatBaseIndenter::autoIndent(const QTextCursor &cursor,
} }
} }
clang::format::FormatStyle ClangFormatBaseIndenter::overrideStyle( clang::format::FormatStyle ClangFormatBaseIndenter::customSettingsStyle(
const Utils::FilePath &fileName) const const Utils::FilePath &fileName) const
{ {
const ProjectExplorer::Project *projectForFile const ProjectExplorer::Project *projectForFile
@@ -820,8 +820,8 @@ const clang::format::FormatStyle &ClangFormatBaseIndenter::styleForFile() const
if (m_cachedStyle.expirationTime > time && !(m_cachedStyle.style == clang::format::getNoStyle())) if (m_cachedStyle.expirationTime > time && !(m_cachedStyle.style == clang::format::getNoStyle()))
return m_cachedStyle.style; return m_cachedStyle.style;
if (getCurrentOverriddenSettings(m_fileName)) { if (getCurrentCustomSettings(m_fileName)) {
clang::format::FormatStyle style = overrideStyle(m_fileName); clang::format::FormatStyle style = customSettingsStyle(m_fileName);
m_cachedStyle.setCache(style, cacheTimeout); m_cachedStyle.setCache(style, cacheTimeout);
return m_cachedStyle.style; return m_cachedStyle.style;
} }

View File

@@ -87,7 +87,7 @@ private:
mutable CachedStyle m_cachedStyle; mutable CachedStyle m_cachedStyle;
clang::format::FormatStyle overrideStyle(const Utils::FilePath &fileName) const; clang::format::FormatStyle customSettingsStyle(const Utils::FilePath &fileName) const;
TextEditor::ICodeStylePreferences *m_overriddenPreferences = nullptr; TextEditor::ICodeStylePreferences *m_overriddenPreferences = nullptr;
}; };

View File

@@ -9,7 +9,7 @@ static const char SETTINGS_FILE_NAME[] = ".clang-format";
static const char SETTINGS_FILE_ALT_NAME[] = "_clang-format"; static const char SETTINGS_FILE_ALT_NAME[] = "_clang-format";
static const char SAMPLE_FILE_NAME[] = "test.cpp"; static const char SAMPLE_FILE_NAME[] = "test.cpp";
static const char SETTINGS_ID[] = "ClangFormat"; static const char SETTINGS_ID[] = "ClangFormat";
static const char OVERRIDE_FILE_ID[] = "ClangFormat.OverrideFile"; static const char USE_CUSTOM_SETTINGS_ID[] = "ClangFormat.OverrideFile";
static const char FORMAT_CODE_ON_SAVE_ID[] = "ClangFormat.FormatCodeOnSave"; static const char FORMAT_CODE_ON_SAVE_ID[] = "ClangFormat.FormatCodeOnSave";
static const char FORMAT_WHILE_TYPING_ID[] = "ClangFormat.FormatWhileTyping"; static const char FORMAT_WHILE_TYPING_ID[] = "ClangFormat.FormatWhileTyping";
static const char MODE_ID[] = "ClangFormat.Mode"; static const char MODE_ID[] = "ClangFormat.Mode";

View File

@@ -9,6 +9,7 @@
#include "clangformatutils.h" #include "clangformatutils.h"
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projecttree.h>
#include <texteditor/icodestylepreferences.h> #include <texteditor/icodestylepreferences.h>
#include <utils/layoutbuilder.h> #include <utils/layoutbuilder.h>
@@ -19,8 +20,6 @@
#include <QSpinBox> #include <QSpinBox>
#include <QWidget> #include <QWidget>
#include <sstream>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
@@ -43,10 +42,16 @@ ClangFormatGlobalConfigWidget::ClangFormatGlobalConfigWidget(
m_indentingOrFormatting = new QComboBox(this); m_indentingOrFormatting = new QComboBox(this);
m_formatWhileTyping = new QCheckBox(Tr::tr("Format while typing")); m_formatWhileTyping = new QCheckBox(Tr::tr("Format while typing"));
m_formatOnSave = new QCheckBox(Tr::tr("Format edited code on file save")); m_formatOnSave = new QCheckBox(Tr::tr("Format edited code on file save"));
m_overrideDefault = new QCheckBox(Tr::tr("Override .clang-format file")); m_useCustomSettingsCheckBox = new QCheckBox(Tr::tr("Use custom settings"));
m_useGlobalSettings = new QCheckBox(Tr::tr("Use global settings")); m_useGlobalSettings = new QCheckBox(Tr::tr("Use global settings"));
m_useGlobalSettings->hide(); m_useGlobalSettings->hide();
m_overrideDefaultFile = ClangFormatSettings::instance().overrideDefaultFile(); m_useCustomSettings = ClangFormatSettings::instance().useCustomSettings();
m_currentProjectLabel = new QLabel(
Tr::tr("Please note that the current project includes a .clang-format file, which will be "
"used for code indenting and formatting."));
m_currentProjectLabel->setStyleSheet("QLabel { color : red; }");
m_currentProjectLabel->setWordWrap(true);
using namespace Layouting; using namespace Layouting;
@@ -64,7 +69,8 @@ ClangFormatGlobalConfigWidget::ClangFormatGlobalConfigWidget(
m_formatWhileTyping, m_formatWhileTyping,
m_formatOnSave, m_formatOnSave,
m_projectHasClangFormat, m_projectHasClangFormat,
m_overrideDefault m_useCustomSettingsCheckBox,
m_currentProjectLabel
} }
}; };
@@ -75,9 +81,10 @@ ClangFormatGlobalConfigWidget::ClangFormatGlobalConfigWidget(
initCheckBoxes(); initCheckBoxes();
initIndentationOrFormattingCombobox(); initIndentationOrFormattingCombobox();
initOverrideCheckBox(); initCustomSettingsCheckBox();
initUseGlobalSettingsCheckBox(); initUseGlobalSettingsCheckBox();
initFileSizeThresholdSpinBox(); initFileSizeThresholdSpinBox();
initCurrentProjectLabel();
if (project) { if (project) {
m_formatOnSave->hide(); m_formatOnSave->hide();
@@ -139,7 +146,7 @@ void ClangFormatGlobalConfigWidget::initUseGlobalSettingsCheckBox()
isDisabled isDisabled
|| (m_indentingOrFormatting->currentIndex() || (m_indentingOrFormatting->currentIndex()
== static_cast<int>(ClangFormatSettings::Mode::Disable))); == static_cast<int>(ClangFormatSettings::Mode::Disable)));
m_overrideDefault->setDisabled(isDisabled m_useCustomSettingsCheckBox->setDisabled(isDisabled
|| (m_indentingOrFormatting->currentIndex() || (m_indentingOrFormatting->currentIndex()
== static_cast<int>(ClangFormatSettings::Mode::Disable))); == static_cast<int>(ClangFormatSettings::Mode::Disable)));
}; };
@@ -173,6 +180,30 @@ void ClangFormatGlobalConfigWidget::initFileSizeThresholdSpinBox()
}); });
} }
void ClangFormatGlobalConfigWidget::initCurrentProjectLabel()
{
auto setCurrentProjectLabelVisible = [this]() {
ProjectExplorer::Project *currentProject
= m_project ? m_project : ProjectExplorer::ProjectTree::currentProject();
if (currentProject) {
Utils::FilePath settingsFilePath = currentProject->projectDirectory()
/ Constants::SETTINGS_FILE_NAME;
Utils::FilePath settingsAltFilePath = currentProject->projectDirectory()
/ Constants::SETTINGS_FILE_ALT_NAME;
if ((settingsFilePath.exists() || settingsAltFilePath.exists())
&& m_useCustomSettingsCheckBox->checkState() == Qt::CheckState::Unchecked) {
m_currentProjectLabel->show();
return;
}
}
m_currentProjectLabel->hide();
};
setCurrentProjectLabelVisible();
connect(m_useCustomSettingsCheckBox, &QCheckBox::toggled, this, setCurrentProjectLabelVisible);
}
bool ClangFormatGlobalConfigWidget::projectClangFormatFileExists() bool ClangFormatGlobalConfigWidget::projectClangFormatFileExists()
{ {
llvm::Expected<clang::format::FormatStyle> styleFromProjectFolder llvm::Expected<clang::format::FormatStyle> styleFromProjectFolder
@@ -181,7 +212,7 @@ bool ClangFormatGlobalConfigWidget::projectClangFormatFileExists()
return styleFromProjectFolder && !(*styleFromProjectFolder == clang::format::getNoStyle()); return styleFromProjectFolder && !(*styleFromProjectFolder == clang::format::getNoStyle());
} }
void ClangFormatGlobalConfigWidget::initOverrideCheckBox() void ClangFormatGlobalConfigWidget::initCustomSettingsCheckBox()
{ {
if (!m_project || !projectClangFormatFileExists()) { if (!m_project || !projectClangFormatFileExists()) {
m_projectHasClangFormat->hide(); m_projectHasClangFormat->hide();
@@ -195,24 +226,24 @@ void ClangFormatGlobalConfigWidget::initOverrideCheckBox()
if (m_ignoreChanges.isLocked()) if (m_ignoreChanges.isLocked())
return; return;
Utils::GuardLocker locker(m_ignoreChanges); Utils::GuardLocker locker(m_ignoreChanges);
m_codeStyle->currentPreferences()->setTemporarilyReadOnly(!m_overrideDefault->isChecked()); m_codeStyle->currentPreferences()->setTemporarilyReadOnly(!m_useCustomSettingsCheckBox->isChecked());
m_codeStyle->currentPreferences()->setIsAdditionalTabDisabled(!m_overrideDefault->isEnabled()); m_codeStyle->currentPreferences()->setIsAdditionalTabDisabled(!m_useCustomSettingsCheckBox->isEnabled());
ClangFormatSettings::instance().write(); ClangFormatSettings::instance().write();
emit m_codeStyle->currentPreferencesChanged(m_codeStyle->currentPreferences()); emit m_codeStyle->currentPreferencesChanged(m_codeStyle->currentPreferences());
}; };
auto setEnableOverrideCheckBox = [this, setTemporarilyReadOnly](int index) { auto setEnableCustomSettingsCheckBox = [this, setTemporarilyReadOnly](int index) {
bool isDisable = index == static_cast<int>(ClangFormatSettings::Mode::Disable); bool isDisable = index == static_cast<int>(ClangFormatSettings::Mode::Disable);
m_overrideDefault->setDisabled(isDisable); m_useCustomSettingsCheckBox->setDisabled(isDisable);
m_projectHasClangFormat->setDisabled(isDisable); m_projectHasClangFormat->setDisabled(isDisable);
setTemporarilyReadOnly(); setTemporarilyReadOnly();
}; };
setEnableOverrideCheckBox(m_indentingOrFormatting->currentIndex()); setEnableCustomSettingsCheckBox(m_indentingOrFormatting->currentIndex());
connect(m_indentingOrFormatting, &QComboBox::currentIndexChanged, connect(m_indentingOrFormatting, &QComboBox::currentIndexChanged,
this, setEnableOverrideCheckBox); this, setEnableCustomSettingsCheckBox);
m_overrideDefault->setToolTip("<html>" m_useCustomSettingsCheckBox->setToolTip("<html>"
+ Tr::tr("When this option is enabled, ClangFormat will use a " + Tr::tr("When this option is enabled, ClangFormat will use a "
"user-specified configuration from the widget below, " "user-specified configuration from the widget below, "
"instead of the project .clang-format file. You can " "instead of the project .clang-format file. You can "
@@ -222,14 +253,17 @@ void ClangFormatGlobalConfigWidget::initOverrideCheckBox()
"configuration, and will not modify the project " "configuration, and will not modify the project "
".clang-format file.")); ".clang-format file."));
m_overrideDefault->setChecked(getProjectOverriddenSettings(m_project)); m_useCustomSettingsCheckBox->setChecked(getProjectCustomSettings(m_project));
setTemporarilyReadOnly(); setTemporarilyReadOnly();
connect(m_overrideDefault, &QCheckBox::toggled, this, [this, setTemporarilyReadOnly](bool checked) { connect(m_useCustomSettingsCheckBox,
&QCheckBox::toggled,
this,
[this, setTemporarilyReadOnly](bool checked) {
if (m_project) { if (m_project) {
m_project->setNamedSettings(Constants::OVERRIDE_FILE_ID, checked); m_project->setNamedSettings(Constants::USE_CUSTOM_SETTINGS_ID, checked);
} else { } else {
ClangFormatSettings::instance().setOverrideDefaultFile(checked); ClangFormatSettings::instance().setUseCustomSettings(checked);
setTemporarilyReadOnly(); setTemporarilyReadOnly();
} }
}); });
@@ -249,18 +283,18 @@ void ClangFormatGlobalConfigWidget::apply()
if (!m_project) { if (!m_project) {
settings.setMode( settings.setMode(
static_cast<ClangFormatSettings::Mode>(m_indentingOrFormatting->currentIndex())); static_cast<ClangFormatSettings::Mode>(m_indentingOrFormatting->currentIndex()));
settings.setOverrideDefaultFile(m_overrideDefault->isChecked()); settings.setUseCustomSettings(m_useCustomSettingsCheckBox->isChecked());
settings.setFileSizeThreshold(m_fileSizeThresholdSpinBox->value()); settings.setFileSizeThreshold(m_fileSizeThresholdSpinBox->value());
m_overrideDefaultFile = m_overrideDefault->isChecked(); m_useCustomSettings = m_useCustomSettingsCheckBox->isChecked();
} }
settings.write(); settings.write();
} }
void ClangFormatGlobalConfigWidget::finish() void ClangFormatGlobalConfigWidget::finish()
{ {
ClangFormatSettings::instance().setOverrideDefaultFile(m_overrideDefaultFile); ClangFormatSettings::instance().setUseCustomSettings(m_useCustomSettings);
m_codeStyle->currentPreferences()->setTemporarilyReadOnly( m_codeStyle->currentPreferences()->setTemporarilyReadOnly(
!ClangFormatSettings::instance().overrideDefaultFile()); !ClangFormatSettings::instance().useCustomSettings());
} }
} // namespace ClangFormat } // namespace ClangFormat

View File

@@ -7,8 +7,6 @@
#include <utils/guard.h> #include <utils/guard.h>
#include <memory>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QCheckBox; class QCheckBox;
class QComboBox; class QComboBox;
@@ -36,16 +34,17 @@ public:
private: private:
void initCheckBoxes(); void initCheckBoxes();
void initIndentationOrFormattingCombobox(); void initIndentationOrFormattingCombobox();
void initOverrideCheckBox(); void initCustomSettingsCheckBox();
void initUseGlobalSettingsCheckBox(); void initUseGlobalSettingsCheckBox();
void initFileSizeThresholdSpinBox(); void initFileSizeThresholdSpinBox();
void initCurrentProjectLabel();
bool projectClangFormatFileExists(); bool projectClangFormatFileExists();
ProjectExplorer::Project *m_project; ProjectExplorer::Project *m_project;
TextEditor::ICodeStylePreferences *m_codeStyle; TextEditor::ICodeStylePreferences *m_codeStyle;
Utils::Guard m_ignoreChanges; Utils::Guard m_ignoreChanges;
bool m_overrideDefaultFile; bool m_useCustomSettings;
QLabel *m_projectHasClangFormat; QLabel *m_projectHasClangFormat;
QLabel *m_formattingModeLabel; QLabel *m_formattingModeLabel;
@@ -54,8 +53,9 @@ private:
QComboBox *m_indentingOrFormatting; QComboBox *m_indentingOrFormatting;
QCheckBox *m_formatWhileTyping; QCheckBox *m_formatWhileTyping;
QCheckBox *m_formatOnSave; QCheckBox *m_formatOnSave;
QCheckBox *m_overrideDefault; QCheckBox *m_useCustomSettingsCheckBox;
QCheckBox *m_useGlobalSettings; QCheckBox *m_useGlobalSettings;
QLabel *m_currentProjectLabel;
}; };
} // namespace ClangFormat } // namespace ClangFormat

View File

@@ -22,7 +22,8 @@ ClangFormatSettings::ClangFormatSettings()
{ {
QtcSettings *settings = Core::ICore::settings(); QtcSettings *settings = Core::ICore::settings();
settings->beginGroup(Constants::SETTINGS_ID); settings->beginGroup(Constants::SETTINGS_ID);
m_overrideDefaultFile = settings->value(Constants::OVERRIDE_FILE_ID, false).toBool(); m_useCustomSettings
= settings->value(Constants::USE_CUSTOM_SETTINGS_ID, false).toBool();
m_formatWhileTyping = settings->value(Constants::FORMAT_WHILE_TYPING_ID, false).toBool(); m_formatWhileTyping = settings->value(Constants::FORMAT_WHILE_TYPING_ID, false).toBool();
m_formatOnSave = settings->value(Constants::FORMAT_CODE_ON_SAVE_ID, false).toBool(); m_formatOnSave = settings->value(Constants::FORMAT_CODE_ON_SAVE_ID, false).toBool();
m_fileSizeThreshold = settings->value(Constants::FILE_SIZE_THREDSHOLD, m_fileSizeThreshold = settings->value(Constants::FILE_SIZE_THREDSHOLD,
@@ -47,7 +48,7 @@ void ClangFormatSettings::write() const
{ {
QtcSettings *settings = Core::ICore::settings(); QtcSettings *settings = Core::ICore::settings();
settings->beginGroup(Constants::SETTINGS_ID); settings->beginGroup(Constants::SETTINGS_ID);
settings->setValue(Constants::OVERRIDE_FILE_ID, m_overrideDefaultFile); settings->setValue(Constants::USE_CUSTOM_SETTINGS_ID, m_useCustomSettings);
settings->setValue(Constants::FORMAT_WHILE_TYPING_ID, m_formatWhileTyping); settings->setValue(Constants::FORMAT_WHILE_TYPING_ID, m_formatWhileTyping);
settings->setValue(Constants::FORMAT_CODE_ON_SAVE_ID, m_formatOnSave); settings->setValue(Constants::FORMAT_CODE_ON_SAVE_ID, m_formatOnSave);
settings->setValue(Constants::MODE_ID, static_cast<int>(m_mode)); settings->setValue(Constants::MODE_ID, static_cast<int>(m_mode));
@@ -55,14 +56,14 @@ void ClangFormatSettings::write() const
settings->endGroup(); settings->endGroup();
} }
void ClangFormatSettings::setOverrideDefaultFile(bool enable) void ClangFormatSettings::setUseCustomSettings(bool enable)
{ {
m_overrideDefaultFile = enable; m_useCustomSettings = enable;
} }
bool ClangFormatSettings::overrideDefaultFile() const bool ClangFormatSettings::useCustomSettings() const
{ {
return m_overrideDefaultFile; return m_useCustomSettings;
} }
void ClangFormatSettings::setFormatWhileTyping(bool enable) void ClangFormatSettings::setFormatWhileTyping(bool enable)

View File

@@ -15,8 +15,8 @@ public:
ClangFormatSettings(); ClangFormatSettings();
void write() const; void write() const;
void setOverrideDefaultFile(bool enable); void setUseCustomSettings(bool enable);
bool overrideDefaultFile() const; bool useCustomSettings() const;
enum Mode { enum Mode {
Indenting = 0, Indenting = 0,
@@ -38,7 +38,7 @@ public:
private: private:
Mode m_mode; Mode m_mode;
bool m_overrideDefaultFile = false; bool m_useCustomSettings = false;
bool m_formatWhileTyping = false; bool m_formatWhileTyping = false;
bool m_formatOnSave = false; bool m_formatOnSave = false;
int m_fileSizeThreshold = 200; int m_fileSizeThreshold = 200;

View File

@@ -287,24 +287,25 @@ bool getProjectUseGlobalSettings(const ProjectExplorer::Project *project)
return projectUseGlobalSettings.isValid() ? projectUseGlobalSettings.toBool() : true; return projectUseGlobalSettings.isValid() ? projectUseGlobalSettings.toBool() : true;
} }
bool getProjectOverriddenSettings(const ProjectExplorer::Project *project) bool getProjectCustomSettings(const ProjectExplorer::Project *project)
{ {
const QVariant projectOverride = project ? project->namedSettings(Constants::OVERRIDE_FILE_ID) const QVariant projectCustomSettings = project ? project->namedSettings(
Constants::USE_CUSTOM_SETTINGS_ID)
: QVariant(); : QVariant();
return projectOverride.isValid() return projectCustomSettings.isValid()
? projectOverride.toBool() ? projectCustomSettings.toBool()
: ClangFormatSettings::instance().overrideDefaultFile(); : ClangFormatSettings::instance().useCustomSettings();
} }
bool getCurrentOverriddenSettings(const Utils::FilePath &filePath) bool getCurrentCustomSettings(const Utils::FilePath &filePath)
{ {
const ProjectExplorer::Project *project = ProjectExplorer::ProjectManager::projectForFile( const ProjectExplorer::Project *project = ProjectExplorer::ProjectManager::projectForFile(
filePath); filePath);
return getProjectUseGlobalSettings(project) return getProjectUseGlobalSettings(project)
? ClangFormatSettings::instance().overrideDefaultFile() ? ClangFormatSettings::instance().useCustomSettings()
: getProjectOverriddenSettings(project); : getProjectCustomSettings(project);
} }
ClangFormatSettings::Mode getProjectIndentationOrFormattingSettings( ClangFormatSettings::Mode getProjectIndentationOrFormattingSettings(
@@ -348,7 +349,7 @@ Utils::FilePath findConfig(const Utils::FilePath &fileName)
Utils::FilePath configForFile(const Utils::FilePath &fileName) Utils::FilePath configForFile(const Utils::FilePath &fileName)
{ {
if (!getCurrentOverriddenSettings(fileName)) if (!getCurrentCustomSettings(fileName))
return findConfig(fileName); return findConfig(fileName);
const ProjectExplorer::Project *projectForFile const ProjectExplorer::Project *projectForFile

View File

@@ -26,8 +26,8 @@ QString projectUniqueId(ProjectExplorer::Project *project);
bool getProjectUseGlobalSettings(const ProjectExplorer::Project *project); bool getProjectUseGlobalSettings(const ProjectExplorer::Project *project);
bool getProjectOverriddenSettings(const ProjectExplorer::Project *project); bool getProjectCustomSettings(const ProjectExplorer::Project *project);
bool getCurrentOverriddenSettings(const Utils::FilePath &filePath); bool getCurrentCustomSettings(const Utils::FilePath &filePath);
ClangFormatSettings::Mode getProjectIndentationOrFormattingSettings( ClangFormatSettings::Mode getProjectIndentationOrFormattingSettings(
const ProjectExplorer::Project *project); const ProjectExplorer::Project *project);
@@ -40,7 +40,7 @@ void fromTabSettings(clang::format::FormatStyle &style, const TextEditor::TabSet
void fromCppCodeStyleSettings(clang::format::FormatStyle &style, void fromCppCodeStyleSettings(clang::format::FormatStyle &style,
const CppEditor::CppCodeStyleSettings &settings); const CppEditor::CppCodeStyleSettings &settings);
bool getProjectOverriddenSettings(const ProjectExplorer::Project *project); bool getProjectCustomSettings(const ProjectExplorer::Project *project);
void addQtcStatementMacros(clang::format::FormatStyle &style); void addQtcStatementMacros(clang::format::FormatStyle &style);
clang::format::FormatStyle qtcStyle(); clang::format::FormatStyle qtcStyle();

View File

@@ -50,7 +50,7 @@ CodeStyleSelectorWidget::CodeStyleSelectorWidget(ICodeStylePreferencesFactory *f
Column { Column {
Grid { Grid {
Tr::tr("Current settings:"), Tr::tr("Custom settings:"),
m_delegateComboBox, m_delegateComboBox,
copyButton, copyButton,
m_removeButton, m_removeButton,
@@ -286,6 +286,9 @@ QString CodeStyleSelectorWidget::displayName(ICodeStylePreferences *codeStyle) c
name = Tr::tr("%1 [proxy: %2]").arg(name).arg(codeStyle->currentDelegate()->displayName()); name = Tr::tr("%1 [proxy: %2]").arg(name).arg(codeStyle->currentDelegate()->displayName());
if (codeStyle->isReadOnly()) if (codeStyle->isReadOnly())
name = Tr::tr("%1 [built-in]").arg(name); name = Tr::tr("%1 [built-in]").arg(name);
else
name = Tr::tr("%1 [customizable]").arg(name);
return name; return name;
} }