mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Save the capture settings on launch, offer button to load most recent
* This gives a one-click way to run the last capture, if it's not complex/regular enough to be worth saving to a settings file on its own. * Doesn't save much if you're selecting an exe as the previous exe location is remembered, but if you also have command line parameters or a working directory it can help.
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -760,6 +760,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="loadLastCapture">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Load the most recently used capture settings</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load Last Settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="buttonsSpace">
|
||||
<property name="orientation">
|
||||
|
||||
Reference in New Issue
Block a user