blob: e6d823bb096bcf1bb8de7a3a098ed8d0dba0de1a (
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#pragma once
#include "Utils/Sigslot.hpp"
#include "cplt_fwd.hpp"
#include <filesystem>
#include <string>
#include <vector>
class GlobalStates {
public:
static void Init();
static void Shutdown();
static GlobalStates& GetInstance();
static const std::filesystem::path& GetUserDataPath();
struct RecentProject {
std::filesystem::path path;
std::string cachedUtf8String;
};
public:
Signal<> OnModified;
private:
std::vector<RecentProject> mRecentProjects;
mutable bool mDirty = false;
public:
const std::vector<RecentProject>& GetRecentProjects() const;
void ClearRecentProjects();
void AddRecentProject(const Project& project);
void RemoveRecentProject(int idx);
// TODO async autosaving to prevent data loss on crash
void WriteToDisk() const;
bool IsDirty() const;
private:
void MarkDirty();
};
|