blob: e664623640f3a8b855949c99a7218070363795fc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <memory>
#include <QFileSystemWatcher>
#include <QStandardItemModel>
#include <QStringList>
#include <QVector>
#include "common/common_types.h"
#include "frontend_common/play_time_manager.h"
#include "qt_common/config/uisettings.h"
namespace Core {
class System;
}
class GameListDir;
class GameListWorker;
class QStandardItem;
namespace FileSys {
class ManualContentProvider;
class VfsFilesystem;
} // namespace FileSys
class GameListModel : public QStandardItemModel {
Q_OBJECT
public:
enum Column {
COLUMN_NAME,
COLUMN_FILE_TYPE,
COLUMN_SIZE,
COLUMN_PLAY_TIME,
COLUMN_ADD_ONS,
COLUMN_COUNT,
};
explicit GameListModel(std::shared_ptr<FileSys::VfsFilesystem> vfs_,
FileSys::ManualContentProvider* provider_,
const PlayTime::PlayTimeManager& play_time_manager_,
Core::System& system_, QObject* parent = nullptr);
~GameListModel() override;
void AddDirEntry(GameListDir* entry_items);
void AddEntry(const QList<QStandardItem*>& entry_items, GameListDir* parent);
void DonePopulating(const QStringList& watch_list);
void PopulateAsync(QVector<UISettings::GameDir>& game_dirs);
void WorkerEvent();
void SetScanEnabled(bool enabled);
bool IsEmpty() const;
void ToggleFavorite(u64 program_id);
void RefreshGameDirectory();
void RefreshExternalContent();
void ResetExternalWatcher();
void RetranslateUI();
QFileSystemWatcher* GetWatcher() const;
void SetFlat(bool flat);
signals:
void ShowList(bool show);
void PopulatingCompleted(const QStringList& watch_list);
void PopulatingStarted();
void SaveConfig();
private:
friend class GameListWorker;
void AddFavorite(u64 program_id);
void RemoveFavorite(u64 program_id);
void Repopulate();
void StopWorker();
bool m_flat = false;
bool scan_enabled = true;
std::shared_ptr<FileSys::VfsFilesystem> vfs;
FileSys::ManualContentProvider* provider;
const PlayTime::PlayTimeManager& play_time_manager;
Core::System& system;
std::unique_ptr<GameListWorker> current_worker;
QFileSystemWatcher* watcher = nullptr;
QFileSystemWatcher* external_watcher = nullptr;
};
|