Qt: Save directory of last loaded file

This commit is contained in:
Jeffrey Pfau 2015-01-10 22:46:59 -08:00
parent 97291824a5
commit 372eb39599
2 changed files with 8 additions and 3 deletions

View File

@ -16,6 +16,7 @@ Features:
- Rewinding of emulation - Rewinding of emulation
- Implemented BIOS routines SoftReset, RegisterRamReset, Diff8bitUnFilterWram, Diff8bitUnFilterVram, and Diff16bitUnFilter - Implemented BIOS routines SoftReset, RegisterRamReset, Diff8bitUnFilterWram, Diff8bitUnFilterVram, and Diff16bitUnFilter
- Support IPv6 - Support IPv6
- Save directory of last loaded file
Bugfixes: Bugfixes:
- Qt: Fix issue with set frame sizes being the wrong height - Qt: Fix issue with set frame sizes being the wrong height
- Qt: Fix emulator crashing when full screen if a game is not running - Qt: Fix emulator crashing when full screen if a game is not running

View File

@ -6,6 +6,7 @@
#include "Window.h" #include "Window.h"
#include <QFileDialog> #include <QFileDialog>
#include <QFileInfo>
#include <QKeyEvent> #include <QKeyEvent>
#include <QKeySequence> #include <QKeySequence>
#include <QMenuBar> #include <QMenuBar>
@ -175,15 +176,17 @@ void Window::saveConfig() {
} }
void Window::selectROM() { void Window::selectROM() {
QString filename = QFileDialog::getOpenFileName(this, tr("Select ROM")); QString filename = QFileDialog::getOpenFileName(this, tr("Select ROM"), m_config->getQtOption("lastDirectory").toString());
if (!filename.isEmpty()) { if (!filename.isEmpty()) {
m_config->setQtOption("lastDirectory", QFileInfo(filename).dir().path());
m_controller->loadGame(filename); m_controller->loadGame(filename);
} }
} }
void Window::selectBIOS() { void Window::selectBIOS() {
QString filename = QFileDialog::getOpenFileName(this, tr("Select BIOS")); QString filename = QFileDialog::getOpenFileName(this, tr("Select BIOS"), m_config->getQtOption("lastDirectory").toString());
if (!filename.isEmpty()) { if (!filename.isEmpty()) {
m_config->setQtOption("lastDirectory", QFileInfo(filename).dir().path());
m_config->setOption("bios", filename); m_config->setOption("bios", filename);
m_config->updateOption("bios"); m_config->updateOption("bios");
m_controller->loadBIOS(filename); m_controller->loadBIOS(filename);
@ -191,8 +194,9 @@ void Window::selectBIOS() {
} }
void Window::selectPatch() { void Window::selectPatch() {
QString filename = QFileDialog::getOpenFileName(this, tr("Select patch"), QString(), tr("Patches (*.ips *.ups)")); QString filename = QFileDialog::getOpenFileName(this, tr("Select patch"), m_config->getQtOption("lastDirectory").toString(), tr("Patches (*.ips *.ups)"));
if (!filename.isEmpty()) { if (!filename.isEmpty()) {
m_config->setQtOption("lastDirectory", QFileInfo(filename).dir().path());
m_controller->loadPatch(filename); m_controller->loadPatch(filename);
} }
} }