Handles all project file operations with ROM-first workflow. More...
#include <project_manager.h>

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::YazeProject & | GetCurrentProject () |
| const project::YazeProject & | GetCurrentProject () 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::ProjectTemplate > | GetZsoTemplates () |
| 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_ |
| ToastManager * | toast_manager_ = nullptr |
| bool | pending_rom_selection_ = false |
| std::string | pending_template_name_ |
| std::function< void()> | rom_selection_callback_ |
Handles all project file operations with ROM-first workflow.
Extracted from EditorManager to provide focused project management:
ROM-First Workflow:
Definition at line 33 of file project_manager.h.
|
explicit |
Definition at line 14 of file project_manager.cc.
|
default |
| absl::Status yaze::editor::ProjectManager::CreateNewProject | ( | const std::string & | template_name = "" | ) |
Definition at line 17 of file project_manager.cc.
References CreateFromTemplate(), current_project_, yaze::project::YazeProject::filepath, GenerateProjectFilename(), yaze::editor::kInfo, yaze::project::YazeProject::name, pending_rom_selection_, yaze::editor::ToastManager::Show(), and toast_manager_.
Referenced by yaze::editor::EditorManager::CreateNewProject().

| absl::Status yaze::editor::ProjectManager::OpenProject | ( | const std::string & | filename = "" | ) |
Definition at line 41 of file project_manager.cc.
References LoadProjectFromFile().

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

| absl::Status yaze::editor::ProjectManager::SaveProjectAs | ( | const std::string & | filename = "" | ) |
Definition at line 85 of file project_manager.cc.
References SaveProjectToFile().

| absl::Status yaze::editor::ProjectManager::ImportProject | ( | const std::string & | project_path | ) |
Definition at line 113 of file project_manager.cc.
References current_project_, yaze::project::YazeProject::ImportZScreamProject(), yaze::editor::kInfo, yaze::editor::kSuccess, yaze::project::YazeProject::Open(), RETURN_IF_ERROR, yaze::editor::ToastManager::Show(), and toast_manager_.
Referenced by yaze::editor::EditorManager::ImportProject().

| absl::Status yaze::editor::ProjectManager::ExportProject | ( | const std::string & | export_path | ) |
Definition at line 150 of file project_manager.cc.
References HasActiveProject(), yaze::editor::kSuccess, yaze::editor::ToastManager::Show(), and toast_manager_.

| absl::Status yaze::editor::ProjectManager::RepairCurrentProject | ( | ) |
Definition at line 170 of file project_manager.cc.
References HasActiveProject(), yaze::editor::kSuccess, yaze::editor::ToastManager::Show(), and toast_manager_.

| absl::Status yaze::editor::ProjectManager::ValidateProject | ( | ) |
Definition at line 185 of file project_manager.cc.
References current_project_, HasActiveProject(), yaze::editor::kError, yaze::editor::kSuccess, yaze::editor::ToastManager::Show(), toast_manager_, and yaze::project::YazeProject::Validate().

|
inline |
Definition at line 53 of file project_manager.h.
References current_project_.
Referenced by yaze::editor::EditorManager::CreateNewProject(), and yaze::editor::EditorManager::ImportProject().
|
inline |
Definition at line 54 of file project_manager.h.
References current_project_.
|
inline |
Definition at line 57 of file project_manager.h.
References current_project_, and yaze::project::YazeProject::filepath.
Referenced by yaze::editor::MenuOrchestrator::CanSaveProject(), ExportProject(), yaze::editor::MenuOrchestrator::HasActiveProject(), RepairCurrentProject(), SaveProject(), and ValidateProject().
| std::string yaze::editor::ProjectManager::GetProjectName | ( | ) | const |
Definition at line 207 of file project_manager.cc.
References current_project_, and yaze::project::YazeProject::name.
Referenced by yaze::editor::MenuOrchestrator::GetProjectName().
| std::string yaze::editor::ProjectManager::GetProjectPath | ( | ) | const |
Definition at line 211 of file project_manager.cc.
References current_project_, and yaze::project::YazeProject::filepath.
| std::vector< std::string > yaze::editor::ProjectManager::GetAvailableTemplates | ( | ) | const |
Definition at line 215 of file project_manager.cc.
| absl::Status yaze::editor::ProjectManager::CreateFromTemplate | ( | const std::string & | template_name, |
| const std::string & | project_name ) |
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().

|
inline |
Check if project is waiting for ROM selection.
Definition at line 73 of file project_manager.h.
References pending_rom_selection_.
| absl::Status yaze::editor::ProjectManager::SetProjectRom | ( | const std::string & | rom_path | ) |
Set the ROM for the current project.
| rom_path | Path 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().

| absl::Status yaze::editor::ProjectManager::FinalizeProjectCreation | ( | const std::string & | project_name, |
| const std::string & | project_path ) |
Complete project creation after ROM is loaded.
| project_name | Name for the project |
| project_path | Path 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().

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

|
inline |
Set callback for when ROM selection is needed.
Definition at line 97 of file project_manager.h.
References rom_selection_callback_.
| void yaze::editor::ProjectManager::RequestRomSelection | ( | ) |
Request ROM selection (triggers callback)
Definition at line 374 of file project_manager.cc.
References rom_selection_callback_.
|
static |
Get ZSO-specific project templates.
Definition at line 385 of file project_manager.cc.
References yaze::project::ProjectManager::ProjectTemplate::description, yaze::project::YazeProject::feature_flags, yaze::project::ProjectManager::ProjectTemplate::icon, yaze::core::FeatureFlags::Flags::Overworld::kLoadCustomOverworld, yaze::core::FeatureFlags::Flags::kSaveAllPalettes, yaze::core::FeatureFlags::Flags::kSaveDungeonMaps, yaze::core::FeatureFlags::Flags::kSaveGfxGroups, yaze::core::FeatureFlags::Flags::Overworld::kSaveOverworldEntrances, yaze::core::FeatureFlags::Flags::Overworld::kSaveOverworldExits, yaze::core::FeatureFlags::Flags::Overworld::kSaveOverworldItems, yaze::core::FeatureFlags::Flags::Overworld::kSaveOverworldMaps, yaze::core::FeatureFlags::Flags::Overworld::kSaveOverworldProperties, yaze::project::ProjectManager::ProjectTemplate::name, yaze::core::FeatureFlags::Flags::overworld, and yaze::project::ProjectManager::ProjectTemplate::template_project.
Referenced by ApplyZsoPreset().
| absl::Status yaze::editor::ProjectManager::ApplyZsoPreset | ( | const std::string & | preset_name | ) |
Apply a ZSO preset to the current project.
| preset_name | Name 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_.

|
private |
Definition at line 50 of file project_manager.cc.
References current_project_, yaze::project::YazeProject::GetDisplayName(), IsValidProjectFile(), yaze::editor::kError, yaze::editor::kSuccess, yaze::project::YazeProject::Open(), yaze::editor::ToastManager::Show(), and toast_manager_.
Referenced by OpenProject().

|
private |
Definition at line 94 of file project_manager.cc.
References current_project_, yaze::editor::kError, yaze::editor::kSuccess, yaze::project::YazeProject::SaveAs(), yaze::editor::ToastManager::Show(), and toast_manager_.
Referenced by SaveProject(), and SaveProjectAs().

|
private |
Definition at line 244 of file project_manager.cc.
Referenced by CreateFromTemplate(), CreateNewProject(), and FinalizeProjectCreation().
|
private |
Definition at line 255 of file project_manager.cc.
Referenced by LoadProjectFromFile().
|
private |
Definition at line 271 of file project_manager.cc.
Referenced by FinalizeProjectCreation().
|
private |
Definition at line 122 of file project_manager.h.
Referenced by ApplyZsoPreset(), CancelPendingProject(), CreateFromTemplate(), CreateNewProject(), FinalizeProjectCreation(), GetCurrentProject(), GetCurrentProject(), GetProjectName(), GetProjectPath(), HasActiveProject(), ImportProject(), LoadProjectFromFile(), SaveProject(), SaveProjectToFile(), SetProjectRom(), and ValidateProject().
|
private |
Definition at line 123 of file project_manager.h.
Referenced by ApplyZsoPreset(), CancelPendingProject(), CreateFromTemplate(), CreateNewProject(), ExportProject(), FinalizeProjectCreation(), ImportProject(), LoadProjectFromFile(), RepairCurrentProject(), SaveProjectToFile(), SetProjectRom(), and ValidateProject().
|
private |
Definition at line 126 of file project_manager.h.
Referenced by CancelPendingProject(), CreateNewProject(), FinalizeProjectCreation(), IsPendingRomSelection(), and SetProjectRom().
|
private |
Definition at line 127 of file project_manager.h.
Referenced by CancelPendingProject(), and FinalizeProjectCreation().
|
private |
Definition at line 128 of file project_manager.h.
Referenced by RequestRomSelection(), and SetRomSelectionCallback().