File indexing completed on 2024-04-28 05:49:07

0001 /*  This file is part of the Kate project.
0002  *
0003  *  SPDX-FileCopyrightText: 2010 Christoph Cullmann <cullmann@kde.org>
0004  *
0005  *  SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 #pragma once
0009 
0010 #include <QComboBox>
0011 #include <QPointer>
0012 #include <QProcess>
0013 #include <QPushButton>
0014 #include <QTimer>
0015 #include <QWidget>
0016 
0017 class KateProjectPluginView;
0018 class KateProjectCodeAnalysisTool;
0019 class KMessageWidget;
0020 class KateProject;
0021 class QStandardItemModel;
0022 class DiagnosticsProvider;
0023 class QSortFilterProxyModel;
0024 class QLabel;
0025 
0026 namespace KTextEditor
0027 {
0028 class Document;
0029 }
0030 
0031 /**
0032  * View for Code Analysis.
0033  * cppcheck and perhaps later more...
0034  */
0035 class KateProjectInfoViewCodeAnalysis : public QWidget
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040     /**
0041      * construct project info view for given project
0042      * @param pluginView our plugin view
0043      * @param project project this view is for
0044      */
0045     KateProjectInfoViewCodeAnalysis(KateProjectPluginView *pluginView, KateProject *project);
0046 
0047     /**
0048      * deconstruct info view
0049      */
0050     ~KateProjectInfoViewCodeAnalysis() override;
0051 
0052     /**
0053      * our project.
0054      * @return project
0055      */
0056     KateProject *project() const
0057     {
0058         return m_project;
0059     }
0060 
0061 private Q_SLOTS:
0062     /**
0063      * Called if the tool is changed (currently via Combobox)
0064      */
0065     void slotToolSelectionChanged(int);
0066 
0067     /**
0068      * Called if start/stop button is clicked.
0069      */
0070     void slotStartStopClicked();
0071 
0072     /**
0073      * More checker output is available
0074      */
0075     void slotReadyRead();
0076 
0077     /**
0078      * Analysis finished
0079      * @param exitCode analyzer process exit code
0080      * @param exitStatus analyzer process exit status
0081      */
0082     void finished(int exitCode, QProcess::ExitStatus exitStatus);
0083 
0084 private:
0085     /**
0086      * our plugin view
0087      */
0088     KateProjectPluginView *m_pluginView;
0089 
0090     /**
0091      * our project
0092      */
0093     KateProject *m_project;
0094 
0095     /**
0096      * start/stop analysis button
0097      */
0098     QPushButton *m_startStopAnalysis;
0099 
0100     /**
0101      * running analyzer process
0102      */
0103     QProcess *m_analyzer;
0104 
0105     /**
0106      * currently selected tool
0107      */
0108     KateProjectCodeAnalysisTool *m_analysisTool;
0109 
0110     /**
0111      * UI element to select the tool
0112      */
0113     QComboBox *m_toolSelector;
0114 
0115     /**
0116      * Contains a rich text to explain what the current tool does
0117      */
0118     QLabel *m_toolInfoLabel;
0119 
0120     DiagnosticsProvider *const m_diagnosticProvider;
0121 
0122     /**
0123      * Output read in the slotReadyRead
0124      * will be cleared after process finishes
0125      */
0126     QByteArray m_errOutput;
0127 };