diff --git a/Controllers/PhilipsHueController/PhilipsHueController.h b/Controllers/PhilipsHueController/PhilipsHueController.h index 1fb2d44b..65b42183 100644 --- a/Controllers/PhilipsHueController/PhilipsHueController.h +++ b/Controllers/PhilipsHueController/PhilipsHueController.h @@ -4,7 +4,6 @@ | Adam Honse (calcprogrammer1@gmail.com), 9/15/2020 | \*---------------------------------------------------------*/ -#include "RGBController.h" #include "HueDeviceTypes.h" #include diff --git a/Controllers/PhilipsHueController/PhilipsHueControllerDetect.cpp b/Controllers/PhilipsHueController/PhilipsHueControllerDetect.cpp index 6678fa26..883c6014 100644 --- a/Controllers/PhilipsHueController/PhilipsHueControllerDetect.cpp +++ b/Controllers/PhilipsHueController/PhilipsHueControllerDetect.cpp @@ -121,6 +121,7 @@ void DetectPhilipsHueControllers(std::vector& rgb_controllers) \*-------------------------------------------------*/ bool save_settings = false; bool use_entertainment = false; + bool auto_connect = false; if(hue_settings.contains("bridges")) { @@ -155,9 +156,10 @@ void DetectPhilipsHueControllers(std::vector& rgb_controllers) \*-------------------------------------------------*/ if(save_settings) { - hue_settings["bridges"][0]["username"] = bridge.getUsername(); - hue_settings["bridges"][0]["clientkey"] = bridge.getClientKey(); - hue_settings["bridges"][0]["entertainment"] = use_entertainment; + hue_settings["bridges"][0]["username"] = bridge.getUsername(); + hue_settings["bridges"][0]["clientkey"] = bridge.getClientKey(); + hue_settings["bridges"][0]["entertainment"] = use_entertainment; + hue_settings["bridges"][0]["autoconnect"] = auto_connect; ResourceManager::get()->GetSettingsManager()->SetSettings("PhilipsHueDevices", hue_settings); @@ -165,13 +167,18 @@ void DetectPhilipsHueControllers(std::vector& rgb_controllers) } /*-------------------------------------------------*\ - | Get all groups from the bridge | + | Get entertainment mode settings | \*-------------------------------------------------*/ if(hue_settings["bridges"][0].contains("entertainment")) { use_entertainment = hue_settings["bridges"][0]["entertainment"]; } + if(hue_settings["bridges"][0].contains("autoconnect")) + { + auto_connect = hue_settings["bridges"][0]["autoconnect"]; + } + /*-------------------------------------------------*\ | Get all groups from the bridge | \*-------------------------------------------------*/ @@ -195,19 +202,22 @@ void DetectPhilipsHueControllers(std::vector& rgb_controllers) } } - /*-------------------------------------------------*\ - | Loop through RGB Controllers to find the first | - | Entertainment group and Set it to "Connect", | - | as only one Stream can be open at a time. | - \*-------------------------------------------------*/ - for (unsigned int controller_idx = 0; controller_idx < rgb_controllers.size(); controller_idx++) - { - if (rgb_controllers[controller_idx]->description == "Philips Hue Entertainment Mode Device") - { - rgb_controllers[controller_idx]->SetMode(0); - break; - } - } + /*-------------------------------------------------*\ + | Loop through RGB Controllers to find the first | + | Entertainment group and Set it to "Connect", | + | as only one Stream can be open at a time. | + \*-------------------------------------------------*/ + if(auto_connect) + { + for(unsigned int controller_idx = 0; controller_idx < rgb_controllers.size(); controller_idx++) + { + if(rgb_controllers[controller_idx]->description == "Philips Hue Entertainment Mode Device") + { + rgb_controllers[controller_idx]->SetMode(0); + break; + } + } + } } } diff --git a/Controllers/PhilipsHueController/PhilipsHueEntertainmentController.cpp b/Controllers/PhilipsHueController/PhilipsHueEntertainmentController.cpp index a2ae194c..904fe18e 100644 --- a/Controllers/PhilipsHueController/PhilipsHueEntertainmentController.cpp +++ b/Controllers/PhilipsHueController/PhilipsHueEntertainmentController.cpp @@ -4,6 +4,7 @@ | Adam Honse (calcprogrammer1@gmail.com), 11/6/2020 | \*---------------------------------------------------------*/ +#include "RGBController.h" #include "PhilipsHueEntertainmentController.h" PhilipsHueEntertainmentController::PhilipsHueEntertainmentController(hueplusplus::Bridge& bridge_ptr, hueplusplus::Group group_ptr):bridge(bridge_ptr),group(group_ptr) @@ -101,4 +102,4 @@ void PhilipsHueEntertainmentController::Disconnect() delete entertainment; } -} \ No newline at end of file +} diff --git a/Controllers/PhilipsHueController/PhilipsHueEntertainmentController.h b/Controllers/PhilipsHueController/PhilipsHueEntertainmentController.h index f6d95819..7339e952 100644 --- a/Controllers/PhilipsHueController/PhilipsHueEntertainmentController.h +++ b/Controllers/PhilipsHueController/PhilipsHueEntertainmentController.h @@ -4,7 +4,6 @@ | Adam Honse (calcprogrammer1@gmail.com), 11/6/2020 | \*---------------------------------------------------------*/ -#include "RGBController.h" #include "Bridge.h" #include "EntertainmentMode.h" #include "Group.h" diff --git a/Controllers/PhilipsHueController/RGBController_PhilipsHueEntertainment.cpp b/Controllers/PhilipsHueController/RGBController_PhilipsHueEntertainment.cpp index dd021bd3..8726a18d 100644 --- a/Controllers/PhilipsHueController/RGBController_PhilipsHueEntertainment.cpp +++ b/Controllers/PhilipsHueController/RGBController_PhilipsHueEntertainment.cpp @@ -116,9 +116,9 @@ void RGBController_PhilipsHueEntertainment::DeviceUpdateMode() { std::vector rgb_controllers = ResourceManager::get()->GetRGBControllers(); - for (unsigned int controller_idx = 0; controller_idx < rgb_controllers.size(); controller_idx++) + for(unsigned int controller_idx = 0; controller_idx < rgb_controllers.size(); controller_idx++) { - if (rgb_controllers[controller_idx] != this && rgb_controllers[controller_idx]->description == "Philips Hue Entertainment Mode Device" && rgb_controllers[controller_idx]->active_mode == 0) + if(rgb_controllers[controller_idx] != this && rgb_controllers[controller_idx]->description == "Philips Hue Entertainment Mode Device" && rgb_controllers[controller_idx]->active_mode == 0) { rgb_controllers[controller_idx]->SetMode(1); } diff --git a/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsEntry.ui b/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsEntry.ui index b994375a..5d81dbd1 100644 --- a/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsEntry.ui +++ b/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsEntry.ui @@ -6,8 +6,8 @@ 0 0 - 287 - 207 + 297 + 228 @@ -26,13 +26,6 @@ - - - - IP: - - - @@ -40,30 +33,6 @@ - - - - Username: - - - - - - - - - - - - - - - - - Client Key: - - - @@ -71,13 +40,45 @@ - - - - - + + - Unpair Bridge + Auto Connect Group: + + + + + + + + + + + + + + IP: + + + + + + + + + + + + + + Client Key: + + + + + + + Username: @@ -88,10 +89,23 @@ - - + + - + Unpair Bridge + + + + + + + + + + + + + diff --git a/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.cpp b/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.cpp index 86571632..22ddf100 100644 --- a/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.cpp +++ b/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.cpp @@ -41,6 +41,11 @@ OpenRGBPhilipsHueSettingsPage::OpenRGBPhilipsHueSettingsPage(QWidget *parent) : entry->ui->EntertainmentCheckBox->setChecked(hue_settings["bridges"][device_idx]["entertainment"]); } + if(hue_settings["bridges"][device_idx].contains("autoconnect")) + { + entry->ui->AutoConnectCheckBox->setChecked(hue_settings["bridges"][device_idx]["autoconnect"]); + } + if(hue_settings["bridges"][device_idx].contains("username")) { entry->ui->UsernameValue->setText(QString::fromStdString(hue_settings["bridges"][device_idx]["username"])); @@ -120,6 +125,7 @@ void Ui::OpenRGBPhilipsHueSettingsPage::on_SavePhilipsHueConfigurationButton_cli hue_settings["bridges"][device_idx]["ip"] = entries[device_idx]->ui->IPEdit->text().toStdString(); hue_settings["bridges"][device_idx]["mac"] = entries[device_idx]->ui->MACEdit->text().toStdString(); hue_settings["bridges"][device_idx]["entertainment"] = entries[device_idx]->ui->EntertainmentCheckBox->isChecked(); + hue_settings["bridges"][device_idx]["autoconnect"] = entries[device_idx]->ui->AutoConnectCheckBox->isChecked(); if(entries[device_idx]->ui->UsernameValue->text() != "") {