mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-12 18:54:25 +01:00
Merge pull request #9180 from Docteh/remove_stuff
UI: split up strings relating to content removal
This commit is contained in:
commit
83eb9cf7da
@ -2018,38 +2018,50 @@ static bool RomFSRawCopy(QProgressDialog& dialog, const FileSys::VirtualDir& src
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString GMainWindow::GetGameListErrorRemoving(InstalledEntryType type) const {
|
||||||
|
switch (type) {
|
||||||
|
case InstalledEntryType::Game:
|
||||||
|
return tr("Error Removing Contents");
|
||||||
|
case InstalledEntryType::Update:
|
||||||
|
return tr("Error Removing Update");
|
||||||
|
case InstalledEntryType::AddOnContent:
|
||||||
|
return tr("Error Removing DLC");
|
||||||
|
default:
|
||||||
|
return QStringLiteral("Error Removing <Invalid Type>");
|
||||||
|
}
|
||||||
|
}
|
||||||
void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryType type) {
|
void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryType type) {
|
||||||
const QString entry_type = [type] {
|
const QString entry_question = [type] {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case InstalledEntryType::Game:
|
case InstalledEntryType::Game:
|
||||||
return tr("Contents");
|
return tr("Remove Installed Game Contents?");
|
||||||
case InstalledEntryType::Update:
|
case InstalledEntryType::Update:
|
||||||
return tr("Update");
|
return tr("Remove Installed Game Update?");
|
||||||
case InstalledEntryType::AddOnContent:
|
case InstalledEntryType::AddOnContent:
|
||||||
return tr("DLC");
|
return tr("Remove Installed Game DLC?");
|
||||||
default:
|
default:
|
||||||
return QString{};
|
return QStringLiteral("Remove Installed Game <Invalid Type>?");
|
||||||
}
|
}
|
||||||
}();
|
}();
|
||||||
|
|
||||||
if (QMessageBox::question(
|
if (QMessageBox::question(this, tr("Remove Entry"), entry_question,
|
||||||
this, tr("Remove Entry"), tr("Remove Installed Game %1?").arg(entry_type),
|
QMessageBox::Yes | QMessageBox::No,
|
||||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes) {
|
QMessageBox::No) != QMessageBox::Yes) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case InstalledEntryType::Game:
|
case InstalledEntryType::Game:
|
||||||
RemoveBaseContent(program_id, entry_type);
|
RemoveBaseContent(program_id, type);
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case InstalledEntryType::Update:
|
case InstalledEntryType::Update:
|
||||||
RemoveUpdateContent(program_id, entry_type);
|
RemoveUpdateContent(program_id, type);
|
||||||
if (type != InstalledEntryType::Game) {
|
if (type != InstalledEntryType::Game) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case InstalledEntryType::AddOnContent:
|
case InstalledEntryType::AddOnContent:
|
||||||
RemoveAddOnContent(program_id, entry_type);
|
RemoveAddOnContent(program_id, type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Common::FS::RemoveDirRecursively(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) /
|
Common::FS::RemoveDirRecursively(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) /
|
||||||
@ -2057,7 +2069,7 @@ void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryT
|
|||||||
game_list->PopulateAsync(UISettings::values.game_dirs);
|
game_list->PopulateAsync(UISettings::values.game_dirs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) {
|
void GMainWindow::RemoveBaseContent(u64 program_id, InstalledEntryType type) {
|
||||||
const auto& fs_controller = system->GetFileSystemController();
|
const auto& fs_controller = system->GetFileSystemController();
|
||||||
const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) ||
|
const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) ||
|
||||||
fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id);
|
fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id);
|
||||||
@ -2067,12 +2079,12 @@ void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) {
|
|||||||
tr("Successfully removed the installed base game."));
|
tr("Successfully removed the installed base game."));
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::warning(
|
QMessageBox::warning(
|
||||||
this, tr("Error Removing %1").arg(entry_type),
|
this, GetGameListErrorRemoving(type),
|
||||||
tr("The base game is not installed in the NAND and cannot be removed."));
|
tr("The base game is not installed in the NAND and cannot be removed."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) {
|
void GMainWindow::RemoveUpdateContent(u64 program_id, InstalledEntryType type) {
|
||||||
const auto update_id = program_id | 0x800;
|
const auto update_id = program_id | 0x800;
|
||||||
const auto& fs_controller = system->GetFileSystemController();
|
const auto& fs_controller = system->GetFileSystemController();
|
||||||
const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) ||
|
const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) ||
|
||||||
@ -2082,12 +2094,12 @@ void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type)
|
|||||||
QMessageBox::information(this, tr("Successfully Removed"),
|
QMessageBox::information(this, tr("Successfully Removed"),
|
||||||
tr("Successfully removed the installed update."));
|
tr("Successfully removed the installed update."));
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::warning(this, tr("Error Removing %1").arg(entry_type),
|
QMessageBox::warning(this, GetGameListErrorRemoving(type),
|
||||||
tr("There is no update installed for this title."));
|
tr("There is no update installed for this title."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) {
|
void GMainWindow::RemoveAddOnContent(u64 program_id, InstalledEntryType type) {
|
||||||
u32 count{};
|
u32 count{};
|
||||||
const auto& fs_controller = system->GetFileSystemController();
|
const auto& fs_controller = system->GetFileSystemController();
|
||||||
const auto dlc_entries = system->GetContentProvider().ListEntriesFilter(
|
const auto dlc_entries = system->GetContentProvider().ListEntriesFilter(
|
||||||
@ -2105,7 +2117,7 @@ void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
QMessageBox::warning(this, tr("Error Removing %1").arg(entry_type),
|
QMessageBox::warning(this, GetGameListErrorRemoving(type),
|
||||||
tr("There are no DLC installed for this title."));
|
tr("There are no DLC installed for this title."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -324,9 +324,10 @@ private slots:
|
|||||||
void OnMouseActivity();
|
void OnMouseActivity();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void RemoveBaseContent(u64 program_id, const QString& entry_type);
|
QString GetGameListErrorRemoving(InstalledEntryType type) const;
|
||||||
void RemoveUpdateContent(u64 program_id, const QString& entry_type);
|
void RemoveBaseContent(u64 program_id, InstalledEntryType type);
|
||||||
void RemoveAddOnContent(u64 program_id, const QString& entry_type);
|
void RemoveUpdateContent(u64 program_id, InstalledEntryType type);
|
||||||
|
void RemoveAddOnContent(u64 program_id, InstalledEntryType type);
|
||||||
void RemoveTransferableShaderCache(u64 program_id, GameListRemoveTarget target);
|
void RemoveTransferableShaderCache(u64 program_id, GameListRemoveTarget target);
|
||||||
void RemoveAllTransferableShaderCaches(u64 program_id);
|
void RemoveAllTransferableShaderCaches(u64 program_id);
|
||||||
void RemoveCustomConfiguration(u64 program_id, const std::string& game_path);
|
void RemoveCustomConfiguration(u64 program_id, const std::string& game_path);
|
||||||
|
Loading…
Reference in New Issue
Block a user