File: settings.cpp

package info (click to toggle)
ares 126-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 32,600 kB
  • sloc: cpp: 356,508; ansic: 20,394; makefile: 16; sh: 2
file content (46 lines) | stat: -rw-r--r-- 2,035 bytes parent folder | download
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
44
45
46
namespace hiro {

Settings::Settings() {
  string path = {Path::userData(), "hiro/"};
  auto document = BML::unserialize(file::read({path, "windows.bml"}));

  document["extendedFrameBounds/popup/x"].value(efbPopup.x);
  document["extendedFrameBounds/popup/y"].value(efbPopup.y);
  document["extendedFrameBounds/popup/width"].value(efbPopup.width);
  document["extendedFrameBounds/popup/height"].value(efbPopup.height);

  document["extendedFrameBounds/fixed/x"].value(efbFixed.x);
  document["extendedFrameBounds/fixed/y"].value(efbFixed.y);
  document["extendedFrameBounds/fixed/width"].value(efbFixed.width);
  document["extendedFrameBounds/fixed/height"].value(efbFixed.height);

  document["extendedFrameBounds/resizable/x"].value(efbResizable.x);
  document["extendedFrameBounds/resizable/y"].value(efbResizable.y);
  document["extendedFrameBounds/resizable/width"].value(efbResizable.width);
  document["extendedFrameBounds/resizable/height"].value(efbResizable.height);
}

Settings::~Settings() {
  string path = {Path::userData(), "hiro/"};
  directory::create(path, 0755);
  Markup::Node document;

  document("extendedFrameBounds/popup/x").setValue(efbPopup.x);
  document("extendedFrameBounds/popup/y").setValue(efbPopup.y);
  document("extendedFrameBounds/popup/width").setValue(efbPopup.width);
  document("extendedFrameBounds/popup/height").setValue(efbPopup.height);

  document("extendedFrameBounds/fixed/x").setValue(efbFixed.x);
  document("extendedFrameBounds/fixed/y").setValue(efbFixed.y);
  document("extendedFrameBounds/fixed/width").setValue(efbFixed.width);
  document("extendedFrameBounds/fixed/height").setValue(efbFixed.height);

  document("extendedFrameBounds/resizable/x").setValue(efbResizable.x);
  document("extendedFrameBounds/resizable/y").setValue(efbResizable.y);
  document("extendedFrameBounds/resizable/width").setValue(efbResizable.width);
  document("extendedFrameBounds/resizable/height").setValue(efbResizable.height);

  file::write({path, "windows.bml"}, BML::serialize(document));
}

}