forked from qt-creator/qt-creator
analyzer: refactor progress
Change-Id: If74c8035bc83a8113c2a15dcacefa38afbbbb4d8 Reviewed-on: http://codereview.qt.nokia.com/1056 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -15,7 +15,6 @@ SOURCES += \
|
||||
ianalyzertool.cpp \
|
||||
analyzerplugin.cpp \
|
||||
analyzerruncontrol.cpp \
|
||||
analyzerruncontrolfactory.cpp \
|
||||
analyzermanager.cpp \
|
||||
analyzersettings.cpp \
|
||||
analyzeroptionspage.cpp \
|
||||
@@ -30,7 +29,6 @@ HEADERS += \
|
||||
analyzerconstants.h \
|
||||
analyzerplugin.h \
|
||||
analyzerruncontrol.h \
|
||||
analyzerruncontrolfactory.h \
|
||||
analyzermanager.h \
|
||||
analyzersettings.h \
|
||||
analyzerstartparameters.h \
|
||||
|
||||
@@ -45,17 +45,18 @@ public:
|
||||
explicit StartMode(int m = 0) : m(m) {}
|
||||
operator int() const { return m; }
|
||||
void operator=(int m_) { m = m_; }
|
||||
// Often used modes.
|
||||
private:
|
||||
int m;
|
||||
};
|
||||
|
||||
// Special values for currently used modes.
|
||||
// Their meaning is interpreted by the individual tools.
|
||||
enum { StartLocal = -1, StartRemote = -2 };
|
||||
|
||||
namespace Constants {
|
||||
|
||||
// modes and their priorities
|
||||
const char * const MODE_ANALYZE = "Analyzer.Mode.Analyze";
|
||||
const char * const MODE_ANALYZE = "Mode.Analyze";
|
||||
const int P_MODE_ANALYZE = 76;
|
||||
|
||||
// context
|
||||
|
||||
@@ -37,12 +37,10 @@
|
||||
#include "analyzerconstants.h"
|
||||
#include "analyzerplugin.h"
|
||||
#include "analyzerruncontrol.h"
|
||||
#include "analyzerruncontrolfactory.h"
|
||||
#include "analyzeroptionspage.h"
|
||||
#include "analyzerstartparameters.h"
|
||||
#include "analyzerutils.h"
|
||||
#include "ianalyzertool.h"
|
||||
#include "startremotedialog.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/findplaceholder.h>
|
||||
@@ -76,10 +74,6 @@
|
||||
#include <utils/statuslabel.h>
|
||||
#include <utils/ssh/sshconnection.h>
|
||||
|
||||
#include <projectexplorer/applicationrunconfiguration.h>
|
||||
#include <remotelinux/linuxdeviceconfiguration.h>
|
||||
#include <remotelinux/remotelinuxrunconfiguration.h>
|
||||
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
@@ -101,6 +95,7 @@
|
||||
|
||||
using namespace Core;
|
||||
using namespace Analyzer::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace Analyzer {
|
||||
namespace Internal {
|
||||
@@ -108,43 +103,11 @@ namespace Internal {
|
||||
const char LAST_ACTIVE_TOOL[] = "Analyzer.Plugin.LastActiveTool";
|
||||
const char INITIAL_DOCK_AREA[] = "initial_dock_area";
|
||||
|
||||
AnalyzerStartParameters localStartParameters(ProjectExplorer::RunConfiguration *runConfiguration)
|
||||
{
|
||||
AnalyzerStartParameters sp;
|
||||
QTC_ASSERT(runConfiguration, return sp);
|
||||
ProjectExplorer::LocalApplicationRunConfiguration *rc =
|
||||
qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration);
|
||||
QTC_ASSERT(rc, return sp);
|
||||
|
||||
sp.startMode = StartLocal;
|
||||
sp.environment = rc->environment();
|
||||
sp.workingDirectory = rc->workingDirectory();
|
||||
sp.debuggee = rc->executable();
|
||||
sp.debuggeeArgs = rc->commandLineArguments();
|
||||
sp.displayName = rc->displayName();
|
||||
sp.connParams.host = QLatin1String("localhost");
|
||||
sp.connParams.port = rc->qmlDebugServerPort();
|
||||
return sp;
|
||||
}
|
||||
|
||||
AnalyzerStartParameters remoteLinuxStartParameters(ProjectExplorer::RunConfiguration *runConfiguration)
|
||||
{
|
||||
AnalyzerStartParameters sp;
|
||||
RemoteLinux::RemoteLinuxRunConfiguration * const rc
|
||||
= qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration);
|
||||
QTC_ASSERT(rc, return sp);
|
||||
|
||||
sp.startMode = StartRemote;
|
||||
sp.debuggee = rc->remoteExecutableFilePath();
|
||||
sp.debuggeeArgs = rc->arguments();
|
||||
sp.connParams = rc->deviceConfig()->sshParameters();
|
||||
sp.analyzerCmdPrefix = rc->commandPrefix();
|
||||
sp.displayName = rc->displayName();
|
||||
return sp;
|
||||
}
|
||||
|
||||
|
||||
// AnalyzerMode ////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// AnalyzerMode
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
class AnalyzerMode : public Core::IMode
|
||||
{
|
||||
@@ -211,22 +174,18 @@ public:
|
||||
void addTool(IAnalyzerTool *tool, const StartModes &modes);
|
||||
void selectSavedTool();
|
||||
void selectTool(IAnalyzerTool *tool, StartMode mode);
|
||||
void stopTool(IAnalyzerTool *tool, StartMode mode);
|
||||
void handleToolFinished(IAnalyzerTool *tool, StartMode mode);
|
||||
void handleToolStarted();
|
||||
void handleToolFinished();
|
||||
void saveToolSettings(IAnalyzerTool *tool, StartMode mode);
|
||||
void loadToolSettings(IAnalyzerTool *tool);
|
||||
QAction *actionFromToolAndMode(IAnalyzerTool *tool, StartMode mode);
|
||||
|
||||
ProjectExplorer::RunControl *createRunControl
|
||||
(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode);
|
||||
|
||||
// Convenience.
|
||||
void startLocalTool(IAnalyzerTool *tool, StartMode mode);
|
||||
void startRemoteTool(IAnalyzerTool *tool, StartMode mode);
|
||||
|
||||
public slots:
|
||||
void startTool();
|
||||
void stopTool() { stopTool(m_currentTool, m_currentMode); }
|
||||
//void stopTool();
|
||||
|
||||
void selectAction();
|
||||
void selectAction(QAction *);
|
||||
@@ -238,8 +197,7 @@ public slots:
|
||||
public:
|
||||
AnalyzerManager *q;
|
||||
AnalyzerMode *m_mode;
|
||||
AnalyzerRunControlFactory *m_runControlFactory;
|
||||
ProjectExplorer::RunControl *m_currentRunControl;
|
||||
bool m_isRunning;
|
||||
Utils::FancyMainWindow *m_mainWindow;
|
||||
IAnalyzerTool *m_currentTool;
|
||||
StartMode m_currentMode;
|
||||
@@ -267,8 +225,7 @@ public:
|
||||
AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager *qq):
|
||||
q(qq),
|
||||
m_mode(0),
|
||||
m_runControlFactory(0),
|
||||
m_currentRunControl(0),
|
||||
m_isRunning(false),
|
||||
m_mainWindow(0),
|
||||
m_currentTool(0),
|
||||
m_currentMode(),
|
||||
@@ -283,15 +240,11 @@ AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager *qq):
|
||||
m_toolBox->setObjectName(QLatin1String("AnalyzerManagerToolBox"));
|
||||
connect(m_toolBox, SIGNAL(currentIndexChanged(int)), SLOT(selectAction(int)));
|
||||
|
||||
m_runControlFactory = new AnalyzerRunControlFactory();
|
||||
AnalyzerPlugin::instance()->addAutoReleasedObject(m_runControlFactory);
|
||||
|
||||
setupActions();
|
||||
|
||||
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
|
||||
this, SLOT(modeChanged(Core::IMode*)));
|
||||
ProjectExplorer::ProjectExplorerPlugin *pe =
|
||||
ProjectExplorer::ProjectExplorerPlugin::instance();
|
||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
||||
connect(pe, SIGNAL(updateRunActions()), SLOT(updateRunActions()));
|
||||
}
|
||||
|
||||
@@ -335,7 +288,7 @@ void AnalyzerManagerPrivate::setupActions()
|
||||
m_stopAction->setEnabled(false);
|
||||
m_stopAction->setIcon(QIcon(Constants::ANALYZER_CONTROL_STOP_ICON));
|
||||
command = am->registerAction(m_stopAction, Constants::STOP, globalcontext);
|
||||
connect(m_stopAction, SIGNAL(triggered()), this, SLOT(stopTool()));
|
||||
//connect(m_stopAction, SIGNAL(triggered()), this, SLOT(stopTool()));
|
||||
|
||||
QAction *separatorAction = new QAction(m_menu);
|
||||
separatorAction->setSeparator(true);
|
||||
@@ -384,8 +337,8 @@ void AnalyzerManagerPrivate::createModeMainWindow()
|
||||
m_mainWindow->setObjectName(QLatin1String("AnalyzerManagerMainWindow"));
|
||||
m_mainWindow->setDocumentMode(true);
|
||||
m_mainWindow->setDockNestingEnabled(true);
|
||||
m_mainWindow->setDockActionsVisible(ModeManager::instance()->currentMode()->id() ==
|
||||
Constants::MODE_ANALYZE);
|
||||
m_mainWindow->setDockActionsVisible(false);
|
||||
//ModeManager::instance()->currentMode() cannot be us yet.
|
||||
connect(m_mainWindow, SIGNAL(resetLayout()), SLOT(resetLayout()));
|
||||
|
||||
QBoxLayout *editorHolderLayout = new QVBoxLayout;
|
||||
@@ -459,16 +412,16 @@ void AnalyzerManagerPrivate::addDock(Qt::DockWidgetArea area, QDockWidget *dockW
|
||||
}
|
||||
|
||||
bool buildTypeAccepted(IAnalyzerTool::ToolMode toolMode,
|
||||
ProjectExplorer::BuildConfiguration::BuildType buildType)
|
||||
BuildConfiguration::BuildType buildType)
|
||||
{
|
||||
if (toolMode == IAnalyzerTool::AnyMode)
|
||||
return true;
|
||||
if (buildType == ProjectExplorer::BuildConfiguration::Unknown)
|
||||
if (buildType == BuildConfiguration::Unknown)
|
||||
return true;
|
||||
if (buildType == ProjectExplorer::BuildConfiguration::Debug
|
||||
if (buildType == BuildConfiguration::Debug
|
||||
&& toolMode == IAnalyzerTool::DebugMode)
|
||||
return true;
|
||||
if (buildType == ProjectExplorer::BuildConfiguration::Release
|
||||
if (buildType == BuildConfiguration::Release
|
||||
&& toolMode == IAnalyzerTool::ReleaseMode)
|
||||
return true;
|
||||
return false;
|
||||
@@ -491,52 +444,6 @@ bool AnalyzerManagerPrivate::showPromptDialog(const QString &title, const QStrin
|
||||
return messageBox.clickedStandardButton() == QDialogButtonBox::Yes;
|
||||
}
|
||||
|
||||
ProjectExplorer::RunControl *AnalyzerManagerPrivate::createRunControl
|
||||
(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode)
|
||||
{
|
||||
Q_UNUSED(mode);
|
||||
|
||||
// FIXME: Move to tool implementations.
|
||||
AnalyzerStartParameters sp;
|
||||
if (qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration)) {
|
||||
sp = localStartParameters(runConfiguration);
|
||||
} else if (qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
|
||||
sp = remoteLinuxStartParameters(runConfiguration);
|
||||
} else {
|
||||
// Might be S60DeviceRunfiguration, or something else ...
|
||||
//sp.startMode = StartRemote;
|
||||
sp.startMode = m_currentMode;
|
||||
}
|
||||
|
||||
IAnalyzerTool *tool = m_currentTool;
|
||||
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration);
|
||||
m_currentRunControl = rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
void AnalyzerManagerPrivate::startRemoteTool(IAnalyzerTool *tool, StartMode mode)
|
||||
{
|
||||
Q_UNUSED(tool);
|
||||
StartRemoteDialog dlg;
|
||||
if (dlg.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
AnalyzerStartParameters sp;
|
||||
sp.toolId = tool->id();
|
||||
sp.startMode = mode;
|
||||
sp.connParams = dlg.sshParams();
|
||||
sp.debuggee = dlg.executable();
|
||||
sp.debuggeeArgs = dlg.arguments();
|
||||
sp.displayName = dlg.executable();
|
||||
sp.workingDirectory = dlg.workingDirectory();
|
||||
|
||||
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0);
|
||||
m_currentRunControl = rc;
|
||||
|
||||
ProjectExplorer::ProjectExplorerPlugin::instance()
|
||||
->startRunControl(rc, Constants::MODE_ANALYZE);
|
||||
}
|
||||
|
||||
void AnalyzerManagerPrivate::startLocalTool(IAnalyzerTool *tool, StartMode mode)
|
||||
{
|
||||
int index = m_tools.indexOf(tool);
|
||||
@@ -548,17 +455,17 @@ void AnalyzerManagerPrivate::startLocalTool(IAnalyzerTool *tool, StartMode mode)
|
||||
// Make sure mode is shown.
|
||||
q->showMode();
|
||||
|
||||
ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
|
||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
||||
|
||||
// ### not sure if we're supposed to check if the RunConFiguration isEnabled
|
||||
ProjectExplorer::Project *pro = pe->startupProject();
|
||||
const ProjectExplorer::RunConfiguration *runConfig = 0;
|
||||
ProjectExplorer::BuildConfiguration::BuildType buildType = ProjectExplorer::BuildConfiguration::Unknown;
|
||||
Project *pro = pe->startupProject();
|
||||
const RunConfiguration *runConfig = 0;
|
||||
BuildConfiguration::BuildType buildType = BuildConfiguration::Unknown;
|
||||
if (pro) {
|
||||
if (const ProjectExplorer::Target *target = pro->activeTarget()) {
|
||||
if (const Target *target = pro->activeTarget()) {
|
||||
runConfig = target->activeRunConfiguration();
|
||||
// Build configuration is 0 for QML projects.
|
||||
if (const ProjectExplorer::BuildConfiguration *buildConfig = target->activeBuildConfiguration())
|
||||
if (const BuildConfiguration *buildConfig = target->activeBuildConfiguration())
|
||||
buildType = buildConfig->buildType();
|
||||
}
|
||||
}
|
||||
@@ -566,7 +473,7 @@ void AnalyzerManagerPrivate::startLocalTool(IAnalyzerTool *tool, StartMode mode)
|
||||
return;
|
||||
|
||||
// Check if there already is an analyzer run.
|
||||
if (m_currentRunControl) {
|
||||
if (m_isRunning) {
|
||||
// ask if user wants to restart the analyzer
|
||||
const QString msg = tr("<html><head/><body><center><i>%1</i> is still running. "
|
||||
"You have to quit the Analyzer before being able to run another instance."
|
||||
@@ -579,7 +486,7 @@ void AnalyzerManagerPrivate::startLocalTool(IAnalyzerTool *tool, StartMode mode)
|
||||
|
||||
// user selected to stop the active run. stop it, activate restart on stop
|
||||
m_restartOnStop = true;
|
||||
stopTool(m_currentTool, m_currentMode);
|
||||
q->stopTool();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -589,10 +496,11 @@ void AnalyzerManagerPrivate::startLocalTool(IAnalyzerTool *tool, StartMode mode)
|
||||
// if not, notify the user and urge him to use the correct mode.
|
||||
if (!buildTypeAccepted(toolMode, buildType)) {
|
||||
const QString toolName = tool->displayName();
|
||||
const QString currentMode = buildType == ProjectExplorer::BuildConfiguration::Debug ? tr("Debug") : tr("Release");
|
||||
const QString currentMode =
|
||||
buildType == BuildConfiguration::Debug ? tr("Debug") : tr("Release");
|
||||
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
const QString configKey = QLatin1String(Constants::MODE_ANALYZE) + QLatin1Char('/') + QLatin1String("AnalyzeCorrectMode");
|
||||
const QString configKey = QLatin1String("Analyzer.AnalyzeCorrectMode");
|
||||
int ret;
|
||||
if (settings->contains(configKey)) {
|
||||
ret = settings->value(configKey, QDialog::Accepted).toInt();
|
||||
@@ -607,14 +515,16 @@ void AnalyzerManagerPrivate::startLocalTool(IAnalyzerTool *tool, StartMode mode)
|
||||
break;
|
||||
}
|
||||
const QString title = tr("Run %1 in %2 Mode?").arg(toolName).arg(currentMode);
|
||||
const QString message = tr("<html><head/><body><p>You are trying to run the tool '%1' on an application in %2 mode. "
|
||||
const QString message = tr("<html><head/><body><p>You are trying "
|
||||
"to run the tool \"%1\" on an application in %2 mode. "
|
||||
"The tool is designed to be used in %3 mode.</p><p>"
|
||||
"Do you want to continue and run it in %2 mode?</p></body></html>").
|
||||
arg(toolName).arg(currentMode).arg(toolModeString);
|
||||
"Do you want to continue and run it in %2 mode?</p></body></html>")
|
||||
.arg(toolName).arg(currentMode).arg(toolModeString);
|
||||
const QString checkBoxText = tr("&Do not ask again");
|
||||
bool checkBoxSetting = false;
|
||||
const QDialogButtonBox::StandardButton button =
|
||||
Utils::CheckableMessageBox::question(Core::ICore::instance()->mainWindow(), title, message, checkBoxText,
|
||||
Utils::CheckableMessageBox::question(Core::ICore::instance()->mainWindow(),
|
||||
title, message, checkBoxText,
|
||||
&checkBoxSetting, QDialogButtonBox::Yes|QDialogButtonBox::Cancel,
|
||||
QDialogButtonBox::Cancel);
|
||||
ret = button == QDialogButtonBox::Yes ? QDialog::Accepted : QDialog::Rejected;
|
||||
@@ -626,8 +536,8 @@ void AnalyzerManagerPrivate::startLocalTool(IAnalyzerTool *tool, StartMode mode)
|
||||
return;
|
||||
}
|
||||
|
||||
pe->runProject(pro, Constants::MODE_ANALYZE);
|
||||
|
||||
m_isRunning = true;
|
||||
pe->runProject(pro, tool->id());
|
||||
updateRunActions();
|
||||
}
|
||||
|
||||
@@ -636,27 +546,9 @@ void AnalyzerManagerPrivate::startTool()
|
||||
m_currentTool->startTool(m_currentMode);
|
||||
}
|
||||
|
||||
void AnalyzerManagerPrivate::stopTool(IAnalyzerTool *tool, StartMode mode)
|
||||
{
|
||||
QTC_ASSERT(tool == m_currentTool, /**/);
|
||||
QTC_ASSERT(mode == m_currentMode, /**/);
|
||||
if (m_currentRunControl)
|
||||
return;
|
||||
|
||||
// be sure to call handleToolFinished only once, and only when the engine is really finished
|
||||
if (m_currentRunControl->stop() == ProjectExplorer::RunControl::StoppedSynchronously)
|
||||
handleToolFinished(tool, mode);
|
||||
// else: wait for the finished() signal to trigger handleToolFinished()
|
||||
}
|
||||
|
||||
void AnalyzerManagerPrivate::modeChanged(IMode *mode)
|
||||
{
|
||||
if (!m_mainWindow)
|
||||
return;
|
||||
const bool makeVisible = mode->id() == Constants::MODE_ANALYZE;
|
||||
if (!makeVisible)
|
||||
return;
|
||||
m_mainWindow->setDockActionsVisible(makeVisible);
|
||||
m_mainWindow->setDockActionsVisible(mode == m_mode);
|
||||
}
|
||||
|
||||
QAction *AnalyzerManagerPrivate::actionFromToolAndMode(IAnalyzerTool *tool, StartMode mode)
|
||||
@@ -784,11 +676,14 @@ void AnalyzerManagerPrivate::addTool(IAnalyzerTool *tool, const StartModes &mode
|
||||
m_toolBox->setEnabled(true);
|
||||
}
|
||||
|
||||
void AnalyzerManagerPrivate::handleToolFinished(IAnalyzerTool *tool, StartMode mode)
|
||||
void AnalyzerManagerPrivate::handleToolStarted()
|
||||
{
|
||||
QTC_ASSERT(tool == m_currentTool, /**/);
|
||||
QTC_ASSERT(mode == m_currentMode, /**/);
|
||||
m_currentRunControl = 0;
|
||||
m_isRunning = true; // FIXME: Make less global.
|
||||
}
|
||||
|
||||
void AnalyzerManagerPrivate::handleToolFinished()
|
||||
{
|
||||
m_isRunning = false;
|
||||
updateRunActions();
|
||||
|
||||
if (m_restartOnStop) {
|
||||
@@ -823,26 +718,24 @@ void AnalyzerManagerPrivate::saveToolSettings(IAnalyzerTool *tool, StartMode mod
|
||||
|
||||
void AnalyzerManagerPrivate::updateRunActions()
|
||||
{
|
||||
ProjectExplorer::ProjectExplorerPlugin *pe =
|
||||
ProjectExplorer::ProjectExplorerPlugin::instance();
|
||||
ProjectExplorer::Project *project = pe->startupProject();
|
||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
||||
Project *project = pe->startupProject();
|
||||
|
||||
bool startEnabled = !m_currentRunControl
|
||||
&& pe->canRun(project, Constants::MODE_ANALYZE)
|
||||
&& m_currentTool;
|
||||
bool startEnabled = !m_isRunning
|
||||
&& m_currentTool && pe->canRun(project, m_currentTool->id());
|
||||
|
||||
QString disabledReason;
|
||||
if (m_currentRunControl)
|
||||
if (m_isRunning)
|
||||
disabledReason = tr("An analysis is still in progress.");
|
||||
else if (!m_currentTool)
|
||||
disabledReason = tr("No analyzer tool selected.");
|
||||
else
|
||||
disabledReason = pe->cannotRunReason(project, Constants::MODE_ANALYZE);
|
||||
disabledReason = pe->cannotRunReason(project, m_currentTool->id());
|
||||
|
||||
m_startAction->setEnabled(startEnabled);
|
||||
m_startAction->setToolTip(disabledReason);
|
||||
m_toolBox->setEnabled(!m_currentRunControl);
|
||||
m_stopAction->setEnabled(m_currentRunControl);
|
||||
m_toolBox->setEnabled(!m_isRunning);
|
||||
m_stopAction->setEnabled(m_isRunning);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@@ -948,9 +841,9 @@ void AnalyzerManager::showMode()
|
||||
ModeManager::instance()->activateMode(m_instance->d->m_mode->id());
|
||||
}
|
||||
|
||||
void AnalyzerManager::stopTool(IAnalyzerTool *tool, StartMode mode)
|
||||
void AnalyzerManager::stopTool()
|
||||
{
|
||||
m_instance->d->stopTool(tool, mode);
|
||||
stopAction()->trigger();
|
||||
}
|
||||
|
||||
void AnalyzerManager::startLocalTool(IAnalyzerTool *tool, StartMode mode)
|
||||
@@ -958,26 +851,20 @@ void AnalyzerManager::startLocalTool(IAnalyzerTool *tool, StartMode mode)
|
||||
m_instance->d->startLocalTool(tool, mode);
|
||||
}
|
||||
|
||||
void AnalyzerManager::startRemoteTool(IAnalyzerTool *tool, StartMode mode)
|
||||
QAction *AnalyzerManager::stopAction()
|
||||
{
|
||||
m_instance->d->startRemoteTool(tool, mode);
|
||||
return m_instance->d->m_stopAction;
|
||||
}
|
||||
|
||||
ProjectExplorer::RunControl *AnalyzerManager::createRunControl
|
||||
(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode)
|
||||
void AnalyzerManager::handleToolFinished()
|
||||
{
|
||||
return m_instance->d->createRunControl(runConfiguration, mode);
|
||||
m_instance->d->handleToolFinished();
|
||||
}
|
||||
|
||||
void AnalyzerManager::handleToolFinished(IAnalyzerTool *tool, StartMode mode)
|
||||
{
|
||||
m_instance->d->handleToolFinished(tool, mode);
|
||||
}
|
||||
|
||||
IAnalyzerTool *AnalyzerManager::toolById(const QByteArray &id)
|
||||
IAnalyzerTool *AnalyzerManager::toolFromId(const QByteArray &id)
|
||||
{
|
||||
foreach (IAnalyzerTool *tool, m_instance->d->m_tools)
|
||||
if (tool->id() == id)
|
||||
if (id.startsWith(tool->id()))
|
||||
return tool;
|
||||
QTC_ASSERT(false, qDebug() << "NO ANAYLYZER TOOL FOUND FOR ID" << id);
|
||||
return 0;
|
||||
|
||||
@@ -67,12 +67,10 @@ public:
|
||||
void extensionsInitialized();
|
||||
void shutdown();
|
||||
|
||||
static ProjectExplorer::RunControl *createRunControl
|
||||
(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode);
|
||||
|
||||
// Register a tool and initialize it.
|
||||
static void addTool(IAnalyzerTool *tool, const StartModes &mode);
|
||||
static IAnalyzerTool *toolById(const QByteArray &id);
|
||||
static IAnalyzerTool *toolFromId(const QByteArray &id);
|
||||
static StartMode modeFromId(const QByteArray &id);
|
||||
|
||||
// Dockwidgets are registered to the main window.
|
||||
static QDockWidget *createDockWidget(IAnalyzerTool *tool, const QString &title,
|
||||
@@ -83,11 +81,10 @@ public:
|
||||
static void showMode();
|
||||
static void selectTool(IAnalyzerTool *tool, StartMode mode);
|
||||
static void startTool(IAnalyzerTool *tool, StartMode mode);
|
||||
static void stopTool(IAnalyzerTool *tool, StartMode mode);
|
||||
static void stopTool();
|
||||
|
||||
// Convenience functions.
|
||||
static void startLocalTool(IAnalyzerTool *tool, StartMode mode);
|
||||
static void startRemoteTool(IAnalyzerTool *tool, StartMode mode);
|
||||
|
||||
static QString msgToolStarted(const QString &name);
|
||||
static QString msgToolFinished(const QString &name, int issuesFound);
|
||||
@@ -95,7 +92,8 @@ public:
|
||||
static void showStatusMessage(const QString &message, int timeoutMS = 10000);
|
||||
static void showPermanentStatusMessage(const QString &message);
|
||||
|
||||
static void handleToolFinished(IAnalyzerTool *tool, StartMode mode);
|
||||
static void handleToolFinished();
|
||||
static QAction *stopAction();
|
||||
|
||||
private:
|
||||
friend class AnalyzerManagerPrivate;
|
||||
|
||||
@@ -70,7 +70,7 @@ AnalyzerRunControl::Private::Private()
|
||||
// AnalyzerRunControl ////////////////////////////////////////////////////
|
||||
AnalyzerRunControl::AnalyzerRunControl(IAnalyzerTool *tool,
|
||||
const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration)
|
||||
: RunControl(runConfiguration, Constants::MODE_ANALYZE),
|
||||
: RunControl(runConfiguration, tool->id()),
|
||||
d(new Private)
|
||||
{
|
||||
d->m_engine = tool->createEngine(sp, runConfiguration);
|
||||
@@ -123,6 +123,12 @@ ProjectExplorer::RunControl::StopResult AnalyzerRunControl::stop()
|
||||
return AsynchronousStop;
|
||||
}
|
||||
|
||||
void AnalyzerRunControl::stopIt()
|
||||
{
|
||||
if (stop() == ProjectExplorer::RunControl::StoppedSynchronously)
|
||||
AnalyzerManager::handleToolFinished();
|
||||
}
|
||||
|
||||
void AnalyzerRunControl::engineFinished()
|
||||
{
|
||||
d->m_isRunning = false;
|
||||
@@ -131,7 +137,7 @@ void AnalyzerRunControl::engineFinished()
|
||||
|
||||
void AnalyzerRunControl::runControlFinished()
|
||||
{
|
||||
AnalyzerManager::handleToolFinished(d->m_engine->tool(), d->m_engine->mode());
|
||||
AnalyzerManager::handleToolFinished();
|
||||
}
|
||||
|
||||
bool AnalyzerRunControl::isRunning() const
|
||||
|
||||
@@ -65,6 +65,7 @@ public:
|
||||
QIcon icon() const;
|
||||
|
||||
private slots:
|
||||
void stopIt();
|
||||
void receiveOutput(const QString &, Utils::OutputFormat format);
|
||||
|
||||
void addTask(ProjectExplorer::Task::TaskType type, const QString &description,
|
||||
|
||||
@@ -64,16 +64,4 @@ QString IAnalyzerTool::defaultActionName(const IAnalyzerTool *tool, StartMode mo
|
||||
return base;
|
||||
}
|
||||
|
||||
void IAnalyzerTool::defaultStartTool(IAnalyzerTool *tool, StartMode mode)
|
||||
{
|
||||
if (mode == StartLocal)
|
||||
AnalyzerManager::startLocalTool(tool, mode);
|
||||
if (mode == StartRemote)
|
||||
AnalyzerManager::startRemoteTool(tool, mode);
|
||||
}
|
||||
|
||||
void IAnalyzerTool::initializeDockWidgets()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace Analyzer
|
||||
|
||||
@@ -105,7 +105,6 @@ public:
|
||||
static QByteArray defaultMenuGroup(StartMode mode);
|
||||
static QByteArray defaultActionId(const IAnalyzerTool *tool, StartMode mode);
|
||||
static QString defaultActionName(const IAnalyzerTool *tool, StartMode mode);
|
||||
static void defaultStartTool(IAnalyzerTool *tool, StartMode mode);
|
||||
|
||||
/// This gets called after all analyzation tools where initialized.
|
||||
virtual void extensionsInitialized() = 0;
|
||||
@@ -114,7 +113,7 @@ public:
|
||||
* This is called to add all dock widgets if tool becomes active first time.
|
||||
* \sa AnalzyerManager::createDockWidget
|
||||
*/
|
||||
virtual void initializeDockWidgets();
|
||||
virtual void initializeDockWidgets() {}
|
||||
|
||||
/// Returns a control widget which will be shown in the status bar when
|
||||
/// this tool is selected. Must be non-zero.
|
||||
@@ -125,8 +124,7 @@ public:
|
||||
virtual IAnalyzerEngine *createEngine(const AnalyzerStartParameters &sp,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration = 0) = 0;
|
||||
|
||||
virtual void startTool(StartMode mode)
|
||||
{ return defaultStartTool(this, mode); }
|
||||
virtual void startTool(StartMode mode) = 0;
|
||||
|
||||
/// Called when tools gets selected.
|
||||
virtual void toolSelected() const {}
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
|
||||
namespace Analyzer {
|
||||
|
||||
StartRemoteDialog::StartRemoteDialog(QWidget *parent, Qt::WindowFlags f)
|
||||
: QDialog(parent, f)
|
||||
StartRemoteDialog::StartRemoteDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, m_ui(new Ui::StartRemoteDialog)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
@@ -33,12 +33,11 @@
|
||||
#ifndef STARTREMOTEDIALOG_H
|
||||
#define STARTREMOTEDIALOG_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
#include "analyzerbase_global.h"
|
||||
|
||||
#include <utils/ssh/sshconnection.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
QT_END_NAMESPACE
|
||||
#include <QtGui/QDialog>
|
||||
|
||||
namespace Analyzer {
|
||||
|
||||
@@ -46,11 +45,12 @@ namespace Ui {
|
||||
class StartRemoteDialog;
|
||||
}
|
||||
|
||||
class StartRemoteDialog : public QDialog {
|
||||
class ANALYZER_EXPORT StartRemoteDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit StartRemoteDialog(QWidget *parent = 0, Qt::WindowFlags f = 0);
|
||||
explicit StartRemoteDialog(QWidget *parent = 0);
|
||||
virtual ~StartRemoteDialog();
|
||||
|
||||
Utils::SshConnectionParameters sshParams() const;
|
||||
@@ -66,6 +66,6 @@ private:
|
||||
Ui::StartRemoteDialog *m_ui;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace Analyzer
|
||||
|
||||
#endif // STARTREMOTEDIALOG_H
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Debugger {
|
||||
namespace Constants {
|
||||
|
||||
// Debug mode
|
||||
const char * const MODE_DEBUG = "Debugger.Mode.Debug";
|
||||
const char * const MODE_DEBUG = "Mode.Debug";
|
||||
|
||||
// Contexts
|
||||
const char * const C_DEBUGMODE = "Debugger.DebugMode";
|
||||
|
||||
@@ -50,7 +50,7 @@ CodaQmlProfilerRunner::CodaQmlProfilerRunner(S60DeviceRunConfiguration *configur
|
||||
QObject *parent) :
|
||||
AbstractQmlProfilerRunner(parent),
|
||||
m_configuration(configuration),
|
||||
m_runControl(new CodaRunControl(configuration, Analyzer::Constants::MODE_ANALYZE))
|
||||
m_runControl(new CodaRunControl(configuration, "QmlProfiler"))
|
||||
{
|
||||
connect(m_runControl, SIGNAL(finished()), this, SIGNAL(stopped()));
|
||||
connect(m_runControl,
|
||||
|
||||
@@ -159,7 +159,7 @@ void QmlProfilerEngine::stop()
|
||||
void QmlProfilerEngine::stopped()
|
||||
{
|
||||
d->m_running = false;
|
||||
AnalyzerManager::stopTool(tool(), mode());
|
||||
AnalyzerManager::stopTool(); // FIXME: Needed?
|
||||
emit finished();
|
||||
}
|
||||
|
||||
|
||||
@@ -541,3 +541,11 @@ void QmlProfilerTool::updateRecordingState()
|
||||
if (d->m_traceWindow->isRecording())
|
||||
clearDisplay();
|
||||
}
|
||||
|
||||
void QmlProfilerTool::startTool(StartMode mode)
|
||||
{
|
||||
if (mode == StartLocal)
|
||||
AnalyzerManager::startLocalTool(this, mode);
|
||||
if (mode == StartRemote)
|
||||
AnalyzerManager::startLocalTool(this, mode);
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ public:
|
||||
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
||||
|
||||
QWidget *createControlWidget();
|
||||
void startTool(Analyzer::StartMode mode);
|
||||
|
||||
public slots:
|
||||
void connectClient(int port);
|
||||
|
||||
@@ -45,7 +45,7 @@ using namespace Analyzer;
|
||||
using namespace ProjectExplorer;
|
||||
using namespace QmlProfiler::Internal;
|
||||
|
||||
AnalyzerStartParameters localStartParameters(ProjectExplorer::RunConfiguration *runConfiguration)
|
||||
static AnalyzerStartParameters localStartParameters(ProjectExplorer::RunConfiguration *runConfiguration)
|
||||
{
|
||||
AnalyzerStartParameters sp;
|
||||
QTC_ASSERT(runConfiguration, return sp);
|
||||
@@ -73,9 +73,8 @@ QmlProjectAnalyzerRunControlFactory::QmlProjectAnalyzerRunControlFactory(QObject
|
||||
|
||||
bool QmlProjectAnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const
|
||||
{
|
||||
if (!qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration))
|
||||
return false;
|
||||
return mode == Constants::MODE_ANALYZE;
|
||||
return mode.startsWith(QLatin1String("QmlProfiler"))
|
||||
&& qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration);
|
||||
}
|
||||
|
||||
RunControl *QmlProjectAnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode)
|
||||
@@ -88,7 +87,7 @@ RunControl *QmlProjectAnalyzerRunControlFactory::create(RunConfiguration *runCon
|
||||
AnalyzerRunControl *QmlProjectAnalyzerRunControlFactory::create
|
||||
(const Analyzer::AnalyzerStartParameters &sp, RunConfiguration *runConfiguration)
|
||||
{
|
||||
return new AnalyzerRunControl(AnalyzerManager::toolById(sp.toolId), sp, runConfiguration);
|
||||
return new AnalyzerRunControl(AnalyzerManager::toolFromId(sp.toolId), sp, runConfiguration);
|
||||
}
|
||||
|
||||
QString QmlProjectAnalyzerRunControlFactory::displayName() const
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <valgrind/callgrind/callgrindparsedata.h>
|
||||
#include <valgrind/callgrind/callgrindproxymodel.h>
|
||||
#include <valgrind/callgrind/callgrindstackbrowser.h>
|
||||
#include <valgrind/valgrindplugin.h>
|
||||
|
||||
#include <analyzerbase/analyzermanager.h>
|
||||
#include <analyzerbase/analyzersettings.h>
|
||||
@@ -679,6 +680,11 @@ IAnalyzerEngine *CallgrindToolPrivate::createEngine(const AnalyzerStartParameter
|
||||
return engine;
|
||||
}
|
||||
|
||||
void CallgrindTool::startTool(StartMode mode)
|
||||
{
|
||||
ValgrindPlugin::startValgrindTool(this, mode);
|
||||
}
|
||||
|
||||
QWidget *CallgrindTool::createControlWidget()
|
||||
{
|
||||
return d->createControlWidget();
|
||||
|
||||
@@ -60,6 +60,8 @@ public:
|
||||
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
||||
QWidget *createControlWidget();
|
||||
|
||||
void startTool(Analyzer::StartMode mode);
|
||||
|
||||
private:
|
||||
CallgrindToolPrivate *d;
|
||||
};
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "memcheckerrorview.h"
|
||||
#include "memchecksettings.h"
|
||||
#include "valgrindsettings.h"
|
||||
#include "valgrindplugin.h"
|
||||
|
||||
#include <analyzerbase/analyzermanager.h>
|
||||
#include <analyzerbase/analyzerconstants.h>
|
||||
@@ -466,6 +467,11 @@ IAnalyzerEngine *MemcheckTool::createEngine(const AnalyzerStartParameters &sp,
|
||||
return engine;
|
||||
}
|
||||
|
||||
void MemcheckTool::startTool(StartMode mode)
|
||||
{
|
||||
ValgrindPlugin::startValgrindTool(this, mode);
|
||||
}
|
||||
|
||||
void MemcheckTool::engineStarting(const IAnalyzerEngine *engine)
|
||||
{
|
||||
clearErrorView();
|
||||
|
||||
@@ -118,6 +118,7 @@ private:
|
||||
|
||||
Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
||||
void startTool(Analyzer::StartMode mode);
|
||||
|
||||
void clearErrorView();
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ QString ValgrindEngine::executable() const
|
||||
|
||||
void ValgrindEngine::handleProgressCanceled()
|
||||
{
|
||||
AnalyzerManager::stopTool(tool(), mode());
|
||||
AnalyzerManager::stopTool();
|
||||
}
|
||||
|
||||
void ValgrindEngine::handleProgressFinished()
|
||||
|
||||
@@ -33,21 +33,197 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "valgrindplugin.h"
|
||||
#include "valgrindsettings.h"
|
||||
#include "callgrindtool.h"
|
||||
|
||||
#include "callgrindsettings.h"
|
||||
#include "memchecktool.h"
|
||||
#include "callgrindtool.h"
|
||||
#include "memchecksettings.h"
|
||||
#include "memchecktool.h"
|
||||
#include "valgrindsettings.h"
|
||||
|
||||
#include <analyzerbase/analyzersettings.h>
|
||||
#include <analyzerbase/analyzerconstants.h>
|
||||
#include <analyzerbase/analyzermanager.h>
|
||||
#include <analyzerbase/analyzerrunconfigwidget.h>
|
||||
#include <analyzerbase/analyzerruncontrol.h>
|
||||
#include <analyzerbase/analyzersettings.h>
|
||||
#include <analyzerbase/analyzerstartparameters.h>
|
||||
#include <analyzerbase/startremotedialog.h>
|
||||
|
||||
#include <projectexplorer/applicationrunconfiguration.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
|
||||
#include <remotelinux/linuxdeviceconfiguration.h>
|
||||
#include <remotelinux/remotelinuxrunconfiguration.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QtPlugin>
|
||||
#include <QtGui/QAction>
|
||||
|
||||
using namespace Analyzer;
|
||||
using namespace Valgrind::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ValgrindRunControlFactory
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
|
||||
static AnalyzerStartParameters localStartParameters(RunConfiguration *runConfiguration)
|
||||
{
|
||||
AnalyzerStartParameters sp;
|
||||
QTC_ASSERT(runConfiguration, return sp);
|
||||
LocalApplicationRunConfiguration *rc =
|
||||
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
|
||||
QTC_ASSERT(rc, return sp);
|
||||
|
||||
sp.startMode = StartLocal;
|
||||
sp.environment = rc->environment();
|
||||
sp.workingDirectory = rc->workingDirectory();
|
||||
sp.debuggee = rc->executable();
|
||||
sp.debuggeeArgs = rc->commandLineArguments();
|
||||
sp.displayName = rc->displayName();
|
||||
sp.connParams.host = QLatin1String("localhost");
|
||||
sp.connParams.port = rc->qmlDebugServerPort();
|
||||
return sp;
|
||||
}
|
||||
|
||||
static AnalyzerStartParameters remoteLinuxStartParameters(RunConfiguration *runConfiguration)
|
||||
{
|
||||
AnalyzerStartParameters sp;
|
||||
RemoteLinux::RemoteLinuxRunConfiguration * const rc
|
||||
= qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration);
|
||||
QTC_ASSERT(rc, return sp);
|
||||
|
||||
sp.startMode = StartRemote;
|
||||
sp.debuggee = rc->remoteExecutableFilePath();
|
||||
sp.debuggeeArgs = rc->arguments();
|
||||
sp.connParams = rc->deviceConfig()->sshParameters();
|
||||
sp.analyzerCmdPrefix = rc->commandPrefix();
|
||||
sp.displayName = rc->displayName();
|
||||
return sp;
|
||||
}
|
||||
|
||||
|
||||
class ValgrindRunControlFactory: public ProjectExplorer::IRunControlFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ValgrindRunControlFactory(QObject *parent = 0);
|
||||
|
||||
typedef ProjectExplorer::RunConfiguration RunConfiguration;
|
||||
typedef ProjectExplorer::RunControl RunControl;
|
||||
|
||||
// IRunControlFactory
|
||||
bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
|
||||
RunControl *create(RunConfiguration *runConfiguration, const QString &mode);
|
||||
QString displayName() const;
|
||||
|
||||
ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect();
|
||||
ProjectExplorer::RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
|
||||
};
|
||||
|
||||
ValgrindRunControlFactory::ValgrindRunControlFactory(QObject *parent)
|
||||
: IRunControlFactory(parent)
|
||||
{
|
||||
setObjectName(QLatin1String("ValgrindRunControlFactory"));
|
||||
}
|
||||
|
||||
bool ValgrindRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const
|
||||
{
|
||||
Q_UNUSED(runConfiguration);
|
||||
return mode.startsWith("Callgrind") || mode.startsWith("Memcheck");
|
||||
}
|
||||
|
||||
RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode)
|
||||
{
|
||||
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
|
||||
|
||||
AnalyzerStartParameters sp;
|
||||
if (qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration)) {
|
||||
sp = localStartParameters(runConfiguration);
|
||||
} else if (qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
|
||||
sp = remoteLinuxStartParameters(runConfiguration);
|
||||
} else {
|
||||
// Might be S60DeviceRunfiguration, or something else ...
|
||||
//sp.startMode = StartRemote;
|
||||
sp.startMode = StartRemote;
|
||||
}
|
||||
|
||||
IAnalyzerTool *tool = AnalyzerManager::toolFromId(mode.toLatin1());
|
||||
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration);
|
||||
QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
|
||||
//m_isRunning = true;
|
||||
return rc;
|
||||
}
|
||||
|
||||
QString ValgrindRunControlFactory::displayName() const
|
||||
{
|
||||
return tr("Analyzer");
|
||||
}
|
||||
|
||||
IRunConfigurationAspect *ValgrindRunControlFactory::createRunConfigurationAspect()
|
||||
{
|
||||
return new AnalyzerProjectSettings;
|
||||
}
|
||||
|
||||
RunConfigWidget *ValgrindRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration)
|
||||
{
|
||||
LocalApplicationRunConfiguration *localRc =
|
||||
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
|
||||
if (!localRc)
|
||||
return 0;
|
||||
AnalyzerProjectSettings *settings = runConfiguration->extraAspect<AnalyzerProjectSettings>();
|
||||
if (!settings)
|
||||
return 0;
|
||||
|
||||
AnalyzerRunConfigWidget *ret = new AnalyzerRunConfigWidget;
|
||||
ret->setRunConfiguration(runConfiguration);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ValgrindPlugin
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void startRemoteTool(IAnalyzerTool *tool, StartMode mode)
|
||||
{
|
||||
Q_UNUSED(tool);
|
||||
StartRemoteDialog dlg;
|
||||
if (dlg.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
AnalyzerStartParameters sp;
|
||||
sp.toolId = tool->id();
|
||||
sp.startMode = mode;
|
||||
sp.connParams = dlg.sshParams();
|
||||
sp.debuggee = dlg.executable();
|
||||
sp.debuggeeArgs = dlg.arguments();
|
||||
sp.displayName = dlg.executable();
|
||||
sp.workingDirectory = dlg.workingDirectory();
|
||||
|
||||
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0);
|
||||
//m_currentRunControl = rc;
|
||||
QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
|
||||
|
||||
ProjectExplorer::ProjectExplorerPlugin::instance()->startRunControl(rc, tool->id());
|
||||
}
|
||||
|
||||
void ValgrindPlugin::startValgrindTool(IAnalyzerTool *tool, StartMode mode)
|
||||
{
|
||||
if (mode == StartLocal)
|
||||
AnalyzerManager::startLocalTool(tool, mode);
|
||||
if (mode == StartRemote)
|
||||
startRemoteTool(tool, mode);
|
||||
}
|
||||
|
||||
static AbstractAnalyzerSubConfig *valgrindConfigFactory()
|
||||
{
|
||||
@@ -89,7 +265,16 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
AnalyzerManager::addTool(new MemcheckTool(this), modes);
|
||||
AnalyzerManager::addTool(new CallgrindTool(this), modes);
|
||||
|
||||
ValgrindRunControlFactory *factory = new ValgrindRunControlFactory();
|
||||
addAutoReleasedObject(factory);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Valgrind
|
||||
|
||||
|
||||
Q_EXPORT_PLUGIN(Valgrind::Internal::ValgrindPlugin)
|
||||
|
||||
#include "valgrindplugin.moc"
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#define VALGRINDTOOLBASEPLUGIN_H
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
#include <analyzerbase/ianalyzertool.h>
|
||||
|
||||
namespace Valgrind {
|
||||
namespace Internal {
|
||||
@@ -49,6 +50,8 @@ public:
|
||||
|
||||
virtual bool initialize(const QStringList &arguments, QString *errorString);
|
||||
virtual void extensionsInitialized() {}
|
||||
|
||||
static void startValgrindTool(Analyzer::IAnalyzerTool *tool, Analyzer::StartMode mode);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user