diff --git a/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp b/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp
index 453ec5a5f..1dd202514 100644
--- a/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp
+++ b/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp
@@ -92,6 +92,32 @@ void CaptureDialog::initWarning(RDLabel *warning)
warning->setVisible(false);
}
+QString CaptureDialog::mostRecentFilename()
+{
+ return configFilePath(lit("most_recent.cap"));
+}
+
+void CaptureDialog::PopulateMostRecent()
+{
+ QString filename = mostRecentFilename();
+
+ if(QFile::exists(filename))
+ {
+ CaptureSettings settings = LoadSettingsFromDisk(filename);
+
+ if(!settings.executable.isEmpty())
+ {
+ ui->loadLastCapture->setEnabled(true);
+ ui->loadLastCapture->setText(
+ tr("Load Last Settings - %1").arg(QFileInfo(QString(settings.executable)).completeBaseName()));
+ return;
+ }
+ }
+
+ ui->loadLastCapture->setEnabled(false);
+ ui->loadLastCapture->setText(tr("Load Last Settings"));
+}
+
CaptureDialog::CaptureDialog(ICaptureContext &ctx, OnCaptureMethod captureCallback,
OnInjectMethod injectCallback, MainWindow *main, QWidget *parent)
: QFrame(parent), ui(new Ui::CaptureDialog), m_Ctx(ctx), m_Main(main)
@@ -167,6 +193,8 @@ CaptureDialog::CaptureDialog(ICaptureContext &ctx, OnCaptureMethod captureCallba
SetSettings(CaptureSettings());
UpdateGlobalHook();
+
+ PopulateMostRecent();
}
CaptureDialog::~CaptureDialog()
@@ -836,6 +864,11 @@ void CaptureDialog::on_loadSettings_clicked()
}
}
+void CaptureDialog::on_loadLastCapture_clicked()
+{
+ LoadSettings(mostRecentFilename());
+}
+
void CaptureDialog::on_launch_clicked()
{
TriggerCapture();
@@ -1003,6 +1036,11 @@ void CaptureDialog::SetCommandLine(const rdcstr &cmd)
}
void CaptureDialog::LoadSettings(const rdcstr &filename)
+{
+ SetSettings(LoadSettingsFromDisk(filename));
+}
+
+CaptureSettings CaptureDialog::LoadSettingsFromDisk(const rdcstr &filename)
{
QFile f(filename);
if(f.open(QIODevice::ReadOnly | QIODevice::Text))
@@ -1013,8 +1051,7 @@ void CaptureDialog::LoadSettings(const rdcstr &filename)
if(success)
{
- CaptureSettings settings(values[lit("settings")]);
- SetSettings(settings);
+ return CaptureSettings(values[lit("settings")]);
}
else
{
@@ -1026,6 +1063,8 @@ void CaptureDialog::LoadSettings(const rdcstr &filename)
{
RDDialog::critical(this, tr("Error loading config"), tr("Couldn't open path %1.").arg(filename));
}
+
+ return CaptureSettings();
}
void CaptureDialog::UpdateGlobalHook()
@@ -1143,6 +1182,10 @@ void CaptureDialog::TriggerCapture()
QString cmdLine = ui->cmdline->text();
+ SaveSettings(mostRecentFilename());
+
+ PopulateMostRecent();
+
m_CaptureCallback(exe, workingDir, cmdLine, Settings().environment, Settings().options,
[this](LiveCapture *live) {
if(ui->queueFrameCap->isChecked())
diff --git a/qrenderdoc/Windows/Dialogs/CaptureDialog.h b/qrenderdoc/Windows/Dialogs/CaptureDialog.h
index 114e943f1..a281e322d 100644
--- a/qrenderdoc/Windows/Dialogs/CaptureDialog.h
+++ b/qrenderdoc/Windows/Dialogs/CaptureDialog.h
@@ -92,6 +92,7 @@ private slots:
void on_saveSettings_clicked();
void on_loadSettings_clicked();
+ void on_loadLastCapture_clicked();
void on_launch_clicked();
void on_close_clicked();
@@ -119,6 +120,11 @@ private:
void fillProcessList();
void initWarning(RDLabel *label);
+ QString mostRecentFilename();
+
+ void PopulateMostRecent();
+ CaptureSettings LoadSettingsFromDisk(const rdcstr &filename);
+
void CheckAndroidSetup(QString &filename);
AndroidFlags m_AndroidFlags;
};
diff --git a/qrenderdoc/Windows/Dialogs/CaptureDialog.ui b/qrenderdoc/Windows/Dialogs/CaptureDialog.ui
index 85cf30f1b..e13cb280c 100644
--- a/qrenderdoc/Windows/Dialogs/CaptureDialog.ui
+++ b/qrenderdoc/Windows/Dialogs/CaptureDialog.ui
@@ -760,6 +760,22 @@
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Load the most recently used capture settings
+
+
+ Load Last Settings
+
+
+
-