mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-27 09:23:01 +00:00
102d254530
- Remove unnecessary icon update code (the UI reloads this stuff anyways); test on Windows please - Cleaned up a bunch of duplicated/unused code within the game list - Fix the game list constantly reloading on macOS * When you reconstruct the entire directory list on the watcher the directoryChanged signal fires on macOS--seems like a behavioral change that occurred somewhere in the 6.8 release cycle--and it would enter an infinite loop very quickly * To fix this, only the differences between the current and old watch list are accounted for on both ends. * Since this bug is now fixed, macOS uses Qt 6.11.1 now. Should theoretically improve our situation. - Fix the external content watcher crashing; the worker would attempt to read files that didn't exist without any bounds since its cache was still pointing to that file. This supersedes and replaces #4099. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4106 Reviewed-by: Lizzie <lizzie@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
100 lines
2.5 KiB
C++
100 lines
2.5 KiB
C++
// 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"
|
|
#include "yuzu/compatibility_list.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_COMPATIBILITY,
|
|
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();
|
|
|
|
bool IsEmpty() const;
|
|
|
|
void ToggleFavorite(u64 program_id);
|
|
|
|
void RefreshGameDirectory();
|
|
void RefreshExternalContent();
|
|
void ResetExternalWatcher();
|
|
|
|
void LoadCompatibilityList();
|
|
|
|
void RetranslateUI();
|
|
|
|
QFileSystemWatcher* GetWatcher() const;
|
|
|
|
const CompatibilityList& GetCompatibilityList() 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();
|
|
|
|
bool m_flat = false;
|
|
|
|
std::shared_ptr<FileSys::VfsFilesystem> vfs;
|
|
FileSys::ManualContentProvider* provider;
|
|
CompatibilityList compatibility_list;
|
|
const PlayTime::PlayTimeManager& play_time_manager;
|
|
Core::System& system;
|
|
|
|
std::unique_ptr<GameListWorker> current_worker;
|
|
QFileSystemWatcher* watcher = nullptr;
|
|
QFileSystemWatcher* external_watcher = nullptr;
|
|
};
|