From 71ca14a77a3fdc62b5b67d778ec121958bc32628 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 26 Aug 2024 21:42:35 +1000 Subject: [PATCH] GameList: Support excluding disc sets --- src/core/game_list.cpp | 11 ++++++----- src/duckstation-qt/mainwindow.cpp | 5 +++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/core/game_list.cpp b/src/core/game_list.cpp index 9b446043e..3b8c7c5ee 100644 --- a/src/core/game_list.cpp +++ b/src/core/game_list.cpp @@ -104,7 +104,7 @@ static bool ScanFile(std::string path, std::time_t timestamp, std::unique_lock& excluded_paths, const PlayedTimeMap& played_time_map); static std::string GetPlayedTimeFile(); static bool ParsePlayedTimeLine(char* line, std::string& serial, PlayedTimeEntry& entry); @@ -819,7 +819,7 @@ void GameList::Refresh(bool invalidate_cache, bool only_cache, ProgressCallback* s_cache_map.clear(); // merge multi-disc games - CreateDiscSetEntries(played_time); + CreateDiscSetEntries(excluded_paths, played_time); } GameList::EntryList GameList::TakeEntryList() @@ -829,7 +829,7 @@ GameList::EntryList GameList::TakeEntryList() return ret; } -void GameList::CreateDiscSetEntries(const PlayedTimeMap& played_time_map) +void GameList::CreateDiscSetEntries(const std::vector& excluded_paths, const PlayedTimeMap& played_time_map) { std::unique_lock lock(s_mutex); @@ -927,8 +927,9 @@ void GameList::CreateDiscSetEntries(const PlayedTimeMap& played_time_map) DEV_LOG("Created disc set {} from {} entries", disc_set_name, num_parts); - // entry is done :) - s_entries.push_back(std::move(set_entry)); + // we have to do the exclusion check at the end, because otherwise the individual discs get added + if (!IsPathExcluded(excluded_paths, disc_set_name)) + s_entries.push_back(std::move(set_entry)); } } diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index 925245f3c..7cbfd26bb 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -1584,6 +1584,11 @@ void MainWindow::onGameListEntryContextMenuRequested(const QPoint& point) menu.addSeparator(); connect(menu.addAction(tr("Select Disc")), &QAction::triggered, this, &MainWindow::onGameListEntryActivated); + + menu.addSeparator(); + + connect(menu.addAction(tr("Exclude From List")), &QAction::triggered, + [this, entry]() { getSettingsWindow()->getGameListSettingsWidget()->addExcludedPath(entry->path); }); } }