feat: Initial work rework current project system

This commit is contained in:
WerWolv
2025-02-10 21:44:14 +01:00
parent b3d208e6e6
commit efe0928fc6
14 changed files with 464 additions and 49 deletions

View File

@@ -0,0 +1,28 @@
#include <hex/project/project.hpp>
#include <hex/project/project_manager.hpp>
namespace hex::proj {
Project::~Project() {
for (auto &content : m_contents) {
ProjectManager::storeContent(*content);
}
}
void Project::addContent(UnlocalizedString type) {
const auto &content = m_contents.emplace_back(
std::make_unique<Content>(
type,
fmt::format("Unnamed {}", Lang(type))
)
);
const auto loadedContent = ProjectManager::getLoadedContent(type);
ProjectManager::storeContent(loadedContent == nullptr ? *content : *loadedContent);
ProjectManager::loadContent(*content);
}
}