mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Add --replayhost command line option for qrenderdoc
This allows users to specify which remote host to connect to on startup.
This commit is contained in:
committed by
Baldur Karlsson
parent
4699b459e5
commit
ca54a910f5
@@ -1379,6 +1379,11 @@ void CaptureContext::SetEventID(const rdcarray<ICaptureViewer *> &exclude, uint3
|
||||
RefreshUIStatus(exclude, updateSelectedEvent, updateEvent);
|
||||
}
|
||||
|
||||
void CaptureContext::SetRemoteHost(int hostIdx)
|
||||
{
|
||||
m_MainWindow->setRemoteHost(hostIdx);
|
||||
}
|
||||
|
||||
void CaptureContext::RefreshUIStatus(const rdcarray<ICaptureViewer *> &exclude,
|
||||
bool updateSelectedEvent, bool updateEvent)
|
||||
{
|
||||
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
void ExportCapture(const CaptureFileFormat &fmt, const rdcstr &exportfile) override;
|
||||
void SetEventID(const rdcarray<ICaptureViewer *> &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<ICaptureViewer *> &exclude, bool updateSelectedEvent,
|
||||
bool updateEvent);
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -1772,21 +1772,9 @@ void MainWindow::FillRemotesMenu(QMenu *menu, bool includeLocalhost)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::switchContext()
|
||||
void MainWindow::setRemoteHost(int hostIdx)
|
||||
{
|
||||
QAction *item = qobject_cast<QAction *>(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<QAction *>(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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user