forked from eranif/codelite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAutoSaveSettings.cpp
More file actions
36 lines (31 loc) · 868 Bytes
/
AutoSaveSettings.cpp
File metadata and controls
36 lines (31 loc) · 868 Bytes
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
#include "AutoSaveSettings.h"
AutoSaveSettings::AutoSaveSettings()
: clConfigItem("auto-save")
, m_flags(0)
, m_checkInterval(5)
{
}
void AutoSaveSettings::FromJSON(const JSONItem& json)
{
m_flags = json.namedObject("m_flags").toSize_t(m_flags);
m_checkInterval = json.namedObject("m_checkInterval").toSize_t(m_checkInterval);
}
JSONItem AutoSaveSettings::ToJSON() const
{
JSONItem json = JSONItem::createObject();
json.addProperty("m_flags", m_flags);
json.addProperty("m_checkInterval", m_checkInterval);
return json;
}
AutoSaveSettings AutoSaveSettings::Load()
{
AutoSaveSettings settings;
clConfig config("auto-save.conf");
config.ReadItem(settings);
return settings;
}
void AutoSaveSettings::Save(const AutoSaveSettings& settings)
{
clConfig config("auto-save.conf");
config.WriteItem(settings);
}