File: settings.cpp

package info (click to toggle)
ares 147%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 35,244 kB
  • sloc: cpp: 334,263; ansic: 98,696; sh: 123; makefile: 31
file content (46 lines) | stat: -rw-r--r-- 2,033 bytes parent folder | download | duplicates (2)
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::program(), "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::program(), "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));
}

}