Qt: Save directory of last loaded file
Jeffrey Pfau jeffrey@endrift.com
Sat, 10 Jan 2015 22:46:59 -0800
2 files changed,
8 insertions(+),
3 deletions(-)
M
CHANGES
→
CHANGES
@@ -16,6 +16,7 @@ - Remappable shortcuts for keyboard and gamepad
- Rewinding of emulation - Implemented BIOS routines SoftReset, RegisterRamReset, Diff8bitUnFilterWram, Diff8bitUnFilterVram, and Diff16bitUnFilter - Support IPv6 + - Save directory of last loaded file Bugfixes: - Qt: Fix issue with set frame sizes being the wrong height - Qt: Fix emulator crashing when full screen if a game is not running
M
src/platform/qt/Window.cpp
→
src/platform/qt/Window.cpp
@@ -6,6 +6,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "Window.h" #include <QFileDialog> +#include <QFileInfo> #include <QKeyEvent> #include <QKeySequence> #include <QMenuBar>@@ -175,15 +176,17 @@ m_config->write();
} 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()) { + m_config->setQtOption("lastDirectory", QFileInfo(filename).dir().path()); m_controller->loadGame(filename); } } 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()) { + m_config->setQtOption("lastDirectory", QFileInfo(filename).dir().path()); m_config->setOption("bios", filename); m_config->updateOption("bios"); m_controller->loadBIOS(filename);@@ -191,8 +194,9 @@ }
} 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()) { + m_config->setQtOption("lastDirectory", QFileInfo(filename).dir().path()); m_controller->loadPatch(filename); } }