From 1ceff8091447bee732cdefa0a5efda541f36052e Mon Sep 17 00:00:00 2001 From: ZGaetano Date: Wed, 6 May 2026 20:34:22 -0400 Subject: [PATCH] Update dragonrelaybackend.cpp --- app/vpn/dragonrelaybackend.cpp | 38 ++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/app/vpn/dragonrelaybackend.cpp b/app/vpn/dragonrelaybackend.cpp index b2362e7..bc64874 100644 --- a/app/vpn/dragonrelaybackend.cpp +++ b/app/vpn/dragonrelaybackend.cpp @@ -99,7 +99,7 @@ void DragonRelayBackend::disconnectRelay() { // ── 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) { qWarning() << "DragonRelayBackend::streamHost called while not ready"; 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. // TODO: wire directly into Moonlight's ComputerManager once the fork is // more deeply integrated. + + qDebug() << "DragonRelayBackend::streamHost called with ip=" << ip + << "app=" << app << "displayIndex=" << displayIndex; + #if defined(Q_OS_WIN) - QProcess::startDetached(QStringLiteral("moonlight"), { + QStringList args{ QStringLiteral("stream"), ip, 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) - QProcess::startDetached(QStringLiteral("moonlight"), { + QStringList args{ QStringLiteral("stream"), ip, 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 - QProcess::startDetached(QStringLiteral("moonlight"), { + QStringList args{ QStringLiteral("stream"), ip, 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 } @@ -140,8 +160,8 @@ QVariantList DragonRelayBackend::displaysForHost(const QString &hostIP) const { void DragonRelayBackend::streamHostDisplay(const QString &hostIP, int displayIndex) { qDebug() << "Streaming host" << hostIP << "display index" << displayIndex; - // TODO(Task 24): Pass displayIndex to streamHost command when display selection is wired - streamHost(hostIP); + // Pass displayIndex to streamHost + streamHost(hostIP, QStringLiteral("Desktop"), displayIndex); } // ── refreshHosts ─────────────────────────────────────────────────────────────