Initial LIFX commit

This commit is contained in:
Adam Honse 2022-02-05 00:25:24 -06:00
parent 069e07c690
commit 0e750b6e9e
14 changed files with 715 additions and 0 deletions

View file

@ -0,0 +1,131 @@
/*---------------------------------------------------------*\
| Driver for LIFX |
| |
| Adam Honse (calcprogrammer1@gmail.com), 2/5/2022 |
\*---------------------------------------------------------*/
#include "LIFXController.h"
#include "json.hpp"
#include "hsv.h"
using json = nlohmann::json;
using namespace std::chrono_literals;
LIFXController::LIFXController(std::string ip)
{
/*-----------------------------------------------------------------*\
| Fill in location string with device's IP address |
\*-----------------------------------------------------------------*/
location = "IP: " + ip;
/*-----------------------------------------------------------------*\
| Open a UDP client sending to the device's IP, port 56700 |
\*-----------------------------------------------------------------*/
port.udp_client(ip.c_str(), "56700");
}
LIFXController::~LIFXController()
{
}
std::string LIFXController::GetLocation()
{
return(location);
}
std::string LIFXController::GetName()
{
return("LIFX");
}
std::string LIFXController::GetVersion()
{
return(module_name + " " + firmware_version);
}
std::string LIFXController::GetManufacturer()
{
return("LIFX");
}
std::string LIFXController::GetUniqueID()
{
return(module_mac);
}
void LIFXController::SetColor(unsigned char red, unsigned char green, unsigned char blue)
{
RGBColor color = ToRGBColor(red, green, blue);
hsv_t hsv;
rgb2hsv(color, &hsv);
data = data_buf;
memset( data, 0, 49 );
source = 2;
sequence = 1;
unsigned char target[8] = {0};
FrameHeader( 49, true, false, 0, source );
FrameAddress( target, false, false, sequence );
ProtocolAddress( 102 );
unsigned char * set_color = &data[36];
unsigned short hue = hsv.hue * (65536/360);
unsigned short saturation = hsv.saturation * (65536/256);
unsigned short brightness = hsv.value * (65536/256);
unsigned short kelvin = 3500;
unsigned int duration = 0;
memcpy(&set_color[LIFX_SET_COLOR_OFFSET_HUE], &hue, sizeof(unsigned short));
memcpy(&set_color[LIFX_SET_COLOR_OFFSET_SATURATION], &saturation, sizeof(unsigned short));
memcpy(&set_color[LIFX_SET_COLOR_OFFSET_BRIGHTNESS], &brightness, sizeof(unsigned short));
memcpy(&set_color[LIFX_SET_COLOR_OFFSET_KELVIN], &kelvin, sizeof(unsigned short));
memcpy(&set_color[LIFX_SET_COLOR_OFFSET_DURATION], &duration, sizeof(unsigned int));
port.udp_write((char *)data, 49);
}
void LIFXController::FrameHeader
(
unsigned short size,
bool addressable,
bool tagged,
unsigned char origin,
unsigned int source
)
{
unsigned short protocol = 1024;
memcpy(&data[LIFX_FRAME_HEADER_OFFSET_SIZE], &size, sizeof(unsigned short));
memcpy(&data[LIFX_FRAME_HEADER_OFFSET_PROTOCOL], &protocol, sizeof(unsigned short));
if(addressable) data[LIFX_FRAME_HEADER_OFFSET_FLAGS] |= (1 << 4);
if(tagged) data[LIFX_FRAME_HEADER_OFFSET_FLAGS] |= (1 << 5);
data[LIFX_FRAME_HEADER_OFFSET_FLAGS] |= origin << 6;
memcpy(&data[LIFX_FRAME_HEADER_OFFSET_SOURCE], &source, sizeof(unsigned int));
}
void LIFXController::FrameAddress
(
unsigned char * target,
bool res_required,
bool ack_required,
unsigned char sequence
)
{
memcpy(&data[LIFX_FRAME_ADDRESS_OFFSET_TARGET], target, 8);
data[LIFX_FRAME_ADDRESS_OFFSET_FLAGS] = (1 << 0) & res_required;
data[LIFX_FRAME_ADDRESS_OFFSET_FLAGS] |= (1 << 1) & ack_required;
data[LIFX_FRAME_ADDRESS_OFFSET_SEQUENCE] = sequence;
}
void LIFXController::ProtocolAddress
(
unsigned short type
)
{
memcpy(&data[LIFX_PROTOCOL_HEADER_OFFSET_TYPE], &type, sizeof(unsigned short));
}

View file

@ -0,0 +1,91 @@
/*---------------------------------------------------------*\
| Definitions for LIFX |
| |
| Adam Honse (calcprogrammer1@gmail.com), 2/5/2022 |
\*---------------------------------------------------------*/
#include "RGBController.h"
#include "net_port.h"
#include <string>
#include <thread>
#include <vector>
#pragma once
enum
{
LIFX_FRAME_HEADER_OFFSET_SIZE = 0, /* 2 bytes, size of the entire message in bytes */
LIFX_FRAME_HEADER_OFFSET_PROTOCOL = 2, /* Protocol number, must be 1024 */
LIFX_FRAME_HEADER_OFFSET_FLAGS = 3, /* Bits 0-3 are part of Protocol */
/* Bit 4, addressable flag */
/* Bit 5, tagged flag */
/* Bit 6/7, origin value */
LIFX_FRAME_HEADER_OFFSET_SOURCE = 4, /* Source identifier, unique value set by client*/
LIFX_FRAME_ADDRESS_OFFSET_TARGET = 8, /* 6 byte device address (MAC) or zero */
/* Last two bytes should be 0 */
LIFX_FRAME_ADDRESS_OFFSET_FLAGS = 22, /* Bit 0, res_required flag */
/* Bit 1, ack_required flag */
LIFX_FRAME_ADDRESS_OFFSET_SEQUENCE = 23, /* Wrap around message sequence number */
LIFX_PROTOCOL_HEADER_OFFSET_TYPE = 32, /* Message type determines the payload used */
};
enum
{
LIFX_SET_COLOR_OFFSET_HUE = 1, /* 16-bit hue value */
LIFX_SET_COLOR_OFFSET_SATURATION = 3, /* 16-bit saturation value */
LIFX_SET_COLOR_OFFSET_BRIGHTNESS = 5, /* 16-bit brightness value */
LIFX_SET_COLOR_OFFSET_KELVIN = 7, /* 16-bit kelvin value */
LIFX_SET_COLOR_OFFSET_DURATION = 9, /* 32-bit brightness value */
};
class LIFXController
{
public:
LIFXController(std::string ip);
~LIFXController();
std::string GetLocation();
std::string GetName();
std::string GetVersion();
std::string GetManufacturer();
std::string GetUniqueID();
void SetColor(unsigned char red, unsigned char green, unsigned char blue);
private:
unsigned char data_buf[49];
unsigned char* data;
unsigned char sequence;
unsigned int source;
std::string firmware_version;
std::string module_name;
std::string module_mac;
std::string location;
net_port port;
/*-----------------------------------------------------*\
| Functions for filling in LIFX header |
\*-----------------------------------------------------*/
void FrameHeader
(
unsigned short size,
bool addressable,
bool tagged,
unsigned char origin,
unsigned int source
);
void FrameAddress
(
unsigned char * target,
bool res_required,
bool ack_required,
unsigned char sequence
);
void ProtocolAddress
(
unsigned short type
);
};

View file

@ -0,0 +1,48 @@
#include "Detector.h"
#include "LIFXController.h"
#include "RGBController.h"
#include "RGBController_LIFX.h"
#include "SettingsManager.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
/******************************************************************************************\
* *
* DetectLIFXControllers *
* *
* Detect LIFX devices *
* *
\******************************************************************************************/
void DetectLIFXControllers(std::vector<RGBController*> &rgb_controllers)
{
json lifx_settings;
/*-------------------------------------------------*\
| Get LIFX settings from settings manager |
\*-------------------------------------------------*/
lifx_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("LIFXDevices");
/*-------------------------------------------------*\
| If the Wiz settings contains devices, process |
\*-------------------------------------------------*/
if(lifx_settings.contains("devices"))
{
for(unsigned int device_idx = 0; device_idx < lifx_settings["devices"].size(); device_idx++)
{
if(lifx_settings["devices"][device_idx].contains("ip"))
{
std::string lifx_ip = lifx_settings["devices"][device_idx]["ip"];
LIFXController* controller = new LIFXController(lifx_ip);
RGBController_LIFX* rgb_controller = new RGBController_LIFX(controller);
rgb_controllers.push_back(rgb_controller);
}
}
}
} /* DetectLIFXControllers() */
REGISTER_DETECTOR("LIFX", DetectLIFXControllers);

View file

@ -0,0 +1,91 @@
/*-----------------------------------------*\
| RGBController_LIFX.cpp |
| |
| Generic RGB Interface for LIFX |
| |
| Adam Honse (CalcProgrammer1) 2/5/2022 |
\*-----------------------------------------*/
#include "RGBController_LIFX.h"
RGBController_LIFX::RGBController_LIFX(LIFXController* controller_ptr)
{
controller = controller_ptr;
name = controller->GetManufacturer() + " " + controller->GetName();
vendor = controller->GetManufacturer();
type = DEVICE_TYPE_LIGHT;
version = controller->GetVersion();
description = "LIFX Device";
serial = controller->GetUniqueID();
location = controller->GetLocation();
mode Direct;
Direct.name = "Direct";
Direct.value = 0;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
}
RGBController_LIFX::~RGBController_LIFX()
{
delete controller;
}
void RGBController_LIFX::SetupZones()
{
zone led_zone;
led_zone.name = "RGB Light";
led_zone.type = ZONE_TYPE_SINGLE;
led_zone.leds_min = 1;
led_zone.leds_max = 1;
led_zone.leds_count = 1;
led_zone.matrix_map = NULL;
zones.push_back(led_zone);
led new_led;
new_led.name = "RGB Light";
leds.push_back(new_led);
SetupColors();
}
void RGBController_LIFX::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LIFX::DeviceUpdateLEDs()
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
controller->SetColor(red, grn, blu);
}
void RGBController_LIFX::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_LIFX::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_LIFX::SetCustomMode()
{
}
void RGBController_LIFX::DeviceUpdateMode()
{
}

View file

@ -0,0 +1,32 @@
/*-----------------------------------------*\
| RGBController_LIFX.h |
| |
| Generic RGB Interface for LIFX |
| |
| Adam Honse (CalcProgrammer1) 2/5/2022 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "LIFXController.h"
class RGBController_LIFX : public RGBController
{
public:
RGBController_LIFX(LIFXController* controller_ptr);
~RGBController_LIFX();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
LIFXController* controller;
};

View file

@ -123,6 +123,7 @@ INCLUDEPATH +=
Controllers/HyperXMousematController/ \
Controllers/LEDStripController/ \
Controllers/LianLiController/ \
Controllers/LIFXController/ \
Controllers/LogitechController/ \
Controllers/MSI3ZoneController/ \
Controllers/MSIGPUController/ \
@ -197,6 +198,8 @@ HEADERS +=
qt/OpenRGBZoneResizeDialog.h \
qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsEntry.h \
qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.h \
qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsEntry.h \
qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsPage.h \
qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsEntry.h \
qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.h \
qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsEntry.h \
@ -368,6 +371,8 @@ HEADERS +=
Controllers/HyperXMousematController/RGBController_HyperXMousemat.h \
Controllers/LEDStripController/LEDStripController.h \
Controllers/LEDStripController/RGBController_LEDStrip.h \
Controllers/LIFXController/LIFXController.h \
Controllers/LIFXController/RGBController_LIFX.h \
Controllers/LianLiController/LianLiUniHubController.h \
Controllers/LianLiController/RGBController_LianLiUniHub.h \
Controllers/LogitechController/LogitechProtocolCommon.h \
@ -575,6 +580,8 @@ SOURCES +=
qt/hsv.cpp \
qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsEntry.cpp \
qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.cpp \
qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsEntry.cpp \
qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsPage.cpp \
qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsEntry.cpp \
qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.cpp \
qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsEntry.cpp \
@ -792,6 +799,9 @@ SOURCES +=
Controllers/LEDStripController/LEDStripController.cpp \
Controllers/LEDStripController/LEDStripControllerDetect.cpp \
Controllers/LEDStripController/RGBController_LEDStrip.cpp \
Controllers/LIFXController/LIFXController.cpp \
Controllers/LIFXController/LIFXControllerDetect.cpp \
Controllers/LIFXController/RGBController_LIFX.cpp \
Controllers/LianLiController/LianLiControllerDetect.cpp \
Controllers/LianLiController/LianLiUniHubController.cpp \
Controllers/LianLiController/RGBController_LianLiUniHub.cpp \
@ -977,6 +987,8 @@ FORMS +=
qt/OpenRGBZoneResizeDialog.ui \
qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsEntry.ui \
qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.ui \
qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsEntry.ui \
qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsPage.ui \
qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsEntry.ui \
qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.ui \
qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsEntry.ui \

View file

@ -465,6 +465,11 @@ OpenRGBDialog2::OpenRGBDialog2(QWidget *parent) : QMainWindow(parent), ui(new Op
\*-----------------------------------------------------*/
AddE131SettingsPage();
/*-----------------------------------------------------*\
| Add the LIFX settings page |
\*-----------------------------------------------------*/
AddLIFXSettingsPage();
/*-----------------------------------------------------*\
| Add the Serial settings page |
\*-----------------------------------------------------*/
@ -710,6 +715,34 @@ void OpenRGBDialog2::AddE131SettingsPage()
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
}
void OpenRGBDialog2::AddLIFXSettingsPage()
{
/*-----------------------------------------------------*\
| Create the Settings page |
\*-----------------------------------------------------*/
LIFXSettingsPage = new OpenRGBLIFXSettingsPage();
ui->SettingsTabBar->addTab(LIFXSettingsPage, "");
QString SettingsLabelString;
if(IsDarkTheme())
{
SettingsLabelString = "light_dark.png";
}
else
{
SettingsLabelString = "light.png";
}
/*-----------------------------------------------------*\
| Create the tab label |
\*-----------------------------------------------------*/
TabLabel* SettingsTabLabel = new TabLabel(SettingsLabelString, "LIFX Devices");
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
}
void OpenRGBDialog2::AddPhilipsHueSettingsPage()
{
/*-----------------------------------------------------*\

View file

@ -10,6 +10,7 @@
#include "OpenRGBSupportedDevicesPage.h"
#include "OpenRGBSettingsPage.h"
#include "OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.h"
#include "OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsPage.h"
#include "OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.h"
#include "OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsPage.h"
#include "OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsPage.h"
@ -72,6 +73,7 @@ private:
OpenRGBSupportedDevicesPage *SupportedPage;
OpenRGBSettingsPage *SettingsPage;
OpenRGBE131SettingsPage *E131SettingsPage;
OpenRGBLIFXSettingsPage *LIFXSettingsPage;
OpenRGBPhilipsHueSettingsPage *PhilipsHueSettingsPage;
OpenRGBPhilipsWizSettingsPage *PhilipsWizSettingsPage;
OpenRGBQMKORGBSettingsPage *QMKORGBSettingsPage;
@ -96,6 +98,7 @@ private:
void AddSupportedDevicesPage();
void AddSettingsPage();
void AddE131SettingsPage();
void AddLIFXSettingsPage();
void AddPhilipsHueSettingsPage();
void AddPhilipsWizSettingsPage();
void AddQMKORGBSettingsPage();

View file

@ -0,0 +1,16 @@
#include "OpenRGBLIFXSettingsEntry.h"
#include "ui_OpenRGBLIFXSettingsEntry.h"
using namespace Ui;
OpenRGBLIFXSettingsEntry::OpenRGBLIFXSettingsEntry(QWidget *parent) :
QWidget(parent),
ui(new Ui::OpenRGBLIFXSettingsEntryUi)
{
ui->setupUi(this);
}
OpenRGBLIFXSettingsEntry::~OpenRGBLIFXSettingsEntry()
{
delete ui;
}

View file

@ -0,0 +1,21 @@
#ifndef OPENRGBLIFXSETTINGSENTRY_H
#define OPENRGBLIFXSETTINGSENTRY_H
#include "ui_OpenRGBLIFXSettingsEntry.h"
#include <QWidget>
namespace Ui {
class OpenRGBLIFXSettingsEntry;
}
class Ui::OpenRGBLIFXSettingsEntry : public QWidget
{
Q_OBJECT
public:
explicit OpenRGBLIFXSettingsEntry(QWidget *parent = nullptr);
~OpenRGBLIFXSettingsEntry();
Ui::OpenRGBLIFXSettingsEntryUi *ui;
};
#endif // OPENRGBLIFXSETTINGSENTRY_H

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OpenRGBLIFXSettingsEntryUi</class>
<widget class="QWidget" name="OpenRGBLIFXSettingsEntryUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>190</width>
<height>59</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="3">
<widget class="QLineEdit" name="IPEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="IPLabel">
<property name="text">
<string>IP:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>IPEdit</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View file

@ -0,0 +1,105 @@
#include "OpenRGBLIFXSettingsPage.h"
#include "ui_OpenRGBLIFXSettingsPage.h"
#include "ResourceManager.h"
using namespace Ui;
OpenRGBLIFXSettingsPage::OpenRGBLIFXSettingsPage(QWidget *parent) :
QWidget(parent),
ui(new Ui::OpenRGBLIFXSettingsPageUi)
{
ui->setupUi(this);
json lifx_settings;
/*-------------------------------------------------*\
| Get LIFX settings |
\*-------------------------------------------------*/
lifx_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("LIFXDevices");
/*-------------------------------------------------*\
| If the Wiz settings contains devices, process |
\*-------------------------------------------------*/
if(lifx_settings.contains("devices"))
{
for(unsigned int device_idx = 0; device_idx < lifx_settings["devices"].size(); device_idx++)
{
OpenRGBLIFXSettingsEntry* entry = new OpenRGBLIFXSettingsEntry;
if(lifx_settings["devices"][device_idx].contains("ip"))
{
entry->ui->IPEdit->setText(QString::fromStdString(lifx_settings["devices"][device_idx]["ip"]));
}
entries.push_back(entry);
QListWidgetItem* item = new QListWidgetItem;
item->setSizeHint(entry->sizeHint());
ui->LIFXDeviceList->addItem(item);
ui->LIFXDeviceList->setItemWidget(item, entry);
ui->LIFXDeviceList->show();
}
}
}
OpenRGBLIFXSettingsPage::~OpenRGBLIFXSettingsPage()
{
delete ui;
}
void Ui::OpenRGBLIFXSettingsPage::on_AddLIFXDeviceButton_clicked()
{
OpenRGBLIFXSettingsEntry* entry = new OpenRGBLIFXSettingsEntry;
entries.push_back(entry);
QListWidgetItem* item = new QListWidgetItem;
item->setSizeHint(entry->sizeHint());
ui->LIFXDeviceList->addItem(item);
ui->LIFXDeviceList->setItemWidget(item, entry);
ui->LIFXDeviceList->show();
}
void Ui::OpenRGBLIFXSettingsPage::on_RemoveLIFXDeviceButton_clicked()
{
int cur_row = ui->LIFXDeviceList->currentRow();
if(cur_row < 0)
{
return;
}
QListWidgetItem* item = ui->LIFXDeviceList->takeItem(cur_row);
ui->LIFXDeviceList->removeItemWidget(item);
delete item;
delete entries[cur_row];
entries.erase(entries.begin() + cur_row);
}
void Ui::OpenRGBLIFXSettingsPage::on_SaveLIFXConfigurationButton_clicked()
{
json lifx_settings;
/*-------------------------------------------------*\
| Get LIFX settings |
\*-------------------------------------------------*/
lifx_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("LIFXDevices");
lifx_settings["devices"].clear();
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
{
/*-------------------------------------------------*\
| Required parameters |
\*-------------------------------------------------*/
lifx_settings["devices"][device_idx]["ip"] = entries[device_idx]->ui->IPEdit->text().toStdString();
}
ResourceManager::get()->GetSettingsManager()->SetSettings("LIFXDevices", lifx_settings);
ResourceManager::get()->GetSettingsManager()->SaveSettings();
}

View file

@ -0,0 +1,34 @@
#ifndef OPENRGBLIFXSETTINGSPAGE_H
#define OPENRGBLIFXSETTINGSPAGE_H
#include "ui_OpenRGBLIFXSettingsPage.h"
#include <QWidget>
#include "OpenRGBLIFXSettingsEntry.h"
namespace Ui {
class OpenRGBLIFXSettingsPage;
}
class Ui::OpenRGBLIFXSettingsPage : public QWidget
{
Q_OBJECT
public:
explicit OpenRGBLIFXSettingsPage(QWidget *parent = nullptr);
~OpenRGBLIFXSettingsPage();
private slots:
void on_AddLIFXDeviceButton_clicked();
void on_RemoveLIFXDeviceButton_clicked();
void on_SaveLIFXConfigurationButton_clicked();
private:
Ui::OpenRGBLIFXSettingsPageUi *ui;
std::vector<OpenRGBLIFXSettingsEntry*> entries;
};
#endif // OPENRGBLIFXSETTINGSPAGE_H

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OpenRGBLIFXSettingsPageUi</class>
<widget class="QWidget" name="OpenRGBLIFXSettingsPageUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QPushButton" name="AddLIFXDeviceButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="RemoveLIFXDeviceButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="SaveLIFXConfigurationButton">
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QListWidget" name="LIFXDeviceList">
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>