BareMetal: Inline UvscServerProviderRunner

Task-number: QTCREATORBUG-29168
Change-Id: Ic8c7d4e2e72510bea2000b17b83e829ee367bb26
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2024-11-21 12:25:16 +01:00
parent 7c7e15cbce
commit 9c012b0640
2 changed files with 5 additions and 56 deletions

View File

@@ -204,13 +204,11 @@ bool UvscServerProvider::aboutToRun(DebuggerRunTool *runTool, QString &errorMess
ProjectExplorer::RunWorker *UvscServerProvider::targetRunner(RunControl *runControl) const ProjectExplorer::RunWorker *UvscServerProvider::targetRunner(RunControl *runControl) const
{ {
// Get uVision executable path. auto worker = new SimpleTargetRunner(runControl);
const ProcessRunData uv = DebuggerKitAspect::runnable(runControl->kit()); worker->setId("BareMetalUvscServer");
const CommandLine server{uv.command.executable(), worker->setCommandLine({DebuggerKitAspect::runnable(runControl->kit()).command.executable(),
{"-j0", QStringLiteral("-s%1").arg(m_channel.port())}}; {"-j0", QStringLiteral("-s%1").arg(m_channel.port())}});
ProcessRunData r; return worker;
r.command = server;
return new UvscServerProviderRunner(runControl, r);
} }
void UvscServerProvider::fromMap(const Store &data) void UvscServerProvider::fromMap(const Store &data)
@@ -339,38 +337,4 @@ void UvscServerProviderConfigWidget::setFromProvider()
m_driverSelector->setSelection(p->driverSelection()); m_driverSelector->setSelection(p->driverSelection());
} }
// UvscServerProviderRunner
UvscServerProviderRunner::UvscServerProviderRunner(ProjectExplorer::RunControl *runControl,
const ProcessRunData &runnable)
: RunWorker(runControl)
{
setId("BareMetalUvscServer");
m_process.setCommand(runnable.command);
connect(&m_process, &Process::started, this, [this] {
ProcessHandle pid(m_process.processId());
this->runControl()->setApplicationProcessHandle(pid);
reportStarted();
});
connect(&m_process, &Process::done, this, [this] {
appendMessage(m_process.exitMessage(), NormalMessageFormat);
reportStopped();
});
}
void UvscServerProviderRunner::start()
{
const QString msg = Tr::tr("Starting %1...").arg(m_process.commandLine().displayName());
appendMessage(msg, NormalMessageFormat);
m_process.start();
}
void UvscServerProviderRunner::stop()
{
m_process.terminate();
}
} // BareMetal::Internal } // BareMetal::Internal

View File

@@ -115,20 +115,5 @@ protected:
Uv::DriverSelector *m_driverSelector = nullptr; Uv::DriverSelector *m_driverSelector = nullptr;
}; };
// UvscServerProviderRunner
class UvscServerProviderRunner final : public ProjectExplorer::RunWorker
{
public:
explicit UvscServerProviderRunner(ProjectExplorer::RunControl *runControl,
const Utils::ProcessRunData &runnable);
private:
void start() final;
void stop() final;
Utils::Process m_process;
};
} // namespace Internal } // namespace Internal
} // namespace BareMetal } // namespace BareMetal