diff options
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r-- | src/yuzu/main.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index c6f170cd7..262e33487 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -12,6 +12,7 @@ #define QT_NO_OPENGL #include <QDesktopWidget> +#include <QDialogButtonBox> #include <QFileDialog> #include <QMessageBox> #include <QtGui> @@ -374,6 +375,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(EmulatedDirectoryTarget::NAND); }); + connect(ui.action_Select_SDMC_Directory, &QAction::triggered, this, + [this] { OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget::SDMC); }); connect(ui.action_Exit, &QAction::triggered, this, &QMainWindow::close); // Emulation @@ -889,6 +894,28 @@ void GMainWindow::OnMenuSelectGameListRoot() { } } +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(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); + } +} + void GMainWindow::OnMenuRecentFile() { QAction* action = qobject_cast<QAction*>(sender()); assert(action); |