Restore removed LastCaptureExe saving last exe selected. Closes #1318

This commit is contained in:
baldurk
2019-03-25 15:12:55 +00:00
parent 8bb962fef8
commit e2bb45fd8f
4 changed files with 16 additions and 2 deletions
@@ -274,6 +274,8 @@ DECLARE_REFLECTION_STRUCT(BugReport);
\
CONFIG_SETTING_VAL(public, QString, rdcstr, LastCapturePath, "") \
\
CONFIG_SETTING_VAL(public, QString, rdcstr, LastCaptureExe, "") \
\
CONFIG_SETTING(public, QVariantList, rdcarray<rdcstr>, RecentCaptureSettings) \
\
CONFIG_SETTING_VAL(public, QString, rdcstr, TemporaryCaptureDirectory, "") \
@@ -459,6 +461,10 @@ For more information about some of these settings that are user-facing see
The path containing the last executable that was captured, which is useful as a default location
for browsing.
.. data:: LastCaptureExe
The filename of the last executable that was captured, inside :data:`LastCapturePath`.
.. data:: RecentCaptureSettings
A ``list`` of ``str`` with the recently opened capture settings files.
+3 -1
View File
@@ -1153,7 +1153,7 @@ QString RDDialog::getOpenFileName(QWidget *parent, const QString &caption, const
}
QString RDDialog::getExecutableFileName(QWidget *parent, const QString &caption, const QString &dir,
QFileDialog::Options options)
const QString &defaultExe, QFileDialog::Options options)
{
QString d = dir;
if(d.isEmpty())
@@ -1175,6 +1175,8 @@ QString RDDialog::getExecutableFileName(QWidget *parent, const QString &caption,
fileProxy->setRequirePermissions(QDir::Executable);
fd.setProxyModel(fileProxy);
}
if(!defaultExe.isEmpty())
fd.selectFile(defaultExe);
show(&fd);
if(fd.result() == QFileDialog::Accepted)
+1
View File
@@ -564,6 +564,7 @@ struct RDDialog
static QString getExecutableFileName(QWidget *parent = NULL, const QString &caption = QString(),
const QString &dir = QString(),
const QString &defaultExe = QString(),
QFileDialog::Options options = QFileDialog::Options());
static QString getSaveFileName(QWidget *parent = NULL, const QString &caption = QString(),
+6 -1
View File
@@ -633,12 +633,14 @@ bool CaptureDialog::checkAllowClose()
void CaptureDialog::on_exePathBrowse_clicked()
{
QString initDir;
QString initExe;
QFileInfo f(ui->exePath->text());
QDir dir = f.dir();
if(f.isAbsolute() && dir.exists())
{
initDir = dir.absolutePath();
initExe = f.fileName();
}
else if(m_Ctx.Replay().CurrentRemote())
{
@@ -647,6 +649,8 @@ void CaptureDialog::on_exePathBrowse_clicked()
else if(!m_Ctx.Config().LastCapturePath.isEmpty())
{
initDir = m_Ctx.Config().LastCapturePath;
if(!m_Ctx.Config().LastCaptureExe.isEmpty())
initExe = m_Ctx.Config().LastCaptureExe;
}
QString filename;
@@ -659,7 +663,7 @@ void CaptureDialog::on_exePathBrowse_clicked()
}
else
{
filename = RDDialog::getExecutableFileName(this, tr("Choose executable"), initDir);
filename = RDDialog::getExecutableFileName(this, tr("Choose executable"), initDir, initExe);
}
if(!filename.isEmpty())
@@ -1038,6 +1042,7 @@ void CaptureDialog::SetExecutableFilename(const rdcstr &filename)
else
{
m_Ctx.Config().LastCapturePath = QFileInfo(fn).absolutePath();
m_Ctx.Config().LastCaptureExe = QFileInfo(fn).fileName();
}
m_Ctx.Config().Save();