2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2018 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2018-08-29 15:58:13 +02:00
|
|
|
|
|
|
|
|
#include "clangformatconfigwidget.h"
|
2018-10-11 14:11:43 +02:00
|
|
|
|
2018-11-13 09:29:09 +01:00
|
|
|
#include "clangformatconstants.h"
|
2019-02-22 09:48:46 +01:00
|
|
|
#include "clangformatindenter.h"
|
2021-09-28 10:26:34 +02:00
|
|
|
#include "clangformatfile.h"
|
2019-01-28 07:54:05 +01:00
|
|
|
#include "clangformatsettings.h"
|
2018-10-11 14:11:43 +02:00
|
|
|
#include "clangformatutils.h"
|
2022-07-28 11:30:41 +02:00
|
|
|
|
|
|
|
|
// the file was generated by scripts/generateClangFormatChecksUI.py
|
2019-04-24 14:44:31 +02:00
|
|
|
#include "ui_clangformatchecks.h"
|
2022-07-28 11:30:41 +02:00
|
|
|
|
2018-08-29 15:58:13 +02:00
|
|
|
#include <clang/Format/Format.h>
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/icore.h>
|
2022-07-22 09:44:47 +02:00
|
|
|
|
2019-02-22 09:48:46 +01:00
|
|
|
#include <cppeditor/cpphighlighter.h>
|
2021-11-01 16:20:08 +01:00
|
|
|
#include <cppeditor/cppcodestylesettings.h>
|
2021-08-30 10:58:08 +02:00
|
|
|
#include <cppeditor/cppcodestylesnippets.h>
|
2022-08-01 17:28:42 +02:00
|
|
|
#include <cppeditor/cpptoolssettings.h>
|
|
|
|
|
#include <cppeditor/cppcodestylepreferences.h>
|
2022-07-22 09:44:47 +02:00
|
|
|
|
2018-08-29 15:58:13 +02:00
|
|
|
#include <projectexplorer/project.h>
|
2022-08-01 17:28:42 +02:00
|
|
|
#include <projectexplorer/editorconfiguration.h>
|
2022-07-22 09:44:47 +02:00
|
|
|
|
2019-02-22 09:48:46 +01:00
|
|
|
#include <texteditor/displaysettings.h>
|
2022-04-04 14:53:05 +02:00
|
|
|
#include <texteditor/icodestylepreferences.h>
|
2019-02-22 09:48:46 +01:00
|
|
|
#include <texteditor/snippets/snippeteditor.h>
|
|
|
|
|
#include <texteditor/textdocument.h>
|
|
|
|
|
#include <texteditor/texteditorsettings.h>
|
2022-07-22 09:44:47 +02:00
|
|
|
|
|
|
|
|
#include <utils/layoutbuilder.h>
|
2019-04-24 14:44:31 +02:00
|
|
|
#include <utils/qtcassert.h>
|
2018-08-29 15:58:13 +02:00
|
|
|
|
2022-07-22 09:44:47 +02:00
|
|
|
#include <QCheckBox>
|
|
|
|
|
#include <QComboBox>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QWidget>
|
2018-08-29 15:58:13 +02:00
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
|
|
using namespace ProjectExplorer;
|
2022-07-22 09:44:47 +02:00
|
|
|
using namespace Utils;
|
2018-08-29 15:58:13 +02:00
|
|
|
|
|
|
|
|
namespace ClangFormat {
|
|
|
|
|
|
2019-04-24 14:44:31 +02:00
|
|
|
bool ClangFormatConfigWidget::eventFilter(QObject *object, QEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (event->type() == QEvent::Wheel && qobject_cast<QComboBox *>(object)) {
|
|
|
|
|
event->ignore();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return QWidget::eventFilter(object, event);
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-04 14:53:05 +02:00
|
|
|
ClangFormatConfigWidget::ClangFormatConfigWidget(TextEditor::ICodeStylePreferences *codeStyle,
|
|
|
|
|
ProjectExplorer::Project *project,
|
|
|
|
|
QWidget *parent)
|
2021-11-01 16:20:08 +01:00
|
|
|
: CppCodeStyleWidget(parent)
|
2018-08-29 15:58:13 +02:00
|
|
|
, m_project(project)
|
2019-04-24 14:44:31 +02:00
|
|
|
, m_checks(std::make_unique<Ui::ClangFormatChecksWidget>())
|
2018-08-29 15:58:13 +02:00
|
|
|
{
|
2022-08-01 17:28:42 +02:00
|
|
|
m_config = std::make_unique<ClangFormatFile>(filePathToCurrentSettings(codeStyle->currentPreferences()));
|
2022-07-22 09:44:47 +02:00
|
|
|
|
2022-08-01 17:28:42 +02:00
|
|
|
resize(489, 305);
|
2022-07-22 09:44:47 +02:00
|
|
|
m_fallbackConfig = new QLabel(tr("Clang-Format Style"));
|
2019-04-25 10:40:08 +02:00
|
|
|
m_checksScrollArea = new QScrollArea();
|
|
|
|
|
m_checksWidget = new QWidget;
|
2022-07-22 09:44:47 +02:00
|
|
|
|
2019-04-25 10:40:08 +02:00
|
|
|
m_checks->setupUi(m_checksWidget);
|
|
|
|
|
m_checksScrollArea->setWidget(m_checksWidget);
|
2022-08-01 17:28:42 +02:00
|
|
|
m_checksScrollArea->setMaximumWidth(600);
|
2022-07-22 09:44:47 +02:00
|
|
|
m_checksWidget->setEnabled(!codeStyle->isReadOnly());
|
2019-04-25 10:40:08 +02:00
|
|
|
|
2022-07-22 09:44:47 +02:00
|
|
|
FilePath fileName;
|
|
|
|
|
if (m_project)
|
|
|
|
|
fileName = m_project->projectFilePath().pathAppended("snippet.cpp");
|
|
|
|
|
else
|
|
|
|
|
fileName = Core::ICore::userResourcePath("snippet.cpp");
|
2019-04-25 10:40:08 +02:00
|
|
|
|
|
|
|
|
m_preview = new TextEditor::SnippetEditorWidget(this);
|
2019-04-26 10:49:48 +02:00
|
|
|
TextEditor::DisplaySettings displaySettings = m_preview->displaySettings();
|
|
|
|
|
displaySettings.m_visualizeWhitespace = true;
|
|
|
|
|
m_preview->setDisplaySettings(displaySettings);
|
2021-08-30 10:58:08 +02:00
|
|
|
m_preview->setPlainText(QLatin1String(CppEditor::Constants::DEFAULT_CODE_STYLE_SNIPPETS[0]));
|
2019-04-26 10:49:48 +02:00
|
|
|
m_preview->textDocument()->setIndenter(new ClangFormatIndenter(m_preview->document()));
|
|
|
|
|
m_preview->textDocument()->setFontSettings(TextEditor::TextEditorSettings::fontSettings());
|
|
|
|
|
m_preview->textDocument()->setSyntaxHighlighter(new CppEditor::CppHighlighter);
|
2022-07-22 09:44:47 +02:00
|
|
|
m_preview->textDocument()->indenter()->setFileName(fileName);
|
2019-04-26 10:49:48 +02:00
|
|
|
|
2022-07-22 09:44:47 +02:00
|
|
|
using namespace Layouting;
|
2022-02-16 15:28:16 +01:00
|
|
|
|
2022-07-22 09:44:47 +02:00
|
|
|
Column {
|
|
|
|
|
m_fallbackConfig,
|
2022-08-01 17:28:42 +02:00
|
|
|
Row { m_checksScrollArea, m_preview }
|
2022-07-22 09:44:47 +02:00
|
|
|
}.attachTo(this);
|
|
|
|
|
|
2022-08-01 17:28:42 +02:00
|
|
|
connect(codeStyle, &TextEditor::ICodeStylePreferences::currentPreferencesChanged,
|
|
|
|
|
this, &ClangFormatConfigWidget::slotCodeStyleChanged);
|
|
|
|
|
|
|
|
|
|
slotCodeStyleChanged(codeStyle->currentPreferences());
|
|
|
|
|
|
2022-07-22 09:44:47 +02:00
|
|
|
showOrHideWidgets();
|
|
|
|
|
fillTable();
|
|
|
|
|
updatePreview();
|
|
|
|
|
|
|
|
|
|
connectChecks();
|
2019-04-25 10:40:08 +02:00
|
|
|
}
|
|
|
|
|
|
2022-07-22 09:44:47 +02:00
|
|
|
ClangFormatConfigWidget::~ClangFormatConfigWidget() = default;
|
|
|
|
|
|
2022-08-01 17:28:42 +02:00
|
|
|
void ClangFormatConfigWidget::slotCodeStyleChanged(
|
|
|
|
|
TextEditor::ICodeStylePreferences *codeStyle)
|
|
|
|
|
{
|
|
|
|
|
if (!codeStyle)
|
|
|
|
|
return;
|
|
|
|
|
m_config.reset(new ClangFormatFile(filePathToCurrentSettings(codeStyle)));
|
|
|
|
|
m_config->setIsReadOnly(codeStyle->isReadOnly());
|
|
|
|
|
m_style = m_config->style();
|
|
|
|
|
|
|
|
|
|
m_checksWidget->setEnabled(!codeStyle->isReadOnly());
|
|
|
|
|
|
|
|
|
|
fillTable();
|
|
|
|
|
updatePreview();
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-25 10:40:08 +02:00
|
|
|
void ClangFormatConfigWidget::connectChecks()
|
|
|
|
|
{
|
2022-08-15 10:09:46 +02:00
|
|
|
auto doSaveChanges = [this](QObject *sender) {
|
|
|
|
|
if (!m_ignoreChanges.isLocked())
|
|
|
|
|
saveChanges(sender);
|
|
|
|
|
};
|
|
|
|
|
|
2019-04-25 10:40:08 +02:00
|
|
|
for (QObject *child : m_checksWidget->children()) {
|
|
|
|
|
auto comboBox = qobject_cast<QComboBox *>(child);
|
|
|
|
|
if (comboBox != nullptr) {
|
2022-07-19 23:29:42 +02:00
|
|
|
connect(comboBox, &QComboBox::currentIndexChanged,
|
2022-08-15 10:09:46 +02:00
|
|
|
this, std::bind(doSaveChanges, comboBox));
|
2019-04-25 10:40:08 +02:00
|
|
|
comboBox->installEventFilter(this);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-28 10:26:34 +02:00
|
|
|
const auto button = qobject_cast<QPushButton *>(child);
|
2019-04-25 10:40:08 +02:00
|
|
|
if (button != nullptr)
|
2022-08-15 10:09:46 +02:00
|
|
|
connect(button, &QPushButton::clicked, this, std::bind(doSaveChanges, button));
|
2019-04-25 10:40:08 +02:00
|
|
|
}
|
2018-10-11 14:11:43 +02:00
|
|
|
}
|
|
|
|
|
|
2019-04-26 10:49:48 +02:00
|
|
|
void ClangFormatConfigWidget::showOrHideWidgets()
|
2018-10-11 14:11:43 +02:00
|
|
|
{
|
2022-07-22 09:44:47 +02:00
|
|
|
auto verticalLayout = qobject_cast<QVBoxLayout *>(layout());
|
|
|
|
|
QTC_ASSERT(verticalLayout, return);
|
2018-10-11 14:11:43 +02:00
|
|
|
|
2022-07-22 09:44:47 +02:00
|
|
|
QLayoutItem *lastItem = verticalLayout->itemAt(verticalLayout->count() - 1);
|
2018-12-05 09:07:10 +01:00
|
|
|
if (lastItem->spacerItem())
|
2022-07-22 09:44:47 +02:00
|
|
|
verticalLayout->removeItem(lastItem);
|
2018-11-20 11:23:30 +01:00
|
|
|
|
2019-04-26 10:49:48 +02:00
|
|
|
createStyleFileIfNeeded(!m_project);
|
2022-07-22 09:44:47 +02:00
|
|
|
m_fallbackConfig->show();
|
2019-04-25 10:40:08 +02:00
|
|
|
m_checksScrollArea->show();
|
2019-03-05 13:12:44 +01:00
|
|
|
m_preview->show();
|
2019-02-22 09:48:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ClangFormatConfigWidget::updatePreview()
|
|
|
|
|
{
|
|
|
|
|
QTextCursor cursor(m_preview->document());
|
|
|
|
|
cursor.setPosition(0);
|
|
|
|
|
cursor.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
|
2019-11-18 10:38:35 +01:00
|
|
|
m_preview->textDocument()->autoIndent(cursor);
|
2018-10-11 14:11:43 +02:00
|
|
|
}
|
|
|
|
|
|
2019-04-24 14:44:31 +02:00
|
|
|
static inline void ltrim(std::string &s)
|
|
|
|
|
{
|
|
|
|
|
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int ch) { return !std::isspace(ch); }));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void rtrim(std::string &s)
|
|
|
|
|
{
|
|
|
|
|
s.erase(std::find_if(s.rbegin(), s.rend(), [](int ch) { return !std::isspace(ch); }).base(),
|
|
|
|
|
s.end());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void trim(std::string &s)
|
|
|
|
|
{
|
|
|
|
|
ltrim(s);
|
|
|
|
|
rtrim(s);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-25 10:40:08 +02:00
|
|
|
static void fillPlainText(QPlainTextEdit *plainText, const std::string &text, size_t index)
|
|
|
|
|
{
|
|
|
|
|
if (index == std::string::npos) {
|
|
|
|
|
plainText->setPlainText("");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
size_t valueStart = text.find('\n', index + 1);
|
|
|
|
|
size_t valueEnd;
|
|
|
|
|
std::string value;
|
|
|
|
|
QTC_ASSERT(valueStart != std::string::npos, return;);
|
|
|
|
|
do {
|
|
|
|
|
valueEnd = text.find('\n', valueStart + 1);
|
|
|
|
|
if (valueEnd == std::string::npos)
|
|
|
|
|
break;
|
|
|
|
|
// Skip also 2 spaces - start with valueStart + 1 + 2.
|
|
|
|
|
std::string line = text.substr(valueStart + 3, valueEnd - valueStart - 3);
|
|
|
|
|
rtrim(line);
|
|
|
|
|
value += value.empty() ? line : '\n' + line;
|
|
|
|
|
valueStart = valueEnd;
|
|
|
|
|
} while (valueEnd < text.size() - 1 && text.at(valueEnd + 1) == ' ');
|
|
|
|
|
plainText->setPlainText(QString::fromStdString(value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void fillComboBoxOrLineEdit(QObject *object, const std::string &text, size_t index)
|
|
|
|
|
{
|
|
|
|
|
auto *comboBox = qobject_cast<QComboBox *>(object);
|
|
|
|
|
auto *lineEdit = qobject_cast<QLineEdit *>(object);
|
|
|
|
|
if (index == std::string::npos) {
|
|
|
|
|
if (comboBox)
|
|
|
|
|
comboBox->setCurrentIndex(0);
|
|
|
|
|
else
|
|
|
|
|
lineEdit->setText("");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const size_t valueStart = text.find(':', index + 1);
|
|
|
|
|
QTC_ASSERT(valueStart != std::string::npos, return;);
|
|
|
|
|
const size_t valueEnd = text.find('\n', valueStart + 1);
|
|
|
|
|
QTC_ASSERT(valueEnd != std::string::npos, return;);
|
|
|
|
|
std::string value = text.substr(valueStart + 1, valueEnd - valueStart - 1);
|
|
|
|
|
trim(value);
|
|
|
|
|
|
2022-08-01 17:28:42 +02:00
|
|
|
if (comboBox) {
|
|
|
|
|
if (comboBox->findText(QString::fromStdString(value)) == -1) {
|
|
|
|
|
comboBox->setCurrentIndex(0);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2019-04-25 10:40:08 +02:00
|
|
|
comboBox->setCurrentText(QString::fromStdString(value));
|
2022-08-01 17:28:42 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lineEdit->setText(QString::fromStdString(value));
|
2019-04-25 10:40:08 +02:00
|
|
|
}
|
|
|
|
|
|
2018-11-08 10:35:23 +01:00
|
|
|
void ClangFormatConfigWidget::fillTable()
|
2018-10-11 14:11:43 +02:00
|
|
|
{
|
2022-08-15 10:09:46 +02:00
|
|
|
Utils::GuardLocker locker(m_ignoreChanges);
|
2018-08-29 15:58:13 +02:00
|
|
|
|
2022-04-04 14:53:05 +02:00
|
|
|
const std::string configText = readFile(m_config->filePath().path());
|
2019-04-24 14:44:31 +02:00
|
|
|
|
|
|
|
|
for (QObject *child : m_checksWidget->children()) {
|
|
|
|
|
if (!qobject_cast<QComboBox *>(child) && !qobject_cast<QLineEdit *>(child)
|
|
|
|
|
&& !qobject_cast<QPlainTextEdit *>(child)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-25 10:40:08 +02:00
|
|
|
size_t index = configText.find('\n' + child->objectName().toStdString());
|
|
|
|
|
if (index == std::string::npos)
|
|
|
|
|
index = configText.find("\n " + child->objectName().toStdString());
|
2019-04-24 14:44:31 +02:00
|
|
|
|
2019-04-25 10:40:08 +02:00
|
|
|
if (qobject_cast<QPlainTextEdit *>(child))
|
|
|
|
|
fillPlainText(qobject_cast<QPlainTextEdit *>(child), configText, index);
|
|
|
|
|
else
|
|
|
|
|
fillComboBoxOrLineEdit(child, configText, index);
|
2019-04-24 14:44:31 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-28 10:26:34 +02:00
|
|
|
void ClangFormatConfigWidget::saveChanges(QObject *sender)
|
2019-04-24 14:44:31 +02:00
|
|
|
{
|
|
|
|
|
if (sender->objectName() == "BasedOnStyle") {
|
2021-09-28 10:26:34 +02:00
|
|
|
const auto *basedOnStyle = m_checksWidget->findChild<QComboBox *>("BasedOnStyle");
|
|
|
|
|
m_config->setBasedOnStyle(basedOnStyle->currentText());
|
2019-04-24 14:44:31 +02:00
|
|
|
} else {
|
2021-09-28 10:26:34 +02:00
|
|
|
QList<ClangFormatFile::Field> fields;
|
|
|
|
|
|
2019-04-24 14:44:31 +02:00
|
|
|
for (QObject *child : m_checksWidget->children()) {
|
2021-09-28 10:26:34 +02:00
|
|
|
if (child->objectName() == "BasedOnStyle")
|
|
|
|
|
continue;
|
2019-04-24 14:44:31 +02:00
|
|
|
auto *label = qobject_cast<QLabel *>(child);
|
|
|
|
|
if (!label)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
QWidget *valueWidget = m_checksWidget->findChild<QWidget *>(label->text().trimmed());
|
|
|
|
|
if (!valueWidget) {
|
|
|
|
|
// Currently BraceWrapping only.
|
2021-09-28 10:26:34 +02:00
|
|
|
fields.append({label->text(), ""});
|
2019-04-24 14:44:31 +02:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
2021-09-28 10:26:34 +02:00
|
|
|
|
|
|
|
|
std::stringstream content;
|
2019-04-24 14:44:31 +02:00
|
|
|
QStringList list = plainText->toPlainText().split('\n');
|
|
|
|
|
for (const QString &line : list)
|
|
|
|
|
content << "\n " << line.toStdString();
|
2021-09-28 10:26:34 +02:00
|
|
|
|
|
|
|
|
fields.append({label->text(), QString::fromStdString(content.str())});
|
2019-04-24 14:44:31 +02:00
|
|
|
} else {
|
2021-09-28 10:26:34 +02:00
|
|
|
QString text;
|
|
|
|
|
if (auto *comboBox = qobject_cast<QComboBox *>(valueWidget)) {
|
|
|
|
|
text = comboBox->currentText();
|
2019-04-24 14:44:31 +02:00
|
|
|
} else {
|
|
|
|
|
auto *lineEdit = qobject_cast<QLineEdit *>(valueWidget);
|
|
|
|
|
QTC_ASSERT(lineEdit, continue;);
|
2021-09-28 10:26:34 +02:00
|
|
|
text = lineEdit->text();
|
2019-04-24 14:44:31 +02:00
|
|
|
}
|
|
|
|
|
|
2021-09-28 10:26:34 +02:00
|
|
|
if (!text.isEmpty() && text != "Default")
|
|
|
|
|
fields.append({label->text(), text});
|
2019-04-24 14:44:31 +02:00
|
|
|
}
|
|
|
|
|
}
|
2021-09-28 10:26:34 +02:00
|
|
|
m_config->changeFields(fields);
|
2019-04-24 14:44:31 +02:00
|
|
|
}
|
|
|
|
|
|
2021-09-28 10:26:34 +02:00
|
|
|
fillTable();
|
|
|
|
|
updatePreview();
|
2021-11-01 16:20:08 +01:00
|
|
|
synchronize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ClangFormatConfigWidget::setCodeStyleSettings(const CppEditor::CppCodeStyleSettings &settings)
|
|
|
|
|
{
|
|
|
|
|
m_config->fromCppCodeStyleSettings(settings);
|
|
|
|
|
|
|
|
|
|
fillTable();
|
|
|
|
|
updatePreview();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ClangFormatConfigWidget::setTabSettings(const TextEditor::TabSettings &settings)
|
|
|
|
|
{
|
|
|
|
|
m_config->fromTabSettings(settings);
|
|
|
|
|
|
|
|
|
|
fillTable();
|
|
|
|
|
updatePreview();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ClangFormatConfigWidget::synchronize()
|
|
|
|
|
{
|
|
|
|
|
emit codeStyleSettingsChanged(m_config->toCppCodeStyleSettings(m_project));
|
|
|
|
|
emit tabSettingsChanged(m_config->toTabSettings(m_project));
|
2018-08-29 15:58:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ClangFormatConfigWidget::apply()
|
|
|
|
|
{
|
2022-05-06 12:18:28 +02:00
|
|
|
if (!m_checksWidget->isVisible() && !m_checksWidget->isEnabled())
|
2019-03-05 17:13:45 +01:00
|
|
|
return;
|
|
|
|
|
|
2022-08-01 17:28:42 +02:00
|
|
|
m_style = m_config->style();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ClangFormatConfigWidget::finish()
|
|
|
|
|
{
|
|
|
|
|
if (!m_checksWidget->isVisible() && !m_checksWidget->isEnabled())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_config->setStyle(m_style);
|
2018-08-29 15:58:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace ClangFormat
|