Publish LumaOps source
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| LIFXSettingsEntry.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB LIFX settings entry |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "LIFXSettingsEntry.h"
|
||||
#include "ui_LIFXSettingsEntry.h"
|
||||
|
||||
LIFXSettingsEntry::LIFXSettingsEntry(QWidget *parent) :
|
||||
BaseManualDeviceEntry(parent),
|
||||
ui(new Ui::LIFXSettingsEntry)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->MultizoneCheckBox, SIGNAL(stateChanged(int)), this, SLOT(on_MultizoneCheckBox_stateChanged(int)));
|
||||
}
|
||||
|
||||
LIFXSettingsEntry::~LIFXSettingsEntry()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void LIFXSettingsEntry::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void LIFXSettingsEntry::loadFromSettings(const json& data)
|
||||
{
|
||||
if(data.contains("ip"))
|
||||
{
|
||||
ui->IPEdit->setText(QString::fromStdString(data["ip"]));
|
||||
}
|
||||
if(data.contains("name"))
|
||||
{
|
||||
ui->NameEdit->setText(QString::fromStdString(data["name"]));
|
||||
}
|
||||
if(data.contains("multizone") && data["multizone"].is_boolean())
|
||||
{
|
||||
ui->MultizoneCheckBox->setCheckState(data["multizone"] == true ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
|
||||
}
|
||||
if(data.contains("extended_multizone") && data["extended_multizone"].is_boolean())
|
||||
{
|
||||
ui->ExtendedMultizoneCheckBox->setCheckState(data["extended_multizone"] == true ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
|
||||
}
|
||||
}
|
||||
|
||||
json LIFXSettingsEntry::saveSettings()
|
||||
{
|
||||
json result;
|
||||
result["ip"] = ui->IPEdit->text().toStdString();
|
||||
result["name"] = ui->NameEdit->text().toStdString();
|
||||
result["multizone"] = ui->MultizoneCheckBox->checkState() == Qt::Checked;
|
||||
result["extended_multizone"] = ui->ExtendedMultizoneCheckBox->checkState() == Qt::Checked;
|
||||
return result;
|
||||
}
|
||||
|
||||
void LIFXSettingsEntry::setName(QString name)
|
||||
{
|
||||
ui->NameEdit->setText(name);
|
||||
}
|
||||
|
||||
void LIFXSettingsEntry::on_MultizoneCheckBox_stateChanged(int checkState)
|
||||
{
|
||||
if (checkState == Qt::Checked)
|
||||
{
|
||||
ui->ExtendedMultizoneCheckBox->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->ExtendedMultizoneCheckBox->setEnabled(false);
|
||||
ui->ExtendedMultizoneCheckBox->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
}
|
||||
|
||||
bool LIFXSettingsEntry::isDataValid()
|
||||
{
|
||||
// stub
|
||||
return true;
|
||||
}
|
||||
|
||||
static BaseManualDeviceEntry* SpawnLIFXSettingsEntry(const json& data)
|
||||
{
|
||||
LIFXSettingsEntry* entry = new LIFXSettingsEntry;
|
||||
entry->loadFromSettings(data);
|
||||
return entry;
|
||||
}
|
||||
|
||||
REGISTER_MANUAL_DEVICE_TYPE("LIFX", "LIFXDevices", SpawnLIFXSettingsEntry);
|
||||
@@ -0,0 +1,36 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| LIFXSettingsEntry.h |
|
||||
| |
|
||||
| User interface for OpenRGB LIFX settings entry |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "BaseManualDeviceEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class LIFXSettingsEntry;
|
||||
}
|
||||
|
||||
class LIFXSettingsEntry : public BaseManualDeviceEntry
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LIFXSettingsEntry(QWidget *parent = nullptr);
|
||||
~LIFXSettingsEntry();
|
||||
void loadFromSettings(const json& data);
|
||||
void setName(QString name);
|
||||
|
||||
json saveSettings() override;
|
||||
bool isDataValid() override;
|
||||
|
||||
private:
|
||||
Ui::LIFXSettingsEntry *ui;
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event) override;
|
||||
void on_MultizoneCheckBox_stateChanged(int arg1);
|
||||
};
|
||||
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LIFXSettingsEntry</class>
|
||||
<widget class="QWidget" name="LIFXSettingsEntry">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>605</width>
|
||||
<height>89</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">LIFX Settings Entry</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>LIFX Device</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="IPEdit"/>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QCheckBox" name="MultizoneCheckBox">
|
||||
<property name="text">
|
||||
<string>Multizone</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="IPLabel">
|
||||
<property name="text">
|
||||
<string>IP:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QLabel" name="NameLabel">
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<widget class="QLineEdit" name="NameEdit"/>
|
||||
</item>
|
||||
<item row="1" column="7">
|
||||
<widget class="QCheckBox" name="ExtendedMultizoneCheckBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Extended Multizone</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>IPEdit</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user