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 ────────────────────────────────────────────────────────────────
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 ─────────────────────────────────────────────────────────────