| 754 | } |
| 755 | |
| 756 | bool OptionSize(std::vector<DeviceOptions>* current_devices, std::string argument, Options* /*options*/, std::vector<RGBController *>& rgb_controllers) |
| 757 | { |
| 758 | const unsigned int new_size = std::stoi(argument); |
| 759 | |
| 760 | ResourceManager::get()->WaitForDeviceDetection(); |
| 761 | |
| 762 | for(size_t i = 0; i < current_devices->size(); i++) |
| 763 | { |
| 764 | int current_device = current_devices->at(i).device; |
| 765 | int current_zone = current_devices->at(i).zone; |
| 766 | |
| 767 | /*---------------------------------------------------------*\ |
| 768 | | Fail out if device, zone, or size are out of range | |
| 769 | \*---------------------------------------------------------*/ |
| 770 | if((current_device >= static_cast<int>(rgb_controllers.size())) || (current_device < 0)) |
| 771 | { |
| 772 | std::cout << "Error: Device is out of range" << std::endl; |
| 773 | return false; |
| 774 | } |
| 775 | else if((current_zone >= static_cast<int>(rgb_controllers[current_device]->zones.size())) || (current_zone < 0)) |
| 776 | { |
| 777 | std::cout << "Error: Zone is out of range" << std::endl; |
| 778 | return false; |
| 779 | } |
| 780 | else if((new_size < rgb_controllers[current_device]->zones[current_zone].leds_min) || (new_size > rgb_controllers[current_device]->zones[current_zone].leds_max)) |
| 781 | { |
| 782 | std::cout << "Error: New size is out of range" << std::endl; |
| 783 | } |
| 784 | |
| 785 | /*---------------------------------------------------------*\ |
| 786 | | Resize the zone | |
| 787 | \*---------------------------------------------------------*/ |
| 788 | rgb_controllers[current_device]->ResizeZone(current_zone, new_size); |
| 789 | |
| 790 | /*---------------------------------------------------------*\ |
| 791 | | Save the profile | |
| 792 | \*---------------------------------------------------------*/ |
| 793 | ResourceManager::get()->GetProfileManager()->SaveProfile("sizes", true); |
| 794 | } |
| 795 | |
| 796 | return true; |
| 797 | } |
| 798 | |
| 799 | bool OptionProfile(std::string argument, std::vector<RGBController *>& rgb_controllers) |
| 800 | { |
no test coverage detected