QmlProfiler: adapt to changes in IAnalyzer interface

Said changes are introduced in patch
I5711f5a1c3a49abce23f2d78b0c4de19933e9c19 of QtCreator (current master)

Change-Id: I51e8a6d41f4cc1ce599941499aa5043796fff8a7
Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
This commit is contained in:
Christiaan Janssen
2013-07-18 16:45:48 +02:00
parent 832e2b8d39
commit bbaa5efb6c
3 changed files with 17 additions and 15 deletions

View File

@@ -64,7 +64,7 @@ namespace Internal {
class QmlProfilerEngine::QmlProfilerEnginePrivate class QmlProfilerEngine::QmlProfilerEnginePrivate
{ {
public: public:
QmlProfilerEnginePrivate(QmlProfilerEngine *qq, const AnalyzerStartParameters &sp) : q(qq), m_runner(0), sp(sp) {} QmlProfilerEnginePrivate(QmlProfilerEngine *qq) : q(qq), m_runner(0) {}
~QmlProfilerEnginePrivate() { delete m_runner; } ~QmlProfilerEnginePrivate() { delete m_runner; }
bool attach(const QString &address, uint port); bool attach(const QString &address, uint port);
@@ -78,7 +78,6 @@ public:
AbstractQmlProfilerRunner *m_runner; AbstractQmlProfilerRunner *m_runner;
QTimer m_noDebugOutputTimer; QTimer m_noDebugOutputTimer;
QmlDebug::QmlOutputParser m_outputParser; QmlDebug::QmlOutputParser m_outputParser;
const AnalyzerStartParameters sp;
}; };
AbstractQmlProfilerRunner * AbstractQmlProfilerRunner *
@@ -117,7 +116,7 @@ QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunCo
const ProjectExplorer::IDevice::ConstPtr device = const ProjectExplorer::IDevice::ConstPtr device =
ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit()); ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit());
QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return 0); QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return 0);
conf.port = sp.analyzerPort; conf.port = q->m_sp.analyzerPort;
runner = new LocalQmlProfilerRunner(conf, parent); runner = new LocalQmlProfilerRunner(conf, parent);
return runner; return runner;
} }
@@ -126,12 +125,13 @@ QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunCo
// QmlProfilerEngine // QmlProfilerEngine
// //
QmlProfilerEngine::QmlProfilerEngine(IAnalyzerTool *tool, QmlProfilerEngine::QmlProfilerEngine(const Analyzer::AnalyzerStartParameters &sp,
const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration) ProjectExplorer::RunConfiguration *runConfiguration)
: IAnalyzerEngine(tool, sp, runConfiguration) : d(new QmlProfilerEnginePrivate(this))
, d(new QmlProfilerEnginePrivate(this, sp))
{ {
m_sp = sp;
m_runConfig = runConfiguration;
d->m_profilerState = 0; d->m_profilerState = 0;
// Only wait 4 seconds for the 'Waiting for connection' on application output, then just try to connect // Only wait 4 seconds for the 'Waiting for connection' on application output, then just try to connect
@@ -189,12 +189,12 @@ bool QmlProfilerEngine::start()
} }
if (d->m_runner) { if (d->m_runner) {
connect(d->m_runner, SIGNAL(stopped()), this, SLOT(processEnded())); connect(d->m_runner, SIGNAL(stopped()), this, SLOT(notifyRemoteFinished()));
connect(d->m_runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)), connect(d->m_runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
this, SLOT(logApplicationMessage(QString,Utils::OutputFormat))); this, SLOT(logApplicationMessage(QString,Utils::OutputFormat)));
d->m_runner->start(); d->m_runner->start();
d->m_noDebugOutputTimer.start(); d->m_noDebugOutputTimer.start();
} else if (d->sp.startMode == StartQmlRemote) { } else if (m_sp.startMode == StartQmlRemote) {
d->m_noDebugOutputTimer.start(); d->m_noDebugOutputTimer.start();
} else { } else {
emit processRunning(startParameters().analyzerPort); emit processRunning(startParameters().analyzerPort);
@@ -230,13 +230,16 @@ void QmlProfilerEngine::stop()
} }
} }
void QmlProfilerEngine::processEnded() void QmlProfilerEngine::notifyRemoteFinished(bool success)
{ {
QTC_ASSERT(d->m_profilerState, return); QTC_ASSERT(d->m_profilerState, return);
switch (d->m_profilerState->currentState()) { switch (d->m_profilerState->currentState()) {
case QmlProfilerStateManager::AppRunning : { case QmlProfilerStateManager::AppRunning : {
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying); if (success)
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying);
else
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppKilled);
AnalyzerManager::stopTool(); AnalyzerManager::stopTool();
emit finished(); emit finished();

View File

@@ -42,8 +42,7 @@ class QmlProfilerEngine : public Analyzer::IAnalyzerEngine
Q_OBJECT Q_OBJECT
public: public:
QmlProfilerEngine(Analyzer::IAnalyzerTool *tool, QmlProfilerEngine(const Analyzer::AnalyzerStartParameters &sp,
const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration); ProjectExplorer::RunConfiguration *runConfiguration);
~QmlProfilerEngine(); ~QmlProfilerEngine();
@@ -62,7 +61,7 @@ public slots:
void stop(); void stop();
private slots: private slots:
void processEnded(); void notifyRemoteFinished(bool success = true);
void cancelProcess(); void cancelProcess();
void logApplicationMessage(const QString &msg, Utils::OutputFormat format); void logApplicationMessage(const QString &msg, Utils::OutputFormat format);

View File

@@ -228,7 +228,7 @@ IAnalyzerTool::ToolMode QmlProfilerTool::toolMode() const
IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp, IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp,
RunConfiguration *runConfiguration) RunConfiguration *runConfiguration)
{ {
QmlProfilerEngine *engine = new QmlProfilerEngine(this, sp, runConfiguration); QmlProfilerEngine *engine = new QmlProfilerEngine(sp, runConfiguration);
engine->registerProfilerStateManager(d->m_profilerState); engine->registerProfilerStateManager(d->m_profilerState);