diff options
| -rw-r--r-- | src/yuzu/main.cpp | 46 | ||||
| -rw-r--r-- | src/yuzu/main.h | 7 |
2 files changed, 33 insertions, 20 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 59e56633a..c27f8196d 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -2018,38 +2018,50 @@ static bool RomFSRawCopy(QProgressDialog& dialog, const FileSys::VirtualDir& src | |||
| 2018 | return true; | 2018 | return true; |
| 2019 | } | 2019 | } |
| 2020 | 2020 | ||
| 2021 | QString GMainWindow::GetGameListErrorRemoving(InstalledEntryType type) const { | ||
| 2022 | switch (type) { | ||
| 2023 | case InstalledEntryType::Game: | ||
| 2024 | return tr("Error Removing Contents"); | ||
| 2025 | case InstalledEntryType::Update: | ||
| 2026 | return tr("Error Removing Update"); | ||
| 2027 | case InstalledEntryType::AddOnContent: | ||
| 2028 | return tr("Error Removing DLC"); | ||
| 2029 | default: | ||
| 2030 | return QStringLiteral("Error Removing <Invalid Type>"); | ||
| 2031 | } | ||
| 2032 | } | ||
| 2021 | void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryType type) { | 2033 | void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryType type) { |
| 2022 | const QString entry_type = [type] { | 2034 | const QString entry_question = [type] { |
| 2023 | switch (type) { | 2035 | switch (type) { |
| 2024 | case InstalledEntryType::Game: | 2036 | case InstalledEntryType::Game: |
| 2025 | return tr("Contents"); | 2037 | return tr("Remove Installed Game Contents?"); |
| 2026 | case InstalledEntryType::Update: | 2038 | case InstalledEntryType::Update: |
| 2027 | return tr("Update"); | 2039 | return tr("Remove Installed Game Update?"); |
| 2028 | case InstalledEntryType::AddOnContent: | 2040 | case InstalledEntryType::AddOnContent: |
| 2029 | return tr("DLC"); | 2041 | return tr("Remove Installed Game DLC?"); |
| 2030 | default: | 2042 | default: |
| 2031 | return QString{}; | 2043 | return QStringLiteral("Remove Installed Game <Invalid Type>?"); |
| 2032 | } | 2044 | } |
| 2033 | }(); | 2045 | }(); |
| 2034 | 2046 | ||
| 2035 | if (QMessageBox::question( | 2047 | if (QMessageBox::question(this, tr("Remove Entry"), entry_question, |
| 2036 | this, tr("Remove Entry"), tr("Remove Installed Game %1?").arg(entry_type), | 2048 | QMessageBox::Yes | QMessageBox::No, |
| 2037 | QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes) { | 2049 | QMessageBox::No) != QMessageBox::Yes) { |
| 2038 | return; | 2050 | return; |
| 2039 | } | 2051 | } |
| 2040 | 2052 | ||
| 2041 | switch (type) { | 2053 | switch (type) { |
| 2042 | case InstalledEntryType::Game: | 2054 | case InstalledEntryType::Game: |
| 2043 | RemoveBaseContent(program_id, entry_type); | 2055 | RemoveBaseContent(program_id, type); |
| 2044 | [[fallthrough]]; | 2056 | [[fallthrough]]; |
| 2045 | case InstalledEntryType::Update: | 2057 | case InstalledEntryType::Update: |
| 2046 | RemoveUpdateContent(program_id, entry_type); | 2058 | RemoveUpdateContent(program_id, type); |
| 2047 | if (type != InstalledEntryType::Game) { | 2059 | if (type != InstalledEntryType::Game) { |
| 2048 | break; | 2060 | break; |
| 2049 | } | 2061 | } |
| 2050 | [[fallthrough]]; | 2062 | [[fallthrough]]; |
| 2051 | case InstalledEntryType::AddOnContent: | 2063 | case InstalledEntryType::AddOnContent: |
| 2052 | RemoveAddOnContent(program_id, entry_type); | 2064 | RemoveAddOnContent(program_id, type); |
| 2053 | break; | 2065 | break; |
| 2054 | } | 2066 | } |
| 2055 | Common::FS::RemoveDirRecursively(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) / | 2067 | Common::FS::RemoveDirRecursively(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) / |
| @@ -2057,7 +2069,7 @@ void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryT | |||
| 2057 | game_list->PopulateAsync(UISettings::values.game_dirs); | 2069 | game_list->PopulateAsync(UISettings::values.game_dirs); |
| 2058 | } | 2070 | } |
| 2059 | 2071 | ||
| 2060 | void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) { | 2072 | void GMainWindow::RemoveBaseContent(u64 program_id, InstalledEntryType type) { |
| 2061 | const auto& fs_controller = system->GetFileSystemController(); | 2073 | const auto& fs_controller = system->GetFileSystemController(); |
| 2062 | const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) || | 2074 | const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) || |
| 2063 | fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id); | 2075 | fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id); |
| @@ -2067,12 +2079,12 @@ void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) { | |||
| 2067 | tr("Successfully removed the installed base game.")); | 2079 | tr("Successfully removed the installed base game.")); |
| 2068 | } else { | 2080 | } else { |
| 2069 | QMessageBox::warning( | 2081 | QMessageBox::warning( |
| 2070 | this, tr("Error Removing %1").arg(entry_type), | 2082 | this, GetGameListErrorRemoving(type), |
| 2071 | tr("The base game is not installed in the NAND and cannot be removed.")); | 2083 | tr("The base game is not installed in the NAND and cannot be removed.")); |
| 2072 | } | 2084 | } |
| 2073 | } | 2085 | } |
| 2074 | 2086 | ||
| 2075 | void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) { | 2087 | void GMainWindow::RemoveUpdateContent(u64 program_id, InstalledEntryType type) { |
| 2076 | const auto update_id = program_id | 0x800; | 2088 | const auto update_id = program_id | 0x800; |
| 2077 | const auto& fs_controller = system->GetFileSystemController(); | 2089 | const auto& fs_controller = system->GetFileSystemController(); |
| 2078 | const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) || | 2090 | const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) || |
| @@ -2082,12 +2094,12 @@ void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) | |||
| 2082 | QMessageBox::information(this, tr("Successfully Removed"), | 2094 | QMessageBox::information(this, tr("Successfully Removed"), |
| 2083 | tr("Successfully removed the installed update.")); | 2095 | tr("Successfully removed the installed update.")); |
| 2084 | } else { | 2096 | } else { |
| 2085 | QMessageBox::warning(this, tr("Error Removing %1").arg(entry_type), | 2097 | QMessageBox::warning(this, GetGameListErrorRemoving(type), |
| 2086 | tr("There is no update installed for this title.")); | 2098 | tr("There is no update installed for this title.")); |
| 2087 | } | 2099 | } |
| 2088 | } | 2100 | } |
| 2089 | 2101 | ||
| 2090 | void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) { | 2102 | void GMainWindow::RemoveAddOnContent(u64 program_id, InstalledEntryType type) { |
| 2091 | u32 count{}; | 2103 | u32 count{}; |
| 2092 | const auto& fs_controller = system->GetFileSystemController(); | 2104 | const auto& fs_controller = system->GetFileSystemController(); |
| 2093 | const auto dlc_entries = system->GetContentProvider().ListEntriesFilter( | 2105 | const auto dlc_entries = system->GetContentProvider().ListEntriesFilter( |
| @@ -2105,7 +2117,7 @@ void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) | |||
| 2105 | } | 2117 | } |
| 2106 | 2118 | ||
| 2107 | if (count == 0) { | 2119 | if (count == 0) { |
| 2108 | QMessageBox::warning(this, tr("Error Removing %1").arg(entry_type), | 2120 | QMessageBox::warning(this, GetGameListErrorRemoving(type), |
| 2109 | tr("There are no DLC installed for this title.")); | 2121 | tr("There are no DLC installed for this title.")); |
| 2110 | return; | 2122 | return; |
| 2111 | } | 2123 | } |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 150ada84c..b73f550dd 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -324,9 +324,10 @@ private slots: | |||
| 324 | void OnMouseActivity(); | 324 | void OnMouseActivity(); |
| 325 | 325 | ||
| 326 | private: | 326 | private: |
| 327 | void RemoveBaseContent(u64 program_id, const QString& entry_type); | 327 | QString GetGameListErrorRemoving(InstalledEntryType type) const; |
| 328 | void RemoveUpdateContent(u64 program_id, const QString& entry_type); | 328 | void RemoveBaseContent(u64 program_id, InstalledEntryType type); |
| 329 | void RemoveAddOnContent(u64 program_id, const QString& entry_type); | 329 | void RemoveUpdateContent(u64 program_id, InstalledEntryType type); |
| 330 | void RemoveAddOnContent(u64 program_id, InstalledEntryType type); | ||
| 330 | void RemoveTransferableShaderCache(u64 program_id, GameListRemoveTarget target); | 331 | void RemoveTransferableShaderCache(u64 program_id, GameListRemoveTarget target); |
| 331 | void RemoveAllTransferableShaderCaches(u64 program_id); | 332 | void RemoveAllTransferableShaderCaches(u64 program_id); |
| 332 | void RemoveCustomConfiguration(u64 program_id, const std::string& game_path); | 333 | void RemoveCustomConfiguration(u64 program_id, const std::string& game_path); |