forked from qt-creator/qt-creator
ClangTools: Merge ClangTidyClazyTool into ClangTool
Change-Id: Ieb6c4994ddcff9339a9cfb25c82e23dd2d2e8912 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -29,38 +29,56 @@
|
||||
#include "clangtoolsdiagnostic.h"
|
||||
#include "clangtoolslogfilereader.h"
|
||||
|
||||
#include <debugger/debuggermainwindow.h>
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <cpptools/projectinfo.h>
|
||||
|
||||
namespace Debugger { class DetailedErrorView; }
|
||||
namespace Utils { class FilePath; }
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QToolButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Debugger {
|
||||
class DetailedErrorView;
|
||||
}
|
||||
namespace Utils {
|
||||
class FilePath;
|
||||
class FancyLineEdit;
|
||||
} // namespace Utils
|
||||
|
||||
namespace ClangTools {
|
||||
namespace Internal {
|
||||
|
||||
class ClangToolsDiagnosticModel;
|
||||
class Diagnostic;
|
||||
class DiagnosticFilterModel;
|
||||
|
||||
const char ClangTidyClazyPerspectiveId[] = "ClangTidyClazy.Perspective";
|
||||
|
||||
class ClangTool : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ClangTool(const QString &name);
|
||||
static ClangTool *instance();
|
||||
|
||||
ClangTool();
|
||||
~ClangTool() override;
|
||||
|
||||
void selectPerspective();
|
||||
|
||||
enum class FileSelection {
|
||||
AllFiles,
|
||||
CurrentFile,
|
||||
AskUser,
|
||||
};
|
||||
virtual void startTool(FileSelection fileSelection) = 0;
|
||||
void startTool(FileSelection fileSelection);
|
||||
|
||||
virtual Diagnostics read(OutputFileFormat outputFileFormat,
|
||||
Diagnostics read(OutputFileFormat outputFileFormat,
|
||||
const QString &logFilePath,
|
||||
const QString &mainFilePath,
|
||||
const QSet<Utils::FilePath> &projectFiles,
|
||||
QString *errorMessage) const = 0;
|
||||
QString *errorMessage) const;
|
||||
|
||||
FileInfos collectFileInfos(ProjectExplorer::Project *project,
|
||||
FileSelection fileSelection) const;
|
||||
@@ -70,7 +88,7 @@ public:
|
||||
|
||||
const QString &name() const;
|
||||
|
||||
virtual void onNewDiagnosticsAvailable(const Diagnostics &diagnostics);
|
||||
void onNewDiagnosticsAvailable(const Diagnostics &diagnostics);
|
||||
|
||||
QAction *startAction() const { return m_startAction; }
|
||||
QAction *startOnCurrentFileAction() const { return m_startOnCurrentFileAction; }
|
||||
@@ -78,11 +96,14 @@ public:
|
||||
signals:
|
||||
void finished(bool success); // For testing.
|
||||
|
||||
protected:
|
||||
virtual void handleStateUpdate() = 0;
|
||||
private:
|
||||
void updateRunActions();
|
||||
void handleStateUpdate();
|
||||
|
||||
void setToolBusy(bool busy);
|
||||
|
||||
void initDiagnosticView();
|
||||
void loadDiagnosticsFromFiles();
|
||||
|
||||
ClangToolsDiagnosticModel *m_diagnosticModel = nullptr;
|
||||
QPointer<Debugger::DetailedErrorView> m_diagnosticView;
|
||||
@@ -93,6 +114,19 @@ protected:
|
||||
bool m_running = false;
|
||||
bool m_toolBusy = false;
|
||||
|
||||
DiagnosticFilterModel *m_diagnosticFilterModel = nullptr;
|
||||
|
||||
Utils::FancyLineEdit *m_filterLineEdit = nullptr;
|
||||
QToolButton *m_applyFixitsButton = nullptr;
|
||||
|
||||
QAction *m_goBack = nullptr;
|
||||
QAction *m_goNext = nullptr;
|
||||
QAction *m_loadExported = nullptr;
|
||||
QAction *m_clear = nullptr;
|
||||
QAction *m_expandCollapse = nullptr;
|
||||
|
||||
Utils::Perspective m_perspective{ClangTidyClazyPerspectiveId, tr("Clang-Tidy and Clazy")};
|
||||
|
||||
private:
|
||||
const QString m_name;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user