yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::RecentProjectsModel Class Reference

#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< RecentProjectentries_
 
std::uint64_t cached_generation_ = 0
 
bool loaded_once_ = false
 
std::unordered_map< std::string, CachedExtrascache_
 
bool cache_dirty_ = false
 
bool cache_loaded_ = false
 
std::uint64_t annotation_generation_ = 0
 
std::deque< RemovedRecentundo_buffer_
 
std::shared_ptr< AsyncScanStatescan_state_
 

Detailed Description

Definition at line 59 of file recent_projects_model.h.

Constructor & Destructor Documentation

◆ RecentProjectsModel()

yaze::editor::RecentProjectsModel::RecentProjectsModel ( )

Definition at line 298 of file recent_projects_model.cc.

◆ ~RecentProjectsModel()

yaze::editor::RecentProjectsModel::~RecentProjectsModel ( )

Definition at line 301 of file recent_projects_model.cc.

References scan_state_.

Member Function Documentation

◆ Refresh()

◆ entries()

const std::vector< RecentProject > & yaze::editor::RecentProjectsModel::entries ( ) const
inline

◆ generation()

std::uint64_t yaze::editor::RecentProjectsModel::generation ( ) const
inline

Definition at line 76 of file recent_projects_model.h.

References cached_generation_.

◆ AddRecent()

void yaze::editor::RecentProjectsModel::AddRecent ( const std::string & path)

Definition at line 523 of file recent_projects_model.cc.

References yaze::project::RecentFilesManager::GetInstance().

Here is the call graph for this function:

◆ RemoveRecent()

◆ ClearAll()

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().

Here is the call graph for this function:

◆ RelinkRecent()

◆ SetPinned()

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().

Here is the call graph for this function:

◆ SetDisplayName()

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().

Here is the call graph for this function:

◆ SetNotes()

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().

Here is the call graph for this function:

◆ HasUndoableRemoval()

bool yaze::editor::RecentProjectsModel::HasUndoableRemoval ( ) const

Definition at line 567 of file recent_projects_model.cc.

References undo_buffer_.

Referenced by PeekLastRemoval(), and UndoLastRemoval().

◆ PeekLastRemoval()

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_.

Here is the call graph for this function:

◆ UndoLastRemoval()

◆ DismissLastRemoval()

void yaze::editor::RecentProjectsModel::DismissLastRemoval ( )

Definition at line 608 of file recent_projects_model.cc.

References undo_buffer_.

◆ BuildEntry()

◆ DispatchBackgroundRomScan()

◆ DrainAsyncResults()

bool yaze::editor::RecentProjectsModel::DrainAsyncResults ( )
private

Definition at line 739 of file recent_projects_model.cc.

References annotation_generation_, cache_, cache_dirty_, SaveCache(), and scan_state_.

Referenced by Refresh().

Here is the call graph for this function:

◆ LoadCache()

◆ SaveCache()

void yaze::editor::RecentProjectsModel::SaveCache ( )
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().

Here is the call graph for this function:

◆ CachePath()

std::filesystem::path yaze::editor::RecentProjectsModel::CachePath ( ) const
private

Definition at line 777 of file recent_projects_model.cc.

References yaze::util::PlatformPaths::GetConfigDirectory().

Referenced by LoadCache(), and SaveCache().

Here is the call graph for this function:

Member Data Documentation

◆ kUndoWindowSeconds

constexpr float yaze::editor::RecentProjectsModel::kUndoWindowSeconds = 8.0f
staticconstexpr

Definition at line 105 of file recent_projects_model.h.

Referenced by RemoveRecent().

◆ entries_

std::vector<RecentProject> yaze::editor::RecentProjectsModel::entries_
private

Definition at line 146 of file recent_projects_model.h.

Referenced by entries(), and Refresh().

◆ cached_generation_

std::uint64_t yaze::editor::RecentProjectsModel::cached_generation_ = 0
private

Definition at line 147 of file recent_projects_model.h.

Referenced by generation(), and Refresh().

◆ loaded_once_

bool yaze::editor::RecentProjectsModel::loaded_once_ = false
private

Definition at line 148 of file recent_projects_model.h.

Referenced by Refresh().

◆ cache_

std::unordered_map<std::string, CachedExtras> yaze::editor::RecentProjectsModel::cache_
private

◆ cache_dirty_

bool yaze::editor::RecentProjectsModel::cache_dirty_ = false
private

◆ cache_loaded_

bool yaze::editor::RecentProjectsModel::cache_loaded_ = false
private

Definition at line 152 of file recent_projects_model.h.

Referenced by Refresh().

◆ annotation_generation_

std::uint64_t yaze::editor::RecentProjectsModel::annotation_generation_ = 0
private

◆ undo_buffer_

std::deque<RemovedRecent> yaze::editor::RecentProjectsModel::undo_buffer_
private

◆ scan_state_

std::shared_ptr<AsyncScanState> yaze::editor::RecentProjectsModel::scan_state_
private

The documentation for this class was generated from the following files: