QmlProfiler: Move output parser into LocalQmlProfilerRunner

In the general case we don't want the QmlProfilerRunControl to parse
the QML debug port from the application output. As for most platforms
the ports are mapped via some remote connection mechanism the parsed
port is almost certainly wrong.

In the case of local connections, however, the port is actually
correct, so we keep the output parser in the LocalQmlProfilerRunner.

Change-Id: Ifdaae85196d8b034e67bc2ba0b8c05be980b62e5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Ulf Hermann
2016-08-25 15:47:32 +02:00
parent 1ca42e24cb
commit 06b2ff604a
5 changed files with 37 additions and 29 deletions

View File

@@ -47,6 +47,7 @@ public:
AnalyzerRunControl(ProjectExplorer::RunConfiguration *runConfiguration, Core::Id runMode);
virtual void notifyRemoteSetupDone(Utils::Port) {}
virtual void notifyRemoteSetupFailed(const QString &) {}
virtual void notifyRemoteFinished() {}
signals:

View File

@@ -79,6 +79,35 @@ LocalQmlProfilerRunner::LocalQmlProfilerRunner(const Configuration &configuratio
this, &LocalQmlProfilerRunner::start);
connect(runControl, &RunControl::finished,
this, &LocalQmlProfilerRunner::stop);
m_outputParser.setNoOutputText(ApplicationLauncher::msgWinCannotRetrieveDebuggingOutput());
connect(runControl, &Debugger::AnalyzerRunControl::appendMessageRequested,
this, [this](RunControl *runControl, const QString &msg, Utils::OutputFormat format) {
Q_UNUSED(runControl);
Q_UNUSED(format);
m_outputParser.processOutput(msg);
});
connect(&m_outputParser, &QmlDebug::QmlOutputParser::waitingForConnectionOnPort,
runControl, [this, runControl](Utils::Port port) {
runControl->notifyRemoteSetupDone(port);
});
connect(&m_outputParser, &QmlDebug::QmlOutputParser::noOutputMessage,
runControl, [this, runControl]() {
runControl->notifyRemoteSetupDone(Utils::Port());
});
connect(&m_outputParser, &QmlDebug::QmlOutputParser::connectingToSocketMessage,
runControl, [this, runControl]() {
runControl->notifyRemoteSetupDone(Utils::Port());
});
connect(&m_outputParser, &QmlDebug::QmlOutputParser::errorMessage,
runControl, [this, runControl](const QString &message) {
runControl->notifyRemoteSetupFailed(message);
});
}
void LocalQmlProfilerRunner::start()

View File

@@ -30,6 +30,7 @@
#include <utils/port.h>
#include <projectexplorer/applicationlauncher.h>
#include <projectexplorer/runnables.h>
#include <qmldebug/qmloutputparser.h>
namespace Debugger {
class AnalyzerRunControl;
@@ -66,6 +67,7 @@ private:
Configuration m_configuration;
ProjectExplorer::ApplicationLauncher m_launcher;
QmlDebug::QmlOutputParser m_outputParser;
};
} // namespace QmlProfiler

View File

@@ -70,7 +70,6 @@ public:
Internal::QmlProfilerTool *m_tool = 0;
QmlProfilerStateManager *m_profilerState = 0;
QTimer m_noDebugOutputTimer;
QmlDebug::QmlOutputParser m_outputParser;
bool m_running = false;
};
@@ -90,18 +89,9 @@ QmlProfilerRunControl::QmlProfilerRunControl(RunConfiguration *runConfiguration,
// (application output might be redirected / blocked)
d->m_noDebugOutputTimer.setSingleShot(true);
d->m_noDebugOutputTimer.setInterval(4000);
connect(&d->m_noDebugOutputTimer, &QTimer::timeout,
this, [this](){processIsRunning(Utils::Port());});
d->m_outputParser.setNoOutputText(ApplicationLauncher::msgWinCannotRetrieveDebuggingOutput());
connect(&d->m_outputParser, &QmlDebug::QmlOutputParser::waitingForConnectionOnPort,
this, &QmlProfilerRunControl::processIsRunning);
connect(&d->m_outputParser, &QmlDebug::QmlOutputParser::noOutputMessage,
this, [this](){processIsRunning(Utils::Port());});
connect(&d->m_outputParser, &QmlDebug::QmlOutputParser::connectingToSocketMessage,
this, [this](){processIsRunning(Utils::Port());});
connect(&d->m_outputParser, &QmlDebug::QmlOutputParser::errorMessage,
this, &QmlProfilerRunControl::wrongSetupMessageBox);
connect(&d->m_noDebugOutputTimer, &QTimer::timeout, this, [this]() {
notifyRemoteSetupDone(Utils::Port());
});
}
QmlProfilerRunControl::~QmlProfilerRunControl()
@@ -203,13 +193,7 @@ void QmlProfilerRunControl::cancelProcess()
emit finished();
}
void QmlProfilerRunControl::appendMessage(const QString &msg, Utils::OutputFormat format)
{
AnalyzerRunControl::appendMessage(msg, format);
d->m_outputParser.processOutput(msg);
}
void QmlProfilerRunControl::wrongSetupMessageBox(const QString &errorMessage)
void QmlProfilerRunControl::notifyRemoteSetupFailed(const QString &errorMessage)
{
QMessageBox *infoBox = new QMessageBox(ICore::mainWindow());
infoBox->setIcon(QMessageBox::Critical);
@@ -242,12 +226,6 @@ void QmlProfilerRunControl::wrongSetupMessageBoxFinished(int button)
}
void QmlProfilerRunControl::notifyRemoteSetupDone(Utils::Port port)
{
d->m_noDebugOutputTimer.stop();
emit processRunning(port);
}
void QmlProfilerRunControl::processIsRunning(Utils::Port port)
{
d->m_noDebugOutputTimer.stop();

View File

@@ -46,21 +46,19 @@ public:
void registerProfilerStateManager( QmlProfilerStateManager *profilerState );
void notifyRemoteSetupDone(Utils::Port port) override;
void notifyRemoteSetupFailed(const QString &errorMessage) override;
void start() override;
StopResult stop() override;
bool isRunning() const override;
void cancelProcess();
void notifyRemoteFinished() override;
void appendMessage(const QString &msg, Utils::OutputFormat format) override;
bool supportsReRunning() const override { return false; }
signals:
void processRunning(Utils::Port port);
private:
void wrongSetupMessageBox(const QString &errorMessage);
void wrongSetupMessageBoxFinished(int);
void processIsRunning(Utils::Port port);
void profilerStateChanged();
class QmlProfilerRunControlPrivate;