forked from qt-creator/qt-creator
Analyzer: Dissolve IAnalyzerTool
Change-Id: I1fd90cf00d6b9dff54b4555a14747282830a4b93 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -500,7 +500,7 @@ static QToolButton *createToolButton(QAction *action)
|
||||
}
|
||||
|
||||
CallgrindTool::CallgrindTool(QObject *parent)
|
||||
: IAnalyzerTool(parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
d = new CallgrindToolPrivate(this);
|
||||
setObjectName(QLatin1String("CallgrindTool"));
|
||||
@@ -643,11 +643,11 @@ QWidget *CallgrindToolPrivate::createWidgets()
|
||||
|
||||
updateCostFormat();
|
||||
|
||||
QDockWidget *callersDock = AnalyzerManager::createDockWidget(q, m_callersView);
|
||||
QDockWidget *flatDock = AnalyzerManager::createDockWidget(q, m_flatView);
|
||||
QDockWidget *calleesDock = AnalyzerManager::createDockWidget(q, m_calleesView);
|
||||
QDockWidget *callersDock = AnalyzerManager::createDockWidget(CallgrindToolId, m_callersView);
|
||||
QDockWidget *flatDock = AnalyzerManager::createDockWidget(CallgrindToolId, m_flatView);
|
||||
QDockWidget *calleesDock = AnalyzerManager::createDockWidget(CallgrindToolId, m_calleesView);
|
||||
QDockWidget *visualizationDock = AnalyzerManager::createDockWidget
|
||||
(q, m_visualisation, Qt::RightDockWidgetArea);
|
||||
(CallgrindToolId, m_visualisation, Qt::RightDockWidgetArea);
|
||||
|
||||
callersDock->show();
|
||||
calleesDock->show();
|
||||
@@ -925,7 +925,7 @@ void CallgrindToolPrivate::handleShowCostsOfFunction()
|
||||
|
||||
m_toggleCollectFunction = qualifiedFunctionName + QLatin1String("()");
|
||||
|
||||
AnalyzerManager::selectTool(q, StartLocal);
|
||||
AnalyzerManager::selectTool(CallgrindToolId, StartLocal);
|
||||
AnalyzerManager::startTool();
|
||||
}
|
||||
|
||||
|
||||
@@ -36,9 +36,11 @@
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
|
||||
const char CallgrindToolId[] = "Callgrind";
|
||||
|
||||
class CallgrindToolPrivate;
|
||||
|
||||
class CallgrindTool : public Analyzer::IAnalyzerTool
|
||||
class CallgrindTool : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ static void initKindFilterAction(QAction *action, const QList<int> &kinds)
|
||||
}
|
||||
|
||||
MemcheckTool::MemcheckTool(QObject *parent)
|
||||
: IAnalyzerTool(parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_settings = 0;
|
||||
m_errorModel = 0;
|
||||
@@ -358,7 +358,7 @@ QWidget *MemcheckTool::createWidgets()
|
||||
m_errorView->setObjectName(QLatin1String("Valgrind.MemcheckTool.ErrorView"));
|
||||
m_errorView->setWindowTitle(tr("Memory Issues"));
|
||||
|
||||
QDockWidget *errorDock = AnalyzerManager::createDockWidget(this, m_errorView);
|
||||
QDockWidget *errorDock = AnalyzerManager::createDockWidget("Memcheck", m_errorView);
|
||||
errorDock->show();
|
||||
mw->splitDockWidget(mw->toolBarDockWidget(), errorDock, Qt::Vertical);
|
||||
|
||||
|
||||
@@ -76,13 +76,19 @@ private:
|
||||
bool m_filterExternalIssues;
|
||||
};
|
||||
|
||||
class MemcheckTool : public Analyzer::IAnalyzerTool
|
||||
class MemcheckTool : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MemcheckTool(QObject *parent);
|
||||
|
||||
void startTool(Analyzer::StartMode mode);
|
||||
QWidget *createWidgets();
|
||||
|
||||
Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
||||
|
||||
private slots:
|
||||
void settingsDestroyed(QObject *settings);
|
||||
void maybeActiveRunConfigurationChanged();
|
||||
@@ -99,8 +105,6 @@ private slots:
|
||||
void loadExternalXmlLogFile();
|
||||
|
||||
private:
|
||||
void startTool(Analyzer::StartMode mode);
|
||||
QWidget *createWidgets();
|
||||
void setBusyCursor(bool busy);
|
||||
|
||||
void clearErrorView();
|
||||
@@ -108,9 +112,6 @@ private:
|
||||
int updateUiAfterFinishedHelper();
|
||||
|
||||
protected:
|
||||
Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
||||
|
||||
virtual MemcheckRunControl *createMemcheckRunControl(
|
||||
const Analyzer::AnalyzerStartParameters &sp,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration);
|
||||
@@ -138,7 +139,6 @@ class MemcheckWithGdbTool : public MemcheckTool
|
||||
public:
|
||||
MemcheckWithGdbTool(QObject *parent);
|
||||
|
||||
protected:
|
||||
void startTool(Analyzer::StartMode mode);
|
||||
MemcheckRunControl *createMemcheckRunControl(
|
||||
const Analyzer::AnalyzerStartParameters &sp,
|
||||
|
||||
@@ -124,10 +124,37 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
"Valgrind Analyze Memory with GDB uses the \"memcheck\" tool to find memory leaks.\n"
|
||||
"When a problem is detected, the application is interrupted and can be debugged");
|
||||
|
||||
MemcheckTool *mcTool = m_memcheckTool;
|
||||
auto mcToolStarter = [mcTool](StartMode mode) { return mcTool->startTool(mode); };
|
||||
auto mcWidgetCreator = [mcTool] { return mcTool->createWidgets(); };
|
||||
auto mcRunControlCreator = [mcTool](const AnalyzerStartParameters &sp,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration) {
|
||||
return mcTool->createRunControl(sp, runConfiguration);
|
||||
};
|
||||
|
||||
MemcheckWithGdbTool *mcgTool = m_memcheckWithGdbTool;
|
||||
auto mcgToolStarter = [mcgTool](StartMode mode) { return mcgTool->startTool(mode); };
|
||||
auto mcgWidgetCreator = [mcgTool] { return mcgTool->createWidgets(); };
|
||||
auto mcgRunControlCreator = [mcgTool](const AnalyzerStartParameters &sp,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration) {
|
||||
return mcgTool->createRunControl(sp, runConfiguration);
|
||||
};
|
||||
|
||||
CallgrindTool *cgTool = m_callgrindTool;
|
||||
auto cgToolStarter = [cgTool](StartMode mode) { return cgTool->startTool(mode); };
|
||||
auto cgWidgetCreator = [cgTool] { return cgTool->createWidgets(); };
|
||||
auto cgRunControlCreator = [cgTool](const AnalyzerStartParameters &sp,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration) {
|
||||
return cgTool->createRunControl(sp, runConfiguration);
|
||||
};
|
||||
|
||||
if (!Utils::HostOsInfo::isWindowsHost()) {
|
||||
action = new AnalyzerAction(this);
|
||||
action->setId("Memcheck.Local");
|
||||
action->setTool(m_memcheckTool);
|
||||
action->setActionId("Memcheck.Local");
|
||||
action->setToolId("Memcheck");
|
||||
action->setWidgetCreator(mcWidgetCreator);
|
||||
action->setRunControlCreator(mcRunControlCreator);
|
||||
action->setToolStarter(mcToolStarter);
|
||||
action->setRunMode(ProjectExplorer::MemcheckRunMode);
|
||||
action->setText(tr("Valgrind Memory Analyzer"));
|
||||
action->setToolTip(memcheckToolTip);
|
||||
@@ -137,8 +164,11 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
AnalyzerManager::addAction(action);
|
||||
|
||||
action = new AnalyzerAction(this);
|
||||
action->setId("MemcheckWithGdb.Local");
|
||||
action->setTool(m_memcheckWithGdbTool);
|
||||
action->setActionId("MemcheckWithGdb.Local");
|
||||
action->setToolId("MemcheckWithGdb");
|
||||
action->setWidgetCreator(mcgWidgetCreator);
|
||||
action->setRunControlCreator(mcgRunControlCreator);
|
||||
action->setToolStarter(mcgToolStarter);
|
||||
action->setRunMode(ProjectExplorer::MemcheckWithGdbRunMode);
|
||||
action->setText(tr("Valgrind Memory Analyzer with GDB"));
|
||||
action->setToolTip(memcheckWithGdbToolTip);
|
||||
@@ -148,8 +178,11 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
AnalyzerManager::addAction(action);
|
||||
|
||||
action = new AnalyzerAction(this);
|
||||
action->setId("Callgrind.Local");
|
||||
action->setTool(m_callgrindTool);
|
||||
action->setActionId("Callgrind.Local");
|
||||
action->setToolId(CallgrindToolId);
|
||||
action->setWidgetCreator(cgWidgetCreator);
|
||||
action->setRunControlCreator(cgRunControlCreator);
|
||||
action->setToolStarter(cgToolStarter);
|
||||
action->setRunMode(ProjectExplorer::CallgrindRunMode);
|
||||
action->setText(tr("Valgrind Function Profiler"));
|
||||
action->setToolTip(callgrindToolTip);
|
||||
@@ -160,8 +193,11 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
}
|
||||
|
||||
action = new AnalyzerAction(this);
|
||||
action->setId("Memcheck.Remote");
|
||||
action->setTool(m_memcheckTool);
|
||||
action->setActionId("Memcheck.Remote");
|
||||
action->setToolId("Memcheck");
|
||||
action->setWidgetCreator(mcWidgetCreator);
|
||||
action->setRunControlCreator(mcRunControlCreator);
|
||||
action->setToolStarter(mcToolStarter);
|
||||
action->setRunMode(ProjectExplorer::MemcheckRunMode);
|
||||
action->setText(tr("Valgrind Memory Analyzer (External Remote Application)"));
|
||||
action->setToolTip(memcheckToolTip);
|
||||
@@ -170,8 +206,11 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
AnalyzerManager::addAction(action);
|
||||
|
||||
action = new AnalyzerAction(this);
|
||||
action->setId("Callgrind.Remote");
|
||||
action->setTool(m_callgrindTool);
|
||||
action->setActionId("Callgrind.Remote");
|
||||
action->setToolId(CallgrindToolId);
|
||||
action->setWidgetCreator(cgWidgetCreator);
|
||||
action->setRunControlCreator(cgRunControlCreator);
|
||||
action->setToolStarter(cgToolStarter);
|
||||
action->setRunMode(ProjectExplorer::CallgrindRunMode);
|
||||
action->setText(tr("Valgrind Function Profiler (External Remote Application)"));
|
||||
action->setToolTip(callgrindToolTip);
|
||||
|
||||
Reference in New Issue
Block a user