summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlat9nq <22451773+lat9nq@users.noreply.github.com>2021-07-30 15:32:26 +0200
committerMorph <39850852+Morph1984@users.noreply.github.com>2021-10-07 19:50:13 +0200
commit4ce53ffe6a61cb853f2fdd88211f35cec63e2f70 (patch)
treee2820ff4acde031dc0eb317a0610b478f0748321
parentconfiguration: Add const qualifier where able (diff)
downloadyuzu-4ce53ffe6a61cb853f2fdd88211f35cec63e2f70.tar
yuzu-4ce53ffe6a61cb853f2fdd88211f35cec63e2f70.tar.gz
yuzu-4ce53ffe6a61cb853f2fdd88211f35cec63e2f70.tar.bz2
yuzu-4ce53ffe6a61cb853f2fdd88211f35cec63e2f70.tar.lz
yuzu-4ce53ffe6a61cb853f2fdd88211f35cec63e2f70.tar.xz
yuzu-4ce53ffe6a61cb853f2fdd88211f35cec63e2f70.tar.zst
yuzu-4ce53ffe6a61cb853f2fdd88211f35cec63e2f70.zip
-rw-r--r--src/yuzu/game_list.cpp7
-rw-r--r--src/yuzu/game_list.h5
-rw-r--r--src/yuzu/game_list_worker.cpp10
-rw-r--r--src/yuzu/game_list_worker.h8
-rw-r--r--src/yuzu/main.cpp2
5 files changed, 19 insertions, 13 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index f9d949e75..99c91a6a8 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -305,8 +305,8 @@ void GameList::OnFilterCloseClicked() {
}
GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvider* provider,
- GMainWindow* parent)
- : QWidget{parent}, vfs(std::move(vfs)), provider(provider) {
+ Core::System& system_, GMainWindow* parent)
+ : QWidget{parent}, vfs(std::move(vfs)), provider(provider), system{system_} {
watcher = new QFileSystemWatcher(this);
connect(watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshGameDirectory);
@@ -738,7 +738,8 @@ void GameList::PopulateAsync(QVector<UISettings::GameDir>& game_dirs) {
emit ShouldCancelWorker();
- GameListWorker* worker = new GameListWorker(vfs, provider, game_dirs, compatibility_list);
+ GameListWorker* worker =
+ new GameListWorker(vfs, provider, game_dirs, compatibility_list, system);
connect(worker, &GameListWorker::EntryReady, this, &GameList::AddEntry, Qt::QueuedConnection);
connect(worker, &GameListWorker::DirEntryReady, this, &GameList::AddDirEntry,
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h
index 10339dcca..675469e66 100644
--- a/src/yuzu/game_list.h
+++ b/src/yuzu/game_list.h
@@ -72,7 +72,8 @@ public:
};
explicit GameList(std::shared_ptr<FileSys::VfsFilesystem> vfs,
- FileSys::ManualContentProvider* provider, GMainWindow* parent = nullptr);
+ FileSys::ManualContentProvider* provider, Core::System& system_,
+ GMainWindow* parent = nullptr);
~GameList() override;
QString GetLastFilterResultItem() const;
@@ -145,6 +146,8 @@ private:
CompatibilityList compatibility_list;
friend class GameListSearchField;
+
+ Core::System& system;
};
class GameListPlaceholder : public QWidget {
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp
index 2d5492157..fd92b36df 100644
--- a/src/yuzu/game_list_worker.cpp
+++ b/src/yuzu/game_list_worker.cpp
@@ -228,16 +228,15 @@ QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::stri
GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs,
FileSys::ManualContentProvider* provider,
QVector<UISettings::GameDir>& game_dirs,
- const CompatibilityList& compatibility_list)
+ const CompatibilityList& compatibility_list, Core::System& system_)
: vfs(std::move(vfs)), provider(provider), game_dirs(game_dirs),
- compatibility_list(compatibility_list) {}
+ compatibility_list(compatibility_list), system{system_} {}
GameListWorker::~GameListWorker() = default;
void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) {
using namespace FileSys;
- auto& system = Core::System::GetInstance();
const auto& cache = dynamic_cast<ContentProviderUnion&>(system.GetContentProvider());
auto installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application,
@@ -285,10 +284,7 @@ void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) {
void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_path, bool deep_scan,
GameListDir* parent_dir) {
- auto& system = Core::System::GetInstance();
-
- const auto callback = [this, target, parent_dir,
- &system](const std::filesystem::path& path) -> bool {
+ const auto callback = [this, target, parent_dir](const std::filesystem::path& path) -> bool {
if (stop_processing) {
// Breaks the callback loop.
return false;
diff --git a/src/yuzu/game_list_worker.h b/src/yuzu/game_list_worker.h
index 396bb2623..1383e9fbc 100644
--- a/src/yuzu/game_list_worker.h
+++ b/src/yuzu/game_list_worker.h
@@ -19,6 +19,10 @@
#include "common/common_types.h"
#include "yuzu/compatibility_list.h"
+namespace Core {
+class System;
+}
+
class QStandardItem;
namespace FileSys {
@@ -37,7 +41,7 @@ public:
explicit GameListWorker(std::shared_ptr<FileSys::VfsFilesystem> vfs,
FileSys::ManualContentProvider* provider,
QVector<UISettings::GameDir>& game_dirs,
- const CompatibilityList& compatibility_list);
+ const CompatibilityList& compatibility_list, Core::System& system_);
~GameListWorker() override;
/// Starts the processing of directory tree information.
@@ -80,4 +84,6 @@ private:
QStringList watch_list;
std::atomic_bool stop_processing;
+
+ Core::System& system;
};
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 056f7da36..1d9e0f79d 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -701,7 +701,7 @@ void GMainWindow::InitializeWidgets() {
render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem, system);
render_window->hide();
- game_list = new GameList(vfs, provider.get(), this);
+ game_list = new GameList(vfs, provider.get(), system, this);
ui.horizontalLayout->addWidget(game_list);
game_list_placeholder = new GameListPlaceholder(this);