display: simplify AnalyzerStartParameters

Change-Id: Ibc9db3d7de96461b097d1a78e1bcfd757458fc99
Reviewed-on: http://codereview.qt.nokia.com/1205
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
hjk
2011-07-06 09:54:50 +02:00
committed by Friedemann Kleint
parent 00f992e277
commit 7a50c47f51
3 changed files with 24 additions and 51 deletions

View File

@@ -60,9 +60,6 @@ public:
QString debuggee; QString debuggee;
QString debuggeeArgs; QString debuggeeArgs;
QString analyzerCmdPrefix; QString analyzerCmdPrefix;
QString remoteMountPoint;
QString localMountDir;
QString remoteSourcesDir;
QString displayName; QString displayName;
Utils::Environment environment; Utils::Environment environment;
QString workingDirectory; QString workingDirectory;

View File

@@ -547,6 +547,8 @@ void QmlProfilerTool::updateRecordingState()
void QmlProfilerTool::startTool(StartMode mode) void QmlProfilerTool::startTool(StartMode mode)
{ {
Q_UNUSED(mode);
using namespace ProjectExplorer; using namespace ProjectExplorer;
// Make sure mode is shown. // Make sure mode is shown.

View File

@@ -74,59 +74,20 @@ using namespace ProjectExplorer;
namespace Valgrind { namespace Valgrind {
namespace Internal { namespace Internal {
static AnalyzerStartParameters localStartParameters(RunConfiguration *runConfiguration) class ValgrindRunControlFactory : public ProjectExplorer::IRunControlFactory
{
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 Q_OBJECT
public: public:
ValgrindRunControlFactory(QObject *parent = 0); ValgrindRunControlFactory(QObject *parent = 0);
typedef ProjectExplorer::RunConfiguration RunConfiguration;
typedef ProjectExplorer::RunControl RunControl;
// IRunControlFactory // IRunControlFactory
bool canRun(RunConfiguration *runConfiguration, const QString &mode) const; bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
RunControl *create(RunConfiguration *runConfiguration, const QString &mode); RunControl *create(RunConfiguration *runConfiguration, const QString &mode);
QString displayName() const; QString displayName() const;
ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect(); IRunConfigurationAspect *createRunConfigurationAspect();
ProjectExplorer::RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration); RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
}; };
ValgrindRunControlFactory::ValgrindRunControlFactory(QObject *parent) ValgrindRunControlFactory::ValgrindRunControlFactory(QObject *parent)
@@ -146,10 +107,24 @@ RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration
QTC_ASSERT(canRun(runConfiguration, mode), return 0); QTC_ASSERT(canRun(runConfiguration, mode), return 0);
AnalyzerStartParameters sp; AnalyzerStartParameters sp;
if (qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration)) { if (LocalApplicationRunConfiguration *rc1 =
sp = localStartParameters(runConfiguration); qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
} else if (qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) { sp.startMode = StartLocal;
sp = remoteLinuxStartParameters(runConfiguration); sp.environment = rc1->environment();
sp.workingDirectory = rc1->workingDirectory();
sp.debuggee = rc1->executable();
sp.debuggeeArgs = rc1->commandLineArguments();
sp.displayName = rc1->displayName();
sp.connParams.host = QLatin1String("localhost");
sp.connParams.port = rc1->qmlDebugServerPort();
} else if (RemoteLinux::RemoteLinuxRunConfiguration *rc2 =
qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
sp.startMode = StartRemote;
sp.debuggee = rc2->remoteExecutableFilePath();
sp.debuggeeArgs = rc2->arguments();
sp.connParams = rc2->deviceConfig()->sshParameters();
sp.analyzerCmdPrefix = rc2->commandPrefix();
sp.displayName = rc2->displayName();
} else { } else {
// Might be S60DeviceRunfiguration, or something else ... // Might be S60DeviceRunfiguration, or something else ...
//sp.startMode = StartRemote; //sp.startMode = StartRemote;
@@ -159,7 +134,6 @@ RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration
IAnalyzerTool *tool = AnalyzerManager::toolFromId(mode.toLatin1()); IAnalyzerTool *tool = AnalyzerManager::toolFromId(mode.toLatin1());
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration); AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration);
QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt())); QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
//m_isRunning = true;
return rc; return rc;
} }
@@ -214,7 +188,7 @@ static void startRemoteTool(IAnalyzerTool *tool, StartMode mode)
//m_currentRunControl = rc; //m_currentRunControl = rc;
QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt())); QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
ProjectExplorer::ProjectExplorerPlugin::instance()->startRunControl(rc, tool->id()); ProjectExplorerPlugin::instance()->startRunControl(rc, tool->id());
} }
void ValgrindPlugin::startValgrindTool(IAnalyzerTool *tool, StartMode mode) void ValgrindPlugin::startValgrindTool(IAnalyzerTool *tool, StartMode mode)