summaryrefslogtreecommitdiff
path: root/core/src/UI/States.cpp
blob: 07bbcf7a303886ab309cd6eecb2bfc55c5265d8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "States.hpp"

#include "Model/Project.hpp"

#include <memory>
#include <utility>

static std::unique_ptr<UIState> uiStateInstance;

void UIState::Init() {
	uiStateInstance = std::make_unique<UIState>();
}

UIState& UIState::GetInstance() {
	return *uiStateInstance;
}

void UIState::SetCurrentProject(std::unique_ptr<Project> project) {
	CloseCurrentProject();
	CurrentProject = std::move(project);
}

void UIState::CloseCurrentProject() {
	if (CurrentProject) {
		// TODO save stuff
		CurrentProject = nullptr;
	}
}