mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-25 16:54:41 +00:00
7f85c6e282
we have no use for it it's dead code most of the time users just complain about how the list isn't updated ok so what if we update it? great now its more noise added to the git, awesome even if we constantly update it, we introduce new breakage that makes keeping track of things extremely difficult either we integrate with emuready (would violate self containment principles) or we integrate with emuready in a similar fashion to eden news outlet (where we cache the list with some TTL of like 60 mins or whatever) that would be better respecting of "self containment" but would probably require having a quick way to update the list additively, probably filtered to the user's device instead of a global thing, and i dont think emuready has that granularity nor we have the "connect this to that" for the api stuffs another (which is what i propose here) is throw everything out of the window until someone can come up with something better Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4201 Reviewed-by: Maufeat <sahyno1996@gmail.com> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
98 lines
2.6 KiB
C++
98 lines
2.6 KiB
C++
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <atomic>
|
|
#include <deque>
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
#include <QList>
|
|
#include <QObject>
|
|
#include <QRunnable>
|
|
#include <QString>
|
|
|
|
#include "common/thread.h"
|
|
#include "core/file_sys/registered_cache.h"
|
|
#include "frontend_common/play_time_manager.h"
|
|
#include "qt_common/config/uisettings.h"
|
|
|
|
namespace Core {
|
|
class System;
|
|
}
|
|
|
|
class GameListDir;
|
|
class GameListModel;
|
|
class QStandardItem;
|
|
|
|
namespace FileSys {
|
|
class NCA;
|
|
class VfsFilesystem;
|
|
} // namespace FileSys
|
|
|
|
/**
|
|
* Asynchronous worker object for populating the game list.
|
|
* Communicates with other threads through Qt's signal/slot system.
|
|
*/
|
|
class GameListWorker : public QObject, public QRunnable {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit GameListWorker(std::shared_ptr<FileSys::VfsFilesystem> vfs_,
|
|
FileSys::ManualContentProvider* provider_,
|
|
QVector<UISettings::GameDir>& game_dirs_,
|
|
const PlayTime::PlayTimeManager& play_time_manager_,
|
|
Core::System& system_);
|
|
~GameListWorker() override;
|
|
|
|
/// Starts the processing of directory tree information.
|
|
void run() override;
|
|
|
|
public:
|
|
/**
|
|
* Synchronously processes any events queued by the worker.
|
|
*
|
|
* AddDirEntry is called on the model for every discovered directory.
|
|
* AddEntry is called on the model for every discovered program.
|
|
* DonePopulating is called on the model when processing completes.
|
|
*/
|
|
void ProcessEvents(GameListModel* model);
|
|
|
|
signals:
|
|
void DataAvailable();
|
|
|
|
private:
|
|
template <typename F>
|
|
void RecordEvent(F&& func);
|
|
|
|
private:
|
|
void AddTitlesToGameList(GameListDir* parent_dir);
|
|
|
|
enum class ScanTarget {
|
|
FillManualContentProvider,
|
|
PopulateGameList,
|
|
};
|
|
|
|
void ScanFileSystem(ScanTarget target, const std::string& dir_path, bool deep_scan,
|
|
GameListDir* parent_dir);
|
|
|
|
std::shared_ptr<FileSys::VfsFilesystem> vfs;
|
|
FileSys::ManualContentProvider* provider;
|
|
QVector<UISettings::GameDir>& game_dirs;
|
|
const PlayTime::PlayTimeManager& play_time_manager;
|
|
|
|
QStringList watch_list;
|
|
|
|
std::mutex lock;
|
|
std::condition_variable cv;
|
|
std::deque<std::function<void(GameListModel*)>> queued_events;
|
|
std::atomic_bool stop_requested = false;
|
|
Common::Event processing_completed;
|
|
|
|
Core::System& system;
|
|
};
|