Update dragonrelaybackend.cpp

This commit is contained in:
Zac Gaetano 2026-05-06 20:34:22 -04:00
parent 8d79aa76fb
commit 1ceff80914

View file

@ -99,7 +99,7 @@ void DragonRelayBackend::disconnectRelay() {
// ── streamHost ──────────────────────────────────────────────────────────────── // ── streamHost ────────────────────────────────────────────────────────────────
void DragonRelayBackend::streamHost(const QString &ip, const QString &app) { void DragonRelayBackend::streamHost(const QString &ip, const QString &app, int displayIndex) {
if (m_status != Ready && m_status != TunnelUp) { if (m_status != Ready && m_status != TunnelUp) {
qWarning() << "DragonRelayBackend::streamHost called while not ready"; qWarning() << "DragonRelayBackend::streamHost called while not ready";
return; return;
@ -109,24 +109,44 @@ void DragonRelayBackend::streamHost(const QString &ip, const QString &app) {
// via a QProcess for now so we don't have to patch PC discovery internals. // via a QProcess for now so we don't have to patch PC discovery internals.
// TODO: wire directly into Moonlight's ComputerManager once the fork is // TODO: wire directly into Moonlight's ComputerManager once the fork is
// more deeply integrated. // more deeply integrated.
qDebug() << "DragonRelayBackend::streamHost called with ip=" << ip
<< "app=" << app << "displayIndex=" << displayIndex;
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
QProcess::startDetached(QStringLiteral("moonlight"), { QStringList args{
QStringLiteral("stream"), QStringLiteral("stream"),
ip, ip,
app app
}); };
// TODO: map displayIndex to Moonlight --display flag or similar
// For now, log displayIndex and pass without flag
if (displayIndex > 0) {
qDebug() << "Display index" << displayIndex << "requested (Moonlight --display flag TODO)";
}
QProcess::startDetached(QStringLiteral("moonlight"), args);
#elif defined(Q_OS_MACOS) #elif defined(Q_OS_MACOS)
QProcess::startDetached(QStringLiteral("moonlight"), { QStringList args{
QStringLiteral("stream"), QStringLiteral("stream"),
ip, ip,
app app
}); };
// TODO: map displayIndex to Moonlight --display flag or similar
if (displayIndex > 0) {
qDebug() << "Display index" << displayIndex << "requested (Moonlight --display flag TODO)";
}
QProcess::startDetached(QStringLiteral("moonlight"), args);
#else #else
QProcess::startDetached(QStringLiteral("moonlight"), { QStringList args{
QStringLiteral("stream"), QStringLiteral("stream"),
ip, ip,
app app
}); };
// TODO: map displayIndex to Moonlight --display flag or similar
if (displayIndex > 0) {
qDebug() << "Display index" << displayIndex << "requested (Moonlight --display flag TODO)";
}
QProcess::startDetached(QStringLiteral("moonlight"), args);
#endif #endif
} }
@ -140,8 +160,8 @@ QVariantList DragonRelayBackend::displaysForHost(const QString &hostIP) const {
void DragonRelayBackend::streamHostDisplay(const QString &hostIP, int displayIndex) { void DragonRelayBackend::streamHostDisplay(const QString &hostIP, int displayIndex) {
qDebug() << "Streaming host" << hostIP << "display index" << displayIndex; qDebug() << "Streaming host" << hostIP << "display index" << displayIndex;
// TODO(Task 24): Pass displayIndex to streamHost command when display selection is wired // Pass displayIndex to streamHost
streamHost(hostIP); streamHost(hostIP, QStringLiteral("Desktop"), displayIndex);
} }
// ── refreshHosts ───────────────────────────────────────────────────────────── // ── refreshHosts ─────────────────────────────────────────────────────────────