analyzer: remove shadowed start parameters

Also, use only one Tool for all Qml profiling.

Change-Id: Ic79d0c3b8781f4dffd8e0cd77af014bf008f4c2e
Reviewed-on: http://codereview.qt.nokia.com/1157
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2011-07-05 12:14:41 +02:00
committed by hjk
parent a89158b887
commit 010d038f90
7 changed files with 71 additions and 35 deletions

View File

@@ -51,7 +51,7 @@ private:
// Special values for currently used modes. // Special values for currently used modes.
// Their meaning is interpreted by the individual tools. // Their meaning is interpreted by the individual tools.
enum { StartLocal = -1, StartRemote = -2 }; enum { StartLocal = -1, StartRemote = -2, StartQml = -3 };
namespace Constants { namespace Constants {

View File

@@ -44,4 +44,11 @@ IAnalyzerEngine::IAnalyzerEngine(IAnalyzerTool *tool, const AnalyzerStartParamet
m_tool = tool; m_tool = tool;
} }
IAnalyzerEngine::IAnalyzerEngine(IAnalyzerTool *tool,
ProjectExplorer::RunConfiguration *runConfiguration)
{
m_runConfig = runConfiguration;
m_tool = tool;
}
} // namespace Analyzer } // namespace Analyzer

View File

@@ -65,6 +65,8 @@ class ANALYZER_EXPORT IAnalyzerEngine : public QObject
public: public:
IAnalyzerEngine(IAnalyzerTool *tool, const AnalyzerStartParameters &sp, IAnalyzerEngine(IAnalyzerTool *tool, const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0); ProjectExplorer::RunConfiguration *runConfiguration = 0);
IAnalyzerEngine(IAnalyzerTool *tool,
ProjectExplorer::RunConfiguration *runConfiguration);
/// Start analyzation process. /// Start analyzation process.
virtual void start() = 0; virtual void start() = 0;

View File

@@ -46,11 +46,17 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <coreplugin/helpmanager.h> #include <coreplugin/helpmanager.h>
#include <qmlprojectmanager/qmlprojectrunconfiguration.h>
#include <projectexplorer/localapplicationruncontrol.h>
#include <projectexplorer/applicationrunconfiguration.h>
#include <qt4projectmanager/qt-s60/s60devicedebugruncontrol.h>
#include <qt4projectmanager/qt-s60/s60devicerunconfiguration.h>
#include <QtGui/QMainWindow> #include <QtGui/QMainWindow>
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>
using namespace Analyzer; using namespace Analyzer;
using namespace ProjectExplorer;
namespace QmlProfiler { namespace QmlProfiler {
namespace Internal { namespace Internal {
@@ -67,12 +73,11 @@ public:
bool attach(const QString &address, uint port); bool attach(const QString &address, uint port);
static AbstractQmlProfilerRunner *createRunner(ProjectExplorer::RunConfiguration *runConfiguration, static AbstractQmlProfilerRunner *createRunner(ProjectExplorer::RunConfiguration *runConfiguration,
const AnalyzerStartParameters &m_params,
QObject *parent); QObject *parent);
QmlProfilerEngine *q; QmlProfilerEngine *q;
AnalyzerStartParameters m_params; //AnalyzerStartParameters m_params;
AbstractQmlProfilerRunner *m_runner; AbstractQmlProfilerRunner *m_runner;
bool m_running; bool m_running;
bool m_fetchingData; bool m_fetchingData;
@@ -80,28 +85,38 @@ public:
}; };
AbstractQmlProfilerRunner * AbstractQmlProfilerRunner *
QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunConfiguration *configuration, QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunConfiguration *runConfiguration,
const AnalyzerStartParameters &m_params,
QObject *parent) QObject *parent)
{ {
AbstractQmlProfilerRunner *runner = 0; AbstractQmlProfilerRunner *runner = 0;
if (m_params.startMode == StartLocal) { if (QmlProjectManager::QmlProjectRunConfiguration *rc1 =
LocalQmlProfilerRunner::Configuration configuration; qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration)) {
configuration.executable = m_params.debuggee; // This is a "plain" .qmlproject.
configuration.executableArguments = m_params.debuggeeArgs; LocalQmlProfilerRunner::Configuration conf;
configuration.workingDirectory = m_params.workingDirectory; conf.executable = rc1->observerPath();
configuration.environment = m_params.environment; conf.executableArguments = rc1->viewerArguments();
configuration.port = m_params.connParams.port; conf.workingDirectory = rc1->workingDirectory();
conf.environment = rc1->environment();
runner = new LocalQmlProfilerRunner(configuration, parent); conf.port = rc1->qmlDebugServerPort();
} else if (m_params.startMode == StartRemote) { runner = new LocalQmlProfilerRunner(conf, parent);
if (Qt4ProjectManager::S60DeviceRunConfiguration *s60Config } else if (LocalApplicationRunConfiguration *rc2 =
= qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration*>(configuration)) { qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
runner = new CodaQmlProfilerRunner(s60Config, parent); // FIXME: Check.
} else if (RemoteLinux::RemoteLinuxRunConfiguration *rmConfig LocalQmlProfilerRunner::Configuration conf;
= qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration*>(configuration)){ conf.executable = rc2->executable();
runner = new RemoteLinuxQmlProfilerRunner(rmConfig, parent); conf.executableArguments = rc2->commandLineArguments();
} conf.workingDirectory = rc2->workingDirectory();
conf.environment = rc2->environment();
conf.port = rc2->qmlDebugServerPort();
runner = new LocalQmlProfilerRunner(conf, parent);
} else if (Qt4ProjectManager::S60DeviceRunConfiguration *s60Config =
qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration*>(runConfiguration)) {
runner = new CodaQmlProfilerRunner(s60Config, parent);
} else if (RemoteLinux::RemoteLinuxRunConfiguration *rmConfig =
qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
runner = new RemoteLinuxQmlProfilerRunner(rmConfig, parent);
} else {
QTC_ASSERT(false, /**/);
} }
return runner; return runner;
} }
@@ -110,12 +125,11 @@ QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunCo
// QmlProfilerEngine // QmlProfilerEngine
// //
QmlProfilerEngine::QmlProfilerEngine(IAnalyzerTool *tool, const AnalyzerStartParameters &sp, QmlProfilerEngine::QmlProfilerEngine(IAnalyzerTool *tool,
ProjectExplorer::RunConfiguration *runConfiguration) ProjectExplorer::RunConfiguration *runConfiguration)
: IAnalyzerEngine(tool, sp, runConfiguration) : IAnalyzerEngine(tool, runConfiguration)
, d(new QmlProfilerEnginePrivate(this)) , d(new QmlProfilerEnginePrivate(this))
{ {
d->m_params = sp;
d->m_running = false; d->m_running = false;
d->m_fetchingData = false; d->m_fetchingData = false;
d->m_delayedDelete = false; d->m_delayedDelete = false;
@@ -131,8 +145,8 @@ QmlProfilerEngine::~QmlProfilerEngine()
void QmlProfilerEngine::start() void QmlProfilerEngine::start()
{ {
QTC_ASSERT(!d->m_runner, return); QTC_ASSERT(!d->m_runner, return);
d->m_runner = QmlProfilerEnginePrivate::createRunner(runConfiguration(), d->m_params, this); d->m_runner = QmlProfilerEnginePrivate::createRunner(runConfiguration(), this);
QTC_ASSERT(d->m_runner, return);
connect(d->m_runner, SIGNAL(stopped()), this, SLOT(stopped())); connect(d->m_runner, SIGNAL(stopped()), this, SLOT(stopped()));
connect(d->m_runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)), connect(d->m_runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)),

View File

@@ -45,7 +45,7 @@ class QmlProfilerEngine : public Analyzer::IAnalyzerEngine
Q_OBJECT Q_OBJECT
public: public:
QmlProfilerEngine(Analyzer::IAnalyzerTool *tool, const Analyzer::AnalyzerStartParameters &sp, QmlProfilerEngine(Analyzer::IAnalyzerTool *tool,
ProjectExplorer::RunConfiguration *runConfiguration); ProjectExplorer::RunConfiguration *runConfiguration);
~QmlProfilerEngine(); ~QmlProfilerEngine();

View File

@@ -171,7 +171,7 @@ IAnalyzerTool::ToolMode QmlProfilerTool::toolMode() const
IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp, IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration) ProjectExplorer::RunConfiguration *runConfiguration)
{ {
QmlProfilerEngine *engine = new QmlProfilerEngine(this, sp, runConfiguration); QmlProfilerEngine *engine = new QmlProfilerEngine(this, runConfiguration);
// Check minimum Qt Version. We cannot really be sure what the Qt version // Check minimum Qt Version. We cannot really be sure what the Qt version
// at runtime is, but guess that the active build configuraiton has been used. // at runtime is, but guess that the active build configuraiton has been used.
@@ -201,6 +201,7 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp
} }
} }
// FIXME: Check that there's something sensible in sp.connParams
if (d->m_connectMode == QmlProfilerToolPrivate::TcpConnection) { if (d->m_connectMode == QmlProfilerToolPrivate::TcpConnection) {
d->m_tcpHost = sp.connParams.host; d->m_tcpHost = sp.connParams.host;
d->m_tcpPort = sp.connParams.port; d->m_tcpPort = sp.connParams.port;

View File

@@ -44,6 +44,8 @@
#include <remotelinux/linuxdeviceconfiguration.h> #include <remotelinux/linuxdeviceconfiguration.h>
#include <remotelinux/remotelinuxrunconfiguration.h> #include <remotelinux/remotelinuxrunconfiguration.h>
#include <qt4projectmanager/qt-s60/s60devicedebugruncontrol.h>
#include <qt4projectmanager/qt-s60/s60devicerunconfiguration.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -62,26 +64,30 @@ QmlProjectAnalyzerRunControlFactory::QmlProjectAnalyzerRunControlFactory(QObject
bool QmlProjectAnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const bool QmlProjectAnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const
{ {
// FIXME: Should this just accept all mode == QLatin1String("QmlProfiler"); ?
if (qobject_cast<QmlProjectRunConfiguration *>(runConfiguration)) if (qobject_cast<QmlProjectRunConfiguration *>(runConfiguration))
return mode == QLatin1String("QmlProfiler"); return mode == QLatin1String("QmlProfiler");
if (qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) if (qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration))
return mode == QLatin1String("QmlProfiler"); return mode == QLatin1String("QmlProfiler");
if (qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) if (qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration))
return mode == QLatin1String("QmlProfiler"); return mode == QLatin1String("QmlProfiler");
if (qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration *>(runConfiguration))
return mode == QLatin1String("QmlProfiler");
return false; return false;
} }
RunControl *QmlProjectAnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode) RunControl *QmlProjectAnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode)
{ {
QTC_ASSERT(canRun(runConfiguration, mode), return 0); QTC_ASSERT(canRun(runConfiguration, mode), return 0);
AnalyzerStartParameters sp; AnalyzerStartParameters sp;
sp.toolId = "QmlProfiler"; sp.toolId = "QmlProfiler";
sp.startMode = StartQml; // FIXME: The parameter struct is not needed/not used.
// FIXME: This is only used to communicate the connParams settings.
if (QmlProjectRunConfiguration *rc1 = if (QmlProjectRunConfiguration *rc1 =
qobject_cast<QmlProjectRunConfiguration *>(runConfiguration)) { qobject_cast<QmlProjectRunConfiguration *>(runConfiguration)) {
// This is a "plain" .qmlproject. // This is a "plain" .qmlproject.
sp.startMode = StartLocal;
sp.environment = rc1->environment(); sp.environment = rc1->environment();
sp.workingDirectory = rc1->workingDirectory(); sp.workingDirectory = rc1->workingDirectory();
sp.debuggee = rc1->observerPath(); sp.debuggee = rc1->observerPath();
@@ -91,7 +97,6 @@ RunControl *QmlProjectAnalyzerRunControlFactory::create(RunConfiguration *runCon
sp.connParams.port = rc1->qmlDebugServerPort(); sp.connParams.port = rc1->qmlDebugServerPort();
} else if (LocalApplicationRunConfiguration *rc2 = } else if (LocalApplicationRunConfiguration *rc2 =
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) { qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
sp.startMode = StartLocal;
sp.environment = rc2->environment(); sp.environment = rc2->environment();
sp.workingDirectory = rc2->workingDirectory(); sp.workingDirectory = rc2->workingDirectory();
sp.debuggee = rc2->executable(); sp.debuggee = rc2->executable();
@@ -101,15 +106,22 @@ RunControl *QmlProjectAnalyzerRunControlFactory::create(RunConfiguration *runCon
sp.connParams.port = rc2->qmlDebugServerPort(); sp.connParams.port = rc2->qmlDebugServerPort();
} else if (RemoteLinux::RemoteLinuxRunConfiguration *rc3 = } else if (RemoteLinux::RemoteLinuxRunConfiguration *rc3 =
qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) { qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
sp.startMode = StartRemote;
sp.debuggee = rc3->remoteExecutableFilePath(); sp.debuggee = rc3->remoteExecutableFilePath();
sp.debuggeeArgs = rc3->arguments(); sp.debuggeeArgs = rc3->arguments();
sp.connParams = rc3->deviceConfig()->sshParameters(); sp.connParams = rc3->deviceConfig()->sshParameters();
sp.analyzerCmdPrefix = rc3->commandPrefix(); sp.analyzerCmdPrefix = rc3->commandPrefix();
sp.displayName = rc3->displayName(); sp.displayName = rc3->displayName();
} else if (Qt4ProjectManager::S60DeviceRunConfiguration *rc4 =
qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration *>(runConfiguration)) {
//sp.environment = rc4->environment();
//sp.workingDirectory = rc4->workingDirectory();
//sp.debuggee = rc4->executable();
sp.debuggeeArgs = rc4->commandLineArguments();
sp.displayName = rc4->displayName();
sp.connParams.host = QLatin1String("localhost");
sp.connParams.port = rc4->qmlDebugServerPort();
} else { } else {
// Might be S60DeviceRunfiguration, or something else ... ? // What could that be?
//sp.startMode = StartRemote;
QTC_ASSERT(false, return 0); QTC_ASSERT(false, return 0);
} }