diff --git a/qrenderdoc/Code/CaptureContext.cpp b/qrenderdoc/Code/CaptureContext.cpp index 14547a207..e978cef71 100644 --- a/qrenderdoc/Code/CaptureContext.cpp +++ b/qrenderdoc/Code/CaptureContext.cpp @@ -1379,6 +1379,11 @@ void CaptureContext::SetEventID(const rdcarray &exclude, uint3 RefreshUIStatus(exclude, updateSelectedEvent, updateEvent); } +void CaptureContext::SetRemoteHost(int hostIdx) +{ + m_MainWindow->setRemoteHost(hostIdx); +} + void CaptureContext::RefreshUIStatus(const rdcarray &exclude, bool updateSelectedEvent, bool updateEvent) { diff --git a/qrenderdoc/Code/CaptureContext.h b/qrenderdoc/Code/CaptureContext.h index 5d2bfa74d..d5fdf3c01 100644 --- a/qrenderdoc/Code/CaptureContext.h +++ b/qrenderdoc/Code/CaptureContext.h @@ -111,7 +111,7 @@ public: void ExportCapture(const CaptureFileFormat &fmt, const rdcstr &exportfile) override; void SetEventID(const rdcarray &exclude, uint32_t selectedEventID, uint32_t eventId, bool force = false) override; - + void SetRemoteHost(int hostIndex); void RefreshStatus() override { SetEventID({}, m_SelectedEventID, m_EventID, true); } void RefreshUIStatus(const rdcarray &exclude, bool updateSelectedEvent, bool updateEvent); diff --git a/qrenderdoc/Code/Interface/RemoteHost.h b/qrenderdoc/Code/Interface/RemoteHost.h index 27b160d1e..5eb6df143 100644 --- a/qrenderdoc/Code/Interface/RemoteHost.h +++ b/qrenderdoc/Code/Interface/RemoteHost.h @@ -29,7 +29,7 @@ class RemoteHost; // do not include any headers here, they must all be in QRDInterface.h #include "QRDInterface.h" -DOCUMENT("A handle for interacting with a remote servers on a given host."); +DOCUMENT("A handle for interacting with a remote server on a given host."); class RemoteHost { public: diff --git a/qrenderdoc/Code/qrenderdoc.cpp b/qrenderdoc/Code/qrenderdoc.cpp index 3a0e7456c..bc28296f6 100644 --- a/qrenderdoc/Code/qrenderdoc.cpp +++ b/qrenderdoc/Code/qrenderdoc.cpp @@ -135,6 +135,10 @@ int main(int argc, char *argv[]) lit("host:port")); parser.addOption(targetcontrol); + QCommandLineOption replayhost(lit("replayhost"), tr("The replay host to connect to on startup."), + lit("host")); + parser.addOption(replayhost); + QCommandLineOption python({lit("python"), lit("script"), lit("py")}, tr("Run a python script before opening the main UI."), lit("filename.py")); @@ -291,6 +295,27 @@ int main(int argc, char *argv[]) .arg(configFilename)); } + int replayHostIndex = -1; + if(parser.isSet(replayhost)) + { + QString replayHost = parser.value(replayhost); + for(int i = 0; i < config.RemoteHosts.count(); i++) + { + if(QString(config.RemoteHosts[i]->hostname) == replayHost) + { + replayHostIndex = i; + break; + } + } + if(replayHostIndex < 0) + { + RDDialog::critical( + NULL, tr("Error loading remote host"), + tr("Remote host %1 doesn't exist. Please add it in Remote Host Manager first.") + .arg(parser.value(replayhost))); + } + } + if(config.Analytics_TotalOptOut) Analytics::Disable(); else @@ -355,7 +380,10 @@ int main(int argc, char *argv[]) } CaptureContext ctx(filename, remoteHost, remoteIdent, temp, config); - + if(replayHostIndex >= 0) + { + ctx.SetRemoteHost(replayHostIndex); + } Analytics::Prompt(ctx, config); ANALYTIC_SET(Metadata.RenderDocVersion, lit(FULL_VERSION_STRING)); diff --git a/qrenderdoc/Windows/MainWindow.cpp b/qrenderdoc/Windows/MainWindow.cpp index 5fb774968..cbf6add2c 100644 --- a/qrenderdoc/Windows/MainWindow.cpp +++ b/qrenderdoc/Windows/MainWindow.cpp @@ -1772,21 +1772,9 @@ void MainWindow::FillRemotesMenu(QMenu *menu, bool includeLocalhost) } } -void MainWindow::switchContext() +void MainWindow::setRemoteHost(int hostIdx) { - QAction *item = qobject_cast(QObject::sender()); - - if(!item) - return; - - bool ok = false; - int hostIdx = item->data().toInt(&ok); - - if(!ok) - return; - RemoteHost *host = NULL; - if(hostIdx >= 0 && hostIdx < m_Ctx.Config().RemoteHosts.count()) { host = m_Ctx.Config().RemoteHosts[hostIdx]; @@ -1933,6 +1921,20 @@ void MainWindow::switchContext() } } +void MainWindow::switchContext() +{ + QAction *item = qobject_cast(QObject::sender()); + + if(!item) + return; + + bool ok = false; + int hostIdx = item->data().toInt(&ok); + + if(ok) + setRemoteHost(hostIdx); +} + void MainWindow::contextChooser_menuShowing() { FillRemotesMenu(contextChooserMenu, true); diff --git a/qrenderdoc/Windows/MainWindow.h b/qrenderdoc/Windows/MainWindow.h index f8b2c51be..4aa311501 100644 --- a/qrenderdoc/Windows/MainWindow.h +++ b/qrenderdoc/Windows/MainWindow.h @@ -73,6 +73,7 @@ public: void show(); void setProgress(float val); + void setRemoteHost(int hostIdx); void takeCaptureOwnership() { m_OwnTempCapture = true; } void captureModified(); void LoadFromFilename(const QString &filename, bool temporary);