game_list: Add "Remove" context menu

Adds the following actions:
- Remove Installed Update
- Remove All Installed DLC
- Remove Shader Cache
- Remove Custom Configuration
- Remove All Installed Contents
master
Morph 2020-07-17 05:20:27 +07:00
parent b205b12e75
commit de6b852dc2
2 changed files with 37 additions and 4 deletions

@ -474,10 +474,17 @@ void GameList::PopupContextMenu(const QPoint& menu_location) {
void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, std::string path) {
QAction* open_save_location = context_menu.addAction(tr("Open Save Data Location"));
QAction* open_lfs_location = context_menu.addAction(tr("Open Mod 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 Shader Cache"));
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_shader_cache = remove_menu->addAction(tr("Remove Shader Cache"));
QAction* remove_custom_config = remove_menu->addAction(tr("Remove Custom Configuration"));
remove_menu->addSeparator();
QAction* remove_all_content = remove_menu->addAction(tr("Remove All Installed Contents"));
QAction* dump_romfs = context_menu.addAction(tr("Dump RomFS"));
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"));
@ -491,11 +498,26 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, std::string pat
connect(open_save_location, &QAction::triggered, [this, program_id, path]() {
emit OpenFolderRequested(GameListOpenTarget::SaveData, path);
});
connect(open_lfs_location, &QAction::triggered, [this, program_id, path]() {
connect(open_mod_location, &QAction::triggered, [this, program_id, path]() {
emit OpenFolderRequested(GameListOpenTarget::ModData, path);
});
connect(open_transferable_shader_cache, &QAction::triggered,
[this, program_id]() { emit OpenTransferableShaderCacheRequested(program_id); });
connect(remove_all_content, &QAction::triggered, [this, program_id]() {
emit RemoveInstalledEntryRequested(program_id, InstalledEntryType::Game);
});
connect(remove_update, &QAction::triggered, [this, program_id]() {
emit RemoveInstalledEntryRequested(program_id, InstalledEntryType::Update);
});
connect(remove_dlc, &QAction::triggered, [this, program_id]() {
emit RemoveInstalledEntryRequested(program_id, InstalledEntryType::AddOnContent);
});
connect(remove_shader_cache, &QAction::triggered, [this, program_id]() {
emit RemoveFileRequested(program_id, GameListRemoveTarget::ShaderCache);
});
connect(remove_custom_config, &QAction::triggered, [this, program_id]() {
emit RemoveFileRequested(program_id, GameListRemoveTarget::CustomConfiguration);
});
connect(dump_romfs, &QAction::triggered,
[this, program_id, path]() { emit DumpRomFSRequested(program_id, path); });
connect(copy_tid, &QAction::triggered,

@ -39,6 +39,17 @@ enum class GameListOpenTarget {
ModData,
};
enum class GameListRemoveTarget {
ShaderCache,
CustomConfiguration,
};
enum class InstalledEntryType {
Game,
Update,
AddOnContent,
};
class GameList : public QWidget {
Q_OBJECT
@ -75,6 +86,8 @@ signals:
void ShouldCancelWorker();
void OpenFolderRequested(GameListOpenTarget target, const std::string& game_path);
void OpenTransferableShaderCacheRequested(u64 program_id);
void RemoveInstalledEntryRequested(u64 program_id, InstalledEntryType type);
void RemoveFileRequested(u64 program_id, GameListRemoveTarget target);
void DumpRomFSRequested(u64 program_id, const std::string& game_path);
void CopyTIDRequested(u64 program_id);
void NavigateToGamedbEntryRequested(u64 program_id,
@ -117,8 +130,6 @@ private:
friend class GameListSearchField;
};
Q_DECLARE_METATYPE(GameListOpenTarget);
class GameListPlaceholder : public QWidget {
Q_OBJECT
public: