MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / UpdateDetectorSettings

Method UpdateDetectorSettings

ResourceManager.cpp:1491–1601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1489}
1490
1491void ResourceManager::UpdateDetectorSettings()
1492{
1493 json detector_settings;
1494 bool save_settings = false;
1495
1496 /*-------------------------------------------------*\
1497 | Open device disable list and read in disabled |
1498 | device strings |
1499 \*-------------------------------------------------*/
1500 detector_settings = settings_manager->GetSettings("Detectors");
1501
1502 /*-------------------------------------------------*\
1503 | Loop through all I2C detectors and see if any |
1504 | need to be saved to the settings |
1505 \*-------------------------------------------------*/
1506 for(unsigned int i2c_detector_idx = 0; i2c_detector_idx < i2c_device_detectors.size(); i2c_detector_idx++)
1507 {
1508 detection_string = i2c_device_detector_strings[i2c_detector_idx].c_str();
1509
1510 if(!(detector_settings.contains("detectors") && detector_settings["detectors"].contains(detection_string)))
1511 {
1512 detector_settings["detectors"][detection_string] = true;
1513 save_settings = true;
1514 }
1515 }
1516
1517 /*-------------------------------------------------*\
1518 | Loop through all I2C PCI detectors and see if any |
1519 | need to be saved to the settings |
1520 \*-------------------------------------------------*/
1521 for(unsigned int i2c_pci_detector_idx = 0; i2c_pci_detector_idx < i2c_pci_device_detectors.size(); i2c_pci_detector_idx++)
1522 {
1523 detection_string = i2c_pci_device_detectors[i2c_pci_detector_idx].name.c_str();
1524
1525 if(!(detector_settings.contains("detectors") && detector_settings["detectors"].contains(detection_string)))
1526 {
1527 detector_settings["detectors"][detection_string] = true;
1528 save_settings = true;
1529 }
1530 }
1531
1532 /*-------------------------------------------------*\
1533 | Loop through all HID detectors and see if any |
1534 | need to be saved to the settings |
1535 \*-------------------------------------------------*/
1536 for(unsigned int hid_detector_idx = 0; hid_detector_idx < hid_device_detectors.size(); hid_detector_idx++)
1537 {
1538 detection_string = hid_device_detectors[hid_detector_idx].name.c_str();
1539
1540 if(!(detector_settings.contains("detectors") && detector_settings["detectors"].contains(detection_string)))
1541 {
1542 detector_settings["detectors"][detection_string] = true;
1543 save_settings = true;
1544 }
1545 }
1546
1547 /*-------------------------------------------------*\
1548 | Loop through all HID wrapped detectors and see if |

Callers

nothing calls this directly

Calls 5

GetSettingsMethod · 0.80
containsMethod · 0.80
SetSettingsMethod · 0.80
sizeMethod · 0.45
SaveSettingsMethod · 0.45

Tested by

no test coverage detected