From f01557a3faee5a618f6c1fba62b16ca69a08930e Mon Sep 17 00:00:00 2001 From: Dmitry K Date: Sun, 16 Jan 2022 00:27:33 +0000 Subject: [PATCH] #1267 Fix Set All Devices function turns off all lights when windows number format is not in English --- qt/OpenRGBDevicePage.cpp | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/qt/OpenRGBDevicePage.cpp b/qt/OpenRGBDevicePage.cpp index 3263c909..cf5b1a62 100644 --- a/qt/OpenRGBDevicePage.cpp +++ b/qt/OpenRGBDevicePage.cpp @@ -917,6 +917,7 @@ void Ui::OpenRGBDevicePage::UpdateDevice() void Ui::OpenRGBDevicePage::SetCustomMode(unsigned char red, unsigned char green, unsigned char blue) { + RGBColor color = ToRGBColor(red, green, blue); /*-----------------------------------------------------*\ | Set the selected mode to the custom mode and update UI| \*-----------------------------------------------------*/ @@ -945,37 +946,19 @@ void Ui::OpenRGBDevicePage::SetCustomMode(unsigned char red, unsigned char green switch(device->modes[selected_mode].color_mode) { case MODE_COLORS_PER_LED: - { - /*-----------------------------------------------------*\ - | Set all device LEDs to the current color | - \*-----------------------------------------------------*/ - RGBColor color = ToRGBColor( - ui->RedSpinBox->text().toInt(), - ui->GreenSpinBox->text().toInt(), - ui->BlueSpinBox->text().toInt() - ); - - device->SetAllLEDs(color); - } - break; + { + device->SetAllLEDs(color); + } + break; case MODE_COLORS_MODE_SPECIFIC: + { + for(std::size_t i = 0; i < device->modes[selected_mode].colors.size(); i++) { - /*-----------------------------------------------------*\ - | Set all device LEDs to the current color | - \*-----------------------------------------------------*/ - RGBColor color = ToRGBColor( - ui->RedSpinBox->text().toInt(), - ui->GreenSpinBox->text().toInt(), - ui->BlueSpinBox->text().toInt() - ); - - for(std::size_t i = 0; i < device->modes[selected_mode].colors.size(); i++) - { - device->modes[selected_mode].colors[i] = color; - } + device->modes[selected_mode].colors[i] = color; } break; + } } /*-----------------------------------------------------*\