From 9b8d2c38d3148b982207caaf97eb395eafe045a0 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 20 Apr 2021 23:31:29 +1000 Subject: [PATCH] Changed "Set All Devices" * Changed `Set All Devices` to `Apply To All Devices` * Added a tooltip to `Apply to All` * Added Black and White quick colour swatches and left them "not flat" to ensure visibility in Light and Dark mode. Commit amended to fix display issues on Windows and to group buttons in layout by Adam Honse --- qt/OpenRGBDevicePage.cpp | 131 ++++++--------- qt/OpenRGBDevicePage.h | 3 + qt/OpenRGBDevicePage.ui | 353 +++++++++++++++++++++------------------ 3 files changed, 244 insertions(+), 243 deletions(-) diff --git a/qt/OpenRGBDevicePage.cpp b/qt/OpenRGBDevicePage.cpp index fa2e5de4..e303dd5b 100644 --- a/qt/OpenRGBDevicePage.cpp +++ b/qt/OpenRGBDevicePage.cpp @@ -72,80 +72,45 @@ OpenRGBDevicePage::OpenRGBDevicePage(RGBController *dev, QWidget *parent) : /*-----------------------------------------------------*\ | Set up the color palette buttons | \*-----------------------------------------------------*/ -#ifdef _WIN32 - if(((OpenRGBDialog2 *)parent)->IsDarkTheme()) - { - ui->ButtonRed->setStyleSheet("QPushButton {background-color: rgb(255,0,0); color: rgb(255,0,0);}"); - ui->ButtonRed->setFlat(true); - ui->ButtonRed->update(); + ui->ButtonBlack->setStyleSheet("QPushButton {background-color: rgb(0,0,0); color: rgb(0,0,0); border: 1px solid rgb(128, 128, 128); padding-top: 1px; padding-bottom: 1px;}"); + ui->ButtonBlack->setFlat(true); + ui->ButtonBlack->setMinimumWidth(20); + ui->ButtonBlack->update(); - ui->ButtonYellow->setStyleSheet("QPushButton {background-color: rgb(255,255,0); color: rgb(255,255,0);}"); - ui->ButtonYellow->setFlat(true); - ui->ButtonYellow->update(); + ui->ButtonRed->setStyleSheet("QPushButton {background-color: rgb(255,0,0); color: rgb(255,0,0); border: 1px solid rgb(128, 128, 128); padding-top: 1px; padding-bottom: 1px;}"); + ui->ButtonRed->setFlat(true); + ui->ButtonRed->setMinimumWidth(20); + ui->ButtonRed->update(); - ui->ButtonGreen->setStyleSheet("QPushButton {background-color: rgb(0,255,0); color: rgb(0,255,0);}"); - ui->ButtonGreen->setFlat(true); - ui->ButtonGreen->update(); + ui->ButtonYellow->setStyleSheet("QPushButton {background-color: rgb(255,255,0); color: rgb(255,255,0); border: 1px solid rgb(128, 128, 128); padding-top: 1px; padding-bottom: 1px;}"); + ui->ButtonYellow->setFlat(true); + ui->ButtonYellow->setMinimumWidth(20); + ui->ButtonYellow->update(); - ui->ButtonCyan->setStyleSheet("QPushButton {background-color: rgb(0,255,255); color: rgb(0,255,255);}"); - ui->ButtonCyan->setFlat(true); - ui->ButtonCyan->update(); + ui->ButtonGreen->setStyleSheet("QPushButton {background-color: rgb(0,255,0); color: rgb(0,255,0); border: 1px solid rgb(128, 128, 128); padding-top: 1px; padding-bottom: 1px;}"); + ui->ButtonGreen->setFlat(true); + ui->ButtonGreen->setMinimumWidth(20); + ui->ButtonGreen->update(); - ui->ButtonBlue->setStyleSheet("QPushButton {background-color: rgb(0,0,255); color: rgb(0,0,255);}"); - ui->ButtonBlue->setFlat(true); - ui->ButtonBlue->update(); + ui->ButtonCyan->setStyleSheet("QPushButton {background-color: rgb(0,255,255); color: rgb(0,255,255); border: 1px solid rgb(128, 128, 128); padding-top: 1px; padding-bottom: 1px;}"); + ui->ButtonCyan->setFlat(true); + ui->ButtonCyan->setMinimumWidth(20); + ui->ButtonCyan->update(); - ui->ButtonMagenta->setStyleSheet("QPushButton {background-color: rgb(255,0,255); color: rgb(255,0,255);}"); - ui->ButtonMagenta->setFlat(true); - ui->ButtonMagenta->update(); - } - else -#endif - { - QPalette pal; + ui->ButtonBlue->setStyleSheet("QPushButton {background-color: rgb(0,0,255); color: rgb(0,0,255); border: 1px solid rgb(128, 128, 128); padding-top: 1px; padding-bottom: 1px;}"); + ui->ButtonBlue->setFlat(true); + ui->ButtonBlue->setMinimumWidth(20); + ui->ButtonBlue->update(); - pal = ui->ButtonRed->palette(); - pal.setColor(QPalette::Button, QColor(255, 0, 0)); - ui->ButtonRed->setAutoFillBackground(true); - ui->ButtonRed->setPalette(pal); - ui->ButtonRed->setFlat(true); - ui->ButtonRed->update(); + ui->ButtonMagenta->setStyleSheet("QPushButton {background-color: rgb(255,0,255); color: rgb(255,0,255); border: 1px solid rgb(128, 128, 128); padding-top: 1px; padding-bottom: 1px;}"); + ui->ButtonMagenta->setFlat(true); + ui->ButtonMagenta->setMinimumWidth(20); + ui->ButtonMagenta->update(); - pal = ui->ButtonYellow->palette(); - pal.setColor(QPalette::Button, QColor(255, 255, 0)); - ui->ButtonYellow->setAutoFillBackground(true); - ui->ButtonYellow->setPalette(pal); - ui->ButtonYellow->setFlat(true); - ui->ButtonYellow->update(); - - pal = ui->ButtonGreen->palette(); - pal.setColor(QPalette::Button, QColor(0, 255, 0)); - ui->ButtonGreen->setAutoFillBackground(true); - ui->ButtonGreen->setPalette(pal); - ui->ButtonGreen->setFlat(true); - ui->ButtonGreen->update(); - - pal = ui->ButtonCyan->palette(); - pal.setColor(QPalette::Button, QColor(0, 255, 255)); - ui->ButtonCyan->setAutoFillBackground(true); - ui->ButtonCyan->setPalette(pal); - ui->ButtonCyan->setFlat(true); - ui->ButtonCyan->update(); - - pal = ui->ButtonBlue->palette(); - pal.setColor(QPalette::Button, QColor(0, 0, 255)); - ui->ButtonBlue->setAutoFillBackground(true); - ui->ButtonBlue->setPalette(pal); - ui->ButtonBlue->setFlat(true); - ui->ButtonBlue->update(); - - pal = ui->ButtonMagenta->palette(); - pal.setColor(QPalette::Button, QColor(255, 0, 255)); - ui->ButtonMagenta->setAutoFillBackground(true); - ui->ButtonMagenta->setPalette(pal); - ui->ButtonMagenta->setFlat(true); - ui->ButtonMagenta->update(); - } + ui->ButtonWhite->setStyleSheet("QPushButton {background-color: rgb(255,255,255); color: rgb(255,255,255); border: 1px solid rgb(128, 128, 128); padding-top: 1px; padding-bottom: 1px;}"); + ui->ButtonWhite->setFlat(true); + ui->ButtonWhite->setMinimumWidth(20); + ui->ButtonWhite->update(); /*-----------------------------------------------------*\ | Fill in the mode selection box | @@ -397,17 +362,17 @@ void Ui::OpenRGBDevicePage::on_LEDBox_currentIndexChanged(int index) case MODE_COLORS_MODE_SPECIFIC: { - /*-----------------------------------------------------*\ - | Update color picker with color of selected mode | - \*-----------------------------------------------------*/ - RGBColor color = device->modes[selected_mode].colors[index]; - UpdatingColor = true; - ui->RedSpinBox->setValue(RGBGetRValue(color)); - ui->GreenSpinBox->setValue(RGBGetGValue(color)); - ui->BlueSpinBox->setValue(RGBGetBValue(color)); - UpdatingColor = false; - updateHSV(); - updateWheel(); + /*-----------------------------------------------------*\ + | Update color picker with color of selected mode | + \*-----------------------------------------------------*/ + RGBColor color = device->modes[selected_mode].colors[index]; + UpdatingColor = true; + ui->RedSpinBox->setValue(RGBGetRValue(color)); + ui->GreenSpinBox->setValue(RGBGetGValue(color)); + ui->BlueSpinBox->setValue(RGBGetBValue(color)); + UpdatingColor = false; + updateHSV(); + updateWheel(); } break; } @@ -952,6 +917,11 @@ void Ui::OpenRGBDevicePage::SetCustomMode(unsigned char red, unsigned char green UpdateMode(); } +void Ui::OpenRGBDevicePage::on_ButtonBlack_clicked() +{ + SetDevice(0, 0, 0); +} + void Ui::OpenRGBDevicePage::on_ButtonRed_clicked() { SetDevice(255, 0, 0); @@ -982,6 +952,11 @@ void Ui::OpenRGBDevicePage::on_ButtonMagenta_clicked() SetDevice(255, 0, 255); } +void Ui::OpenRGBDevicePage::on_ButtonWhite_clicked() +{ + SetDevice(255, 255, 255); +} + void Ui::OpenRGBDevicePage::on_ColorWheelBox_colorChanged(const QColor color) { if(UpdatingColor) diff --git a/qt/OpenRGBDevicePage.h b/qt/OpenRGBDevicePage.h index cdb351e2..bbc6d50e 100644 --- a/qt/OpenRGBDevicePage.h +++ b/qt/OpenRGBDevicePage.h @@ -45,12 +45,15 @@ private slots: void on_ValSpinBox_valueChanged(int arg1); void on_DeviceViewBox_selectionChanged(QVector); + void on_ButtonBlack_clicked(); void on_ButtonRed_clicked(); void on_ButtonYellow_clicked(); void on_ButtonGreen_clicked(); void on_ButtonCyan_clicked(); void on_ButtonBlue_clicked(); void on_ButtonMagenta_clicked(); + void on_ButtonWhite_clicked(); + void on_SetAllButton_clicked(); void on_RandomCheck_clicked(); void on_PerLEDCheck_clicked(); diff --git a/qt/OpenRGBDevicePage.ui b/qt/OpenRGBDevicePage.ui index 5acbed14..93ae55d3 100644 --- a/qt/OpenRGBDevicePage.ui +++ b/qt/OpenRGBDevicePage.ui @@ -6,7 +6,7 @@ 0 0 - 875 + 800 374 @@ -14,58 +14,10 @@ Frame - - + + - - - - - - - - - - - R: - - - - - - - Colors: - - - - - - - - - - - - - - - - - 255 - - - - - - - Apply Colors - - - - - - - + Select All @@ -85,49 +37,141 @@ - - + + - Mode: + Resize - - - - Qt::Horizontal - - - - - + + - S: + Speed: - - + + - Set All Devices + Per-LED - + + + + Colors: + + + + LED: - - + + - + Mode: - + + + + + + + Apply Colors To Selection + + + + + + + Random + + + + + + + Qt::Horizontal + + + + + + + <html><head/><body><p align="justify">Sets all devices to<br/><b>Static</b> mode and<br/>applies the selected color.</p></body></html> + + + Apply All Devices + + + + + + + Zone: + + + + + + + + + + + + + + + + Dir: + + + + + + + Mode-Specific + + + + + + + B: + + + + + + + G: + + + + + + + R: + + + + + + + 255 + + + + 255 @@ -148,80 +192,31 @@ - - + + - Dir: + S: - - - - Mode-Specific - - - - - - - - - - - - - - 255 - - - - + H: - - - - G: - - - - + 359 - - - - Random - - - - - - - Speed: - - - - - - - Per-LED - - - - - - - + + + + 255 @@ -232,41 +227,67 @@ - - - - B: - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - Select All - - - - - - - Resize - - - - - - - Zone: - - - - - - - + @@ -310,12 +331,14 @@ HueSpinBox SatSpinBox ValSpinBox + ButtonBlack ButtonRed ButtonYellow ButtonGreen ButtonCyan ButtonBlue ButtonMagenta + ButtonWhite