aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/clangtools/diagnosticconfigswidget.h
blob: bca3ec6203a488ae737b7806afc4ef27839a9231 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include "executableinfo.h"

#include <cppeditor/clangdiagnosticconfigswidget.h>

#include <memory>

namespace ClangTools {
namespace Internal {
class Diagnostic;

// Not UI-related, but requires the tree model (or else a huge refactoring or code duplication).
QString removeClangTidyCheck(const QString &checks, const QString &check);
QString removeClazyCheck(const QString &checks, const QString &check);
void disableChecks(const QList<Diagnostic> &diagnostics);

namespace Ui {
class ClazyChecks;
class TidyChecks;
}

class TidyChecksTreeModel;
class ClazyChecksTreeModel;
class ClazyChecksSortFilterModel;

// Like CppEditor::ClangDiagnosticConfigsWidget, but with tabs/widgets for clang-tidy and clazy
class DiagnosticConfigsWidget : public CppEditor::ClangDiagnosticConfigsWidget
{
    Q_OBJECT

public:
    DiagnosticConfigsWidget(const CppEditor::ClangDiagnosticConfigs &configs,
                            const Utils::Id &configToSelect,
                            const ClangTidyInfo &tidyInfo,
                            const ClazyStandaloneInfo &clazyInfo);
    ~DiagnosticConfigsWidget();

private:
    void syncExtraWidgets(const CppEditor::ClangDiagnosticConfig &config) override;

    void syncClangTidyWidgets(const CppEditor::ClangDiagnosticConfig &config);
    void syncTidyChecksToTree(const CppEditor::ClangDiagnosticConfig &config);

    void syncClazyWidgets(const CppEditor::ClangDiagnosticConfig &config);
    void syncClazyChecksGroupBox();

    void onClangTidyModeChanged(int index);
    void onClangTidyTreeChanged();
    void onClazyTreeChanged();

    void connectClangTidyItemChanged();
    void disconnectClangTidyItemChanged();

    void connectClazyItemChanged();
    void disconnectClazyItemChanged();

private:
    // Clang-Tidy
    std::unique_ptr<Ui::TidyChecks> m_tidyChecks;
    QWidget *m_tidyChecksWidget = nullptr;
    std::unique_ptr<TidyChecksTreeModel> m_tidyTreeModel;
    ClangTidyInfo m_tidyInfo;

    // Clazy
    std::unique_ptr<Ui::ClazyChecks> m_clazyChecks;
    QWidget *m_clazyChecksWidget = nullptr;
    std::unique_ptr<ClazyChecksTreeModel> m_clazyTreeModel;
    ClazyChecksSortFilterModel *m_clazySortFilterProxyModel = nullptr;
    ClazyStandaloneInfo m_clazyInfo;
};

} // namespace Internal
} // namespace ClangTools