mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-13 18:21:01 +00:00
Save last capture path per remote host. Closes #1094
This commit is contained in:
@@ -708,7 +708,7 @@ struct IReplayManager
|
||||
:return: The host connected to, or ``None`` if no connection is active.
|
||||
:rtype: RemoteHost
|
||||
)");
|
||||
virtual const RemoteHost *CurrentRemote() = 0;
|
||||
virtual RemoteHost *CurrentRemote() = 0;
|
||||
|
||||
DOCUMENT(R"(Retrieves the capture file handle for the currently open file.
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ RemoteHost::RemoteHost(const QVariant &var)
|
||||
friendlyName = map[lit("friendlyName")].toString();
|
||||
if(map.contains(lit("runCommand")))
|
||||
runCommand = map[lit("runCommand")].toString();
|
||||
if(map.contains(lit("lastCapturePath")))
|
||||
lastCapturePath = map[lit("lastCapturePath")].toString();
|
||||
|
||||
serverRunning = connected = busy = versionMismatch = false;
|
||||
}
|
||||
@@ -51,6 +53,7 @@ RemoteHost::operator QVariant() const
|
||||
map[lit("hostname")] = hostname;
|
||||
map[lit("friendlyName")] = friendlyName;
|
||||
map[lit("runCommand")] = runCommand;
|
||||
map[lit("lastCapturePath")] = lastCapturePath;
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,9 @@ public:
|
||||
DOCUMENT("The command to run locally to try to launch the server remotely.");
|
||||
rdcstr runCommand;
|
||||
|
||||
DOCUMENT("The last folder browser to on this host, to provide a reasonable default path.");
|
||||
rdcstr lastCapturePath;
|
||||
|
||||
DOCUMENT(R"(
|
||||
Returns the name to display for this host in the UI, either :data:`friendlyName` or :data:`hostname`
|
||||
)");
|
||||
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
// work whether local or remote.
|
||||
ICaptureFile *GetCaptureFile() { return m_CaptureFile; }
|
||||
void ReopenCaptureFile(const QString &path);
|
||||
const RemoteHost *CurrentRemote() { return m_RemoteHost; }
|
||||
RemoteHost *CurrentRemote() { return m_RemoteHost; }
|
||||
ExecuteResult ExecuteAndInject(const rdcstr &exe, const rdcstr &workingDir, const rdcstr &cmdLine,
|
||||
const rdcarray<EnvironmentModification> &env,
|
||||
const rdcstr &capturefile, CaptureOptions opts);
|
||||
|
||||
@@ -575,6 +575,10 @@ void CaptureDialog::on_exePathBrowse_clicked()
|
||||
{
|
||||
initDir = dir.absolutePath();
|
||||
}
|
||||
else if(m_Ctx.Replay().CurrentRemote())
|
||||
{
|
||||
initDir = m_Ctx.Replay().CurrentRemote()->lastCapturePath;
|
||||
}
|
||||
else if(!m_Ctx.Config().LastCapturePath.isEmpty())
|
||||
{
|
||||
initDir = m_Ctx.Config().LastCapturePath;
|
||||
@@ -584,7 +588,7 @@ void CaptureDialog::on_exePathBrowse_clicked()
|
||||
|
||||
if(m_Ctx.Replay().CurrentRemote())
|
||||
{
|
||||
VirtualFileDialog vfd(m_Ctx, this);
|
||||
VirtualFileDialog vfd(m_Ctx, initDir, this);
|
||||
RDDialog::show(&vfd);
|
||||
filename = vfd.chosenPath();
|
||||
}
|
||||
@@ -606,26 +610,31 @@ void CaptureDialog::on_exePathBrowse_clicked()
|
||||
|
||||
void CaptureDialog::on_workDirBrowse_clicked()
|
||||
{
|
||||
QString initDir;
|
||||
QString initDir = ui->workDirPath->text();
|
||||
|
||||
if(QDir(ui->workDirPath->text()).exists())
|
||||
if(initDir.isEmpty())
|
||||
{
|
||||
initDir = ui->workDirPath->text();
|
||||
}
|
||||
else
|
||||
{
|
||||
QDir dir = QFileInfo(ui->exePath->text()).dir();
|
||||
if(dir.exists())
|
||||
initDir = dir.absolutePath();
|
||||
else if(!m_Ctx.Config().LastCapturePath.isEmpty())
|
||||
initDir = m_Ctx.Config().LastCapturePath;
|
||||
if(m_Ctx.Replay().CurrentRemote())
|
||||
{
|
||||
initDir = m_Ctx.Replay().CurrentRemote()->lastCapturePath;
|
||||
}
|
||||
else if(!QDir(initDir).exists())
|
||||
{
|
||||
QDir dir = QFileInfo(ui->exePath->text()).dir();
|
||||
if(dir.exists())
|
||||
initDir = dir.absolutePath();
|
||||
else if(!m_Ctx.Config().LastCapturePath.isEmpty())
|
||||
initDir = m_Ctx.Config().LastCapturePath;
|
||||
else
|
||||
initDir = QString();
|
||||
}
|
||||
}
|
||||
|
||||
QString dir;
|
||||
|
||||
if(m_Ctx.Replay().CurrentRemote())
|
||||
{
|
||||
VirtualFileDialog vfd(m_Ctx, this);
|
||||
VirtualFileDialog vfd(m_Ctx, initDir, this);
|
||||
vfd.setDirBrowse();
|
||||
RDDialog::show(&vfd);
|
||||
dir = vfd.chosenPath();
|
||||
@@ -921,10 +930,12 @@ void CaptureDialog::SetExecutableFilename(const rdcstr &filename)
|
||||
|
||||
ui->exePath->setText(fn);
|
||||
|
||||
if(!m_Ctx.Replay().CurrentRemote())
|
||||
{
|
||||
if(m_Ctx.Replay().CurrentRemote())
|
||||
m_Ctx.Replay().CurrentRemote()->lastCapturePath = QFileInfo(fn).absolutePath();
|
||||
else
|
||||
m_Ctx.Config().LastCapturePath = QFileInfo(fn).absolutePath();
|
||||
}
|
||||
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void CaptureDialog::SetWorkingDirectory(const rdcstr &dir)
|
||||
|
||||
@@ -550,7 +550,7 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
VirtualFileDialog::VirtualFileDialog(ICaptureContext &ctx, QWidget *parent)
|
||||
VirtualFileDialog::VirtualFileDialog(ICaptureContext &ctx, QString initialDirectory, QWidget *parent)
|
||||
: QDialog(parent), ui(new Ui::VirtualFileDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@@ -591,7 +591,8 @@ VirtualFileDialog::VirtualFileDialog(ICaptureContext &ctx, QWidget *parent)
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(false);
|
||||
|
||||
// switch to home folder and expand it
|
||||
changeCurrentDir(m_Model->homeFolder());
|
||||
changeCurrentDir(initialDirectory.isEmpty() ? m_Model->homeFolder()
|
||||
: m_Model->indexForPath(initialDirectory));
|
||||
ui->dirList->expand(m_DirProxy->mapFromSource(currentDir()));
|
||||
|
||||
QObject::connect(ui->fileList->selectionModel(), &QItemSelectionModel::selectionChanged, this,
|
||||
|
||||
@@ -41,7 +41,7 @@ class VirtualFileDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VirtualFileDialog(ICaptureContext &ctx, QWidget *parent = 0);
|
||||
explicit VirtualFileDialog(ICaptureContext &ctx, QString initialDirectory, QWidget *parent = 0);
|
||||
~VirtualFileDialog();
|
||||
|
||||
QString chosenPath() { return m_ChosenPath; }
|
||||
|
||||
Reference in New Issue
Block a user