Browse Source

[qt] reorder per-game context menu

Signed-off-by: lizzie <lizzie@eden-emu.dev>
reorder-menu-game-per-config
lizzie 3 weeks ago
parent
commit
59734dcc04
No known key found for this signature in database GPG Key ID: 850DB8A38AD9F75F
  1. 14
      src/qt_common/util/game.cpp
  2. 72
      src/yuzu/game_list.cpp
  3. 6
      src/yuzu/main_window.cpp

14
src/qt_common/util/game.cpp

@ -274,18 +274,10 @@ void RemoveTransferableShaderCache(u64 program_id, GameListRemoveTarget target)
const auto shader_cache_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::ShaderDir);
const auto shader_cache_folder_path = shader_cache_dir / fmt::format("{:016x}", program_id);
const auto target_file = shader_cache_folder_path / target_file_name;
if (!Common::FS::Exists(target_file)) {
QtCommon::Frontend::Warning(tr("Error Removing Transferable Shader Cache"),
tr("A shader cache for this title does not exist."));
return;
}
if (Common::FS::RemoveFile(target_file)) {
QtCommon::Frontend::Information(tr("Successfully Removed"),
tr("Successfully removed the transferable shader cache."));
if (!Common::FS::Exists(target_file) || Common::FS::RemoveFile(target_file)) {
QtCommon::Frontend::Information(tr("Successfully Removed"), tr("Successfully removed the shader cache."));
} else {
QtCommon::Frontend::Warning(tr("Error Removing Transferable Shader Cache"),
tr("Failed to remove the transferable shader cache."));
QtCommon::Frontend::Warning(tr("Error Removing Shader Cache"), tr("Failed to remove the shader cache."));
}
}

72
src/yuzu/game_list.cpp

@ -545,44 +545,40 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri
// TODO(crueter): Refactor this and make it less bad
QAction* favorite = context_menu.addAction(tr("Favorite"));
context_menu.addSeparator();
QAction* start_game = context_menu.addAction(tr("Start Game"));
QAction* start_game_global =
context_menu.addAction(tr("Start Game without Custom Configuration"));
QAction* start_game = context_menu.addAction(tr("Start"));
QAction* start_game_global = context_menu.addAction(tr("Start with Global Settings"));
context_menu.addSeparator();
QAction* open_save_location = context_menu.addAction(tr("Open Save Data Location"));
QAction* open_mod_location = context_menu.addAction(tr("Open Mod Data Location"));
QAction* open_transferable_shader_cache =
context_menu.addAction(tr("Open Transferable Pipeline Cache"));
QAction* ryujinx = context_menu.addAction(tr("Link to Ryujinx"));
QAction* properties = context_menu.addAction(tr("Configure Game"));
context_menu.addSeparator();
QMenu* remove_menu = context_menu.addMenu(tr("Remove"));
QAction* remove_update = remove_menu->addAction(tr("Remove Installed Update"));
QAction* remove_dlc = remove_menu->addAction(tr("Remove All Installed DLC"));
QAction* remove_custom_config = remove_menu->addAction(tr("Remove Custom Configuration"));
QAction* remove_cache_storage = remove_menu->addAction(tr("Remove Cache Storage"));
QAction* remove_gl_shader_cache = remove_menu->addAction(tr("Remove OpenGL Pipeline Cache"));
QAction* remove_vk_shader_cache = remove_menu->addAction(tr("Remove Vulkan Pipeline Cache"));
remove_menu->addSeparator();
QAction* remove_shader_cache = remove_menu->addAction(tr("Remove All Pipeline Caches"));
QAction* remove_all_content = remove_menu->addAction(tr("Remove All Installed Contents"));
QMenu* play_time_menu = context_menu.addMenu(tr("Manage Play Time"));
QAction* set_play_time = play_time_menu->addAction(tr("Edit Play Time Data"));
QAction* remove_play_time_data = play_time_menu->addAction(tr("Remove Play Time Data"));
QMenu* dump_romfs_menu = context_menu.addMenu(tr("Dump RomFS"));
QAction* dump_romfs = dump_romfs_menu->addAction(tr("Dump RomFS"));
QAction* dump_romfs_sdmc = dump_romfs_menu->addAction(tr("Dump RomFS to SDMC"));
QAction* verify_integrity = context_menu.addAction(tr("Verify Integrity"));
QAction* copy_tid = context_menu.addAction(tr("Copy Title ID to Clipboard"));
QAction* navigate_to_gamedb_entry = context_menu.addAction(tr("Navigate to GameDB entry"));
QMenu* shader_cache_menu = context_menu.addMenu(tr("Shader Cache"));
QAction* open_transferable_shader_cache = shader_cache_menu->addAction(tr("Open Pipeline Cache"));
QAction* remove_shader_cache = shader_cache_menu->addAction(tr("Remove All Pipeline Caches"));
QAction* remove_gl_shader_cache = shader_cache_menu->addAction(tr("Remove OpenGL Pipeline Cache"));
QAction* remove_vk_shader_cache = shader_cache_menu->addAction(tr("Remove Vulkan Pipeline Cache"));
QMenu* storage_menu = context_menu.addMenu(tr("Storage"));
QAction* remove_all_content = storage_menu->addAction(tr("Remove All Installed Contents"));
QAction* remove_cache_storage = storage_menu->addAction(tr("Remove Cache Storage"));
QAction* remove_update = storage_menu->addAction(tr("Remove Installed Update"));
QAction* remove_dlc = storage_menu->addAction(tr("Remove All Installed DLC"));
QAction* remove_custom_config = storage_menu->addAction(tr("Remove Custom Settings"));
QAction* dump_romfs = storage_menu->addAction(tr("Dump RomFS"));
QAction* dump_romfs_sdmc = storage_menu->addAction(tr("Dump RomFS to SDMC"));
QAction* ryujinx = context_menu.addAction(tr("Link to Ryujinx"));
QMenu* play_time_menu = context_menu.addMenu(tr("Play Time"));
QAction* set_play_time = play_time_menu->addAction(tr("Edit"));
QAction* remove_play_time_data = play_time_menu->addAction(tr("Clear"));
// TODO: Implement shortcut creation for macOS
#if !defined(__APPLE__)
QMenu* shortcut_menu = context_menu.addMenu(tr("Create Shortcut"));
QAction* create_desktop_shortcut = shortcut_menu->addAction(tr("Add to Desktop"));
QAction* create_applications_menu_shortcut =
shortcut_menu->addAction(tr("Add to Applications Menu"));
QAction* create_applications_menu_shortcut = shortcut_menu->addAction(tr("Add to Applications Menu"));
#endif
context_menu.addSeparator();
QAction* properties = context_menu.addAction(tr("Configure Game"));
QAction* verify_integrity = context_menu.addAction(tr("Verify Integrity"));
QAction* copy_tid = context_menu.addAction(tr("Copy Title ID"));
QAction* navigate_to_gamedb_entry = context_menu.addAction(tr("View on GameDB"));
favorite->setVisible(program_id != 0);
favorite->setCheckable(true);
@ -603,10 +599,12 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri
connect(open_save_location, &QAction::triggered, [this, program_id, path]() {
emit OpenFolderRequested(program_id, GameListOpenTarget::SaveData, path);
});
connect(start_game, &QAction::triggered,
[this, path]() { emit BootGame(QString::fromStdString(path), StartGameType::Normal); });
connect(start_game_global, &QAction::triggered,
[this, path]() { emit BootGame(QString::fromStdString(path), StartGameType::Global); });
connect(start_game, &QAction::triggered, [this, path]() {
emit BootGame(QString::fromStdString(path), StartGameType::Normal);
});
connect(start_game_global, &QAction::triggered, [this, path]() {
emit BootGame(QString::fromStdString(path), StartGameType::Global);
});
connect(open_mod_location, &QAction::triggered, [this, program_id, path]() {
emit OpenFolderRequested(program_id, GameListOpenTarget::ModData, path);
});
@ -633,10 +631,12 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri
connect(remove_custom_config, &QAction::triggered, [this, program_id, path]() {
emit RemoveFileRequested(program_id, QtCommon::Game::GameListRemoveTarget::CustomConfiguration, path);
});
connect(set_play_time, &QAction::triggered,
[this, program_id]() { emit SetPlayTimeRequested(program_id); });
connect(remove_play_time_data, &QAction::triggered,
[this, program_id]() { emit RemovePlayTimeRequested(program_id); });
connect(set_play_time, &QAction::triggered, [this, program_id]() {
emit SetPlayTimeRequested(program_id);
});
connect(remove_play_time_data, &QAction::triggered, [this, program_id]() {
emit RemovePlayTimeRequested(program_id);
});
connect(remove_cache_storage, &QAction::triggered, [this, program_id, path] {
emit RemoveFileRequested(program_id, QtCommon::Game::GameListRemoveTarget::CacheStorage, path);
});

6
src/yuzu/main_window.cpp

@ -2536,11 +2536,11 @@ void MainWindow::OnGameListRemoveFile(u64 program_id, QtCommon::Game::GameListRe
const QString question = [target] {
switch (target) {
case QtCommon::Game::GameListRemoveTarget::GlShaderCache:
return tr("Delete OpenGL Transferable Shader Cache?");
return tr("Delete OpenGL Shader Cache?");
case QtCommon::Game::GameListRemoveTarget::VkShaderCache:
return tr("Delete Vulkan Transferable Shader Cache?");
return tr("Delete Vulkan Shader Cache?");
case QtCommon::Game::GameListRemoveTarget::AllShaderCache:
return tr("Delete All Transferable Shader Caches?");
return tr("Delete All Shader Caches?");
case QtCommon::Game::GameListRemoveTarget::CustomConfiguration:
return tr("Remove Custom Game Configuration?");
case QtCommon::Game::GameListRemoveTarget::CacheStorage:

Loading…
Cancel
Save