fix compile errors on Mac and provide reviewed changes

This commit is contained in:
digant73 2025-11-30 19:56:43 +01:00
parent d1c11fcaaf
commit 82cccf8947
3 changed files with 110 additions and 116 deletions

View file

@ -1420,13 +1420,13 @@ void game_list_frame::ShowSingleSelectionContextMenu(const game_info& gameinfo,
switch (type) switch (type)
{ {
case icon_type::game_list: case icon_type::game_list:
msg = tr("Remove Custom Icon of %0?").arg(serial); msg = tr("Remove Custom Icon of %0?").arg(QString::fromStdString(serial));
break; break;
case icon_type::hover_gif: case icon_type::hover_gif:
msg = tr("Remove Custom Hover Gif of %0?").arg(serial); msg = tr("Remove Custom Hover Gif of %0?").arg(QString::fromStdString(serial));
break; break;
case icon_type::shader_load: case icon_type::shader_load:
msg = tr("Remove Custom Shader Loading Background of %0?").arg(serial); msg = tr("Remove Custom Shader Loading Background of %0?").arg(QString::fromStdString(serial));
break; break;
} }
@ -1995,12 +1995,12 @@ void game_list_frame::ShowContextMenu(const QPoint& pos)
} }
} }
void game_list_frame::SetContentList(u16 contentTypes, const ContentInfo& contentInfo) void game_list_frame::SetContentList(u16 content_types, const content_info& content_info)
{ {
this->contentInfo = contentInfo; m_content_info = content_info;
this->contentInfo.contentTypes = contentTypes; m_content_info.content_types = content_types;
this->contentInfo.clearOnFinish = true; // Always overridden by BatchRemoveContentLists() m_content_info.clear_on_finish = true; // Always overridden by BatchRemoveContentLists()
} }
void game_list_frame::ClearContentList(bool refresh) void game_list_frame::ClearContentList(bool refresh)
@ -2010,7 +2010,7 @@ void game_list_frame::ClearContentList(bool refresh)
std::vector<std::string> serials_to_remove_from_yml; std::vector<std::string> serials_to_remove_from_yml;
// Prepare the list of serials (title id) to remove in "games.yml" file (if any) // Prepare the list of serials (title id) to remove in "games.yml" file (if any)
for (auto& removedDisc : contentInfo.removedDiscList) for (const auto& removedDisc : m_content_info.removed_disc_list)
{ {
serials_to_remove_from_yml.push_back(removedDisc); serials_to_remove_from_yml.push_back(removedDisc);
} }
@ -2020,24 +2020,24 @@ void game_list_frame::ClearContentList(bool refresh)
Refresh(true, serials_to_remove_from_yml); Refresh(true, serials_to_remove_from_yml);
} }
contentInfo = {NO_CONTENT}; m_content_info = {NO_CONTENT};
} }
game_list_frame::ContentInfo game_list_frame::GetContentInfo(const std::vector<game_info>& games) game_list_frame::content_info game_list_frame::GetContentInfo(const std::vector<game_info>& games)
{ {
ContentInfo contentInfo = {NO_CONTENT}; content_info content_info = {NO_CONTENT};
if (games.size() == 0) if (games.empty())
return contentInfo; return content_info;
bool is_disc_game = false; bool is_disc_game = false;
u64 total_disc_size = 0; u64 total_disc_size = 0;
u64 total_data_size = 0; u64 total_data_size = 0;
QString text; QString text;
// Fill in contentInfo // Fill in content_info
contentInfo.isSingleSelection = games.size() == 1; content_info.is_single_selection = games.size() == 1;
for (const auto& game : games) for (const auto& game : games)
{ {
@ -2046,10 +2046,10 @@ game_list_frame::ContentInfo game_list_frame::GetContentInfo(const std::vector<g
is_disc_game = QString::fromStdString(current_game.category) == cat::cat_disc_game; is_disc_game = QString::fromStdString(current_game.category) == cat::cat_disc_game;
// +1 if it's a disc game's path and it's present in the shared games folder // +1 if it's a disc game's path and it's present in the shared games folder
contentInfo.inGamesDirCount += (is_disc_game && Emu.IsPathInsideDir(current_game.path, rpcs3::utils::get_games_dir())) ? 1 : 0; content_info.in_games_dir_count += (is_disc_game && Emu.IsPathInsideDir(current_game.path, rpcs3::utils::get_games_dir())) ? 1 : 0;
// Add the name to the content's name list for the related serial // Add the name to the content's name list for the related serial
contentInfo.nameList[current_game.serial].insert(current_game.name); content_info.name_list[current_game.serial].insert(current_game.name);
if (is_disc_game) if (is_disc_game)
{ {
@ -2057,7 +2057,7 @@ game_list_frame::ContentInfo game_list_frame::GetContentInfo(const std::vector<g
total_disc_size += current_game.size_on_disk; total_disc_size += current_game.size_on_disk;
// Add the serial to the disc list // Add the serial to the disc list
contentInfo.discList.insert(current_game.serial); content_info.disc_list.insert(current_game.serial);
// It could be an empty list for a disc game // It could be an empty list for a disc game
std::set<std::string> data_dir_list = rpcs3::utils::get_dir_list(rpcs3::utils::get_hdd0_game_dir(), current_game.serial); std::set<std::string> data_dir_list = rpcs3::utils::get_dir_list(rpcs3::utils::get_hdd0_game_dir(), current_game.serial);
@ -2065,19 +2065,19 @@ game_list_frame::ContentInfo game_list_frame::GetContentInfo(const std::vector<g
// Add the path list to the content's path list for the related serial // Add the path list to the content's path list for the related serial
for (const auto& data_dir : data_dir_list) for (const auto& data_dir : data_dir_list)
{ {
contentInfo.pathList[current_game.serial].insert(data_dir); content_info.path_list[current_game.serial].insert(data_dir);
} }
} }
else else
{ {
// Add the path to the content's path list for the related serial // Add the path to the content's path list for the related serial
contentInfo.pathList[current_game.serial].insert(current_game.path); content_info.path_list[current_game.serial].insert(current_game.path);
} }
} }
// Fill in text based on filled in contentInfo // Fill in text based on filled in content_info
if (contentInfo.isSingleSelection) // Single selection if (content_info.is_single_selection) // Single selection
{ {
GameInfo& current_game = games[0]->info; GameInfo& current_game = games[0]->info;
@ -2092,7 +2092,7 @@ game_list_frame::ContentInfo game_list_frame::GetContentInfo(const std::vector<g
} }
// if a path is present (it could be an empty list for a disc game) // if a path is present (it could be an empty list for a disc game)
if (const auto& it = contentInfo.pathList.find(current_game.serial); it != contentInfo.pathList.end()) if (const auto& it = content_info.path_list.find(current_game.serial); it != content_info.path_list.end())
{ {
text += tr("\n%0 Info:\n").arg(is_disc_game ? tr("Game Data") : games[0]->localized_category); text += tr("\n%0 Info:\n").arg(is_disc_game ? tr("Game Data") : games[0]->localized_category);
@ -2113,7 +2113,7 @@ game_list_frame::ContentInfo game_list_frame::GetContentInfo(const std::vector<g
} }
else // Multi selection else // Multi selection
{ {
for (const auto& [serial, data_dir_list] : contentInfo.pathList) for (const auto& [serial, data_dir_list] : content_info.path_list)
{ {
for (const auto& data_dir : data_dir_list) for (const auto& data_dir : data_dir_list)
{ {
@ -2123,23 +2123,23 @@ game_list_frame::ContentInfo game_list_frame::GetContentInfo(const std::vector<g
} }
text = tr("%0 selected games: %1 Disc Game - %2 not Disc Game\n").arg(games.size()) text = tr("%0 selected games: %1 Disc Game - %2 not Disc Game\n").arg(games.size())
.arg(contentInfo.discList.size()).arg(games.size() - contentInfo.discList.size()); .arg(content_info.disc_list.size()).arg(games.size() - content_info.disc_list.size());
text += tr("\nDisc Game Info:\n"); text += tr("\nDisc Game Info:\n");
if (contentInfo.discList.size() != contentInfo.inGamesDirCount) if (content_info.disc_list.size() != content_info.in_games_dir_count)
text += tr("VFS unhosted: %0\n").arg(contentInfo.discList.size() - contentInfo.inGamesDirCount); text += tr("VFS unhosted: %0\n").arg(content_info.disc_list.size() - content_info.in_games_dir_count);
if (contentInfo.inGamesDirCount) if (content_info.in_games_dir_count)
text += tr("VFS hosted: %0\n").arg(contentInfo.inGamesDirCount); text += tr("VFS hosted: %0\n").arg(content_info.in_games_dir_count);
if (contentInfo.discList.size() != contentInfo.inGamesDirCount && contentInfo.inGamesDirCount) if (content_info.disc_list.size() != content_info.in_games_dir_count && content_info.in_games_dir_count)
text += tr("Total games: %0\n").arg((contentInfo.discList.size() - contentInfo.inGamesDirCount) + contentInfo.inGamesDirCount); text += tr("Total games: %0\n").arg((content_info.disc_list.size() - content_info.in_games_dir_count) + content_info.in_games_dir_count);
if (total_disc_size) if (total_disc_size)
text += tr("Total size: %0\n").arg(gui::utils::format_byte_size(total_disc_size)); text += tr("Total size: %0\n").arg(gui::utils::format_byte_size(total_disc_size));
if (contentInfo.pathList.size()) if (content_info.path_list.size())
text += tr("\nGame Data Info:\nTotal size: %0\n").arg(gui::utils::format_byte_size(total_data_size)); text += tr("\nGame Data Info:\nTotal size: %0\n").arg(gui::utils::format_byte_size(total_data_size));
} }
@ -2150,7 +2150,7 @@ game_list_frame::ContentInfo game_list_frame::GetContentInfo(const std::vector<g
u64 recordings_size = 0; u64 recordings_size = 0;
u64 screenshots_size = 0; u64 screenshots_size = 0;
for (const auto& [serial, name_list] : contentInfo.nameList) for (const auto& [serial, name_list] : content_info.name_list)
{ {
// Main cache // Main cache
if (const u64 size = fs::get_dir_size(rpcs3::utils::get_cache_dir_by_serial(serial), 1); size != umax) if (const u64 size = fs::get_dir_size(rpcs3::utils::get_cache_dir_by_serial(serial), 1); size != umax)
@ -2193,18 +2193,18 @@ game_list_frame::ContentInfo game_list_frame::GetContentInfo(const std::vector<g
if (fs::device_stat stat{}; fs::statfs(rpcs3::utils::get_hdd0_dir(), stat)) if (fs::device_stat stat{}; fs::statfs(rpcs3::utils::get_hdd0_dir(), stat))
text += tr("\nCurrent free disk space: %0\n").arg(gui::utils::format_byte_size(stat.avail_free)); text += tr("\nCurrent free disk space: %0\n").arg(gui::utils::format_byte_size(stat.avail_free));
contentInfo.info = text; content_info.info = text;
return contentInfo; return content_info;
} }
void game_list_frame::DialogRemoveGame(const std::vector<game_info>& games) void game_list_frame::DialogRemoveGame(const std::vector<game_info>& games)
{ {
if (games.size() == 0) if (games.empty())
return; return;
ContentInfo contentInfo = GetContentInfo(games); content_info content_info = GetContentInfo(games);
QString text = contentInfo.info; QString text = content_info.info;
QCheckBox* disc = new QCheckBox(tr("Remove title from game list (Disc Game path is not removed!)")); QCheckBox* disc = new QCheckBox(tr("Remove title from game list (Disc Game path is not removed!)"));
QCheckBox* caches = new QCheckBox(tr("Remove caches and custom configs")); QCheckBox* caches = new QCheckBox(tr("Remove caches and custom configs"));
@ -2214,16 +2214,16 @@ void game_list_frame::DialogRemoveGame(const std::vector<game_info>& games)
QCheckBox* recordings = new QCheckBox(tr("Remove recordings")); QCheckBox* recordings = new QCheckBox(tr("Remove recordings"));
QCheckBox* screenshots = new QCheckBox(tr("Remove screenshots")); QCheckBox* screenshots = new QCheckBox(tr("Remove screenshots"));
if (contentInfo.discList.size()) if (content_info.disc_list.size())
{ {
if (contentInfo.inGamesDirCount == contentInfo.discList.size()) if (content_info.in_games_dir_count == content_info.disc_list.size())
{ {
disc->setToolTip(tr("Title located under auto-detection VFS \"games\" folder cannot be removed")); disc->setToolTip(tr("Title located under auto-detection VFS \"games\" folder cannot be removed"));
disc->setDisabled(true); disc->setDisabled(true);
} }
else else
{ {
if (!contentInfo.isSingleSelection) // Multi selection if (!content_info.is_single_selection) // Multi selection
disc->setToolTip(tr("Title located under auto-detection VFS \"games\" folder cannot be removed")); disc->setToolTip(tr("Title located under auto-detection VFS \"games\" folder cannot be removed"));
disc->setChecked(true); disc->setChecked(true);
@ -2235,10 +2235,10 @@ void game_list_frame::DialogRemoveGame(const std::vector<game_info>& games)
disc->setVisible(false); disc->setVisible(false);
} }
if (contentInfo.pathList.size()) // If a path is present if (content_info.path_list.size()) // If a path is present
{ {
text += tr("\nPermanently remove %0 and selected (optional) contents from drive?\n") text += tr("\nPermanently remove %0 and selected (optional) contents from drive?\n")
.arg((contentInfo.discList.size() || !contentInfo.isSingleSelection) .arg((content_info.disc_list.size() || !content_info.is_single_selection)
? tr("Game Data") : games[0]->localized_category); ? tr("Game Data") : games[0]->localized_category);
} }
else else
@ -2267,36 +2267,36 @@ void game_list_frame::DialogRemoveGame(const std::vector<game_info>& games)
return; return;
// Remove data path in "dev_hdd0/game" folder (if any) and lock file in "dev_hdd0/game/locks" folder (if any) // Remove data path in "dev_hdd0/game" folder (if any) and lock file in "dev_hdd0/game/locks" folder (if any)
u16 contentTypes = DATA | LOCKS; u16 content_types = DATA | LOCKS;
// Remove serials (title id) in "games.yml" file (if any) // Remove serials (title id) in "games.yml" file (if any)
if (disc->isChecked()) if (disc->isChecked())
contentTypes |= DISC; content_types |= DISC;
// Remove caches in "cache" and "dev_hdd1/caches" folders (if any) and custom configs in "config/custom_config" folder (if any) // Remove caches in "cache" and "dev_hdd1/caches" folders (if any) and custom configs in "config/custom_config" folder (if any)
if (caches->isChecked()) if (caches->isChecked())
contentTypes |= CACHES | CUSTOM_CONFIG; content_types |= CACHES | CUSTOM_CONFIG;
// Remove icons in "Icons/game_icons" folder (if any) and // Remove icons in "Icons/game_icons" folder (if any) and
// shortcuts in "games/shortcuts" folder and from desktop / start menu (if any) // shortcuts in "games/shortcuts" folder and from desktop / start menu (if any)
if (icons->isChecked()) if (icons->isChecked())
contentTypes |= ICONS | SHORTCUTS; content_types |= ICONS | SHORTCUTS;
if (savestate->isChecked()) if (savestate->isChecked())
contentTypes |= SAVESTATES; content_types |= SAVESTATES;
if (captures->isChecked()) if (captures->isChecked())
contentTypes |= CAPTURES; content_types |= CAPTURES;
if (recordings->isChecked()) if (recordings->isChecked())
contentTypes |= RECORDINGS; content_types |= RECORDINGS;
if (screenshots->isChecked()) if (screenshots->isChecked())
contentTypes |= SCREENSHOTS; content_types |= SCREENSHOTS;
SetContentList(contentTypes, contentInfo); SetContentList(content_types, content_info);
if (contentInfo.isSingleSelection) // Single selection if (content_info.is_single_selection) // Single selection
{ {
if (!RemoveContentList(games[0]->info.serial, true)) if (!RemoveContentList(games[0]->info.serial, true))
{ {
@ -2315,7 +2315,7 @@ void game_list_frame::DialogRemoveGame(const std::vector<game_info>& games)
void game_list_frame::DialogGameInfo(const std::vector<game_info>& games) void game_list_frame::DialogGameInfo(const std::vector<game_info>& games)
{ {
if (games.size() == 0) if (games.empty())
return; return;
QMessageBox::information(this, tr("Game Info"), GetContentInfo(games).info); QMessageBox::information(this, tr("Game Info"), GetContentInfo(games).info);
@ -2326,11 +2326,6 @@ bool game_list_frame::IsGameRunning(const std::string& serial)
return !Emu.IsStopped(true) && (serial == Emu.GetTitleID() || (serial == "vsh.self" && Emu.IsVsh())); return !Emu.IsStopped(true) && (serial == Emu.GetTitleID() || (serial == "vsh.self" && Emu.IsVsh()));
} }
bool game_list_frame::IsEmulatorRunning()
{
return Emu.GetStatus(false) != system_state::stopped;
}
bool game_list_frame::ValidateRemoval(const std::string& serial, const std::string& path, const std::string& desc, bool is_interactive) bool game_list_frame::ValidateRemoval(const std::string& serial, const std::string& path, const std::string& desc, bool is_interactive)
{ {
if (serial.empty()) if (serial.empty())
@ -2358,7 +2353,7 @@ bool game_list_frame::ValidateRemoval(const std::string& serial, const std::stri
return false; return false;
} }
if (QMessageBox::question(this, tr("Confirm Removal"), tr("Remove %0?").arg(desc)) != QMessageBox::Yes) if (QMessageBox::question(this, tr("Confirm Removal"), tr("Remove %0?").arg(QString::fromStdString(desc))) != QMessageBox::Yes)
return false; return false;
} }
@ -2367,7 +2362,7 @@ bool game_list_frame::ValidateRemoval(const std::string& serial, const std::stri
bool game_list_frame::ValidateBatchRemoval(const std::string& desc, bool is_interactive) bool game_list_frame::ValidateBatchRemoval(const std::string& desc, bool is_interactive)
{ {
if (IsEmulatorRunning()) if (!Emu.IsStopped(true))
{ {
game_list_log.error("Removal of %s not allowed due to emulator is running!", desc); game_list_log.error("Removal of %s not allowed due to emulator is running!", desc);
@ -2382,7 +2377,7 @@ bool game_list_frame::ValidateBatchRemoval(const std::string& desc, bool is_inte
if (is_interactive) if (is_interactive)
{ {
if (QMessageBox::question(this, tr("Confirm Removal"), tr("Remove %0?").arg(desc)) != QMessageBox::Yes) if (QMessageBox::question(this, tr("Confirm Removal"), tr("Remove %0?").arg(QString::fromStdString(desc))) != QMessageBox::Yes)
return false; return false;
} }
@ -2711,22 +2706,22 @@ bool game_list_frame::RemoveContentList(const std::string& serial, bool is_inter
// Just used for confirmation, if requested. Folder returned by fs::get_config_dir() is always present! // Just used for confirmation, if requested. Folder returned by fs::get_config_dir() is always present!
if (!ValidateRemoval(serial, fs::get_config_dir(), "selected content", is_interactive)) if (!ValidateRemoval(serial, fs::get_config_dir(), "selected content", is_interactive))
{ {
if (contentInfo.clearOnFinish) if (m_content_info.clear_on_finish)
ClearContentList(); // Clear only the content's info ClearContentList(); // Clear only the content's info
return true; return true;
} }
u16 contentTypes = contentInfo.contentTypes; u16 content_types = m_content_info.content_types;
// Remove data path in "dev_hdd0/game" folder (if any) // Remove data path in "dev_hdd0/game" folder (if any)
if (contentTypes & DATA) if (content_types & DATA)
{ {
if (const auto it = contentInfo.pathList.find(serial); it != contentInfo.pathList.cend()) if (const auto it = m_content_info.path_list.find(serial); it != m_content_info.path_list.cend())
{ {
if (RemoveContentPathList(it->second, "data") != it->second.size()) if (RemoveContentPathList(it->second, "data") != it->second.size())
{ {
if (contentInfo.clearOnFinish) if (m_content_info.clear_on_finish)
ClearContentList(); // Clear only the content's info ClearContentList(); // Clear only the content's info
// Skip the removal of the remaining selected contents in case some data paths could not be removed // Skip the removal of the remaining selected contents in case some data paths could not be removed
@ -2736,28 +2731,28 @@ bool game_list_frame::RemoveContentList(const std::string& serial, bool is_inter
} }
// Add serial (title id) to the list of serials to be removed in "games.yml" file (if any) // Add serial (title id) to the list of serials to be removed in "games.yml" file (if any)
if (contentTypes & DISC) if (content_types & DISC)
{ {
if (const auto it = contentInfo.discList.find(serial); it != contentInfo.discList.cend()) if (const auto it = m_content_info.disc_list.find(serial); it != m_content_info.disc_list.cend())
contentInfo.removedDiscList.insert(serial); m_content_info.removed_disc_list.insert(serial);
} }
// Remove lock file in "dev_hdd0/game/locks" folder (if any) // Remove lock file in "dev_hdd0/game/locks" folder (if any)
if (contentTypes & LOCKS) if (content_types & LOCKS)
{ {
if (ValidateRemoval(serial, rpcs3::utils::get_hdd0_locks_dir(), "lock")) if (ValidateRemoval(serial, rpcs3::utils::get_hdd0_locks_dir(), "lock"))
RemoveContentBySerial(rpcs3::utils::get_hdd0_locks_dir(), serial, "lock"); RemoveContentBySerial(rpcs3::utils::get_hdd0_locks_dir(), serial, "lock");
} }
// Remove caches in "cache" and "dev_hdd1/caches" folders (if any) // Remove caches in "cache" and "dev_hdd1/caches" folders (if any)
if (contentTypes & CACHES) if (content_types & CACHES)
{ {
if (ValidateRemoval(serial, rpcs3::utils::get_cache_dir_by_serial(serial), "all caches")) if (ValidateRemoval(serial, rpcs3::utils::get_cache_dir_by_serial(serial), "all caches"))
RemoveAllCaches(serial); RemoveAllCaches(serial);
} }
// Remove custom configs in "config/custom_config" folder (if any) // Remove custom configs in "config/custom_config" folder (if any)
if (contentTypes & CUSTOM_CONFIG) if (content_types & CUSTOM_CONFIG)
{ {
if (ValidateRemoval(serial, rpcs3::utils::get_custom_config_path(serial), "custom configuration")) if (ValidateRemoval(serial, rpcs3::utils::get_custom_config_path(serial), "custom configuration"))
RemoveCustomConfiguration(serial); RemoveCustomConfiguration(serial);
@ -2767,16 +2762,16 @@ bool game_list_frame::RemoveContentList(const std::string& serial, bool is_inter
} }
// Remove icons in "Icons/game_icons" folder (if any) // Remove icons in "Icons/game_icons" folder (if any)
if (contentTypes & ICONS) if (content_types & ICONS)
{ {
if (ValidateRemoval(serial, rpcs3::utils::get_icons_dir(serial), "icons")) if (ValidateRemoval(serial, rpcs3::utils::get_icons_dir(serial), "icons"))
RemoveContentBySerial(rpcs3::utils::get_icons_dir(), serial, "icons"); RemoveContentBySerial(rpcs3::utils::get_icons_dir(), serial, "icons");
} }
// Remove shortcuts in "games/shortcuts" folder and from desktop / start menu (if any) // Remove shortcuts in "games/shortcuts" folder and from desktop / start menu (if any)
if (contentTypes & SHORTCUTS) if (content_types & SHORTCUTS)
{ {
if (const auto it = contentInfo.nameList.find(serial); it != contentInfo.nameList.cend()) if (const auto it = m_content_info.name_list.find(serial); it != m_content_info.name_list.cend())
{ {
const bool remove_rpcs3_links = ValidateRemoval(serial, rpcs3::utils::get_games_shortcuts_dir(), "link"); const bool remove_rpcs3_links = ValidateRemoval(serial, rpcs3::utils::get_games_shortcuts_dir(), "link");
@ -2794,31 +2789,31 @@ bool game_list_frame::RemoveContentList(const std::string& serial, bool is_inter
} }
} }
if (contentTypes & SAVESTATES) if (content_types & SAVESTATES)
{ {
if (ValidateRemoval(serial, rpcs3::utils::get_savestates_dir(serial), "savestates")) if (ValidateRemoval(serial, rpcs3::utils::get_savestates_dir(serial), "savestates"))
RemoveContentBySerial(rpcs3::utils::get_savestates_dir(), serial, "savestates"); RemoveContentBySerial(rpcs3::utils::get_savestates_dir(), serial, "savestates");
} }
if (contentTypes & CAPTURES) if (content_types & CAPTURES)
{ {
if (ValidateRemoval(serial, rpcs3::utils::get_captures_dir(), "captures")) if (ValidateRemoval(serial, rpcs3::utils::get_captures_dir(), "captures"))
RemoveContentBySerial(rpcs3::utils::get_captures_dir(), serial, "captures"); RemoveContentBySerial(rpcs3::utils::get_captures_dir(), serial, "captures");
} }
if (contentTypes & RECORDINGS) if (content_types & RECORDINGS)
{ {
if (ValidateRemoval(serial, rpcs3::utils::get_recordings_dir(serial), "recordings")) if (ValidateRemoval(serial, rpcs3::utils::get_recordings_dir(serial), "recordings"))
RemoveContentBySerial(rpcs3::utils::get_recordings_dir(), serial, "recordings"); RemoveContentBySerial(rpcs3::utils::get_recordings_dir(), serial, "recordings");
} }
if (contentTypes & SCREENSHOTS) if (content_types & SCREENSHOTS)
{ {
if (ValidateRemoval(serial, rpcs3::utils::get_screenshots_dir(serial), "screenshots")) if (ValidateRemoval(serial, rpcs3::utils::get_screenshots_dir(serial), "screenshots"))
RemoveContentBySerial(rpcs3::utils::get_screenshots_dir(), serial, "screenshots"); RemoveContentBySerial(rpcs3::utils::get_screenshots_dir(), serial, "screenshots");
} }
if (contentInfo.clearOnFinish) if (m_content_info.clear_on_finish)
ClearContentList(true); // Update the game list and clear the content's info once removed ClearContentList(true); // Update the game list and clear the content's info once removed
return true; return true;
@ -3203,7 +3198,7 @@ void game_list_frame::BatchRemoveAllCaches(const std::vector<game_info>& games,
void game_list_frame::BatchRemoveContentLists(const std::vector<game_info>& games, bool is_interactive) void game_list_frame::BatchRemoveContentLists(const std::vector<game_info>& games, bool is_interactive)
{ {
// Let the batch process (not RemoveContentList()) make cleanup when terminated // Let the batch process (not RemoveContentList()) make cleanup when terminated
contentInfo.clearOnFinish = false; m_content_info.clear_on_finish = false;
if (!ValidateBatchRemoval("selected content", is_interactive)) if (!ValidateBatchRemoval("selected content", is_interactive))
{ {

View file

@ -63,7 +63,7 @@ public:
bool IsEntryVisible(const game_info& game, bool search_fallback = false) const; bool IsEntryVisible(const game_info& game, bool search_fallback = false) const;
enum ContentType enum content_type
{ {
NO_CONTENT = 0, NO_CONTENT = 0,
DISC = (1 << 0), DISC = (1 << 0),
@ -79,18 +79,18 @@ public:
SCREENSHOTS = (1 << 10) SCREENSHOTS = (1 << 10)
}; };
struct ContentInfo struct content_info
{ {
u16 contentTypes = NO_CONTENT; // Always set by SetContentList() u16 content_types = NO_CONTENT; // Always set by SetContentList()
bool clearOnFinish = true; // Always overridden by BatchRemoveContentLists() bool clear_on_finish = true; // Always overridden by BatchRemoveContentLists()
bool isSingleSelection = false; bool is_single_selection = false;
u16 inGamesDirCount = 0; u16 in_games_dir_count = 0;
QString info; QString info;
std::map<std::string, std::set<std::string>> nameList; std::map<std::string, std::set<std::string>> name_list;
std::map<std::string, std::set<std::string>> pathList; std::map<std::string, std::set<std::string>> path_list;
std::set<std::string> discList; std::set<std::string> disc_list;
std::set<std::string> removedDiscList; // Filled in by RemoveContentList() std::set<std::string> removed_disc_list; // Filled in by RemoveContentList()
}; };
public Q_SLOTS: public Q_SLOTS:
@ -108,7 +108,7 @@ public Q_SLOTS:
// - RemoveContentList() // - RemoveContentList()
// - BatchRemoveContentLists() // - BatchRemoveContentLists()
// //
void SetContentList(u16 contentTypes, const ContentInfo& contentInfo); void SetContentList(u16 content_types, const content_info& content_info);
void BatchRemoveContentLists(const std::vector<game_info>& games = {}, bool is_interactive = false); void BatchRemoveContentLists(const std::vector<game_info>& games = {}, bool is_interactive = false);
void SetListMode(const bool& is_list); void SetListMode(const bool& is_list);
@ -175,23 +175,22 @@ private:
void ShowMultiSelectionContextMenu(const std::vector<game_info>& games, QPoint& global_pos); void ShowMultiSelectionContextMenu(const std::vector<game_info>& games, QPoint& global_pos);
// NOTE: // NOTE:
// contentInfo is used by: // m_content_info is used by:
// - SetContentList() // - SetContentList()
// - ClearContentList() // - ClearContentList()
// - GetContentInfo() // - GetContentInfo()
// - RemoveContentList() // - RemoveContentList()
// - BatchRemoveContentLists() // - BatchRemoveContentLists()
// //
ContentInfo contentInfo; content_info m_content_info;
void ClearContentList(bool refresh = false); void ClearContentList(bool refresh = false);
ContentInfo GetContentInfo(const std::vector<game_info>& games); content_info GetContentInfo(const std::vector<game_info>& games);
void DialogRemoveGame(const std::vector<game_info>& games); void DialogRemoveGame(const std::vector<game_info>& games);
void DialogGameInfo(const std::vector<game_info>& games); void DialogGameInfo(const std::vector<game_info>& games);
static bool IsGameRunning(const std::string& serial); static bool IsGameRunning(const std::string& serial);
static bool IsEmulatorRunning();
bool ValidateRemoval(const std::string& serial, const std::string& path, const std::string& desc, bool is_interactive = false); bool ValidateRemoval(const std::string& serial, const std::string& path, const std::string& desc, bool is_interactive = false);
bool ValidateBatchRemoval(const std::string& desc, bool is_interactive = false); bool ValidateBatchRemoval(const std::string& desc, bool is_interactive = false);

View file

@ -2765,42 +2765,42 @@ void main_window::CreateConnects()
}); });
connect(ui->exitAct, &QAction::triggered, this, &QWidget::close); connect(ui->exitAct, &QAction::triggered, this, &QWidget::close);
connect(ui->batchCreateCPUCachesAct, &QAction::triggered, m_game_list_frame, [list = m_game_list_frame]() connect(ui->batchCreateCPUCachesAct, &QAction::triggered, this, [this]()
{ {
list->BatchCreateCPUCaches({}, false, true); m_game_list_frame->BatchCreateCPUCaches({}, false, true);
}); });
connect(ui->batchRemoveCustomConfigurationsAct, &QAction::triggered, m_game_list_frame, [list = m_game_list_frame]() connect(ui->batchRemoveCustomConfigurationsAct, &QAction::triggered, this, [this]()
{ {
list->BatchRemoveCustomConfigurations({}, true); m_game_list_frame->BatchRemoveCustomConfigurations({}, true);
}); });
connect(ui->batchRemoveCustomPadConfigurationsAct, &QAction::triggered, m_game_list_frame, [list = m_game_list_frame]() connect(ui->batchRemoveCustomPadConfigurationsAct, &QAction::triggered, this, [this]()
{ {
list->BatchRemoveCustomPadConfigurations({}, true); m_game_list_frame->BatchRemoveCustomPadConfigurations({}, true);
}); });
connect(ui->batchRemoveShaderCachesAct, &QAction::triggered, m_game_list_frame, [list = m_game_list_frame]() connect(ui->batchRemoveShaderCachesAct, &QAction::triggered, this, [this]()
{ {
list->BatchRemoveShaderCaches({}, true); m_game_list_frame->BatchRemoveShaderCaches({}, true);
}); });
connect(ui->batchRemovePPUCachesAct, &QAction::triggered, m_game_list_frame, [list = m_game_list_frame]() connect(ui->batchRemovePPUCachesAct, &QAction::triggered, this, [this]()
{ {
list->BatchRemovePPUCaches({}, true); m_game_list_frame->BatchRemovePPUCaches({}, true);
}); });
connect(ui->batchRemoveSPUCachesAct, &QAction::triggered, m_game_list_frame, [list = m_game_list_frame]() connect(ui->batchRemoveSPUCachesAct, &QAction::triggered, this, [this]()
{ {
list->BatchRemoveSPUCaches({}, true); m_game_list_frame->BatchRemoveSPUCaches({}, true);
}); });
connect(ui->removeHDD1CachesAct, &QAction::triggered, m_game_list_frame, [list = m_game_list_frame]() connect(ui->removeHDD1CachesAct, &QAction::triggered, this, [this]()
{ {
list->BatchRemoveHDD1Caches({}, true); m_game_list_frame->BatchRemoveHDD1Caches({}, true);
}); });
connect(ui->removeAllCachesAct, &QAction::triggered, m_game_list_frame, [list = m_game_list_frame]() connect(ui->removeAllCachesAct, &QAction::triggered, this, [this]()
{ {
list->BatchRemoveAllCaches({}, true); m_game_list_frame->BatchRemoveAllCaches({}, true);
}); });
connect(ui->removeSavestatesAct, &QAction::triggered, m_game_list_frame, [list = m_game_list_frame]() connect(ui->removeSavestatesAct, &QAction::triggered, this, [this]()
{ {
list->SetContentList(game_list_frame::ContentType::SAVESTATES, {}); m_game_list_frame->SetContentList(game_list_frame::content_type::SAVESTATES, {});
list->BatchRemoveContentLists({}, true); m_game_list_frame->BatchRemoveContentLists({}, true);
}); });
connect(ui->cleanUpGameListAct, &QAction::triggered, this, &main_window::CleanUpGameList); connect(ui->cleanUpGameListAct, &QAction::triggered, this, &main_window::CleanUpGameList);