forked from qt-creator/qt-creator
Analyzer: Move tool startup code closer to the action setup
The code sharing in the base was along a somewhat unfortunate boundary. Moving it into the only user also removes some of the wrong local/remote separation. Change-Id: I0be9636ea448d123f9f5105a52d56f47ff7871c3 Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
This commit is contained in:
@@ -558,24 +558,6 @@ AnalyzerRunControl *CallgrindToolPrivate::createRunControl(const AnalyzerStartPa
|
||||
return rc;
|
||||
}
|
||||
|
||||
void CallgrindTool::startLocalTool()
|
||||
{
|
||||
if (checkForLocalStart(ReleaseMode)) {
|
||||
ProjectExplorerPlugin::runStartupProject(CallgrindRunMode);
|
||||
d->setBusyCursor(true);
|
||||
}
|
||||
}
|
||||
|
||||
void CallgrindTool::startRemoteTool()
|
||||
{
|
||||
AnalyzerStartParameters sp;
|
||||
if (checkForRemoteStart(&sp)) {
|
||||
AnalyzerRunControl *rc = createRunControl(sp, 0);
|
||||
ProjectExplorerPlugin::startRunControl(rc, CallgrindRunMode);
|
||||
d->setBusyCursor(true);
|
||||
}
|
||||
}
|
||||
|
||||
void CallgrindTool::handleShowCostsOfFunction()
|
||||
{
|
||||
d->handleShowCostsOfFunction();
|
||||
|
||||
@@ -54,9 +54,6 @@ public:
|
||||
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
||||
QWidget *createWidgets();
|
||||
|
||||
void startLocalTool();
|
||||
void startRemoteTool();
|
||||
|
||||
public slots:
|
||||
void handleShowCostsOfFunction();
|
||||
|
||||
|
||||
@@ -594,42 +594,12 @@ void MemcheckTool::setBusyCursor(bool busy)
|
||||
m_errorView->setCursor(cursor);
|
||||
}
|
||||
|
||||
void MemcheckTool::startLocalTool()
|
||||
{
|
||||
if (checkForLocalStart(DebugMode))
|
||||
ProjectExplorerPlugin::runStartupProject(MemcheckRunMode);
|
||||
}
|
||||
|
||||
void MemcheckTool::startRemoteTool()
|
||||
{
|
||||
AnalyzerStartParameters sp;
|
||||
if (checkForRemoteStart(&sp)) {
|
||||
AnalyzerRunControl *rc = createRunControl(sp, 0);
|
||||
ProjectExplorerPlugin::startRunControl(rc, MemcheckRunMode);
|
||||
}
|
||||
}
|
||||
|
||||
MemcheckWithGdbTool::MemcheckWithGdbTool(QObject *parent) :
|
||||
MemcheckTool(parent)
|
||||
{
|
||||
setObjectName(QLatin1String("MemcheckWithGdbTool"));
|
||||
}
|
||||
|
||||
void MemcheckWithGdbTool::startLocalTool()
|
||||
{
|
||||
if (checkForLocalStart(DebugMode))
|
||||
ProjectExplorerPlugin::runStartupProject(MemcheckWithGdbRunMode);
|
||||
}
|
||||
|
||||
void MemcheckWithGdbTool::startRemoteTool()
|
||||
{
|
||||
AnalyzerStartParameters sp;
|
||||
if (checkForRemoteStart(&sp)) {
|
||||
AnalyzerRunControl *rc = createRunControl(sp, 0);
|
||||
ProjectExplorerPlugin::startRunControl(rc, MemcheckWithGdbRunMode);
|
||||
}
|
||||
}
|
||||
|
||||
MemcheckRunControl *MemcheckWithGdbTool::createMemcheckRunControl(const AnalyzerStartParameters &sp,
|
||||
RunConfiguration *runConfiguration)
|
||||
{
|
||||
|
||||
@@ -83,8 +83,6 @@ class MemcheckTool : public QObject
|
||||
public:
|
||||
MemcheckTool(QObject *parent);
|
||||
|
||||
void startLocalTool();
|
||||
void startRemoteTool();
|
||||
QWidget *createWidgets();
|
||||
|
||||
Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
||||
@@ -140,8 +138,6 @@ class MemcheckWithGdbTool : public MemcheckTool
|
||||
public:
|
||||
MemcheckWithGdbTool(QObject *parent);
|
||||
|
||||
void startLocalTool();
|
||||
void startRemoteTool();
|
||||
MemcheckRunControl *createMemcheckRunControl(
|
||||
const Analyzer::AnalyzerStartParameters &sp,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration) override;
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
#include "valgrindconfigwidget.h"
|
||||
|
||||
#include <analyzerbase/analyzermanager.h>
|
||||
#include <analyzerbase/analyzerruncontrol.h>
|
||||
#include <analyzerbase/analyzerstartparameters.h>
|
||||
#include <analyzerbase/startremotedialog.h>
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
@@ -49,6 +52,9 @@
|
||||
|
||||
#include <cppeditor/cppeditorconstants.h>
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
#include <QtPlugin>
|
||||
@@ -56,6 +62,7 @@
|
||||
#include <QPointer>
|
||||
|
||||
using namespace Analyzer;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
@@ -101,6 +108,24 @@ ValgrindPlugin::~ValgrindPlugin()
|
||||
theGlobalSettings = 0;
|
||||
}
|
||||
|
||||
static void customStart(ProjectExplorer::RunMode runMode)
|
||||
{
|
||||
StartRemoteDialog dlg;
|
||||
if (dlg.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
AnalyzerStartParameters sp;
|
||||
sp.useStartupProject = false;
|
||||
sp.connParams = dlg.sshParams();
|
||||
sp.debuggee = dlg.executable();
|
||||
sp.debuggeeArgs = dlg.arguments();
|
||||
sp.displayName = dlg.executable();
|
||||
sp.workingDirectory = dlg.workingDirectory();
|
||||
|
||||
AnalyzerRunControl *rc = AnalyzerManager::createRunControl(sp, 0);
|
||||
ProjectExplorerPlugin::startRunControl(rc, runMode);
|
||||
}
|
||||
|
||||
bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
{
|
||||
theGlobalSettings = new ValgrindGlobalSettings();
|
||||
@@ -151,11 +176,11 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
action->setToolId("Memcheck");
|
||||
action->setWidgetCreator(mcWidgetCreator);
|
||||
action->setRunControlCreator(mcRunControlCreator);
|
||||
action->setToolStarter([mcTool] { mcTool->startLocalTool(); });
|
||||
action->setToolMode(DebugMode);
|
||||
action->setRunMode(ProjectExplorer::MemcheckRunMode);
|
||||
action->setText(tr("Valgrind Memory Analyzer"));
|
||||
action->setToolTip(memcheckToolTip);
|
||||
action->setMenuGroup(Constants::G_ANALYZER_TOOLS);
|
||||
action->setMenuGroup(Analyzer::Constants::G_ANALYZER_TOOLS);
|
||||
action->setEnabled(false);
|
||||
AnalyzerManager::addAction(action);
|
||||
|
||||
@@ -164,11 +189,11 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
action->setToolId("MemcheckWithGdb");
|
||||
action->setWidgetCreator(mcgWidgetCreator);
|
||||
action->setRunControlCreator(mcgRunControlCreator);
|
||||
action->setToolStarter([mcgTool] { mcgTool->startLocalTool(); });
|
||||
action->setToolMode(DebugMode);
|
||||
action->setRunMode(ProjectExplorer::MemcheckWithGdbRunMode);
|
||||
action->setText(tr("Valgrind Memory Analyzer with GDB"));
|
||||
action->setToolTip(memcheckWithGdbToolTip);
|
||||
action->setMenuGroup(Constants::G_ANALYZER_TOOLS);
|
||||
action->setMenuGroup(Analyzer::Constants::G_ANALYZER_TOOLS);
|
||||
action->setEnabled(false);
|
||||
AnalyzerManager::addAction(action);
|
||||
|
||||
@@ -177,11 +202,11 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
action->setToolId(CallgrindToolId);
|
||||
action->setWidgetCreator(cgWidgetCreator);
|
||||
action->setRunControlCreator(cgRunControlCreator);
|
||||
action->setToolStarter([cgTool] { cgTool->startLocalTool(); });
|
||||
action->setRunMode(ProjectExplorer::CallgrindRunMode);
|
||||
action->setToolMode(ReleaseMode);
|
||||
action->setRunMode(CallgrindRunMode);
|
||||
action->setText(tr("Valgrind Function Profiler"));
|
||||
action->setToolTip(callgrindToolTip);
|
||||
action->setMenuGroup(Constants::G_ANALYZER_TOOLS);
|
||||
action->setMenuGroup(Analyzer::Constants::G_ANALYZER_TOOLS);
|
||||
action->setEnabled(false);
|
||||
AnalyzerManager::addAction(action);
|
||||
}
|
||||
@@ -191,11 +216,11 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
action->setToolId("Memcheck");
|
||||
action->setWidgetCreator(mcWidgetCreator);
|
||||
action->setRunControlCreator(mcRunControlCreator);
|
||||
action->setToolStarter([mcTool] { mcTool->startRemoteTool(); });
|
||||
action->setRunMode(ProjectExplorer::MemcheckRunMode);
|
||||
action->setToolStarter([] { customStart(MemcheckRunMode); });
|
||||
action->setRunMode(MemcheckRunMode);
|
||||
action->setText(tr("Valgrind Memory Analyzer (External Remote Application)"));
|
||||
action->setToolTip(memcheckToolTip);
|
||||
action->setMenuGroup(Constants::G_ANALYZER_REMOTE_TOOLS);
|
||||
action->setMenuGroup(Analyzer::Constants::G_ANALYZER_REMOTE_TOOLS);
|
||||
action->setUseSpecialStart();
|
||||
AnalyzerManager::addAction(action);
|
||||
|
||||
@@ -204,11 +229,11 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
action->setToolId(CallgrindToolId);
|
||||
action->setWidgetCreator(cgWidgetCreator);
|
||||
action->setRunControlCreator(cgRunControlCreator);
|
||||
action->setToolStarter([cgTool] { cgTool->startRemoteTool(); });
|
||||
action->setRunMode(ProjectExplorer::CallgrindRunMode);
|
||||
action->setToolStarter([] { customStart(CallgrindRunMode); });
|
||||
action->setRunMode(CallgrindRunMode);
|
||||
action->setText(tr("Valgrind Function Profiler (External Remote Application)"));
|
||||
action->setToolTip(callgrindToolTip);
|
||||
action->setMenuGroup(Constants::G_ANALYZER_REMOTE_TOOLS);
|
||||
action->setMenuGroup(Analyzer::Constants::G_ANALYZER_REMOTE_TOOLS);
|
||||
action->setUseSpecialStart();
|
||||
AnalyzerManager::addAction(action);
|
||||
|
||||
@@ -246,4 +271,3 @@ void ValgrindPlugin::extensionsInitialized()
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Valgrind
|
||||
|
||||
|
||||
Reference in New Issue
Block a user