forked from qt-creator/qt-creator
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:
@@ -64,7 +64,7 @@ namespace Internal {
|
||||
class QmlProfilerEngine::QmlProfilerEnginePrivate
|
||||
{
|
||||
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; }
|
||||
|
||||
bool attach(const QString &address, uint port);
|
||||
@@ -78,7 +78,6 @@ public:
|
||||
AbstractQmlProfilerRunner *m_runner;
|
||||
QTimer m_noDebugOutputTimer;
|
||||
QmlDebug::QmlOutputParser m_outputParser;
|
||||
const AnalyzerStartParameters sp;
|
||||
};
|
||||
|
||||
AbstractQmlProfilerRunner *
|
||||
@@ -117,7 +116,7 @@ QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunCo
|
||||
const ProjectExplorer::IDevice::ConstPtr device =
|
||||
ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit());
|
||||
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);
|
||||
return runner;
|
||||
}
|
||||
@@ -126,12 +125,13 @@ QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunCo
|
||||
// QmlProfilerEngine
|
||||
//
|
||||
|
||||
QmlProfilerEngine::QmlProfilerEngine(IAnalyzerTool *tool,
|
||||
const Analyzer::AnalyzerStartParameters &sp,
|
||||
QmlProfilerEngine::QmlProfilerEngine(const Analyzer::AnalyzerStartParameters &sp,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration)
|
||||
: IAnalyzerEngine(tool, sp, runConfiguration)
|
||||
, d(new QmlProfilerEnginePrivate(this, sp))
|
||||
: d(new QmlProfilerEnginePrivate(this))
|
||||
{
|
||||
m_sp = sp;
|
||||
m_runConfig = runConfiguration;
|
||||
|
||||
d->m_profilerState = 0;
|
||||
|
||||
// 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) {
|
||||
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)),
|
||||
this, SLOT(logApplicationMessage(QString,Utils::OutputFormat)));
|
||||
d->m_runner->start();
|
||||
d->m_noDebugOutputTimer.start();
|
||||
} else if (d->sp.startMode == StartQmlRemote) {
|
||||
} else if (m_sp.startMode == StartQmlRemote) {
|
||||
d->m_noDebugOutputTimer.start();
|
||||
} else {
|
||||
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);
|
||||
|
||||
switch (d->m_profilerState->currentState()) {
|
||||
case QmlProfilerStateManager::AppRunning : {
|
||||
if (success)
|
||||
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying);
|
||||
else
|
||||
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppKilled);
|
||||
AnalyzerManager::stopTool();
|
||||
|
||||
emit finished();
|
||||
|
@@ -42,8 +42,7 @@ class QmlProfilerEngine : public Analyzer::IAnalyzerEngine
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QmlProfilerEngine(Analyzer::IAnalyzerTool *tool,
|
||||
const Analyzer::AnalyzerStartParameters &sp,
|
||||
QmlProfilerEngine(const Analyzer::AnalyzerStartParameters &sp,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration);
|
||||
~QmlProfilerEngine();
|
||||
|
||||
@@ -62,7 +61,7 @@ public slots:
|
||||
void stop();
|
||||
|
||||
private slots:
|
||||
void processEnded();
|
||||
void notifyRemoteFinished(bool success = true);
|
||||
|
||||
void cancelProcess();
|
||||
void logApplicationMessage(const QString &msg, Utils::OutputFormat format);
|
||||
|
@@ -228,7 +228,7 @@ IAnalyzerTool::ToolMode QmlProfilerTool::toolMode() const
|
||||
IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp,
|
||||
RunConfiguration *runConfiguration)
|
||||
{
|
||||
QmlProfilerEngine *engine = new QmlProfilerEngine(this, sp, runConfiguration);
|
||||
QmlProfilerEngine *engine = new QmlProfilerEngine(sp, runConfiguration);
|
||||
|
||||
engine->registerProfilerStateManager(d->m_profilerState);
|
||||
|
||||
|
Reference in New Issue
Block a user