| 718 | } |
| 719 | |
| 720 | bool 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 = ¤t_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 | |
| 756 | bool OptionSize(std::vector<DeviceOptions>* current_devices, std::string argument, Options* /*options*/, std::vector<RGBController *>& rgb_controllers) |
| 757 | { |