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);
89 const std::string& project_name,
90 const std::string& project_path = std::string()) const;
91
96
100 void SetRomSelectionCallback(std::function<void()> callback) {
101 rom_selection_callback_ = callback;
102 }
103
107 void RequestRomSelection();
108
109 // ============================================================================
110 // ZSCustomOverworld Presets
111 // ============================================================================
112
116 static std::vector<project::ProjectManager::ProjectTemplate>
118
123 absl::Status ApplyZsoPreset(const std::string& preset_name);
124
125 private:
128
129 // ROM-first workflow state
132 std::function<void()> rom_selection_callback_;
133
134 // Helper methods
135 absl::Status LoadProjectFromFile(const std::string& filename);
136 absl::Status SaveProjectToFile(const std::string& filename);
137 std::string ResolveProjectCreationPath(const std::string& project_name,
138 const std::string& project_path) const;
139 std::string GenerateProjectFilename(const std::string& project_name) const;
140 bool IsValidProjectFile(const std::string& filename) const;
141 absl::Status InitializeProjectStructure(const std::string& project_path);
142};
143
144} // namespace editor
145} // namespace yaze
146
147#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
absl::Status ValidateProjectCreationTarget(const std::string &project_name, const std::string &project_path=std::string()) const
std::string GetProjectPath() const
std::string ResolveProjectCreationPath(const std::string &project_name, const std::string &project_path) 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:172