#include <recent_projects_model.h>
Classes | |
| struct | AsyncScanResult |
| struct | AsyncScanState |
| struct | CachedExtras |
| struct | PendingUndo |
| struct | RemovedRecent |
Public Member Functions | |
| RecentProjectsModel () | |
| ~RecentProjectsModel () | |
| void | Refresh (bool force=false) |
| const std::vector< RecentProject > & | entries () const |
| std::uint64_t | generation () const |
| void | AddRecent (const std::string &path) |
| void | RemoveRecent (const std::string &path) |
| void | ClearAll () |
| void | RelinkRecent (const std::string &old_path, const std::string &new_path) |
| void | SetPinned (const std::string &path, bool pinned) |
| void | SetDisplayName (const std::string &path, std::string display_name) |
| void | SetNotes (const std::string &path, std::string notes) |
| bool | HasUndoableRemoval () const |
| PendingUndo | PeekLastRemoval () const |
| bool | UndoLastRemoval () |
| void | DismissLastRemoval () |
Static Public Attributes | |
| static constexpr float | kUndoWindowSeconds = 8.0f |
Private Member Functions | |
| RecentProject | BuildEntry (const std::string &filepath) |
| void | DispatchBackgroundRomScan (const std::string &filepath, std::uint64_t size_bytes, std::int64_t mtime_epoch_ns) |
| bool | DrainAsyncResults () |
| void | LoadCache () |
| void | SaveCache () |
| std::filesystem::path | CachePath () const |
Private Attributes | |
| std::vector< RecentProject > | entries_ |
| std::uint64_t | cached_generation_ = 0 |
| bool | loaded_once_ = false |
| std::unordered_map< std::string, CachedExtras > | cache_ |
| bool | cache_dirty_ = false |
| bool | cache_loaded_ = false |
| std::uint64_t | annotation_generation_ = 0 |
| std::deque< RemovedRecent > | undo_buffer_ |
| std::shared_ptr< AsyncScanState > | scan_state_ |
Definition at line 59 of file recent_projects_model.h.
| yaze::editor::RecentProjectsModel::RecentProjectsModel | ( | ) |
Definition at line 298 of file recent_projects_model.cc.
| yaze::editor::RecentProjectsModel::~RecentProjectsModel | ( | ) |
Definition at line 301 of file recent_projects_model.cc.
References scan_state_.
| void yaze::editor::RecentProjectsModel::Refresh | ( | bool | force = false | ) |
Definition at line 473 of file recent_projects_model.cc.
References annotation_generation_, BuildEntry(), cache_dirty_, cache_loaded_, cached_generation_, DrainAsyncResults(), entries_, yaze::project::RecentFilesManager::GetInstance(), LoadCache(), loaded_once_, and SaveCache().
Referenced by yaze::editor::WelcomeScreen::RefreshRecentProjects().
|
inline |
Definition at line 75 of file recent_projects_model.h.
References entries_.
Referenced by yaze::editor::WelcomeScreen::DrawFirstRunGuide(), yaze::editor::WelcomeScreen::DrawQuickActions(), yaze::editor::CommandPalette::RegisterWelcomeCommands(), and SaveCache().
|
inline |
Definition at line 76 of file recent_projects_model.h.
References cached_generation_.
| void yaze::editor::RecentProjectsModel::AddRecent | ( | const std::string & | path | ) |
Definition at line 523 of file recent_projects_model.cc.
References yaze::project::RecentFilesManager::GetInstance().

| void yaze::editor::RecentProjectsModel::RemoveRecent | ( | const std::string & | path | ) |
Definition at line 529 of file recent_projects_model.cc.
References cache_, cache_dirty_, yaze::editor::RecentProjectsModel::RemovedRecent::display_name, yaze::editor::RecentProjectsModel::RemovedRecent::expires_at, yaze::editor::RecentProjectsModel::RemovedRecent::extras, yaze::project::RecentFilesManager::GetInstance(), kUndoWindowSeconds, yaze::editor::RecentProjectsModel::RemovedRecent::path, SaveCache(), and undo_buffer_.

| void yaze::editor::RecentProjectsModel::ClearAll | ( | ) |
Definition at line 642 of file recent_projects_model.cc.
References cache_, cache_dirty_, yaze::project::RecentFilesManager::GetInstance(), and SaveCache().

| void yaze::editor::RecentProjectsModel::RelinkRecent | ( | const std::string & | old_path, |
| const std::string & | new_path ) |
Definition at line 612 of file recent_projects_model.cc.
References cache_, cache_dirty_, yaze::editor::RecentProjectsModel::CachedExtras::crc32, yaze::project::RecentFilesManager::GetInstance(), yaze::editor::RecentProjectsModel::CachedExtras::mtime_epoch_ns, SaveCache(), yaze::editor::RecentProjectsModel::CachedExtras::size_bytes, yaze::editor::RecentProjectsModel::CachedExtras::snes_map_mode, yaze::editor::RecentProjectsModel::CachedExtras::snes_region, and yaze::editor::RecentProjectsModel::CachedExtras::snes_title.

| void yaze::editor::RecentProjectsModel::SetPinned | ( | const std::string & | path, |
| bool | pinned ) |
Definition at line 653 of file recent_projects_model.cc.
References annotation_generation_, cache_, cache_dirty_, and SaveCache().

| void yaze::editor::RecentProjectsModel::SetDisplayName | ( | const std::string & | path, |
| std::string | display_name ) |
Definition at line 664 of file recent_projects_model.cc.
References annotation_generation_, cache_, cache_dirty_, and SaveCache().

| void yaze::editor::RecentProjectsModel::SetNotes | ( | const std::string & | path, |
| std::string | notes ) |
Definition at line 676 of file recent_projects_model.cc.
References annotation_generation_, cache_, cache_dirty_, and SaveCache().

| bool yaze::editor::RecentProjectsModel::HasUndoableRemoval | ( | ) | const |
Definition at line 567 of file recent_projects_model.cc.
References undo_buffer_.
Referenced by PeekLastRemoval(), and UndoLastRemoval().
| RecentProjectsModel::PendingUndo yaze::editor::RecentProjectsModel::PeekLastRemoval | ( | ) | const |
Definition at line 573 of file recent_projects_model.cc.
References HasUndoableRemoval(), yaze::editor::RecentProjectsModel::PendingUndo::path, and undo_buffer_.

| bool yaze::editor::RecentProjectsModel::UndoLastRemoval | ( | ) |
Definition at line 580 of file recent_projects_model.cc.
References annotation_generation_, cache_, cache_dirty_, yaze::editor::RecentProjectsModel::CachedExtras::display_name_override, yaze::editor::RecentProjectsModel::RemovedRecent::extras, yaze::project::RecentFilesManager::GetInstance(), HasUndoableRemoval(), yaze::editor::RecentProjectsModel::CachedExtras::notes, yaze::editor::RecentProjectsModel::RemovedRecent::path, yaze::editor::RecentProjectsModel::CachedExtras::pinned, SaveCache(), and undo_buffer_.

| void yaze::editor::RecentProjectsModel::DismissLastRemoval | ( | ) |
Definition at line 608 of file recent_projects_model.cc.
References undo_buffer_.
|
private |
Definition at line 314 of file recent_projects_model.cc.
References cache_, cache_dirty_, yaze::editor::RecentProject::crc32, yaze::editor::RecentProjectsModel::CachedExtras::crc32, DispatchBackgroundRomScan(), yaze::editor::RecentProject::display_name_override, yaze::editor::RecentProject::filepath, ICON_MD_FOLDER_SPECIAL, ICON_MD_INSERT_DRIVE_FILE, ICON_MD_MEMORY, ICON_MD_WARNING, yaze::editor::RecentProject::is_missing, yaze::editor::RecentProject::item_icon, yaze::editor::RecentProject::item_type, yaze::editor::RecentProject::last_modified, yaze::editor::RecentProject::metadata_summary, yaze::editor::RecentProject::mtime_epoch_ns, yaze::editor::RecentProjectsModel::CachedExtras::mtime_epoch_ns, yaze::editor::RecentProject::name, yaze::editor::RecentProject::notes, yaze::editor::RecentProject::pinned, yaze::editor::RecentProject::rom_title, yaze::editor::RecentProject::size_bytes, yaze::editor::RecentProjectsModel::CachedExtras::size_bytes, yaze::editor::RecentProject::snes_map_mode, yaze::editor::RecentProjectsModel::CachedExtras::snes_map_mode, yaze::editor::RecentProject::snes_region, yaze::editor::RecentProjectsModel::CachedExtras::snes_region, yaze::editor::RecentProjectsModel::CachedExtras::snes_title, and yaze::editor::RecentProject::unavailable.
Referenced by Refresh().

|
private |
Definition at line 687 of file recent_projects_model.cc.
References yaze::editor::RecentProjectsModel::AsyncScanResult::crc32, yaze::editor::RecentProjectsModel::AsyncScanResult::mtime_epoch_ns, yaze::editor::RecentProjectsModel::AsyncScanResult::path, scan_state_, yaze::editor::RecentProjectsModel::AsyncScanResult::size_bytes, yaze::editor::RecentProjectsModel::AsyncScanResult::snes_map_mode, yaze::editor::RecentProjectsModel::AsyncScanResult::snes_region, and yaze::editor::RecentProjectsModel::AsyncScanResult::snes_title.
Referenced by BuildEntry().
|
private |
Definition at line 739 of file recent_projects_model.cc.
References annotation_generation_, cache_, cache_dirty_, SaveCache(), and scan_state_.
Referenced by Refresh().

|
private |
Definition at line 784 of file recent_projects_model.cc.
References cache_, CachePath(), yaze::editor::RecentProjectsModel::CachedExtras::crc32, yaze::editor::RecentProjectsModel::CachedExtras::display_name_override, LOG_WARN, yaze::editor::RecentProjectsModel::CachedExtras::mtime_epoch_ns, yaze::editor::RecentProjectsModel::CachedExtras::notes, yaze::editor::RecentProjectsModel::CachedExtras::pinned, yaze::editor::RecentProjectsModel::CachedExtras::size_bytes, yaze::editor::RecentProjectsModel::CachedExtras::snes_map_mode, yaze::editor::RecentProjectsModel::CachedExtras::snes_region, and yaze::editor::RecentProjectsModel::CachedExtras::snes_title.
Referenced by Refresh().

|
private |
Definition at line 825 of file recent_projects_model.cc.
References cache_, CachePath(), entries(), and LOG_WARN.
Referenced by ClearAll(), DrainAsyncResults(), Refresh(), RelinkRecent(), RemoveRecent(), SetDisplayName(), SetNotes(), SetPinned(), and UndoLastRemoval().

|
private |
Definition at line 777 of file recent_projects_model.cc.
References yaze::util::PlatformPaths::GetConfigDirectory().
Referenced by LoadCache(), and SaveCache().

|
staticconstexpr |
Definition at line 105 of file recent_projects_model.h.
Referenced by RemoveRecent().
|
private |
Definition at line 146 of file recent_projects_model.h.
|
private |
Definition at line 147 of file recent_projects_model.h.
Referenced by generation(), and Refresh().
|
private |
Definition at line 148 of file recent_projects_model.h.
Referenced by Refresh().
|
private |
Definition at line 150 of file recent_projects_model.h.
Referenced by BuildEntry(), ClearAll(), DrainAsyncResults(), LoadCache(), RelinkRecent(), RemoveRecent(), SaveCache(), SetDisplayName(), SetNotes(), SetPinned(), and UndoLastRemoval().
|
private |
Definition at line 151 of file recent_projects_model.h.
Referenced by BuildEntry(), ClearAll(), DrainAsyncResults(), Refresh(), RelinkRecent(), RemoveRecent(), SetDisplayName(), SetNotes(), SetPinned(), and UndoLastRemoval().
|
private |
Definition at line 152 of file recent_projects_model.h.
Referenced by Refresh().
|
private |
Definition at line 157 of file recent_projects_model.h.
Referenced by DrainAsyncResults(), Refresh(), SetDisplayName(), SetNotes(), SetPinned(), and UndoLastRemoval().
|
private |
Definition at line 168 of file recent_projects_model.h.
Referenced by DismissLastRemoval(), HasUndoableRemoval(), PeekLastRemoval(), RemoveRecent(), and UndoLastRemoval().
|
private |
Definition at line 190 of file recent_projects_model.h.
Referenced by DispatchBackgroundRomScan(), DrainAsyncResults(), and ~RecentProjectsModel().