Publish LumaOps source
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| QMKORGBSettingsEntry.cpp |
|
||||
| |
|
||||
| User interface entry for OpenRGB QMK configuration |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "QMKORGBSettingsEntry.h"
|
||||
#include "ui_QMKORGBSettingsEntry.h"
|
||||
|
||||
QMKORGBSettingsEntry::QMKORGBSettingsEntry(QWidget *parent) :
|
||||
BaseManualDeviceEntry(parent),
|
||||
ui(new Ui::QMKORGBSettingsEntry)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
QMKORGBSettingsEntry::~QMKORGBSettingsEntry()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void QMKORGBSettingsEntry::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void QMKORGBSettingsEntry::loadFromSettings(const json& data)
|
||||
{
|
||||
if(data.contains("name"))
|
||||
{
|
||||
ui->NameEdit->setText(QString::fromStdString(data["name"]));
|
||||
}
|
||||
|
||||
if(data.contains("usb_vid"))
|
||||
{
|
||||
ui->USBVIDEdit->setText(QString::fromStdString(data["usb_vid"]));
|
||||
}
|
||||
|
||||
if(data.contains("usb_pid"))
|
||||
{
|
||||
ui->USBPIDEdit->setText(QString::fromStdString(data["usb_pid"]));
|
||||
}
|
||||
}
|
||||
|
||||
json QMKORGBSettingsEntry::saveSettings()
|
||||
{
|
||||
json result;
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
result["name"] = ui->NameEdit->text().toStdString();
|
||||
result["usb_vid"] = ui->USBVIDEdit->text().toStdString();
|
||||
result["usb_pid"] = ui->USBPIDEdit->text().toStdString();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool QMKORGBSettingsEntry::isDataValid()
|
||||
{
|
||||
// stub
|
||||
return true;
|
||||
}
|
||||
|
||||
static BaseManualDeviceEntry* SpawnQMKORGBSettingsEntry(const json& data)
|
||||
{
|
||||
QMKORGBSettingsEntry* entry = new QMKORGBSettingsEntry;
|
||||
entry->loadFromSettings(data);
|
||||
return entry;
|
||||
}
|
||||
|
||||
static const char* QMKDeviceName = QT_TRANSLATE_NOOP("ManualDevice", "QMK (OpenRGB Protocol)");
|
||||
|
||||
REGISTER_MANUAL_DEVICE_TYPE(QMKDeviceName, "QMKOpenRGBDevices", SpawnQMKORGBSettingsEntry);
|
||||
@@ -0,0 +1,35 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| QMKORGBSettingsEntry.h |
|
||||
| |
|
||||
| User interface entry for OpenRGB QMK configuration |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "BaseManualDeviceEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class QMKORGBSettingsEntry;
|
||||
}
|
||||
|
||||
class QMKORGBSettingsEntry : public BaseManualDeviceEntry
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event) override;
|
||||
|
||||
public:
|
||||
explicit QMKORGBSettingsEntry(QWidget *parent = nullptr);
|
||||
~QMKORGBSettingsEntry();
|
||||
void loadFromSettings(const json& data);
|
||||
json saveSettings() override;
|
||||
bool isDataValid() override;
|
||||
|
||||
private:
|
||||
Ui::QMKORGBSettingsEntry *ui;
|
||||
};
|
||||
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QMKORGBSettingsEntry</class>
|
||||
<widget class="QWidget" name="QMKORGBSettingsEntry">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>531</width>
|
||||
<height>237</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"> QMK OpenRGB 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>QMK OpenRGB Device</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="5">
|
||||
<widget class="QLineEdit" name="USBPIDEdit"/>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="NameEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="NameLabel">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLineEdit" name="USBVIDEdit"/>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<widget class="QLabel" name="USBPIDLabel">
|
||||
<property name="text">
|
||||
<string>USB PID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="USBVIDLabel">
|
||||
<property name="text">
|
||||
<string>USB VID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>NameEdit</tabstop>
|
||||
<tabstop>USBVIDEdit</tabstop>
|
||||
<tabstop>USBPIDEdit</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user