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

Function OptionProfile

cli.cpp:799–833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

797}
798
799bool OptionProfile(std::string argument, std::vector<RGBController *>& rgb_controllers)
800{
801 ResourceManager::get()->WaitForDeviceDetection();
802
803 /*---------------------------------------------------------*\
804 | Attempt to load profile |
805 \*---------------------------------------------------------*/
806 if(ResourceManager::get()->GetProfileManager()->LoadProfile(argument))
807 {
808 /*-----------------------------------------------------*\
809 | Change device mode if profile loading was successful |
810 \*-----------------------------------------------------*/
811 for(std::size_t controller_idx = 0; controller_idx < rgb_controllers.size(); controller_idx++)
812 {
813 RGBController* device = rgb_controllers[controller_idx];
814
815 device->DeviceUpdateMode();
816 LOG_DEBUG("Updating mode for %s to %i", device->name.c_str(), device->active_mode);
817
818 if(device->modes[device->active_mode].color_mode == MODE_COLORS_PER_LED)
819 {
820 device->DeviceUpdateLEDs();
821 LOG_DEBUG("Mode uses per-LED color, also updating LEDs");
822 }
823 }
824
825 std::cout << "Profile loaded successfully" << std::endl;
826 return true;
827 }
828 else
829 {
830 std::cout << "Profile failed to load" << std::endl;
831 return false;
832 }
833}
834
835bool OptionSaveProfile(std::string argument)
836{

Callers 1

ProcessOptionsFunction · 0.85

Calls 7

LoadProfileMethod · 0.80
GetProfileManagerMethod · 0.80
getFunction · 0.50
sizeMethod · 0.45
DeviceUpdateModeMethod · 0.45
DeviceUpdateLEDsMethod · 0.45

Tested by

no test coverage detected