2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2022 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2022-07-28 16:13:35 +02:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <cppeditor/cppcodestylesettingspage.h>
|
|
|
|
|
|
2023-05-08 11:00:04 +02:00
|
|
|
#include <utils/guard.h>
|
|
|
|
|
|
2022-07-22 09:44:47 +02:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QCheckBox;
|
|
|
|
|
class QComboBox;
|
|
|
|
|
class QLabel;
|
2023-05-11 11:34:08 +02:00
|
|
|
class QSpinBox;
|
2022-07-22 09:44:47 +02:00
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
2022-07-28 16:13:35 +02:00
|
|
|
namespace ProjectExplorer { class Project; }
|
2024-01-11 11:31:00 +01:00
|
|
|
namespace TextEditor {
|
|
|
|
|
class ICodeStylePreferences;
|
|
|
|
|
class CodeStyleEditorWidget;
|
|
|
|
|
} // namespace TextEditor
|
2022-07-28 16:13:35 +02:00
|
|
|
|
|
|
|
|
namespace ClangFormat {
|
|
|
|
|
|
2024-01-11 11:31:00 +01:00
|
|
|
class ClangFormatGlobalConfigWidget : public TextEditor::CodeStyleEditorWidget
|
2022-07-28 16:13:35 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2023-04-04 14:28:27 +02:00
|
|
|
explicit ClangFormatGlobalConfigWidget(TextEditor::ICodeStylePreferences *codeStyle,
|
|
|
|
|
ProjectExplorer::Project *project = nullptr,
|
2022-07-28 16:13:35 +02:00
|
|
|
QWidget *parent = nullptr);
|
|
|
|
|
~ClangFormatGlobalConfigWidget() override;
|
|
|
|
|
void apply() override;
|
2023-04-17 14:14:22 +02:00
|
|
|
void finish() override;
|
2022-07-28 16:13:35 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void initCheckBoxes();
|
|
|
|
|
void initIndentationOrFormattingCombobox();
|
2024-01-02 14:54:11 +01:00
|
|
|
void initCustomSettingsCheckBox();
|
2023-01-10 14:29:49 +01:00
|
|
|
void initUseGlobalSettingsCheckBox();
|
2023-05-11 11:34:08 +02:00
|
|
|
void initFileSizeThresholdSpinBox();
|
2024-01-02 14:54:11 +01:00
|
|
|
void initCurrentProjectLabel();
|
2022-07-28 16:13:35 +02:00
|
|
|
|
2022-08-19 15:20:22 +02:00
|
|
|
bool projectClangFormatFileExists();
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::Project *m_project;
|
2023-04-04 14:28:27 +02:00
|
|
|
TextEditor::ICodeStylePreferences *m_codeStyle;
|
2023-05-08 11:00:04 +02:00
|
|
|
Utils::Guard m_ignoreChanges;
|
2024-01-02 14:54:11 +01:00
|
|
|
bool m_useCustomSettings;
|
2022-08-19 15:20:22 +02:00
|
|
|
|
|
|
|
|
QLabel *m_projectHasClangFormat;
|
2022-07-22 09:44:47 +02:00
|
|
|
QLabel *m_formattingModeLabel;
|
2023-05-11 11:34:08 +02:00
|
|
|
QLabel *m_fileSizeThresholdLabel;
|
|
|
|
|
QSpinBox *m_fileSizeThresholdSpinBox;
|
2022-07-22 09:44:47 +02:00
|
|
|
QComboBox *m_indentingOrFormatting;
|
|
|
|
|
QCheckBox *m_formatWhileTyping;
|
|
|
|
|
QCheckBox *m_formatOnSave;
|
2024-01-02 14:54:11 +01:00
|
|
|
QCheckBox *m_useCustomSettingsCheckBox;
|
2023-01-10 14:29:49 +01:00
|
|
|
QCheckBox *m_useGlobalSettings;
|
2024-01-02 14:54:11 +01:00
|
|
|
QLabel *m_currentProjectLabel;
|
2022-07-28 16:13:35 +02:00
|
|
|
};
|
|
|
|
|
|
2024-01-19 15:01:50 +01:00
|
|
|
void setupClangFormatStyleFactory(QObject *guard);
|
|
|
|
|
|
2022-07-28 16:13:35 +02:00
|
|
|
} // namespace ClangFormat
|