citra-emu
/
citra
Archived
1
0
Fork 0

Save the path leading where the last file have been loaded

I use two variables to save the path for the ROMs and the symbols.
Use of QSettings to avoid new member variable to the class.
Global settings of QSettings is done in main.
This commit is contained in:
LittleWhite 2015-07-26 17:13:02 +02:00
parent ce65925bc3
commit cb405ad1b4
1 changed files with 20 additions and 5 deletions

View File

@ -122,9 +122,8 @@ GMainWindow::GMainWindow() : emu_thread(nullptr)
y = (screenRect.y() + screenRect.height()) / 2 - h * 55 / 100; y = (screenRect.y() + screenRect.height()) / 2 - h * 55 / 100;
setGeometry(x, y, w, h); setGeometry(x, y, w, h);
// Restore UI state // Restore UI state
QSettings settings(QSettings::IniFormat, QSettings::UserScope, "Citra team", "Citra"); QSettings settings;
restoreGeometry(settings.value("geometry").toByteArray()); restoreGeometry(settings.value("geometry").toByteArray());
restoreState(settings.value("state").toByteArray()); restoreState(settings.value("state").toByteArray());
render_window->restoreGeometry(settings.value("geometryRenderWindow").toByteArray()); render_window->restoreGeometry(settings.value("geometryRenderWindow").toByteArray());
@ -271,8 +270,13 @@ void GMainWindow::ShutdownGame() {
void GMainWindow::OnMenuLoadFile() void GMainWindow::OnMenuLoadFile()
{ {
QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), QString(), tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.cci *.cxi)")); QSettings settings;
QString rom_path = settings.value("romsPath", QString()).toString();
QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), rom_path, tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.cci *.cxi)"));
if (filename.size()) { if (filename.size()) {
settings.setValue("romsPath", QFileInfo(filename).path());
// Shutdown previous session if the emu thread is still active... // Shutdown previous session if the emu thread is still active...
if (emu_thread != nullptr) if (emu_thread != nullptr)
ShutdownGame(); ShutdownGame();
@ -282,9 +286,15 @@ void GMainWindow::OnMenuLoadFile()
} }
void GMainWindow::OnMenuLoadSymbolMap() { void GMainWindow::OnMenuLoadSymbolMap() {
QString filename = QFileDialog::getOpenFileName(this, tr("Load Symbol Map"), QString(), tr("Symbol map (*)")); QSettings settings;
if (filename.size()) QString symbol_path = settings.value("symbolsPath", QString()).toString();
QString filename = QFileDialog::getOpenFileName(this, tr("Load Symbol Map"), symbol_path, tr("Symbol map (*)"));
if (filename.size()) {
settings.setValue("symbolsPath", QFileInfo(filename).path());
LoadSymbolMap(filename.toLatin1().data()); LoadSymbolMap(filename.toLatin1().data());
}
} }
void GMainWindow::OnStartGame() void GMainWindow::OnStartGame()
@ -375,6 +385,11 @@ int main(int argc, char* argv[])
Log::Filter log_filter(Log::Level::Info); Log::Filter log_filter(Log::Level::Info);
Log::SetFilter(&log_filter); Log::SetFilter(&log_filter);
// Init settings params
QSettings::setDefaultFormat(QSettings::IniFormat);
QCoreApplication::setOrganizationName("Citra team");
QCoreApplication::setApplicationName("Citra");
QApplication::setAttribute(Qt::AA_X11InitThreads); QApplication::setAttribute(Qt::AA_X11InitThreads);
QApplication app(argc, argv); QApplication app(argc, argv);