yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
project_manager.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_SYSTEM_PROJECT_MANAGER_H_
2#define YAZE_APP_EDITOR_SYSTEM_PROJECT_MANAGER_H_
3
4#include <functional>
5#include <string>
6#include <vector>
7
8#include "absl/status/status.h"
9#include "core/project.h"
10
11namespace yaze {
12namespace editor {
13
14class ToastManager;
15
34 public:
35 explicit ProjectManager(ToastManager* toast_manager);
36 ~ProjectManager() = default;
37
38 // Project file operations
39 absl::Status CreateNewProject(const std::string& template_name = "");
40 absl::Status OpenProject(const std::string& filename = "");
41 absl::Status SaveProject();
42 absl::Status SaveProjectAs(const std::string& filename = "");
43
44 // Project import/export
45 absl::Status ImportProject(const std::string& project_path);
46 absl::Status ExportProject(const std::string& export_path);
47
48 // Project maintenance
49 absl::Status RepairCurrentProject();
50 absl::Status ValidateProject();
51
52 // Project information
57 bool HasActiveProject() const { return !current_project_.filepath.empty(); }
58 std::string GetProjectName() const;
59 std::string GetProjectPath() const;
60
61 // Project templates
62 std::vector<std::string> GetAvailableTemplates() const;
63 absl::Status CreateFromTemplate(const std::string& template_name,
64 const std::string& project_name);
65
66 // ============================================================================
67 // ROM-First Workflow
68 // ============================================================================
69
74
79 absl::Status SetProjectRom(const std::string& rom_path);
80
86 absl::Status FinalizeProjectCreation(const std::string& project_name,
87 const std::string& project_path);
88
93
97 void SetRomSelectionCallback(std::function<void()> callback) {
98 rom_selection_callback_ = callback;
99 }
100
104 void RequestRomSelection();
105
106 // ============================================================================
107 // ZSCustomOverworld Presets
108 // ============================================================================
109
113 static std::vector<project::ProjectManager::ProjectTemplate> GetZsoTemplates();
114
119 absl::Status ApplyZsoPreset(const std::string& preset_name);
120
121 private:
124
125 // ROM-first workflow state
128 std::function<void()> rom_selection_callback_;
129
130 // Helper methods
131 absl::Status LoadProjectFromFile(const std::string& filename);
132 absl::Status SaveProjectToFile(const std::string& filename);
133 std::string GenerateProjectFilename(const std::string& project_name) const;
134 bool IsValidProjectFile(const std::string& filename) const;
135 absl::Status InitializeProjectStructure(const std::string& project_path);
136};
137
138} // namespace editor
139} // namespace yaze
140
141#endif // YAZE_APP_EDITOR_SYSTEM_PROJECT_MANAGER_H_
Handles all project file operations with ROM-first workflow.
std::string GenerateProjectFilename(const std::string &project_name) const
absl::Status FinalizeProjectCreation(const std::string &project_name, const std::string &project_path)
Complete project creation after ROM is loaded.
absl::Status SaveProjectAs(const std::string &filename="")
absl::Status ExportProject(const std::string &export_path)
std::vector< std::string > GetAvailableTemplates() const
std::string GetProjectPath() const
absl::Status ApplyZsoPreset(const std::string &preset_name)
Apply a ZSO preset to the current project.
bool IsValidProjectFile(const std::string &filename) const
absl::Status SetProjectRom(const std::string &rom_path)
Set the ROM for the current project.
const project::YazeProject & GetCurrentProject() const
absl::Status CreateNewProject(const std::string &template_name="")
project::YazeProject current_project_
absl::Status OpenProject(const std::string &filename="")
void RequestRomSelection()
Request ROM selection (triggers callback)
static std::vector< project::ProjectManager::ProjectTemplate > GetZsoTemplates()
Get ZSO-specific project templates.
void CancelPendingProject()
Cancel pending project creation.
ProjectManager(ToastManager *toast_manager)
bool IsPendingRomSelection() const
Check if project is waiting for ROM selection.
absl::Status ImportProject(const std::string &project_path)
std::function< void()> rom_selection_callback_
absl::Status LoadProjectFromFile(const std::string &filename)
absl::Status InitializeProjectStructure(const std::string &project_path)
absl::Status CreateFromTemplate(const std::string &template_name, const std::string &project_name)
project::YazeProject & GetCurrentProject()
absl::Status SaveProjectToFile(const std::string &filename)
std::string GetProjectName() const
void SetRomSelectionCallback(std::function< void()> callback)
Set callback for when ROM selection is needed.
Modern project structure with comprehensive settings consolidation.
Definition project.h:84