Lime3DS/src/lime_qt/game_list_worker.h
OpenSauce 6cf2c37392
The big rebrand commit
- Rebranded executable files to reference Lime instead of Citra
- Rebranded many files in the source tree to reference Lime instead of Citra
- Rebranded many resource files to reference Lime instead of Citra
- Rebranded all instances of Citra's reverse DNS to Lime's reverse DNS
- Other small misc rebrands
2024-03-31 16:50:40 +01:00

67 lines
1.9 KiB
C++

// Copyright 2018 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <atomic>
#include <memory>
#include <string>
#include <QList>
#include <QObject>
#include <QRunnable>
#include <QString>
#include <QVector>
#include "common/common_types.h"
#include "lime_qt/compatibility_list.h"
namespace Service::FS {
enum class MediaType : u32;
}
class QStandardItem;
/**
* 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:
GameListWorker(QVector<UISettings::GameDir>& game_dirs,
const CompatibilityList& compatibility_list);
~GameListWorker() override;
/// Starts the processing of directory tree information.
void run() override;
/// Tells the worker that it should no longer continue processing. Thread-safe.
void Cancel();
signals:
/**
* The `EntryReady` signal is emitted once an entry has been prepared and is ready
* to be added to the game list.
* @param entry_items a list with `QStandardItem`s that make up the columns of the new entry.
*/
void DirEntryReady(GameListDir* entry_items);
void EntryReady(QList<QStandardItem*> entry_items, GameListDir* parent_dir);
/**
* After the worker has traversed the game directory looking for entries, this signal is emitted
* with a list of folders that should be watched for changes as well.
*/
void Finished(QStringList watch_list);
private:
void AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion,
GameListDir* parent_dir, Service::FS::MediaType media_type);
QVector<UISettings::GameDir>& game_dirs;
const CompatibilityList& compatibility_list;
QStringList watch_list;
std::atomic_bool stop_processing;
};