From 6877aeefa4ed972da6ada785e6d1bf9d11b8422a Mon Sep 17 00:00:00 2001 From: morg Date: Sat, 6 Nov 2021 14:02:37 +0100 Subject: [PATCH] Auto update selection when active mode does not automaticall save to flash. --- qt/OpenRGBDevicePage.cpp | 13 ++++++++++++- qt/OpenRGBDevicePage.h | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/qt/OpenRGBDevicePage.cpp b/qt/OpenRGBDevicePage.cpp index 4361a55a4..db44b9255 100644 --- a/qt/OpenRGBDevicePage.cpp +++ b/qt/OpenRGBDevicePage.cpp @@ -108,6 +108,7 @@ OpenRGBDevicePage::OpenRGBDevicePage(RGBController *dev, QWidget *parent) : ui->RedSpinBox->setValue(ui->ColorWheelBox->color().red()); ui->GreenSpinBox->setValue(ui->ColorWheelBox->color().green()); ui->BlueSpinBox->setValue(ui->ColorWheelBox->color().blue()); + ui->ApplyColorsButton->setDisabled(autoUpdateEnabled()); } OpenRGBDevicePage::~OpenRGBDevicePage() @@ -364,6 +365,11 @@ void Ui::OpenRGBDevicePage::on_ModeBox_currentIndexChanged(int /*index*/) | Change device mode | \*-----------------------------------------------------*/ UpdateMode(); + + /*-----------------------------------------------------*\ + | Disable the button if we can safely auto apply colors | + \*-----------------------------------------------------*/ + ui->ApplyColorsButton->setDisabled(autoUpdateEnabled()); } void Ui::OpenRGBDevicePage::on_PerLEDCheck_clicked() @@ -1073,7 +1079,7 @@ void Ui::OpenRGBDevicePage::updateWheel() void Ui::OpenRGBDevicePage::updateDeviceView() { - if(false)//ui->AutoFillCheck->isChecked()) + if(autoUpdateEnabled()) { /*-----------------------------------------------------*\ | Read selected mode | @@ -1115,6 +1121,11 @@ void Ui::OpenRGBDevicePage::updateDeviceView() } } +bool Ui::OpenRGBDevicePage::autoUpdateEnabled() +{ + return !(device->modes[device->active_mode].flags & MODE_FLAG_AUTOMATIC_SAVE); +} + void Ui::OpenRGBDevicePage::on_RedSpinBox_valueChanged(int /*arg1*/) { updateHSV(); diff --git a/qt/OpenRGBDevicePage.h b/qt/OpenRGBDevicePage.h index 5e31041ac..2339d7b48 100644 --- a/qt/OpenRGBDevicePage.h +++ b/qt/OpenRGBDevicePage.h @@ -73,6 +73,8 @@ private: void updateWheel(); void updateDeviceView(); + bool autoUpdateEnabled(); + signals: void SetAllDevices(unsigned char red, unsigned char green, unsigned char blue); void SaveSizeProfile();