Initial support for Govee devices
This commit is contained in:
parent
20f6565f44
commit
95b029d49d
17 changed files with 1164 additions and 17 deletions
|
|
@ -494,6 +494,11 @@ OpenRGBDialog::OpenRGBDialog(QWidget *parent) : QMainWindow(parent), ui(new Open
|
|||
\*-----------------------------------------------------*/
|
||||
AddE131SettingsPage();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add the Govee settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
AddGoveeSettingsPage();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add the Kasa Smart settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
|
|
@ -833,6 +838,23 @@ void OpenRGBDialog::AddE131SettingsPage()
|
|||
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
|
||||
}
|
||||
|
||||
void OpenRGBDialog::AddGoveeSettingsPage()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the Settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
GoveeSettingsPage = new OpenRGBGoveeSettingsPage();
|
||||
|
||||
ui->SettingsTabBar->addTab(GoveeSettingsPage, "");
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the tab label |
|
||||
\*-----------------------------------------------------*/
|
||||
TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::bulb, tr("Govee Devices"), (char *)"Govee Devices", (char *)context);
|
||||
|
||||
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
|
||||
}
|
||||
|
||||
void OpenRGBDialog::AddKasaSmartSettingsPage()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.h"
|
||||
#include "OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsPage.h"
|
||||
#include "OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsPage.h"
|
||||
#include "OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsPage.h"
|
||||
#include "OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsPage.h"
|
||||
#include "OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsPage.h"
|
||||
#include "OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.h"
|
||||
|
|
@ -103,6 +104,7 @@ private:
|
|||
OpenRGBE131SettingsPage *E131SettingsPage;
|
||||
OpenRGBElgatoKeyLightSettingsPage *ElgatoKeyLightSettingsPage;
|
||||
OpenRGBElgatoLightStripSettingsPage *ElgatoLightStripSettingsPage;
|
||||
OpenRGBGoveeSettingsPage *GoveeSettingsPage;
|
||||
OpenRGBKasaSmartSettingsPage *KasaSmartSettingsPage;
|
||||
OpenRGBLIFXSettingsPage *LIFXSettingsPage;
|
||||
OpenRGBPhilipsHueSettingsPage *PhilipsHueSettingsPage;
|
||||
|
|
@ -134,6 +136,7 @@ private:
|
|||
void AddE131SettingsPage();
|
||||
void AddElgatoKeyLightSettingsPage();
|
||||
void AddElgatoLightStripSettingsPage();
|
||||
void AddGoveeSettingsPage();
|
||||
void AddKasaSmartSettingsPage();
|
||||
void AddLIFXSettingsPage();
|
||||
void AddPhilipsHueSettingsPage();
|
||||
|
|
|
|||
35
qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsEntry.cpp
Normal file
35
qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsEntry.cpp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| OpenRGBGoveeSettingsEntry.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB Govee settings entry |
|
||||
| |
|
||||
| Adam Honse (calcprogrammer1@gmail.com) 15 May 2025 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "OpenRGBGoveeSettingsEntry.h"
|
||||
#include "ui_OpenRGBGoveeSettingsEntry.h"
|
||||
|
||||
using namespace Ui;
|
||||
|
||||
OpenRGBGoveeSettingsEntry::OpenRGBGoveeSettingsEntry(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBGoveeSettingsEntryUi)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
OpenRGBGoveeSettingsEntry::~OpenRGBGoveeSettingsEntry()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBGoveeSettingsEntry::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
33
qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsEntry.h
Normal file
33
qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsEntry.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| OpenRGBGoveeSettingsEntry.h |
|
||||
| |
|
||||
| User interface for OpenRGB Govee settings entry |
|
||||
| |
|
||||
| Adam Honse (calcprogrammer1@gmail.com) 15 May 2025 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_OpenRGBGoveeSettingsEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBGoveeSettingsEntry;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBGoveeSettingsEntry : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBGoveeSettingsEntry(QWidget *parent = nullptr);
|
||||
~OpenRGBGoveeSettingsEntry();
|
||||
Ui::OpenRGBGoveeSettingsEntryUi *ui;
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
};
|
||||
46
qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsEntry.ui
Normal file
46
qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsEntry.ui
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBGoveeSettingsEntryUi</class>
|
||||
<widget class="QWidget" name="OpenRGBGoveeSettingsEntryUi">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>328</width>
|
||||
<height>72</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Philips Wiz Settings Entry</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="IPLabel">
|
||||
<property name="text">
|
||||
<string>IP:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="IPEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
125
qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsPage.cpp
Normal file
125
qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsPage.cpp
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| OpenRGBGoveeSettingsPage.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB Govee settings page |
|
||||
| |
|
||||
| Adam Honse (calcprogrammer1@gmail.com) 15 May 2025 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "OpenRGBGoveeSettingsPage.h"
|
||||
#include "ui_OpenRGBGoveeSettingsPage.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "SettingsManager.h"
|
||||
|
||||
using namespace Ui;
|
||||
|
||||
OpenRGBGoveeSettingsPage::OpenRGBGoveeSettingsPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBGoveeSettingsPageUi)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
json govee_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get Govee settings |
|
||||
\*-------------------------------------------------*/
|
||||
govee_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("GoveeDevices");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the Govee settings contains devices, process |
|
||||
\*-------------------------------------------------*/
|
||||
if(govee_settings.contains("devices"))
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < govee_settings["devices"].size(); device_idx++)
|
||||
{
|
||||
OpenRGBGoveeSettingsEntry* entry = new OpenRGBGoveeSettingsEntry;
|
||||
|
||||
if(govee_settings["devices"][device_idx].contains("ip"))
|
||||
{
|
||||
entry->ui->IPEdit->setText(QString::fromStdString(govee_settings["devices"][device_idx]["ip"]));
|
||||
}
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->GoveeDeviceList->addItem(item);
|
||||
ui->GoveeDeviceList->setItemWidget(item, entry);
|
||||
ui->GoveeDeviceList->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OpenRGBGoveeSettingsPage::~OpenRGBGoveeSettingsPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBGoveeSettingsPage::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void Ui::OpenRGBGoveeSettingsPage::on_AddGoveeDeviceButton_clicked()
|
||||
{
|
||||
OpenRGBGoveeSettingsEntry* entry = new OpenRGBGoveeSettingsEntry;
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->GoveeDeviceList->addItem(item);
|
||||
ui->GoveeDeviceList->setItemWidget(item, entry);
|
||||
ui->GoveeDeviceList->show();
|
||||
}
|
||||
|
||||
void Ui::OpenRGBGoveeSettingsPage::on_RemoveGoveeDeviceButton_clicked()
|
||||
{
|
||||
int cur_row = ui->GoveeDeviceList->currentRow();
|
||||
|
||||
if(cur_row < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* item = ui->GoveeDeviceList->takeItem(cur_row);
|
||||
|
||||
ui->GoveeDeviceList->removeItemWidget(item);
|
||||
delete item;
|
||||
|
||||
delete entries[cur_row];
|
||||
entries.erase(entries.begin() + cur_row);
|
||||
}
|
||||
|
||||
void Ui::OpenRGBGoveeSettingsPage::on_SaveGoveeConfigurationButton_clicked()
|
||||
{
|
||||
json govee_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get Govee settings |
|
||||
\*-------------------------------------------------*/
|
||||
govee_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("GoveeDevices");
|
||||
|
||||
govee_settings["devices"].clear();
|
||||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
govee_settings["devices"][device_idx]["ip"] = entries[device_idx]->ui->IPEdit->text().toStdString();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("GoveeDevices", govee_settings);
|
||||
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
||||
}
|
||||
43
qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsPage.h
Normal file
43
qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsPage.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| OpenRGBGoveeSettingsPage.h |
|
||||
| |
|
||||
| User interface for OpenRGB Govee settings page |
|
||||
| |
|
||||
| Adam Honse (calcprogrammer1@gmail.com) 15 May 2025 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_OpenRGBGoveeSettingsPage.h"
|
||||
#include "OpenRGBGoveeSettingsEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBGoveeSettingsPage;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBGoveeSettingsPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBGoveeSettingsPage(QWidget *parent = nullptr);
|
||||
~OpenRGBGoveeSettingsPage();
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
void on_AddGoveeDeviceButton_clicked();
|
||||
|
||||
void on_RemoveGoveeDeviceButton_clicked();
|
||||
|
||||
void on_SaveGoveeConfigurationButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBGoveeSettingsPageUi *ui;
|
||||
std::vector<OpenRGBGoveeSettingsEntry*> entries;
|
||||
|
||||
};
|
||||
49
qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsPage.ui
Normal file
49
qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsPage.ui
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBGoveeSettingsPageUi</class>
|
||||
<widget class="QWidget" name="OpenRGBGoveeSettingsPageUi">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Philips Wiz Settings Page</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="AddGoveeDeviceButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="RemoveGoveeDeviceButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="SaveGoveeConfigurationButton">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="GoveeDeviceList">
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Loading…
Add table
Add a link
Reference in a new issue