ClangFormat: Move ClangFormatGlobalConfigWidget definition to .cpp

Not needed outside anymore.

Change-Id: If5dc3e8b3eddaea59d2633f480abeadda140f564
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
This commit is contained in:
hjk
2024-01-19 15:07:09 +01:00
parent fddbb0e2d9
commit 225762dbe5
2 changed files with 42 additions and 61 deletions

View File

@@ -11,6 +11,7 @@
#include "clangformatutils.h"
#include <cppeditor/cppcodestylepreferencesfactory.h>
#include <cppeditor/cppcodestylesettingspage.h>
#include <cppeditor/cppeditorconstants.h>
#include <projectexplorer/project.h>
@@ -19,13 +20,13 @@
#include <texteditor/icodestylepreferences.h>
#include <texteditor/texteditorsettings.h>
#include <utils/guard.h>
#include <utils/layoutbuilder.h>
#include <QCheckBox>
#include <QComboBox>
#include <QLabel>
#include <QSpinBox>
#include <QWidget>
using namespace CppEditor;
using namespace ProjectExplorer;
@@ -34,8 +35,44 @@ using namespace Utils;
namespace ClangFormat {
ClangFormatGlobalConfigWidget::ClangFormatGlobalConfigWidget(
TextEditor::ICodeStylePreferences *codeStyle, ProjectExplorer::Project *project, QWidget *parent)
class ClangFormatGlobalConfigWidget final : public CodeStyleEditorWidget
{
public:
ClangFormatGlobalConfigWidget(ICodeStylePreferences *codeStyle,
Project *project,
QWidget *parent);
void apply() final;
void finish() final;
private:
void initCheckBoxes();
void initIndentationOrFormattingCombobox();
void initCustomSettingsCheckBox();
void initUseGlobalSettingsCheckBox();
void initFileSizeThresholdSpinBox();
void initCurrentProjectLabel();
bool projectClangFormatFileExists();
Project *m_project;
ICodeStylePreferences *m_codeStyle;
Guard m_ignoreChanges;
bool m_useCustomSettings;
QLabel *m_projectHasClangFormat;
QLabel *m_formattingModeLabel;
QLabel *m_fileSizeThresholdLabel;
QSpinBox *m_fileSizeThresholdSpinBox;
QComboBox *m_indentingOrFormatting;
QCheckBox *m_formatWhileTyping;
QCheckBox *m_formatOnSave;
QCheckBox *m_useCustomSettingsCheckBox;
QCheckBox *m_useGlobalSettings;
QLabel *m_currentProjectLabel;
};
ClangFormatGlobalConfigWidget::ClangFormatGlobalConfigWidget(ICodeStylePreferences *codeStyle,
Project *project, QWidget *parent)
: TextEditor::CodeStyleEditorWidget(parent)
, m_project(project)
, m_codeStyle(codeStyle)
@@ -106,8 +143,6 @@ ClangFormatGlobalConfigWidget::ClangFormatGlobalConfigWidget(
globalSettingsGroupBoxWidget->show();
}
ClangFormatGlobalConfigWidget::~ClangFormatGlobalConfigWidget() = default;
void ClangFormatGlobalConfigWidget::initCheckBoxes()
{
auto setEnableCheckBoxes = [this](int index) {

View File

@@ -3,64 +3,10 @@
#pragma once
#include <cppeditor/cppcodestylesettingspage.h>
#include <utils/guard.h>
QT_BEGIN_NAMESPACE
class QCheckBox;
class QComboBox;
class QLabel;
class QSpinBox;
QT_END_NAMESPACE
namespace ProjectExplorer { class Project; }
namespace TextEditor {
class ICodeStylePreferences;
class CodeStyleEditorWidget;
} // namespace TextEditor
#include <QObject>
namespace ClangFormat {
class ClangFormatGlobalConfigWidget : public TextEditor::CodeStyleEditorWidget
{
Q_OBJECT
public:
explicit ClangFormatGlobalConfigWidget(TextEditor::ICodeStylePreferences *codeStyle,
ProjectExplorer::Project *project = nullptr,
QWidget *parent = nullptr);
~ClangFormatGlobalConfigWidget() override;
void apply() override;
void finish() override;
private:
void initCheckBoxes();
void initIndentationOrFormattingCombobox();
void initCustomSettingsCheckBox();
void initUseGlobalSettingsCheckBox();
void initFileSizeThresholdSpinBox();
void initCurrentProjectLabel();
bool projectClangFormatFileExists();
ProjectExplorer::Project *m_project;
TextEditor::ICodeStylePreferences *m_codeStyle;
Utils::Guard m_ignoreChanges;
bool m_useCustomSettings;
QLabel *m_projectHasClangFormat;
QLabel *m_formattingModeLabel;
QLabel *m_fileSizeThresholdLabel;
QSpinBox *m_fileSizeThresholdSpinBox;
QComboBox *m_indentingOrFormatting;
QCheckBox *m_formatWhileTyping;
QCheckBox *m_formatOnSave;
QCheckBox *m_useCustomSettingsCheckBox;
QCheckBox *m_useGlobalSettings;
QLabel *m_currentProjectLabel;
};
void setupClangFormatStyleFactory(QObject *guard);
} // namespace ClangFormat
} // ClangFormat