From dbdf5eab0bb619062fa94ac7bbd66029a8d40b5e 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 `Apply Colors` to contextual * 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 | 143 +++++++-------- qt/OpenRGBDevicePage.h | 3 + qt/OpenRGBDevicePage.ui | 363 ++++++++++++++++++++------------------- 3 files changed, 254 insertions(+), 255 deletions(-) diff --git a/qt/OpenRGBDevicePage.cpp b/qt/OpenRGBDevicePage.cpp index fa2e5de49..208ba3f58 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 | @@ -245,6 +210,12 @@ void Ui::OpenRGBDevicePage::on_ZoneBox_currentIndexChanged(int /*index*/) ui->DeviceViewBox->clearSelection(); ui->DeviceViewBox->blockSignals(false); } + ui->ApplyColorsButton->setText("Apply Colors To This Device"); + } + else + { + //If the index has been changed and there is more than one zone change the "Apply" text + ui->ApplyColorsButton->setText("Apply Colors To The Selection"); } selected_zone = selected_zone - 1; } @@ -325,6 +296,12 @@ void Ui::OpenRGBDevicePage::on_LEDBox_currentIndexChanged(int index) ui->DeviceViewBox->clearSelection(); ui->DeviceViewBox->blockSignals(false); } + ui->ApplyColorsButton->setText("Apply Colors To This Device"); + } + else + { + //If the index has been changed and there is more than one zone change the "Apply" text + ui->ApplyColorsButton->setText("Apply Colors To The Selection"); } index = index - 1; } @@ -397,17 +374,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 +929,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 +964,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 cdb351e2c..bbc6d50e1 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 5acbed140..8fdbe6903 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: - - - - - - - + @@ -304,18 +325,6 @@ RandomCheck SpeedSlider DirectionBox - RedSpinBox - GreenSpinBox - BlueSpinBox - HueSpinBox - SatSpinBox - ValSpinBox - ButtonRed - ButtonYellow - ButtonGreen - ButtonCyan - ButtonBlue - ButtonMagenta