From b3ff39138a9cb10e79234983c0b5325c72b5d914 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Tue, 31 Jan 2023 19:18:32 -0600 Subject: [PATCH] Save settings for wrapped HID device detectors --- ResourceManager.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ResourceManager.cpp b/ResourceManager.cpp index 2281caa2..88be2a98 100644 --- a/ResourceManager.cpp +++ b/ResourceManager.cpp @@ -1519,6 +1519,21 @@ void ResourceManager::UpdateDetectorSettings() } } + /*-------------------------------------------------*\ + | Loop through all HID wrapped detectors and see if | + | any need to be saved to the settings | + \*-------------------------------------------------*/ + for(unsigned int hid_wrapped_detector_idx = 0; hid_wrapped_detector_idx < hid_wrapped_device_detectors.size(); hid_wrapped_detector_idx++) + { + detection_string = hid_wrapped_device_detectors[hid_wrapped_detector_idx].name.c_str(); + + if(!(detector_settings.contains("detectors") && detector_settings["detectors"].contains(detection_string))) + { + detector_settings["detectors"][detection_string] = true; + save_settings = true; + } + } + /*-------------------------------------------------*\ | Loop through remaining detectors and see if any | | need to be saved to the settings | @@ -1545,6 +1560,11 @@ void ResourceManager::UpdateDetectorSettings() } } + /*-------------------------------------------------*\ + | If there were any setting changes that need to be | + | saved, set the settings in the settings manager | + | and save them. | + \*-------------------------------------------------*/ if(save_settings) { LOG_INFO("Saving detector settings");