Android: Add QmlServer data earlier to runControl

Instead of funneling it through custom signals. This makes it more similar
to the "Ports gathering ends before run control starts" setup.

Change-Id: Ic6910a5ef48c02333aa9a01745e2622a37853eb3
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-10-29 15:48:20 +01:00
parent 62dff704c8
commit b63dd3e6db
5 changed files with 12 additions and 16 deletions

View File

@@ -177,8 +177,8 @@ void AndroidDebugSupport::start()
} }
if (isQmlDebugging()) { if (isQmlDebugging()) {
qCDebug(androidDebugSupportLog) << "QML debugging enabled. QML server: " qCDebug(androidDebugSupportLog) << "QML debugging enabled. QML server: "
<< m_runner->qmlServer().toDisplayString(); << qmlChannel().toDisplayString();
setQmlServer(m_runner->qmlServer()); setQmlServer(qmlChannel());
//TODO: Not sure if these are the right paths. //TODO: Not sure if these are the right paths.
if (qtVersion) if (qtVersion)
addSearchDirectory(qtVersion->qmlPath()); addSearchDirectory(qtVersion->qmlPath());

View File

@@ -130,11 +130,10 @@ void AndroidRunner::qmlServerPortReady(Port port)
emit qmlServerReady(serverUrl); emit qmlServerReady(serverUrl);
} }
void AndroidRunner::remoteStarted(const Port &debugServerPort, const QUrl &qmlServer, qint64 pid) void AndroidRunner::remoteStarted(const Port &debugServerPort, qint64 pid)
{ {
m_pid = ProcessHandle(pid); m_pid = ProcessHandle(pid);
m_debugServerPort = debugServerPort; m_debugServerPort = debugServerPort;
m_qmlServer = qmlServer;
reportStarted(); reportStarted();
} }

View File

@@ -22,7 +22,6 @@ public:
explicit AndroidRunner(ProjectExplorer::RunControl *runControl); explicit AndroidRunner(ProjectExplorer::RunControl *runControl);
Utils::Port debugServerPort() const { return m_debugServerPort; } // GDB or LLDB Utils::Port debugServerPort() const { return m_debugServerPort; } // GDB or LLDB
QUrl qmlServer() const { return m_qmlServer; }
Utils::ProcessHandle pid() const { return m_pid; } Utils::ProcessHandle pid() const { return m_pid; }
void start() override; void start() override;
@@ -36,13 +35,12 @@ signals:
private: private:
void qmlServerPortReady(Utils::Port port); void qmlServerPortReady(Utils::Port port);
void remoteStarted(const Utils::Port &debugServerPort, const QUrl &qmlServer, qint64 pid); void remoteStarted(const Utils::Port &debugServerPort, qint64 pid);
void remoteFinished(const QString &errString); void remoteFinished(const QString &errString);
void remoteStdOut(const QString &output); void remoteStdOut(const QString &output);
void remoteStdErr(const QString &output); void remoteStdErr(const QString &output);
Utils::Port m_debugServerPort; Utils::Port m_debugServerPort;
QUrl m_qmlServer;
Utils::ProcessHandle m_pid; Utils::ProcessHandle m_pid;
QmlDebug::QmlOutputParser m_outputParser; QmlDebug::QmlOutputParser m_outputParser;
Tasking::TaskTreeRunner m_taskTreeRunner; Tasking::TaskTreeRunner m_taskTreeRunner;

View File

@@ -623,8 +623,8 @@ static ExecutableItem uploadDebugServerRecipe(const Storage<RunnerStorage> &stor
const auto onTempDebugServerPath = [storage, tempDebugServerPathStorage] { const auto onTempDebugServerPath = [storage, tempDebugServerPathStorage] {
const bool tempDirOK = !tempDebugServerPathStorage->isEmpty(); const bool tempDirOK = !tempDebugServerPathStorage->isEmpty();
if (tempDirOK) { if (tempDirOK) {
storage->m_glue->setStarted(s_localDebugServerPort, storage->m_qmlServer, storage->m_glue->runControl()->setQmlChannel(storage->m_qmlServer);
storage->m_processPID); storage->m_glue->setStarted(s_localDebugServerPort, storage->m_processPID);
} else { } else {
qCDebug(androidRunWorkerLog) << "Can not get temporary file name"; qCDebug(androidRunWorkerLog) << "Can not get temporary file name";
} }
@@ -826,8 +826,8 @@ static ExecutableItem pidRecipe(const Storage<RunnerStorage> &storage)
storage->m_processUser = processUser; storage->m_processUser = processUser;
qCDebug(androidRunWorkerLog) << "Process ID changed to:" << storage->m_processPID; qCDebug(androidRunWorkerLog) << "Process ID changed to:" << storage->m_processPID;
if (!storage->m_useCppDebugger) { if (!storage->m_useCppDebugger) {
storage->m_glue->setStarted(s_localDebugServerPort, storage->m_qmlServer, storage->m_glue->runControl()->setQmlChannel(storage->m_qmlServer);
storage->m_processPID); storage->m_glue->setStarted(s_localDebugServerPort, storage->m_processPID);
} }
return DoneResult::Success; return DoneResult::Success;
} }
@@ -874,10 +874,9 @@ void RunnerInterface::cancel()
emit canceled(); emit canceled();
} }
void RunnerInterface::setStarted(const Utils::Port &debugServerPort, const QUrl &qmlServer, void RunnerInterface::setStarted(const Port &debugServerPort, qint64 pid)
qint64 pid)
{ {
emit started(debugServerPort, qmlServer, pid); emit started(debugServerPort, pid);
} }
ExecutableItem runnerRecipe(const Storage<RunnerInterface> &glueStorage) ExecutableItem runnerRecipe(const Storage<RunnerInterface> &glueStorage)

View File

@@ -34,7 +34,7 @@ public:
void cancel(); void cancel();
// business logic -> GUI // business logic -> GUI
void setStarted(const Utils::Port &debugServerPort, const QUrl &qmlServer, qint64 pid); void setStarted(const Utils::Port &debugServerPort, qint64 pid);
void setFinished(const QString &errorMessage) { emit finished(errorMessage); } void setFinished(const QString &errorMessage) { emit finished(errorMessage); }
void addStdOut(const QString &data) { emit stdOut(data); } void addStdOut(const QString &data) { emit stdOut(data); }
void addStdErr(const QString &data) { emit stdErr(data); } void addStdErr(const QString &data) { emit stdErr(data); }
@@ -44,7 +44,7 @@ signals:
void canceled(); void canceled();
// business logic -> GUI // business logic -> GUI
void started(const Utils::Port &debugServerPort, const QUrl &qmlServer, qint64 pid); void started(const Utils::Port &debugServerPort, qint64 pid);
void finished(const QString &errorMessage); void finished(const QString &errorMessage);
void stdOut(const QString &data); void stdOut(const QString &data);
void stdErr(const QString &data); void stdErr(const QString &data);