Qt/MainWindow: Remember last directory in "Open" prompt

This commit is contained in:
spycrab 2018-06-05 13:19:44 +02:00
parent 8675fa09b8
commit c6704b1323
1 changed files with 12 additions and 2 deletions

View File

@ -527,10 +527,20 @@ void MainWindow::RefreshGameList()
QString MainWindow::PromptFileName()
{
return QFileDialog::getOpenFileName(
this, tr("Select a File"), QDir::currentPath(),
auto& settings = Settings::Instance().GetQSettings();
QString path = QFileDialog::getOpenFileName(
this, tr("Select a File"),
settings.value(QStringLiteral("mainwindow/lastdir"), QStringLiteral("")).toString(),
tr("All GC/Wii files (*.elf *.dol *.gcm *.iso *.tgc *.wbfs *.ciso *.gcz *.wad);;"
"All Files (*)"));
if (!path.isEmpty())
{
settings.setValue(QStringLiteral("mainwindow/lastdir"),
QFileInfo(path).absoluteDir().absolutePath());
}
return path;
}
void MainWindow::ChangeDisc()