citra_qt: Add 'Open Mods Location'

This commit is contained in:
zhupengfei 2020-02-07 14:44:34 +08:00
parent 91e5a39a08
commit 7c652a0479
No known key found for this signature in database
GPG key ID: DD129E108BD09378
3 changed files with 16 additions and 1 deletions

View file

@ -468,6 +468,7 @@ void GameList::AddGamePopup(QMenu& context_menu, const QString& path, u64 progra
QAction* open_texture_dump_location = context_menu.addAction(tr("Open Texture Dump Location"));
QAction* open_texture_load_location =
context_menu.addAction(tr("Open Custom Texture Location"));
QAction* open_mods_location = context_menu.addAction(tr("Open Mods Location"));
QAction* navigate_to_gamedb_entry = context_menu.addAction(tr("Navigate to GameDB entry"));
const bool is_application =
@ -497,6 +498,7 @@ void GameList::AddGamePopup(QMenu& context_menu, const QString& path, u64 progra
open_texture_dump_location->setVisible(is_application);
open_texture_load_location->setVisible(is_application);
open_mods_location->setVisible(is_application);
navigate_to_gamedb_entry->setVisible(it != compatibility_list.end());
@ -526,6 +528,13 @@ void GameList::AddGamePopup(QMenu& context_menu, const QString& path, u64 progra
emit OpenFolderRequested(program_id, GameListOpenTarget::TEXTURE_LOAD);
}
});
connect(open_mods_location, &QAction::triggered, [this, program_id] {
if (FileUtil::CreateFullPath(fmt::format("{}mods/{:016X}/",
FileUtil::GetUserPath(FileUtil::UserPath::LoadDir),
program_id))) {
emit OpenFolderRequested(program_id, GameListOpenTarget::MODS);
}
});
connect(navigate_to_gamedb_entry, &QAction::triggered, [this, program_id]() {
emit NavigateToGamedbEntryRequested(program_id, compatibility_list);
});

View file

@ -35,7 +35,8 @@ enum class GameListOpenTarget {
APPLICATION = 2,
UPDATE_DATA = 3,
TEXTURE_DUMP = 4,
TEXTURE_LOAD = 5
TEXTURE_LOAD = 5,
MODS = 6,
};
class GameList : public QWidget {

View file

@ -1141,6 +1141,11 @@ void GMainWindow::OnGameListOpenFolder(u64 data_id, GameListOpenTarget target) {
path = fmt::format("{}textures/{:016X}/",
FileUtil::GetUserPath(FileUtil::UserPath::LoadDir), data_id);
break;
case GameListOpenTarget::MODS:
open_target = "Mods";
path = fmt::format("{}mods/{:016X}/", FileUtil::GetUserPath(FileUtil::UserPath::LoadDir),
data_id);
break;
default:
LOG_ERROR(Frontend, "Unexpected target {}", static_cast<int>(target));
return;