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

Function OptionBrightness

cli.cpp:720–754  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

718}
719
720bool OptionBrightness(std::vector<DeviceOptions>* current_devices, std::string argument, Options* options)
721{
722 if(argument.size() == 0)
723 {
724 std::cout << "Error: --brightness passed with no argument" << std::endl;
725 return false;
726 }
727
728 /*---------------------------------------------------------*\
729 | If a device is not selected i.e. size() == 0 |
730 | then add brightness to allDeviceOptions |
731 \*---------------------------------------------------------*/
732 bool found = false;
733 DeviceOptions* currentDevOpts = &options->allDeviceOptions;
734
735 if(current_devices->size() == 0)
736 {
737 currentDevOpts->brightness = std::min(std::max(std::stoi(argument), 0),(int)brightness_percentage);
738 currentDevOpts->hasOption = true;
739 found = true;
740 }
741 else
742 {
743 for(size_t i = 0; i < current_devices->size(); i++)
744 {
745 DeviceOptions* currentDevOpts = &current_devices->at(i);
746
747 currentDevOpts->brightness = std::min(std::max(std::stoi(argument), 0),(int)brightness_percentage);
748 currentDevOpts->hasOption = true;
749 found = true;
750 }
751 }
752
753 return found;
754}
755
756bool OptionSize(std::vector<DeviceOptions>* current_devices, std::string argument, Options* /*options*/, std::vector<RGBController *>& rgb_controllers)
757{

Callers 1

ProcessOptionsFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected