mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2025-12-23 23:37:48 -05:00
Add manual device configuration for QMK VialRGB protocol
This commit is contained in:
@@ -74,6 +74,6 @@ static BaseManualDeviceEntry* SpawnQMKORGBSettingsEntry(const json& data)
|
||||
return entry;
|
||||
}
|
||||
|
||||
static const char* QMKDeviceName = QT_TRANSLATE_NOOP("ManualDevice", "QMK (built with ORGB support)");
|
||||
static const char* QMKDeviceName = QT_TRANSLATE_NOOP("ManualDevice", "QMK (OpenRGB Protocol)");
|
||||
|
||||
REGISTER_MANUAL_DEVICE_TYPE(QMKDeviceName, "QMKOpenRGBDevices", SpawnQMKORGBSettingsEntry);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| QMKORGBSettingsEntry.h |
|
||||
| QMKORGBSettingsEntry.h |
|
||||
| |
|
||||
| User interface entry for OpenRGB QMK configuration |
|
||||
| |
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"> QMK Settings Entry</string>
|
||||
<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 Device</string>
|
||||
<string>QMK OpenRGB Device</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="5">
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| QMKVialRGBSettingsEntry.cpp |
|
||||
| |
|
||||
| User interface entry for VialRGB QMK configuration |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "QMKVialRGBSettingsEntry.h"
|
||||
#include "ui_QMKVialRGBSettingsEntry.h"
|
||||
|
||||
QMKVialRGBSettingsEntry::QMKVialRGBSettingsEntry(QWidget *parent) :
|
||||
BaseManualDeviceEntry(parent),
|
||||
ui(new Ui::QMKVialRGBSettingsEntry)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
QMKVialRGBSettingsEntry::~QMKVialRGBSettingsEntry()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void QMKVialRGBSettingsEntry::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void QMKVialRGBSettingsEntry::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 QMKVialRGBSettingsEntry::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 QMKVialRGBSettingsEntry::isDataValid()
|
||||
{
|
||||
// stub
|
||||
return true;
|
||||
}
|
||||
|
||||
static BaseManualDeviceEntry* SpawnQMKVialRGBSettingsEntry(const json& data)
|
||||
{
|
||||
QMKVialRGBSettingsEntry* entry = new QMKVialRGBSettingsEntry;
|
||||
entry->loadFromSettings(data);
|
||||
return entry;
|
||||
}
|
||||
|
||||
static const char* QMKDeviceName = QT_TRANSLATE_NOOP("ManualDevice", "QMK (VialRGB Protocol)");
|
||||
|
||||
REGISTER_MANUAL_DEVICE_TYPE(QMKDeviceName, "QMKVialRGBDevices", SpawnQMKVialRGBSettingsEntry);
|
||||
@@ -0,0 +1,35 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| QMKVialRGBSettingsEntry.h |
|
||||
| |
|
||||
| User interface entry for VialRGB 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 QMKVialRGBSettingsEntry;
|
||||
}
|
||||
|
||||
class QMKVialRGBSettingsEntry : public BaseManualDeviceEntry
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event) override;
|
||||
|
||||
public:
|
||||
explicit QMKVialRGBSettingsEntry(QWidget *parent = nullptr);
|
||||
~QMKVialRGBSettingsEntry();
|
||||
void loadFromSettings(const json& data);
|
||||
json saveSettings() override;
|
||||
bool isDataValid() override;
|
||||
|
||||
private:
|
||||
Ui::QMKVialRGBSettingsEntry *ui;
|
||||
};
|
||||
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QMKVialRGBSettingsEntry</class>
|
||||
<widget class="QWidget" name="QMKVialRGBSettingsEntry">
|
||||
<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 VialRGB 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 VialRGB 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