forked from qt-creator/qt-creator
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:
@@ -51,7 +51,7 @@ private:
|
||||
|
||||
// Special values for currently used modes.
|
||||
// Their meaning is interpreted by the individual tools.
|
||||
enum { StartLocal = -1, StartRemote = -2 };
|
||||
enum { StartLocal = -1, StartRemote = -2, StartQml = -3 };
|
||||
|
||||
namespace Constants {
|
||||
|
||||
|
@@ -44,4 +44,11 @@ IAnalyzerEngine::IAnalyzerEngine(IAnalyzerTool *tool, const AnalyzerStartParamet
|
||||
m_tool = tool;
|
||||
}
|
||||
|
||||
IAnalyzerEngine::IAnalyzerEngine(IAnalyzerTool *tool,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration)
|
||||
{
|
||||
m_runConfig = runConfiguration;
|
||||
m_tool = tool;
|
||||
}
|
||||
|
||||
} // namespace Analyzer
|
||||
|
@@ -65,6 +65,8 @@ class ANALYZER_EXPORT IAnalyzerEngine : public QObject
|
||||
public:
|
||||
IAnalyzerEngine(IAnalyzerTool *tool, const AnalyzerStartParameters &sp,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
||||
IAnalyzerEngine(IAnalyzerTool *tool,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration);
|
||||
|
||||
/// Start analyzation process.
|
||||
virtual void start() = 0;
|
||||
|
@@ -46,11 +46,17 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/qtcassert.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/QMessageBox>
|
||||
|
||||
using namespace Analyzer;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
@@ -67,12 +73,11 @@ public:
|
||||
|
||||
bool attach(const QString &address, uint port);
|
||||
static AbstractQmlProfilerRunner *createRunner(ProjectExplorer::RunConfiguration *runConfiguration,
|
||||
const AnalyzerStartParameters &m_params,
|
||||
QObject *parent);
|
||||
|
||||
QmlProfilerEngine *q;
|
||||
|
||||
AnalyzerStartParameters m_params;
|
||||
//AnalyzerStartParameters m_params;
|
||||
AbstractQmlProfilerRunner *m_runner;
|
||||
bool m_running;
|
||||
bool m_fetchingData;
|
||||
@@ -80,28 +85,38 @@ public:
|
||||
};
|
||||
|
||||
AbstractQmlProfilerRunner *
|
||||
QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunConfiguration *configuration,
|
||||
const AnalyzerStartParameters &m_params,
|
||||
QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunConfiguration *runConfiguration,
|
||||
QObject *parent)
|
||||
{
|
||||
AbstractQmlProfilerRunner *runner = 0;
|
||||
if (m_params.startMode == StartLocal) {
|
||||
LocalQmlProfilerRunner::Configuration configuration;
|
||||
configuration.executable = m_params.debuggee;
|
||||
configuration.executableArguments = m_params.debuggeeArgs;
|
||||
configuration.workingDirectory = m_params.workingDirectory;
|
||||
configuration.environment = m_params.environment;
|
||||
configuration.port = m_params.connParams.port;
|
||||
|
||||
runner = new LocalQmlProfilerRunner(configuration, parent);
|
||||
} else if (m_params.startMode == StartRemote) {
|
||||
if (Qt4ProjectManager::S60DeviceRunConfiguration *s60Config
|
||||
= qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration*>(configuration)) {
|
||||
runner = new CodaQmlProfilerRunner(s60Config, parent);
|
||||
} else if (RemoteLinux::RemoteLinuxRunConfiguration *rmConfig
|
||||
= qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration*>(configuration)){
|
||||
runner = new RemoteLinuxQmlProfilerRunner(rmConfig, parent);
|
||||
}
|
||||
if (QmlProjectManager::QmlProjectRunConfiguration *rc1 =
|
||||
qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration)) {
|
||||
// This is a "plain" .qmlproject.
|
||||
LocalQmlProfilerRunner::Configuration conf;
|
||||
conf.executable = rc1->observerPath();
|
||||
conf.executableArguments = rc1->viewerArguments();
|
||||
conf.workingDirectory = rc1->workingDirectory();
|
||||
conf.environment = rc1->environment();
|
||||
conf.port = rc1->qmlDebugServerPort();
|
||||
runner = new LocalQmlProfilerRunner(conf, parent);
|
||||
} else if (LocalApplicationRunConfiguration *rc2 =
|
||||
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
|
||||
// FIXME: Check.
|
||||
LocalQmlProfilerRunner::Configuration conf;
|
||||
conf.executable = rc2->executable();
|
||||
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;
|
||||
}
|
||||
@@ -110,12 +125,11 @@ QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunCo
|
||||
// QmlProfilerEngine
|
||||
//
|
||||
|
||||
QmlProfilerEngine::QmlProfilerEngine(IAnalyzerTool *tool, const AnalyzerStartParameters &sp,
|
||||
QmlProfilerEngine::QmlProfilerEngine(IAnalyzerTool *tool,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration)
|
||||
: IAnalyzerEngine(tool, sp, runConfiguration)
|
||||
: IAnalyzerEngine(tool, runConfiguration)
|
||||
, d(new QmlProfilerEnginePrivate(this))
|
||||
{
|
||||
d->m_params = sp;
|
||||
d->m_running = false;
|
||||
d->m_fetchingData = false;
|
||||
d->m_delayedDelete = false;
|
||||
@@ -131,8 +145,8 @@ QmlProfilerEngine::~QmlProfilerEngine()
|
||||
void QmlProfilerEngine::start()
|
||||
{
|
||||
QTC_ASSERT(!d->m_runner, return);
|
||||
d->m_runner = QmlProfilerEnginePrivate::createRunner(runConfiguration(), d->m_params, this);
|
||||
QTC_ASSERT(d->m_runner, return);
|
||||
d->m_runner = QmlProfilerEnginePrivate::createRunner(runConfiguration(), this);
|
||||
|
||||
|
||||
connect(d->m_runner, SIGNAL(stopped()), this, SLOT(stopped()));
|
||||
connect(d->m_runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
|
||||
|
@@ -45,7 +45,7 @@ class QmlProfilerEngine : public Analyzer::IAnalyzerEngine
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QmlProfilerEngine(Analyzer::IAnalyzerTool *tool, const Analyzer::AnalyzerStartParameters &sp,
|
||||
QmlProfilerEngine(Analyzer::IAnalyzerTool *tool,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration);
|
||||
~QmlProfilerEngine();
|
||||
|
||||
|
@@ -171,7 +171,7 @@ IAnalyzerTool::ToolMode QmlProfilerTool::toolMode() const
|
||||
IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp,
|
||||
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
|
||||
// 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) {
|
||||
d->m_tcpHost = sp.connParams.host;
|
||||
d->m_tcpPort = sp.connParams.port;
|
||||
|
@@ -44,6 +44,8 @@
|
||||
|
||||
#include <remotelinux/linuxdeviceconfiguration.h>
|
||||
#include <remotelinux/remotelinuxrunconfiguration.h>
|
||||
#include <qt4projectmanager/qt-s60/s60devicedebugruncontrol.h>
|
||||
#include <qt4projectmanager/qt-s60/s60devicerunconfiguration.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -62,26 +64,30 @@ QmlProjectAnalyzerRunControlFactory::QmlProjectAnalyzerRunControlFactory(QObject
|
||||
|
||||
bool QmlProjectAnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const
|
||||
{
|
||||
// FIXME: Should this just accept all mode == QLatin1String("QmlProfiler"); ?
|
||||
if (qobject_cast<QmlProjectRunConfiguration *>(runConfiguration))
|
||||
return mode == QLatin1String("QmlProfiler");
|
||||
if (qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration))
|
||||
return mode == QLatin1String("QmlProfiler");
|
||||
if (qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration))
|
||||
return mode == QLatin1String("QmlProfiler");
|
||||
if (qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration *>(runConfiguration))
|
||||
return mode == QLatin1String("QmlProfiler");
|
||||
return false;
|
||||
}
|
||||
|
||||
RunControl *QmlProjectAnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode)
|
||||
{
|
||||
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
|
||||
|
||||
AnalyzerStartParameters sp;
|
||||
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 =
|
||||
qobject_cast<QmlProjectRunConfiguration *>(runConfiguration)) {
|
||||
// This is a "plain" .qmlproject.
|
||||
sp.startMode = StartLocal;
|
||||
sp.environment = rc1->environment();
|
||||
sp.workingDirectory = rc1->workingDirectory();
|
||||
sp.debuggee = rc1->observerPath();
|
||||
@@ -91,7 +97,6 @@ RunControl *QmlProjectAnalyzerRunControlFactory::create(RunConfiguration *runCon
|
||||
sp.connParams.port = rc1->qmlDebugServerPort();
|
||||
} else if (LocalApplicationRunConfiguration *rc2 =
|
||||
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
|
||||
sp.startMode = StartLocal;
|
||||
sp.environment = rc2->environment();
|
||||
sp.workingDirectory = rc2->workingDirectory();
|
||||
sp.debuggee = rc2->executable();
|
||||
@@ -101,15 +106,22 @@ RunControl *QmlProjectAnalyzerRunControlFactory::create(RunConfiguration *runCon
|
||||
sp.connParams.port = rc2->qmlDebugServerPort();
|
||||
} else if (RemoteLinux::RemoteLinuxRunConfiguration *rc3 =
|
||||
qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
|
||||
sp.startMode = StartRemote;
|
||||
sp.debuggee = rc3->remoteExecutableFilePath();
|
||||
sp.debuggeeArgs = rc3->arguments();
|
||||
sp.connParams = rc3->deviceConfig()->sshParameters();
|
||||
sp.analyzerCmdPrefix = rc3->commandPrefix();
|
||||
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 {
|
||||
// Might be S60DeviceRunfiguration, or something else ... ?
|
||||
//sp.startMode = StartRemote;
|
||||
// What could that be?
|
||||
QTC_ASSERT(false, return 0);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user