diff --git a/qt/OpenRGBDevicePage.cpp b/qt/OpenRGBDevicePage.cpp index 66f448be..9c8bcb04 100644 --- a/qt/OpenRGBDevicePage.cpp +++ b/qt/OpenRGBDevicePage.cpp @@ -115,6 +115,18 @@ void Ui::OpenRGBDevicePage::on_ModeBox_currentIndexChanged(int index) device->SetMode(ui->ModeBox->currentIndex()); } +void Ui::OpenRGBDevicePage::SetDevice(unsigned char red, unsigned char green, unsigned char blue) +{ + UpdatingColor = true; + ui->RedSpinBox->setValue(red); + ui->GreenSpinBox->setValue(green); + ui->BlueSpinBox->setValue(blue); + UpdatingColor = false; + updateHSV(); + + on_SetDeviceButton_clicked(); +} + void Ui::OpenRGBDevicePage::on_SetDeviceButton_clicked() { /*-----------------------------------------------------*\ @@ -291,3 +303,12 @@ void Ui::OpenRGBDevicePage::on_ValSpinBox_valueChanged(int arg1) { updateRGB(); } + +void Ui::OpenRGBDevicePage::on_SetAllButton_clicked() +{ + unsigned char red = ui->RedSpinBox->value(); + unsigned char green = ui->GreenSpinBox->value(); + unsigned char blue = ui->BlueSpinBox->value(); + + emit SetAllDevices(red, green, blue); +} diff --git a/qt/OpenRGBDevicePage.h b/qt/OpenRGBDevicePage.h index 6d90f71c..080e2e95 100644 --- a/qt/OpenRGBDevicePage.h +++ b/qt/OpenRGBDevicePage.h @@ -18,6 +18,8 @@ public: explicit OpenRGBDevicePage(RGBController *dev, QWidget *parent = nullptr); ~OpenRGBDevicePage(); + void SetDevice(unsigned char red, unsigned char green, unsigned char blue); + private slots: void on_ButtonRed_clicked(); void on_ButtonYellow_clicked(); @@ -38,6 +40,8 @@ private slots: void on_BlueSpinBox_valueChanged(int arg1); void on_ValSpinBox_valueChanged(int arg1); + void on_SetAllButton_clicked(); + private: Ui::OpenRGBDevicePageUi *ui; RGBController *device; @@ -47,6 +51,9 @@ private: void updateRGB(); void updateHSV(); + +signals: + void SetAllDevices(unsigned char red, unsigned char green, unsigned char blue); }; #endif // OPENRGBDEVICEPAGE_H diff --git a/qt/OpenRGBDevicePage.ui b/qt/OpenRGBDevicePage.ui index 32fcc04c..17a90464 100644 --- a/qt/OpenRGBDevicePage.ui +++ b/qt/OpenRGBDevicePage.ui @@ -368,6 +368,19 @@ Set: + + + + 110 + 180 + 80 + 22 + + + + Set All Devices + + diff --git a/qt/OpenRGBDialog2.cpp b/qt/OpenRGBDialog2.cpp index d38771b6..16d8eb2f 100644 --- a/qt/OpenRGBDialog2.cpp +++ b/qt/OpenRGBDialog2.cpp @@ -25,6 +25,14 @@ OpenRGBDialog2::OpenRGBDialog2(std::vector& bus, std::vec OpenRGBDevicePage *NewPage = new OpenRGBDevicePage(control[dev_idx]); ui->DevicesTabBar->addTab(NewPage, ""); + /*-----------------------------------------------------*\ + | Connect the page's Set All button to the Set All slot | + \*-----------------------------------------------------*/ + connect(NewPage, + SIGNAL(SetAllDevices(unsigned char, unsigned char, unsigned char)), + this, + SLOT(on_SetAllDevices(unsigned char, unsigned char, unsigned char))); + /*-----------------------------------------------------*\ | Use Qt's HTML capabilities to display both icon and | | text in the tab label. Choose icon based on device | @@ -148,3 +156,11 @@ void OpenRGBDialog2::show() { QMainWindow::show(); } + +void OpenRGBDialog2::on_SetAllDevices(unsigned char red, unsigned char green, unsigned char blue) +{ + for(int device = 0; device < ui->DevicesTabBar->count(); device++) + { + qobject_cast(ui->DevicesTabBar->widget(device))->SetDevice(red, green, blue); + } +} diff --git a/qt/OpenRGBDialog2.h b/qt/OpenRGBDialog2.h index 8531efca..a6ff8cad 100644 --- a/qt/OpenRGBDialog2.h +++ b/qt/OpenRGBDialog2.h @@ -34,6 +34,9 @@ protected: private: Ui::OpenRGBDialog2Ui *ui; + +private slots: + void on_SetAllDevices(unsigned char red, unsigned char green, unsigned char blue); }; #endif // OPENRGBDIALOG2_H diff --git a/qt/OpenRGBDialog2.ui b/qt/OpenRGBDialog2.ui index d184587b..850de4e5 100644 --- a/qt/OpenRGBDialog2.ui +++ b/qt/OpenRGBDialog2.ui @@ -70,18 +70,8 @@ QTabWidget::West - 0 + -1 - - - Static - - - - - Tab 2 - -