Handles all project file operations. 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) |
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 |
Handles all project file operations.
Extracted from EditorManager to provide focused project management:
Definition at line 24 of file project_manager.h.
|
explicit |
Definition at line 13 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::kSuccess, yaze::project::YazeProject::name, 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 33 of file project_manager.cc.
References LoadProjectFromFile().
absl::Status yaze::editor::ProjectManager::SaveProject | ( | ) |
Definition at line 75 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 83 of file project_manager.cc.
References SaveProjectToFile().
absl::Status yaze::editor::ProjectManager::ImportProject | ( | const std::string & | project_path | ) |
Definition at line 118 of file project_manager.cc.
References yaze::editor::kSuccess, yaze::editor::ToastManager::Show(), and toast_manager_.
absl::Status yaze::editor::ProjectManager::ExportProject | ( | const std::string & | export_path | ) |
Definition at line 140 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 161 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 176 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 44 of file project_manager.h.
References current_project_.
Referenced by yaze::editor::EditorManager::CreateNewProject().
|
inline |
Definition at line 45 of file project_manager.h.
References current_project_.
|
inline |
Definition at line 46 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 198 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 202 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 206 of file project_manager.cc.
absl::Status yaze::editor::ProjectManager::CreateFromTemplate | ( | const std::string & | template_name, |
const std::string & | project_name | ||
) |
Definition at line 217 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().
|
private |
Definition at line 42 of file project_manager.cc.
References current_project_, yaze::project::YazeProject::filepath, IsValidProjectFile(), yaze::editor::kError, yaze::editor::kSuccess, yaze::project::YazeProject::name, yaze::editor::ToastManager::Show(), and toast_manager_.
Referenced by OpenProject().
|
private |
Definition at line 92 of file project_manager.cc.
References current_project_, yaze::project::YazeProject::filepath, yaze::editor::kError, yaze::editor::kSuccess, yaze::editor::ToastManager::Show(), and toast_manager_.
Referenced by SaveProject(), and SaveProjectAs().
|
private |
Definition at line 239 of file project_manager.cc.
Referenced by CreateFromTemplate(), and CreateNewProject().
|
private |
Definition at line 249 of file project_manager.cc.
Referenced by LoadProjectFromFile().
|
private |
Definition at line 263 of file project_manager.cc.
|
private |
Definition at line 56 of file project_manager.h.
Referenced by CreateFromTemplate(), CreateNewProject(), GetCurrentProject(), GetCurrentProject(), GetProjectName(), GetProjectPath(), HasActiveProject(), LoadProjectFromFile(), SaveProject(), SaveProjectToFile(), and ValidateProject().
|
private |
Definition at line 57 of file project_manager.h.
Referenced by CreateFromTemplate(), CreateNewProject(), ExportProject(), ImportProject(), LoadProjectFromFile(), RepairCurrentProject(), SaveProjectToFile(), and ValidateProject().