mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 21:05:56 -05:00
feat: Initial work rework current project system
This commit is contained in:
28
lib/libimhex/source/project/project.cpp
Normal file
28
lib/libimhex/source/project/project.cpp
Normal 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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user