Hide device view when a mode that doesn't have per-LED is active

This commit is contained in:
Adam Honse 2022-11-07 09:24:27 -06:00
parent 11bc9d6521
commit ca49748603
2 changed files with 26 additions and 10 deletions

View file

@ -341,7 +341,7 @@ void Ui::OpenRGBDevicePage::on_LEDBox_currentIndexChanged(int index)
| Update color picker with color of selected mode |
\*-----------------------------------------------------*/
RGBColor color = device->modes[selected_mode].colors[index];
current_color.setRgb(RGBGetRValue(color), RGBGetGValue(color), RGBGetBValue(color));
updateColorUi();
@ -486,7 +486,7 @@ void Ui::OpenRGBDevicePage::UpdateModeUi()
ui->SpeedSlider->setMaximum(device->modes[selected_mode].speed_max);
current_speed = device->modes[selected_mode].speed;
}
ui->SpeedSlider->setValue(current_speed);
ui->SpeedSlider->setEnabled(true);
ui->SpeedSlider->blockSignals(false);
@ -533,7 +533,7 @@ void Ui::OpenRGBDevicePage::UpdateModeUi()
ui->DirectionBox->blockSignals(true);
ui->DirectionBox->clear();
if(supports_dir_lr)
{
ui->DirectionBox->addItem(tr("Left"));
@ -599,14 +599,18 @@ void Ui::OpenRGBDevicePage::UpdateModeUi()
{
ui->DirectionBox->setEnabled(false);
}
ui->DirectionBox->blockSignals(false);
if(supports_per_led)
{
ui->PerLEDCheck->setEnabled(true);
ui->PerLEDCheck->setChecked(per_led);
ui->DeviceViewBox->setPerLED(true);
if(DeviceViewShowing)
{
ui->DeviceViewBoxFrame->show();
}
}
else
{
@ -614,7 +618,7 @@ void Ui::OpenRGBDevicePage::UpdateModeUi()
ui->PerLEDCheck->setAutoExclusive(false);
ui->PerLEDCheck->setChecked(false);
ui->PerLEDCheck->setAutoExclusive(true);
ui->DeviceViewBox->setPerLED(false);
ui->DeviceViewBoxFrame->hide();
}
if(supports_mode_specific)
@ -995,7 +999,7 @@ void Ui::OpenRGBDevicePage::on_SatSpinBox_valueChanged(int sat)
int hue = current_color.hue();
int val = current_color.value();
current_color.setHsv(hue, sat, val);
colorChanged();
}
@ -1010,7 +1014,7 @@ void Ui::OpenRGBDevicePage::on_ValSpinBox_valueChanged(int val)
int hue = current_color.hue();
int sat = current_color.saturation();
current_color.setHsv(hue, sat, val);
colorChanged();
}
@ -1127,11 +1131,22 @@ void Ui::OpenRGBDevicePage::on_ResizeButton_clicked()
void Ui::OpenRGBDevicePage::ShowDeviceView()
{
ui->DeviceViewBoxFrame->show();
/*-----------------------------------------------------*\
| Read selected mode |
\*-----------------------------------------------------*/
unsigned int selected_mode = (unsigned int)ui->ModeBox->currentIndex();
DeviceViewShowing = true;
if(device->modes[selected_mode].flags & MODE_FLAG_HAS_PER_LED_COLOR)
{
ui->DeviceViewBoxFrame->show();
}
}
void Ui::OpenRGBDevicePage::HideDeviceView()
{
DeviceViewShowing = false;
ui->DeviceViewBoxFrame->hide();
}
@ -1211,7 +1226,7 @@ void Ui::OpenRGBDevicePage::colorChanged()
switch(device->modes[selected_mode].color_mode)
{
case MODE_COLORS_PER_LED:
case MODE_COLORS_PER_LED:
{
ui->DeviceViewBox->setSelectionColor(rgb_color);
break;

View file

@ -66,6 +66,7 @@ private:
bool InvertedSpeed = false;
bool InvertedBrightness = false;
bool MultipleSelected = false;
bool DeviceViewShowing = false;
QColor current_color;
void updateColorUi();