#include "States.hpp" #include "Model/GlobalStates.hpp" #include "Model/Project.hpp" #include #include static std::unique_ptr uiStateInstance; void UIState::Init() { uiStateInstance = std::make_unique(); } void UIState::Shutdown() { if (uiStateInstance) { uiStateInstance->CloseCurrentProject(); uiStateInstance = nullptr; } } UIState& UIState::GetInstance() { return *uiStateInstance; } void UIState::SetCurrentProject(std::unique_ptr project) { CloseCurrentProject(); if (project) { GlobalStates::GetInstance().MoveProjectToTop(*project); } CurrentProject = std::move(project); } void UIState::CloseCurrentProject() { if (CurrentProject) { CurrentProject->WriteToDisk(); CurrentProject = nullptr; } }