diff options
| author | 2016-12-15 09:56:32 +0000 | |
|---|---|---|
| committer | 2016-12-15 18:43:11 +0000 | |
| commit | 5a4e1b469d959e8ad24195185c7f5176b6a3d2cb (patch) | |
| tree | e9ad322897434234c8d8a8f1745b88fe1f644787 /src | |
| parent | game_list: Implement context menu for items in list (diff) | |
| download | yuzu-5a4e1b469d959e8ad24195185c7f5176b6a3d2cb.tar.gz yuzu-5a4e1b469d959e8ad24195185c7f5176b6a3d2cb.tar.xz yuzu-5a4e1b469d959e8ad24195185c7f5176b6a3d2cb.zip | |
main: Open folder when open save folder location context menu is clicked
Diffstat (limited to 'src')
| -rw-r--r-- | src/citra_qt/main.cpp | 19 | ||||
| -rw-r--r-- | src/citra_qt/main.h | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index a3887f9ab..ad6221739 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <cinttypes> | ||
| 5 | #include <clocale> | 6 | #include <clocale> |
| 6 | #include <memory> | 7 | #include <memory> |
| 7 | #include <thread> | 8 | #include <thread> |
| @@ -41,6 +42,7 @@ | |||
| 41 | #include "common/string_util.h" | 42 | #include "common/string_util.h" |
| 42 | #include "core/arm/disassembler/load_symbol_map.h" | 43 | #include "core/arm/disassembler/load_symbol_map.h" |
| 43 | #include "core/core.h" | 44 | #include "core/core.h" |
| 45 | #include "core/file_sys/archive_source_sd_savedata.h" | ||
| 44 | #include "core/gdbstub/gdbstub.h" | 46 | #include "core/gdbstub/gdbstub.h" |
| 45 | #include "core/loader/loader.h" | 47 | #include "core/loader/loader.h" |
| 46 | #include "core/settings.h" | 48 | #include "core/settings.h" |
| @@ -171,6 +173,8 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { | |||
| 171 | // Setup connections | 173 | // Setup connections |
| 172 | connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString)), | 174 | connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString)), |
| 173 | Qt::DirectConnection); | 175 | Qt::DirectConnection); |
| 176 | connect(game_list, SIGNAL(OpenSaveFolderRequested(u64)), this, | ||
| 177 | SLOT(OnGameListOpenSaveFolder(u64)), Qt::DirectConnection); | ||
| 174 | connect(ui.action_Configure, SIGNAL(triggered()), this, SLOT(OnConfigure())); | 178 | connect(ui.action_Configure, SIGNAL(triggered()), this, SLOT(OnConfigure())); |
| 175 | connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile()), | 179 | connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile()), |
| 176 | Qt::DirectConnection); | 180 | Qt::DirectConnection); |
| @@ -460,6 +464,21 @@ void GMainWindow::OnGameListLoadFile(QString game_path) { | |||
| 460 | BootGame(game_path.toStdString()); | 464 | BootGame(game_path.toStdString()); |
| 461 | } | 465 | } |
| 462 | 466 | ||
| 467 | void GMainWindow::OnGameListOpenSaveFolder(u64 program_id) { | ||
| 468 | std::string sdmc_dir = FileUtil::GetUserPath(D_SDMC_IDX); | ||
| 469 | std::string path = FileSys::ArchiveSource_SDSaveData::GetSaveDataPathFor(sdmc_dir, program_id); | ||
| 470 | QString qpath = QString::fromStdString(path); | ||
| 471 | |||
| 472 | QDir dir(qpath); | ||
| 473 | if (!dir.exists()) { | ||
| 474 | QMessageBox::critical(this, tr("Error Opening Save Folder"), tr("Folder does not exist!")); | ||
| 475 | return; | ||
| 476 | } | ||
| 477 | |||
| 478 | LOG_INFO(Frontend, "Opening save data path for program_id=%" PRIu64, program_id); | ||
| 479 | QDesktopServices::openUrl(QUrl::fromLocalFile(qpath)); | ||
| 480 | } | ||
| 481 | |||
| 463 | void GMainWindow::OnMenuLoadFile() { | 482 | void GMainWindow::OnMenuLoadFile() { |
| 464 | QString filename = | 483 | QString filename = |
| 465 | QFileDialog::getOpenFileName(this, tr("Load File"), UISettings::values.roms_path, | 484 | QFileDialog::getOpenFileName(this, tr("Load File"), UISettings::values.roms_path, |
diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index f87178227..035b68a35 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h | |||
| @@ -105,6 +105,7 @@ private slots: | |||
| 105 | void OnStopGame(); | 105 | void OnStopGame(); |
| 106 | /// Called whenever a user selects a game in the game list widget. | 106 | /// Called whenever a user selects a game in the game list widget. |
| 107 | void OnGameListLoadFile(QString game_path); | 107 | void OnGameListLoadFile(QString game_path); |
| 108 | void OnGameListOpenSaveFolder(u64 program_id); | ||
| 108 | void OnMenuLoadFile(); | 109 | void OnMenuLoadFile(); |
| 109 | void OnMenuLoadSymbolMap(); | 110 | void OnMenuLoadSymbolMap(); |
| 110 | /// Called whenever a user selects the "File->Select Game List Root" menu item | 111 | /// Called whenever a user selects the "File->Select Game List Root" menu item |