Publish LumaOps source
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| PhilipsWizSettingsEntry.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB Philips Wiz settings entry |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "PhilipsWizSettingsEntry.h"
|
||||
#include "ui_PhilipsWizSettingsEntry.h"
|
||||
|
||||
PhilipsWizSettingsEntry::PhilipsWizSettingsEntry(QWidget *parent) :
|
||||
BaseManualDeviceEntry(parent),
|
||||
ui(new Ui::PhilipsWizSettingsEntry)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->WhiteStrategyComboBox->addItem(tr("Average"));
|
||||
ui->WhiteStrategyComboBox->addItem(tr("Minimum"));
|
||||
}
|
||||
|
||||
PhilipsWizSettingsEntry::~PhilipsWizSettingsEntry()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PhilipsWizSettingsEntry::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void PhilipsWizSettingsEntry::loadFromSettings(const json& data)
|
||||
{
|
||||
if(data.contains("ip"))
|
||||
{
|
||||
ui->IPEdit->setText(QString::fromStdString(data["ip"]));
|
||||
}
|
||||
|
||||
if(data.contains("use_cool_white"))
|
||||
{
|
||||
ui->UseCoolWhiteCheckBox->setChecked(data["use_cool_white"]);
|
||||
}
|
||||
|
||||
if(data.contains("use_warm_white"))
|
||||
{
|
||||
ui->UseWarmWhiteCheckBox->setChecked(data["use_warm_white"]);
|
||||
}
|
||||
|
||||
if(data.contains("selected_white_strategy"))
|
||||
{
|
||||
ui->WhiteStrategyComboBox->setCurrentText(QString::fromStdString(data["selected_white_strategy"]));
|
||||
}
|
||||
}
|
||||
|
||||
json PhilipsWizSettingsEntry::saveSettings()
|
||||
{
|
||||
json result;
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
result["ip"] = ui->IPEdit->text().toStdString();
|
||||
result["use_cool_white"] = ui->UseCoolWhiteCheckBox->isChecked();
|
||||
result["use_warm_white"] = ui->UseWarmWhiteCheckBox->isChecked();
|
||||
result["selected_white_strategy"] = ui->WhiteStrategyComboBox->currentText().toStdString();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool PhilipsWizSettingsEntry::isDataValid()
|
||||
{
|
||||
// stub
|
||||
return true;
|
||||
}
|
||||
|
||||
static BaseManualDeviceEntry* SpawnPhilipsWizSettingsEntry(const json& data)
|
||||
{
|
||||
PhilipsWizSettingsEntry* entry = new PhilipsWizSettingsEntry;
|
||||
entry->loadFromSettings(data);
|
||||
return entry;
|
||||
}
|
||||
|
||||
REGISTER_MANUAL_DEVICE_TYPE("Philips Wiz", "PhilipsWizDevices", SpawnPhilipsWizSettingsEntry);
|
||||
@@ -0,0 +1,35 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| PhilipsWizSettingsEntry.h |
|
||||
| |
|
||||
| User interface for OpenRGB Philips Wiz 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 PhilipsWizSettingsEntry;
|
||||
}
|
||||
|
||||
class PhilipsWizSettingsEntry : public BaseManualDeviceEntry
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PhilipsWizSettingsEntry(QWidget *parent = nullptr);
|
||||
~PhilipsWizSettingsEntry();
|
||||
void loadFromSettings(const json& data);
|
||||
json saveSettings() override;
|
||||
bool isDataValid() override;
|
||||
|
||||
private:
|
||||
Ui::PhilipsWizSettingsEntry *ui;
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event) override;
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PhilipsWizSettingsEntry</class>
|
||||
<widget class="QWidget" name="PhilipsWizSettingsEntry">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>327</width>
|
||||
<height>149</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>Philips Wiz Device</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="UseCoolWhiteCheckBox">
|
||||
<property name="text">
|
||||
<string>Use Cool White</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="UseWarmWhiteCheckBox">
|
||||
<property name="text">
|
||||
<string>Use Warm White</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="IPEdit"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="IPLabel">
|
||||
<property name="text">
|
||||
<string>IP:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="WhiteStrategyComboBox"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="WhiteStrategyLabel">
|
||||
<property name="text">
|
||||
<string>White Strategy:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user