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

Handles all project file operations with ROM-first workflow. More...

#include <project_manager.h>

Collaboration diagram for yaze::editor::ProjectManager:

Public Member Functions

 ProjectManager (ToastManager *toast_manager)
 
 ~ProjectManager ()=default
 
absl::Status CreateNewProject (const std::string &template_name="")
 
absl::Status OpenProject (const std::string &filename="")
 
absl::Status SaveProject ()
 
absl::Status SaveProjectAs (const std::string &filename="")
 
absl::Status ImportProject (const std::string &project_path)
 
absl::Status ExportProject (const std::string &export_path)
 
absl::Status RepairCurrentProject ()
 
absl::Status ValidateProject ()
 
project::YazeProjectGetCurrentProject ()
 
const project::YazeProjectGetCurrentProject () const
 
bool HasActiveProject () const
 
std::string GetProjectName () const
 
std::string GetProjectPath () const
 
std::vector< std::string > GetAvailableTemplates () const
 
absl::Status CreateFromTemplate (const std::string &template_name, const std::string &project_name)
 
bool IsPendingRomSelection () const
 Check if project is waiting for ROM selection.
 
absl::Status SetProjectRom (const std::string &rom_path)
 Set the ROM for the current project.
 
absl::Status FinalizeProjectCreation (const std::string &project_name, const std::string &project_path)
 Complete project creation after ROM is loaded.
 
void CancelPendingProject ()
 Cancel pending project creation.
 
void SetRomSelectionCallback (std::function< void()> callback)
 Set callback for when ROM selection is needed.
 
void RequestRomSelection ()
 Request ROM selection (triggers callback)
 
absl::Status ApplyZsoPreset (const std::string &preset_name)
 Apply a ZSO preset to the current project.
 

Static Public Member Functions

static std::vector< project::ProjectManager::ProjectTemplateGetZsoTemplates ()
 Get ZSO-specific project templates.
 

Private Member Functions

absl::Status LoadProjectFromFile (const std::string &filename)
 
absl::Status SaveProjectToFile (const std::string &filename)
 
std::string GenerateProjectFilename (const std::string &project_name) const
 
bool IsValidProjectFile (const std::string &filename) const
 
absl::Status InitializeProjectStructure (const std::string &project_path)
 

Private Attributes

project::YazeProject current_project_
 
ToastManagertoast_manager_ = nullptr
 
bool pending_rom_selection_ = false
 
std::string pending_template_name_
 
std::function< void()> rom_selection_callback_
 

Detailed Description

Handles all project file operations with ROM-first workflow.

Extracted from EditorManager to provide focused project management:

  • Project creation and templates (ROM-first workflow)
  • Project loading and saving
  • Project import/export
  • Project validation and repair
  • ZSCustomOverworld preset integration

ROM-First Workflow:

  1. User creates new project
  2. ROM selection dialog opens
  3. ROM load options (ZSO version, feature flags)
  4. Project configured with selected options

Definition at line 33 of file project_manager.h.

Constructor & Destructor Documentation

◆ ProjectManager()

yaze::editor::ProjectManager::ProjectManager ( ToastManager * toast_manager)
explicit

Definition at line 14 of file project_manager.cc.

◆ ~ProjectManager()

yaze::editor::ProjectManager::~ProjectManager ( )
default

Member Function Documentation

◆ CreateNewProject()

absl::Status yaze::editor::ProjectManager::CreateNewProject ( const std::string & template_name = "")

◆ OpenProject()

absl::Status yaze::editor::ProjectManager::OpenProject ( const std::string & filename = "")
Todo
Show file dialog

Definition at line 41 of file project_manager.cc.

References LoadProjectFromFile().

Here is the call graph for this function:

◆ SaveProject()

absl::Status yaze::editor::ProjectManager::SaveProject ( )

Definition at line 77 of file project_manager.cc.

References current_project_, yaze::project::YazeProject::filepath, HasActiveProject(), and SaveProjectToFile().

Here is the call graph for this function:

◆ SaveProjectAs()

absl::Status yaze::editor::ProjectManager::SaveProjectAs ( const std::string & filename = "")
Todo
Show save dialog

Definition at line 85 of file project_manager.cc.

References SaveProjectToFile().

Here is the call graph for this function:

◆ ImportProject()

absl::Status yaze::editor::ProjectManager::ImportProject ( const std::string & project_path)

◆ ExportProject()

absl::Status yaze::editor::ProjectManager::ExportProject ( const std::string & export_path)
Todo
Implement project export logic

Definition at line 150 of file project_manager.cc.

References HasActiveProject(), yaze::editor::kSuccess, yaze::editor::ToastManager::Show(), and toast_manager_.

Here is the call graph for this function:

◆ RepairCurrentProject()

absl::Status yaze::editor::ProjectManager::RepairCurrentProject ( )
Todo
Implement project repair logic

Definition at line 170 of file project_manager.cc.

References HasActiveProject(), yaze::editor::kSuccess, yaze::editor::ToastManager::Show(), and toast_manager_.

Here is the call graph for this function:

◆ ValidateProject()

absl::Status yaze::editor::ProjectManager::ValidateProject ( )

◆ GetCurrentProject() [1/2]

project::YazeProject & yaze::editor::ProjectManager::GetCurrentProject ( )
inline

◆ GetCurrentProject() [2/2]

const project::YazeProject & yaze::editor::ProjectManager::GetCurrentProject ( ) const
inline

Definition at line 54 of file project_manager.h.

References current_project_.

◆ HasActiveProject()

◆ GetProjectName()

std::string yaze::editor::ProjectManager::GetProjectName ( ) const

◆ GetProjectPath()

std::string yaze::editor::ProjectManager::GetProjectPath ( ) const

Definition at line 211 of file project_manager.cc.

References current_project_, and yaze::project::YazeProject::filepath.

◆ GetAvailableTemplates()

std::vector< std::string > yaze::editor::ProjectManager::GetAvailableTemplates ( ) const
Todo
Scan templates directory and return available templates

Definition at line 215 of file project_manager.cc.

◆ CreateFromTemplate()

absl::Status yaze::editor::ProjectManager::CreateFromTemplate ( const std::string & template_name,
const std::string & project_name )
Todo
Implement template-based project creation

Definition at line 221 of file project_manager.cc.

References current_project_, yaze::project::YazeProject::filepath, GenerateProjectFilename(), yaze::editor::kSuccess, yaze::project::YazeProject::name, yaze::editor::ToastManager::Show(), and toast_manager_.

Referenced by CreateNewProject().

Here is the call graph for this function:

◆ IsPendingRomSelection()

bool yaze::editor::ProjectManager::IsPendingRomSelection ( ) const
inline

Check if project is waiting for ROM selection.

Definition at line 73 of file project_manager.h.

References pending_rom_selection_.

◆ SetProjectRom()

absl::Status yaze::editor::ProjectManager::SetProjectRom ( const std::string & rom_path)

Set the ROM for the current project.

Parameters
rom_pathPath to the ROM file

Definition at line 294 of file project_manager.cc.

References current_project_, yaze::editor::kSuccess, pending_rom_selection_, yaze::project::YazeProject::rom_filename, yaze::editor::ToastManager::Show(), and toast_manager_.

Referenced by yaze::editor::EditorManager::Initialize().

Here is the call graph for this function:

◆ FinalizeProjectCreation()

absl::Status yaze::editor::ProjectManager::FinalizeProjectCreation ( const std::string & project_name,
const std::string & project_path )

Complete project creation after ROM is loaded.

Parameters
project_nameName for the project
project_pathPath to save project file

Definition at line 319 of file project_manager.cc.

References current_project_, yaze::project::YazeProject::filepath, GenerateProjectFilename(), InitializeProjectStructure(), yaze::editor::kSuccess, yaze::editor::kWarning, yaze::project::YazeProject::name, pending_rom_selection_, pending_template_name_, yaze::editor::ToastManager::Show(), and toast_manager_.

Referenced by yaze::editor::EditorManager::Initialize().

Here is the call graph for this function:

◆ CancelPendingProject()

void yaze::editor::ProjectManager::CancelPendingProject ( )

Cancel pending project creation.

Definition at line 362 of file project_manager.cc.

References current_project_, yaze::editor::kInfo, pending_rom_selection_, pending_template_name_, yaze::editor::ToastManager::Show(), and toast_manager_.

Here is the call graph for this function:

◆ SetRomSelectionCallback()

void yaze::editor::ProjectManager::SetRomSelectionCallback ( std::function< void()> callback)
inline

Set callback for when ROM selection is needed.

Definition at line 97 of file project_manager.h.

References rom_selection_callback_.

◆ RequestRomSelection()

void yaze::editor::ProjectManager::RequestRomSelection ( )

Request ROM selection (triggers callback)

Definition at line 374 of file project_manager.cc.

References rom_selection_callback_.

◆ GetZsoTemplates()

◆ ApplyZsoPreset()

absl::Status yaze::editor::ProjectManager::ApplyZsoPreset ( const std::string & preset_name)

Apply a ZSO preset to the current project.

Parameters
preset_nameName of the preset ("vanilla", "zso_v2", "zso_v3", "rando")

Definition at line 447 of file project_manager.cc.

References current_project_, yaze::project::YazeProject::feature_flags, GetZsoTemplates(), yaze::editor::kSuccess, yaze::editor::ToastManager::Show(), and toast_manager_.

Here is the call graph for this function:

◆ LoadProjectFromFile()

absl::Status yaze::editor::ProjectManager::LoadProjectFromFile ( const std::string & filename)
private

◆ SaveProjectToFile()

absl::Status yaze::editor::ProjectManager::SaveProjectToFile ( const std::string & filename)
private

◆ GenerateProjectFilename()

std::string yaze::editor::ProjectManager::GenerateProjectFilename ( const std::string & project_name) const
private

◆ IsValidProjectFile()

bool yaze::editor::ProjectManager::IsValidProjectFile ( const std::string & filename) const
private

Definition at line 255 of file project_manager.cc.

Referenced by LoadProjectFromFile().

◆ InitializeProjectStructure()

absl::Status yaze::editor::ProjectManager::InitializeProjectStructure ( const std::string & project_path)
private

Definition at line 271 of file project_manager.cc.

Referenced by FinalizeProjectCreation().

Member Data Documentation

◆ current_project_

◆ toast_manager_

◆ pending_rom_selection_

bool yaze::editor::ProjectManager::pending_rom_selection_ = false
private

◆ pending_template_name_

std::string yaze::editor::ProjectManager::pending_template_name_
private

Definition at line 127 of file project_manager.h.

Referenced by CancelPendingProject(), and FinalizeProjectCreation().

◆ rom_selection_callback_

std::function<void()> yaze::editor::ProjectManager::rom_selection_callback_
private

Definition at line 128 of file project_manager.h.

Referenced by RequestRomSelection(), and SetRomSelectionCallback().


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