Publish LumaOps source
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| PhilipsHueSettingsEntry.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB Philips Hue settings entry |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "PhilipsHueSettingsEntry.h"
|
||||
#include "ui_PhilipsHueSettingsEntry.h"
|
||||
|
||||
PhilipsHueSettingsEntry::PhilipsHueSettingsEntry(QWidget *parent) :
|
||||
BaseManualDeviceEntry(parent),
|
||||
ui(new Ui::PhilipsHueSettingsEntry)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
PhilipsHueSettingsEntry::~PhilipsHueSettingsEntry()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PhilipsHueSettingsEntry::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void PhilipsHueSettingsEntry::on_UnpairButton_clicked()
|
||||
{
|
||||
ui->UsernameValue->setText("");
|
||||
ui->ClientKeyValue->setText("");
|
||||
}
|
||||
|
||||
void PhilipsHueSettingsEntry::loadFromSettings(const json& data)
|
||||
{
|
||||
if(data.contains("ip"))
|
||||
{
|
||||
ui->IPEdit->setText(QString::fromStdString(data["ip"]));
|
||||
}
|
||||
|
||||
if(data.contains("mac"))
|
||||
{
|
||||
ui->MACEdit->setText(QString::fromStdString(data["mac"]));
|
||||
}
|
||||
|
||||
if(data.contains("entertainment"))
|
||||
{
|
||||
ui->EntertainmentCheckBox->setChecked(data["entertainment"]);
|
||||
}
|
||||
|
||||
if(data.contains("autoconnect"))
|
||||
{
|
||||
ui->AutoConnectCheckBox->setChecked(data["autoconnect"]);
|
||||
}
|
||||
|
||||
if(data.contains("username"))
|
||||
{
|
||||
ui->UsernameValue->setText(QString::fromStdString(data["username"]));
|
||||
}
|
||||
|
||||
if(data.contains("clientkey"))
|
||||
{
|
||||
ui->ClientKeyValue->setText(QString::fromStdString(data["clientkey"]));
|
||||
}
|
||||
}
|
||||
|
||||
json PhilipsHueSettingsEntry::saveSettings()
|
||||
{
|
||||
json result;
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
result["ip"] = ui->IPEdit->text().toStdString();
|
||||
result["mac"] = ui->MACEdit->text().toStdString();
|
||||
result["entertainment"] = ui->EntertainmentCheckBox->isChecked();
|
||||
result["autoconnect"] = ui->AutoConnectCheckBox->isChecked();
|
||||
|
||||
if(ui->UsernameValue->text() != "")
|
||||
{
|
||||
result["username"] = ui->UsernameValue->text().toStdString();
|
||||
}
|
||||
|
||||
if(ui->ClientKeyValue->text() != "")
|
||||
{
|
||||
result["clientkey"] = ui->ClientKeyValue->text().toStdString();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool PhilipsHueSettingsEntry::isDataValid()
|
||||
{
|
||||
// stub
|
||||
return true;
|
||||
}
|
||||
|
||||
static BaseManualDeviceEntry* SpawnPhilipsHueSettingsEntry(const json& data)
|
||||
{
|
||||
PhilipsHueSettingsEntry* entry = new PhilipsHueSettingsEntry;
|
||||
entry->loadFromSettings(data);
|
||||
return entry;
|
||||
}
|
||||
|
||||
REGISTER_MANUAL_DEVICE_TYPE("Philips Hue", "PhilipsHueDevices", SpawnPhilipsHueSettingsEntry);
|
||||
@@ -0,0 +1,36 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| PhilipsHueSettingsEntry.h |
|
||||
| |
|
||||
| User interface for OpenRGB Philips Hue settings entry |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "BaseManualDeviceEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class PhilipsHueSettingsEntry;
|
||||
}
|
||||
|
||||
class PhilipsHueSettingsEntry : public BaseManualDeviceEntry
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PhilipsHueSettingsEntry(QWidget *parent = nullptr);
|
||||
~PhilipsHueSettingsEntry();
|
||||
void loadFromSettings(const json& data);
|
||||
json saveSettings() override;
|
||||
bool isDataValid() override;
|
||||
|
||||
private:
|
||||
Ui::PhilipsHueSettingsEntry *ui;
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event) override;
|
||||
void on_UnpairButton_clicked();
|
||||
};
|
||||
@@ -0,0 +1,122 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PhilipsHueSettingsEntry</class>
|
||||
<widget class="QWidget" name="PhilipsHueSettingsEntry">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>297</width>
|
||||
<height>260</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 Hue 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>Philips Hue Bridge</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="EntertainmentLabel">
|
||||
<property name="text">
|
||||
<string>Entertainment Mode:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QCheckBox" name="EntertainmentCheckBox">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="AutoConnectLabel">
|
||||
<property name="text">
|
||||
<string>Auto Connect Group:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QCheckBox" name="AutoConnectCheckBox">
|
||||
<property name="text">
|
||||
<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="6" column="3">
|
||||
<widget class="QLabel" name="ClientKeyValue">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="ClientKeyLabel">
|
||||
<property name="text">
|
||||
<string>Client Key:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="UsernameLabel">
|
||||
<property name="text">
|
||||
<string>Username:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="MACLabel">
|
||||
<property name="text">
|
||||
<string>MAC:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="4">
|
||||
<widget class="QPushButton" name="UnpairButton">
|
||||
<property name="text">
|
||||
<string>Unpair Bridge</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLineEdit" name="MACEdit"/>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="IPEdit"/>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QLabel" name="UsernameValue">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>IPEdit</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user