about summary refs log tree commit diff stats
path: root/src/tracker_config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tracker_config.cpp')
-rw-r--r--src/tracker_config.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/tracker_config.cpp b/src/tracker_config.cpp index 85164d5..da5d60a 100644 --- a/src/tracker_config.cpp +++ b/src/tracker_config.cpp
@@ -16,7 +16,9 @@ void TrackerConfig::Load() {
16 asked_to_check_for_updates = file["asked_to_check_for_updates"].as<bool>(); 16 asked_to_check_for_updates = file["asked_to_check_for_updates"].as<bool>();
17 should_check_for_updates = file["should_check_for_updates"].as<bool>(); 17 should_check_for_updates = file["should_check_for_updates"].as<bool>();
18 hybrid_areas = file["hybrid_areas"].as<bool>(); 18 hybrid_areas = file["hybrid_areas"].as<bool>();
19 show_hunt_panels = file["show_hunt_panels"].as<bool>(); 19 if (file["show_hunt_panels"] && file["show_hunt_panels"].as<bool>()) {
20 visible_panels = kHUNT_PANELS;
21 }
20 22
21 if (file["connection_history"]) { 23 if (file["connection_history"]) {
22 for (const auto& connection : file["connection_history"]) { 24 for (const auto& connection : file["connection_history"]) {
@@ -27,6 +29,11 @@ void TrackerConfig::Load() {
27 }); 29 });
28 } 30 }
29 } 31 }
32
33 ipc_address = file["ipc_address"].as<std::string>();
34 track_position = file["track_position"].as<bool>();
35 visible_panels =
36 static_cast<VisiblePanels>(file["visible_panels"].as<int>());
30 } catch (const std::exception&) { 37 } catch (const std::exception&) {
31 // It's fine if the file can't be loaded. 38 // It's fine if the file can't be loaded.
32 } 39 }
@@ -40,7 +47,6 @@ void TrackerConfig::Save() {
40 output["asked_to_check_for_updates"] = asked_to_check_for_updates; 47 output["asked_to_check_for_updates"] = asked_to_check_for_updates;
41 output["should_check_for_updates"] = should_check_for_updates; 48 output["should_check_for_updates"] = should_check_for_updates;
42 output["hybrid_areas"] = hybrid_areas; 49 output["hybrid_areas"] = hybrid_areas;
43 output["show_hunt_panels"] = show_hunt_panels;
44 50
45 output.remove("connection_history"); 51 output.remove("connection_history");
46 for (const ConnectionDetails& details : connection_history) { 52 for (const ConnectionDetails& details : connection_history) {
@@ -52,6 +58,10 @@ void TrackerConfig::Save() {
52 output["connection_history"].push_back(connection); 58 output["connection_history"].push_back(connection);
53 } 59 }
54 60
61 output["ipc_address"] = ipc_address;
62 output["track_position"] = track_position;
63 output["visible_panels"] = static_cast<int>(visible_panels);
64
55 std::ofstream filewriter(filename_); 65 std::ofstream filewriter(filename_);
56 filewriter << output; 66 filewriter << output;
57} 67}