diff --git a/src/plugins/debugger/analyzer/analyzerruncontrol.h b/src/plugins/debugger/analyzer/analyzerruncontrol.h index 97ce85e69a9..2fc47727dbd 100644 --- a/src/plugins/debugger/analyzer/analyzerruncontrol.h +++ b/src/plugins/debugger/analyzer/analyzerruncontrol.h @@ -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: diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp index 3be605542ef..bffe0d23c80 100644 --- a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp +++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp @@ -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() diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.h b/src/plugins/qmlprofiler/localqmlprofilerrunner.h index 0122771b57b..bcbd996af89 100644 --- a/src/plugins/qmlprofiler/localqmlprofilerrunner.h +++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.h @@ -30,6 +30,7 @@ #include #include #include +#include namespace Debugger { class AnalyzerRunControl; @@ -66,6 +67,7 @@ private: Configuration m_configuration; ProjectExplorer::ApplicationLauncher m_launcher; + QmlDebug::QmlOutputParser m_outputParser; }; } // namespace QmlProfiler diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp index 55a47e3f59d..224e5652cf7 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp @@ -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(); diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h index b1a1f121fea..49716c05a44 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h @@ -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;