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:
Haiyu Zhen
2019-02-06 15:43:40 -05:00
committed by Baldur Karlsson
parent 4699b459e5
commit ca54a910f5
6 changed files with 52 additions and 16 deletions
+5
View File
@@ -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)
{
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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:
+29 -1
View File
@@ -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));
+15 -13
View File
@@ -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);
+1
View File
@@ -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);