From 1ff3318458e15e68b5a5946c8d395d625692637a Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Sat, 1 Sep 2018 14:49:18 -0400 Subject: qt: Add UI options to change NAND/SD dirs --- src/yuzu/main.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index cfc48a416..01a5d2552 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -372,6 +372,10 @@ void GMainWindow::ConnectMenuEvents() { &GMainWindow::OnMenuInstallToNAND); connect(ui.action_Select_Game_List_Root, &QAction::triggered, this, &GMainWindow::OnMenuSelectGameListRoot); + connect(ui.action_Select_NAND_Directory, &QAction::triggered, this, + [this] { OnMenuSelectEmulatedDirectory(false); }); + connect(ui.action_Select_SDMC_Directory, &QAction::triggered, this, + [this] { OnMenuSelectEmulatedDirectory(true); }); connect(ui.action_Exit, &QAction::triggered, this, &QMainWindow::close); // Emulation @@ -887,6 +891,16 @@ void GMainWindow::OnMenuSelectGameListRoot() { } } +void GMainWindow::OnMenuSelectEmulatedDirectory(bool is_sdmc) { + QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory")); + if (!dir_path.isEmpty()) { + FileUtil::GetUserPath(is_sdmc ? FileUtil::UserPath::SDMCDir : FileUtil::UserPath::NANDDir, + dir_path.toStdString()); + Service::FileSystem::CreateFactories(vfs); + game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan); + } +} + void GMainWindow::OnMenuRecentFile() { QAction* action = qobject_cast(sender()); assert(action); -- cgit v1.2.3 From 04397cd185bf6f6f8c979df4fe48379f669f0ed5 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Mon, 3 Sep 2018 19:23:10 -0400 Subject: qt: Add message about not moving contents on dir change --- src/yuzu/main.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 01a5d2552..a21f7bdbc 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -12,6 +12,7 @@ #define QT_NO_OPENGL #include +#include #include #include #include @@ -373,9 +374,9 @@ void GMainWindow::ConnectMenuEvents() { connect(ui.action_Select_Game_List_Root, &QAction::triggered, this, &GMainWindow::OnMenuSelectGameListRoot); connect(ui.action_Select_NAND_Directory, &QAction::triggered, this, - [this] { OnMenuSelectEmulatedDirectory(false); }); + [this] { OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget::NAND); }); connect(ui.action_Select_SDMC_Directory, &QAction::triggered, this, - [this] { OnMenuSelectEmulatedDirectory(true); }); + [this] { OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget::SDMC); }); connect(ui.action_Exit, &QAction::triggered, this, &QMainWindow::close); // Emulation @@ -891,10 +892,22 @@ void GMainWindow::OnMenuSelectGameListRoot() { } } -void GMainWindow::OnMenuSelectEmulatedDirectory(bool is_sdmc) { +void GMainWindow::OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget target) { + const auto res = QMessageBox::information( + this, tr("Changing Emulated Directory"), + tr("You are about to change the emulated %1 directory of the system. Please note " + "that this does not also move the contents of the previous directory to the " + "new one and you will have to do that yourself.") + .arg(target == EmulatedDirectoryTarget::SDMC ? tr("SD card") : tr("NAND")), + QMessageBox::StandardButtons{QMessageBox::Ok, QMessageBox::Cancel}); + + if (res == QMessageBox::Cancel) + return; + QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory")); if (!dir_path.isEmpty()) { - FileUtil::GetUserPath(is_sdmc ? FileUtil::UserPath::SDMCDir : FileUtil::UserPath::NANDDir, + FileUtil::GetUserPath(target == EmulatedDirectoryTarget::SDMC ? FileUtil::UserPath::SDMCDir + : FileUtil::UserPath::NANDDir, dir_path.toStdString()); Service::FileSystem::CreateFactories(vfs); game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan); -- cgit v1.2.3