Move Autogenerated UI code into Private sections of the window classes
This commit is contained in:
parent
4c6bf55c8a
commit
6793d4a3a0
45 changed files with 940 additions and 531 deletions
|
|
@ -17,7 +17,7 @@
|
|||
#include <QDir>
|
||||
#include "OpenRGBPluginInterface.h"
|
||||
|
||||
typedef struct
|
||||
struct OpenRGBPluginEntry
|
||||
{
|
||||
OpenRGBPluginInfo info;
|
||||
OpenRGBPluginInterface* plugin;
|
||||
|
|
@ -29,7 +29,7 @@ typedef struct
|
|||
bool incompatible;
|
||||
bool is_system;
|
||||
int api_version;
|
||||
} OpenRGBPluginEntry;
|
||||
};
|
||||
|
||||
typedef void (*AddPluginCallback)(void *, OpenRGBPluginEntry* plugin);
|
||||
typedef void (*RemovePluginCallback)(void *, OpenRGBPluginEntry* plugin);
|
||||
|
|
|
|||
|
|
@ -31,3 +31,74 @@ void OpenRGBDMXSettingsEntry::changeEvent(QEvent *event)
|
|||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBDMXSettingsEntry::loadFromSettings(const json& data)
|
||||
{
|
||||
if(data.contains("name"))
|
||||
{
|
||||
ui->NameEdit->setText(QString::fromStdString(data["name"]));
|
||||
}
|
||||
|
||||
if(data.contains("port"))
|
||||
{
|
||||
ui->PortEdit->setText(QString::fromStdString(data["port"]));
|
||||
}
|
||||
|
||||
if(data.contains("red_channel"))
|
||||
{
|
||||
ui->RedEdit->setText(QString::number((int)data["red_channel"]));
|
||||
}
|
||||
|
||||
if(data.contains("green_channel"))
|
||||
{
|
||||
ui->GreenEdit->setText(QString::number((int)data["green_channel"]));
|
||||
}
|
||||
|
||||
if(data.contains("blue_channel"))
|
||||
{
|
||||
ui->BlueEdit->setText(QString::number((int)data["blue_channel"]));
|
||||
}
|
||||
|
||||
if(data.contains("brightness_channel"))
|
||||
{
|
||||
ui->BrightnessEdit->setText(QString::number((int)data["brightness_channel"]));
|
||||
}
|
||||
|
||||
if(data.contains("keepalive_time"))
|
||||
{
|
||||
ui->KeepaliveTimeEdit->setText(QString::number((int)data["keepalive_time"]));
|
||||
}
|
||||
}
|
||||
|
||||
json OpenRGBDMXSettingsEntry::saveSettings()
|
||||
{
|
||||
json result;
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
result["name"] = ui->NameEdit->text().toStdString();
|
||||
result["port"] = ui->PortEdit->text().toStdString();
|
||||
result["red_channel"] = ui->RedEdit->text().toUInt();
|
||||
result["green_channel"] = ui->GreenEdit->text().toUInt();
|
||||
result["blue_channel"] = ui->BlueEdit->text().toUInt();
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Optional parameters |
|
||||
\*-------------------------------------------------*/
|
||||
if(ui->BrightnessEdit->text() != "")
|
||||
{
|
||||
result["brightness_channel"] = ui->BrightnessEdit->text().toUInt();
|
||||
}
|
||||
|
||||
if(ui->KeepaliveTimeEdit->text() != "")
|
||||
{
|
||||
result["keepalive_time"] = ui->KeepaliveTimeEdit->text().toUInt();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* OpenRGBDMXSettingsEntry::settingsSection()
|
||||
{
|
||||
return "DMXDevices";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_OpenRGBDMXSettingsEntry.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBDMXSettingsEntry;
|
||||
class OpenRGBDMXSettingsEntryUi;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBDMXSettingsEntry : public QWidget
|
||||
|
|
@ -24,6 +27,11 @@ class Ui::OpenRGBDMXSettingsEntry : public QWidget
|
|||
public:
|
||||
explicit OpenRGBDMXSettingsEntry(QWidget *parent = nullptr);
|
||||
~OpenRGBDMXSettingsEntry();
|
||||
void loadFromSettings(const json& data);
|
||||
json saveSettings();
|
||||
const char* settingsSection();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBDMXSettingsEntryUi *ui;
|
||||
|
||||
private slots:
|
||||
|
|
|
|||
|
|
@ -36,40 +36,7 @@ OpenRGBDMXSettingsPage::OpenRGBDMXSettingsPage(QWidget *parent) :
|
|||
{
|
||||
OpenRGBDMXSettingsEntry* entry = new OpenRGBDMXSettingsEntry;
|
||||
|
||||
if(dmx_settings["devices"][device_idx].contains("name"))
|
||||
{
|
||||
entry->ui->NameEdit->setText(QString::fromStdString(dmx_settings["devices"][device_idx]["name"]));
|
||||
}
|
||||
|
||||
if(dmx_settings["devices"][device_idx].contains("port"))
|
||||
{
|
||||
entry->ui->PortEdit->setText(QString::fromStdString(dmx_settings["devices"][device_idx]["port"]));
|
||||
}
|
||||
|
||||
if(dmx_settings["devices"][device_idx].contains("red_channel"))
|
||||
{
|
||||
entry->ui->RedEdit->setText(QString::number((int)dmx_settings["devices"][device_idx]["red_channel"]));
|
||||
}
|
||||
|
||||
if(dmx_settings["devices"][device_idx].contains("green_channel"))
|
||||
{
|
||||
entry->ui->GreenEdit->setText(QString::number((int)dmx_settings["devices"][device_idx]["green_channel"]));
|
||||
}
|
||||
|
||||
if(dmx_settings["devices"][device_idx].contains("blue_channel"))
|
||||
{
|
||||
entry->ui->BlueEdit->setText(QString::number((int)dmx_settings["devices"][device_idx]["blue_channel"]));
|
||||
}
|
||||
|
||||
if(dmx_settings["devices"][device_idx].contains("brightness_channel"))
|
||||
{
|
||||
entry->ui->BrightnessEdit->setText(QString::number((int)dmx_settings["devices"][device_idx]["brightness_channel"]));
|
||||
}
|
||||
|
||||
if(dmx_settings["devices"][device_idx].contains("keepalive_time"))
|
||||
{
|
||||
entry->ui->KeepaliveTimeEdit->setText(QString::number((int)dmx_settings["devices"][device_idx]["keepalive_time"]));
|
||||
}
|
||||
entry->loadFromSettings(dmx_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
|
|
@ -142,27 +109,7 @@ void Ui::OpenRGBDMXSettingsPage::on_SaveDMXConfigurationButton_clicked()
|
|||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
dmx_settings["devices"][device_idx]["name"] = entries[device_idx]->ui->NameEdit->text().toStdString();
|
||||
dmx_settings["devices"][device_idx]["port"] = entries[device_idx]->ui->PortEdit->text().toStdString();
|
||||
dmx_settings["devices"][device_idx]["red_channel"] = entries[device_idx]->ui->RedEdit->text().toUInt();
|
||||
dmx_settings["devices"][device_idx]["green_channel"] = entries[device_idx]->ui->GreenEdit->text().toUInt();
|
||||
dmx_settings["devices"][device_idx]["blue_channel"] = entries[device_idx]->ui->BlueEdit->text().toUInt();
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Optional parameters |
|
||||
\*-------------------------------------------------*/
|
||||
if(entries[device_idx]->ui->BrightnessEdit->text() != "")
|
||||
{
|
||||
dmx_settings["devices"][device_idx]["brightness_channel"] = entries[device_idx]->ui->BrightnessEdit->text().toUInt();
|
||||
}
|
||||
|
||||
if(entries[device_idx]->ui->KeepaliveTimeEdit->text() != "")
|
||||
{
|
||||
dmx_settings["devices"][device_idx]["keepalive_time"] = entries[device_idx]->ui->KeepaliveTimeEdit->text().toUInt();
|
||||
}
|
||||
dmx_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("DMXDevices", dmx_settings);
|
||||
|
|
|
|||
|
|
@ -89,3 +89,204 @@ void Ui::OpenRGBE131SettingsEntry::on_TypeComboBox_currentIndexChanged(int index
|
|||
HideMatrixSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBE131SettingsEntry::loadFromSettings(const json& data)
|
||||
{
|
||||
if(data.contains("name"))
|
||||
{
|
||||
ui->NameEdit->setText(QString::fromStdString(data["name"]));
|
||||
}
|
||||
|
||||
if(data.contains("ip"))
|
||||
{
|
||||
ui->IPEdit->setText(QString::fromStdString(data["ip"]));
|
||||
}
|
||||
|
||||
if(data.contains("start_universe"))
|
||||
{
|
||||
ui->StartUniverseEdit->setText(QString::number((int)data["start_universe"]));
|
||||
}
|
||||
|
||||
if(data.contains("start_channel"))
|
||||
{
|
||||
ui->StartChannelEdit->setText(QString::number((int)data["start_channel"]));
|
||||
}
|
||||
|
||||
if(data.contains("num_leds"))
|
||||
{
|
||||
ui->NumLEDsEdit->setText(QString::number((int)data["num_leds"]));
|
||||
}
|
||||
|
||||
if(data.contains("type"))
|
||||
{
|
||||
if(data["type"].is_string())
|
||||
{
|
||||
std::string type_val = data["type"];
|
||||
|
||||
if(type_val == "SINGLE")
|
||||
{
|
||||
ui->TypeComboBox->setCurrentIndex(0);
|
||||
}
|
||||
else if(type_val == "LINEAR")
|
||||
{
|
||||
ui->TypeComboBox->setCurrentIndex(1);
|
||||
}
|
||||
else if(type_val == "MATRIX")
|
||||
{
|
||||
ui->TypeComboBox->setCurrentIndex(2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->TypeComboBox->setCurrentIndex(data["type"]);
|
||||
}
|
||||
}
|
||||
|
||||
if(data.contains("rgb_order"))
|
||||
{
|
||||
if(data["rgb_order"].is_string())
|
||||
{
|
||||
std::string rgb_order_val = data["rgb_order"];
|
||||
|
||||
if(rgb_order_val == "RGB")
|
||||
{
|
||||
ui->RGBOrderComboBox->setCurrentIndex(0);
|
||||
}
|
||||
else if(rgb_order_val == "RBG")
|
||||
{
|
||||
ui->RGBOrderComboBox->setCurrentIndex(1);
|
||||
}
|
||||
else if(rgb_order_val == "GRB")
|
||||
{
|
||||
ui->RGBOrderComboBox->setCurrentIndex(2);
|
||||
}
|
||||
else if(rgb_order_val == "GBR")
|
||||
{
|
||||
ui->RGBOrderComboBox->setCurrentIndex(3);
|
||||
}
|
||||
else if(rgb_order_val == "BRG")
|
||||
{
|
||||
ui->RGBOrderComboBox->setCurrentIndex(4);
|
||||
}
|
||||
else if(rgb_order_val == "BGR")
|
||||
{
|
||||
ui->RGBOrderComboBox->setCurrentIndex(5);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->RGBOrderComboBox->setCurrentIndex(data["rgb_order"]);
|
||||
}
|
||||
}
|
||||
|
||||
if(data.contains("matrix_width"))
|
||||
{
|
||||
ui->MatrixWidthEdit->setText(QString::number((int)data["matrix_width"]));
|
||||
}
|
||||
|
||||
if(data.contains("matrix_height"))
|
||||
{
|
||||
ui->MatrixHeightEdit->setText(QString::number((int)data["matrix_height"]));
|
||||
}
|
||||
|
||||
if(data.contains("matrix_order"))
|
||||
{
|
||||
if(data["matrix_order"].is_string())
|
||||
{
|
||||
std::string matrix_order_val = data["matrix_order"];
|
||||
|
||||
if(matrix_order_val == "HORIZONTAL_TOP_LEFT")
|
||||
{
|
||||
ui->MatrixOrderComboBox->setCurrentIndex(0);
|
||||
}
|
||||
else if(matrix_order_val == "HORIZONTAL_TOP_RIGHT")
|
||||
{
|
||||
ui->MatrixOrderComboBox->setCurrentIndex(1);
|
||||
}
|
||||
else if(matrix_order_val == "HORIZONTAL_BOTTOM_LEFT")
|
||||
{
|
||||
ui->MatrixOrderComboBox->setCurrentIndex(2);
|
||||
}
|
||||
else if(matrix_order_val == "HORIZONTAL_BOTTOM_RIGHT")
|
||||
{
|
||||
ui->MatrixOrderComboBox->setCurrentIndex(3);
|
||||
}
|
||||
else if(matrix_order_val == "VERTICAL_TOP_LEFT")
|
||||
{
|
||||
ui->MatrixOrderComboBox->setCurrentIndex(4);
|
||||
}
|
||||
else if(matrix_order_val == "VERTICAL_TOP_RIGHT")
|
||||
{
|
||||
ui->MatrixOrderComboBox->setCurrentIndex(5);
|
||||
}
|
||||
else if(matrix_order_val == "VERTICAL_BOTTOM_LEFT")
|
||||
{
|
||||
ui->MatrixOrderComboBox->setCurrentIndex(6);
|
||||
}
|
||||
else if(matrix_order_val == "VERTICAL_BOTTOM_RIGHT")
|
||||
{
|
||||
ui->MatrixOrderComboBox->setCurrentIndex(7);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->MatrixOrderComboBox->setCurrentIndex(data["matrix_order"]);
|
||||
}
|
||||
}
|
||||
|
||||
if(data.contains("universe_size"))
|
||||
{
|
||||
ui->UniverseSizeEdit->setText(QString::number((int)data["universe_size"]));
|
||||
}
|
||||
|
||||
if(data.contains("keepalive_time"))
|
||||
{
|
||||
ui->KeepaliveTimeEdit->setText(QString::number((int)data["keepalive_time"]));
|
||||
}
|
||||
}
|
||||
|
||||
json OpenRGBE131SettingsEntry::saveSettings()
|
||||
{
|
||||
json result;
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
result["name"] = ui->NameEdit->text().toStdString();
|
||||
result["start_universe"] = ui->StartUniverseEdit->text().toUInt();
|
||||
result["start_channel"] = ui->StartChannelEdit->text().toUInt();
|
||||
result["num_leds"] = ui->NumLEDsEdit->text().toUInt();
|
||||
result["type"] = ui->TypeComboBox->currentIndex();
|
||||
result["rgb_order"] = ui->RGBOrderComboBox->currentIndex();
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Optional parameters |
|
||||
\*-------------------------------------------------*/
|
||||
if(ui->IPEdit->text() != "")
|
||||
{
|
||||
result["ip"] = ui->IPEdit->text().toStdString();
|
||||
}
|
||||
|
||||
if(result["type"] == 2)
|
||||
{
|
||||
result["matrix_width"] = ui->MatrixWidthEdit->text().toUInt();
|
||||
result["matrix_height"] = ui->MatrixHeightEdit->text().toUInt();
|
||||
result["matrix_order"] = ui->MatrixOrderComboBox->currentIndex();
|
||||
}
|
||||
|
||||
if(ui->UniverseSizeEdit->text() != "")
|
||||
{
|
||||
result["universe_size"] = ui->UniverseSizeEdit->text().toUInt();
|
||||
}
|
||||
|
||||
if(ui->KeepaliveTimeEdit->text() != "")
|
||||
{
|
||||
result["keepalive_time"] = ui->KeepaliveTimeEdit->text().toUInt();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* OpenRGBE131SettingsEntry::settingsSection()
|
||||
{
|
||||
return "E131Devices";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_OpenRGBE131SettingsEntry.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBE131SettingsEntry;
|
||||
class OpenRGBE131SettingsEntryUi;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBE131SettingsEntry : public QWidget
|
||||
|
|
@ -24,6 +27,11 @@ class Ui::OpenRGBE131SettingsEntry : public QWidget
|
|||
public:
|
||||
explicit OpenRGBE131SettingsEntry(QWidget *parent = nullptr);
|
||||
~OpenRGBE131SettingsEntry();
|
||||
void loadFromSettings(const json& data);
|
||||
json saveSettings();
|
||||
const char* settingsSection();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBE131SettingsEntryUi *ui;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -36,157 +36,7 @@ OpenRGBE131SettingsPage::OpenRGBE131SettingsPage(QWidget *parent) :
|
|||
{
|
||||
OpenRGBE131SettingsEntry* entry = new OpenRGBE131SettingsEntry;
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("name"))
|
||||
{
|
||||
entry->ui->NameEdit->setText(QString::fromStdString(e131_settings["devices"][device_idx]["name"]));
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("ip"))
|
||||
{
|
||||
entry->ui->IPEdit->setText(QString::fromStdString(e131_settings["devices"][device_idx]["ip"]));
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("start_universe"))
|
||||
{
|
||||
entry->ui->StartUniverseEdit->setText(QString::number((int)e131_settings["devices"][device_idx]["start_universe"]));
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("start_channel"))
|
||||
{
|
||||
entry->ui->StartChannelEdit->setText(QString::number((int)e131_settings["devices"][device_idx]["start_channel"]));
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("num_leds"))
|
||||
{
|
||||
entry->ui->NumLEDsEdit->setText(QString::number((int)e131_settings["devices"][device_idx]["num_leds"]));
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("type"))
|
||||
{
|
||||
if(e131_settings["devices"][device_idx]["type"].is_string())
|
||||
{
|
||||
std::string type_val = e131_settings["devices"][device_idx]["type"];
|
||||
|
||||
if(type_val == "SINGLE")
|
||||
{
|
||||
entry->ui->TypeComboBox->setCurrentIndex(0);
|
||||
}
|
||||
else if(type_val == "LINEAR")
|
||||
{
|
||||
entry->ui->TypeComboBox->setCurrentIndex(1);
|
||||
}
|
||||
else if(type_val == "MATRIX")
|
||||
{
|
||||
entry->ui->TypeComboBox->setCurrentIndex(2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
entry->ui->TypeComboBox->setCurrentIndex(e131_settings["devices"][device_idx]["type"]);
|
||||
}
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("rgb_order"))
|
||||
{
|
||||
if(e131_settings["devices"][device_idx]["rgb_order"].is_string())
|
||||
{
|
||||
std::string rgb_order_val = e131_settings["devices"][device_idx]["rgb_order"];
|
||||
|
||||
if(rgb_order_val == "RGB")
|
||||
{
|
||||
entry->ui->RGBOrderComboBox->setCurrentIndex(0);
|
||||
}
|
||||
else if(rgb_order_val == "RBG")
|
||||
{
|
||||
entry->ui->RGBOrderComboBox->setCurrentIndex(1);
|
||||
}
|
||||
else if(rgb_order_val == "GRB")
|
||||
{
|
||||
entry->ui->RGBOrderComboBox->setCurrentIndex(2);
|
||||
}
|
||||
else if(rgb_order_val == "GBR")
|
||||
{
|
||||
entry->ui->RGBOrderComboBox->setCurrentIndex(3);
|
||||
}
|
||||
else if(rgb_order_val == "BRG")
|
||||
{
|
||||
entry->ui->RGBOrderComboBox->setCurrentIndex(4);
|
||||
}
|
||||
else if(rgb_order_val == "BGR")
|
||||
{
|
||||
entry->ui->RGBOrderComboBox->setCurrentIndex(5);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
entry->ui->RGBOrderComboBox->setCurrentIndex(e131_settings["devices"][device_idx]["rgb_order"]);
|
||||
}
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("matrix_width"))
|
||||
{
|
||||
entry->ui->MatrixWidthEdit->setText(QString::number((int)e131_settings["devices"][device_idx]["matrix_width"]));
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("matrix_height"))
|
||||
{
|
||||
entry->ui->MatrixHeightEdit->setText(QString::number((int)e131_settings["devices"][device_idx]["matrix_height"]));
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("matrix_order"))
|
||||
{
|
||||
if(e131_settings["devices"][device_idx]["matrix_order"].is_string())
|
||||
{
|
||||
std::string matrix_order_val = e131_settings["devices"][device_idx]["matrix_order"];
|
||||
|
||||
if(matrix_order_val == "HORIZONTAL_TOP_LEFT")
|
||||
{
|
||||
entry->ui->MatrixOrderComboBox->setCurrentIndex(0);
|
||||
}
|
||||
else if(matrix_order_val == "HORIZONTAL_TOP_RIGHT")
|
||||
{
|
||||
entry->ui->MatrixOrderComboBox->setCurrentIndex(1);
|
||||
}
|
||||
else if(matrix_order_val == "HORIZONTAL_BOTTOM_LEFT")
|
||||
{
|
||||
entry->ui->MatrixOrderComboBox->setCurrentIndex(2);
|
||||
}
|
||||
else if(matrix_order_val == "HORIZONTAL_BOTTOM_RIGHT")
|
||||
{
|
||||
entry->ui->MatrixOrderComboBox->setCurrentIndex(3);
|
||||
}
|
||||
else if(matrix_order_val == "VERTICAL_TOP_LEFT")
|
||||
{
|
||||
entry->ui->MatrixOrderComboBox->setCurrentIndex(4);
|
||||
}
|
||||
else if(matrix_order_val == "VERTICAL_TOP_RIGHT")
|
||||
{
|
||||
entry->ui->MatrixOrderComboBox->setCurrentIndex(5);
|
||||
}
|
||||
else if(matrix_order_val == "VERTICAL_BOTTOM_LEFT")
|
||||
{
|
||||
entry->ui->MatrixOrderComboBox->setCurrentIndex(6);
|
||||
}
|
||||
else if(matrix_order_val == "VERTICAL_BOTTOM_RIGHT")
|
||||
{
|
||||
entry->ui->MatrixOrderComboBox->setCurrentIndex(7);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
entry->ui->MatrixOrderComboBox->setCurrentIndex(e131_settings["devices"][device_idx]["matrix_order"]);
|
||||
}
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("universe_size"))
|
||||
{
|
||||
entry->ui->UniverseSizeEdit->setText(QString::number((int)e131_settings["devices"][device_idx]["universe_size"]));
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("keepalive_time"))
|
||||
{
|
||||
entry->ui->KeepaliveTimeEdit->setText(QString::number((int)e131_settings["devices"][device_idx]["keepalive_time"]));
|
||||
}
|
||||
entry->loadFromSettings(e131_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
|
|
@ -259,40 +109,7 @@ void Ui::OpenRGBE131SettingsPage::on_SaveE131ConfigurationButton_clicked()
|
|||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
e131_settings["devices"][device_idx]["name"] = entries[device_idx]->ui->NameEdit->text().toStdString();
|
||||
e131_settings["devices"][device_idx]["start_universe"] = entries[device_idx]->ui->StartUniverseEdit->text().toUInt();
|
||||
e131_settings["devices"][device_idx]["start_channel"] = entries[device_idx]->ui->StartChannelEdit->text().toUInt();
|
||||
e131_settings["devices"][device_idx]["num_leds"] = entries[device_idx]->ui->NumLEDsEdit->text().toUInt();
|
||||
e131_settings["devices"][device_idx]["type"] = entries[device_idx]->ui->TypeComboBox->currentIndex();
|
||||
e131_settings["devices"][device_idx]["rgb_order"] = entries[device_idx]->ui->RGBOrderComboBox->currentIndex();
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Optional parameters |
|
||||
\*-------------------------------------------------*/
|
||||
if(entries[device_idx]->ui->IPEdit->text() != "")
|
||||
{
|
||||
e131_settings["devices"][device_idx]["ip"] = entries[device_idx]->ui->IPEdit->text().toStdString();
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx]["type"] == 2)
|
||||
{
|
||||
e131_settings["devices"][device_idx]["matrix_width"] = entries[device_idx]->ui->MatrixWidthEdit->text().toUInt();
|
||||
e131_settings["devices"][device_idx]["matrix_height"] = entries[device_idx]->ui->MatrixHeightEdit->text().toUInt();
|
||||
e131_settings["devices"][device_idx]["matrix_order"] = entries[device_idx]->ui->MatrixOrderComboBox->currentIndex();
|
||||
}
|
||||
|
||||
if(entries[device_idx]->ui->UniverseSizeEdit->text() != "")
|
||||
{
|
||||
e131_settings["devices"][device_idx]["universe_size"] = entries[device_idx]->ui->UniverseSizeEdit->text().toUInt();
|
||||
}
|
||||
|
||||
if(entries[device_idx]->ui->KeepaliveTimeEdit->text() != "")
|
||||
{
|
||||
e131_settings["devices"][device_idx]["keepalive_time"] = entries[device_idx]->ui->KeepaliveTimeEdit->text().toUInt();
|
||||
}
|
||||
e131_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("E131Devices", e131_settings);
|
||||
|
|
|
|||
|
|
@ -32,3 +32,23 @@ void OpenRGBElgatoKeyLightSettingsEntry::changeEvent(QEvent *event)
|
|||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBElgatoKeyLightSettingsEntry::loadFromSettings(const json& data)
|
||||
{
|
||||
if(data.contains("ip"))
|
||||
{
|
||||
ui->IPEdit->setText(QString::fromStdString(data["ip"]));
|
||||
}
|
||||
}
|
||||
|
||||
json OpenRGBElgatoKeyLightSettingsEntry::saveSettings()
|
||||
{
|
||||
json result;
|
||||
result["ip"] = ui->IPEdit->text().toStdString();
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* OpenRGBElgatoKeyLightSettingsEntry::settingsSection()
|
||||
{
|
||||
return "ElgatoKeyLightDevices";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include "ui_OpenRGBElgatoKeyLightSettingsEntry.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBElgatoKeyLightSettingsEntry;
|
||||
class OpenRGBElgatoKeyLightSettingsEntryUi;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBElgatoKeyLightSettingsEntry : public QDialog
|
||||
|
|
@ -24,6 +27,11 @@ class Ui::OpenRGBElgatoKeyLightSettingsEntry : public QDialog
|
|||
public:
|
||||
explicit OpenRGBElgatoKeyLightSettingsEntry(QWidget *parent = nullptr);
|
||||
~OpenRGBElgatoKeyLightSettingsEntry();
|
||||
void loadFromSettings(const json& data);
|
||||
json saveSettings();
|
||||
const char* settingsSection();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBElgatoKeyLightSettingsEntryUi *ui;
|
||||
|
||||
private slots:
|
||||
|
|
|
|||
|
|
@ -33,10 +33,7 @@ OpenRGBElgatoKeyLightSettingsPage::OpenRGBElgatoKeyLightSettingsPage(QWidget *pa
|
|||
{
|
||||
OpenRGBElgatoKeyLightSettingsEntry* entry = new OpenRGBElgatoKeyLightSettingsEntry;
|
||||
|
||||
if(elgato_keylight_settings["devices"][device_idx].contains("ip"))
|
||||
{
|
||||
entry->ui->IPEdit->setText(QString::fromStdString(elgato_keylight_settings["devices"][device_idx]["ip"]));
|
||||
}
|
||||
entry->loadFromSettings(elgato_keylight_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
|
|
@ -106,10 +103,7 @@ void Ui::OpenRGBElgatoKeyLightSettingsPage::on_SaveElgatoKeyLightConfigurationBu
|
|||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
elgato_keylight_settings["devices"][device_idx]["ip"] = entries[device_idx]->ui->IPEdit->text().toStdString();
|
||||
elgato_keylight_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("ElgatoKeyLightDevices", elgato_keylight_settings);
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_OpenRGBElgatoKeyLightSettingsPage.h"
|
||||
#include "OpenRGBElgatoKeyLightSettingsEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBElgatoKeyLightSettingsPage;
|
||||
class OpenRGBElgatoKeyLightSettingsPageUi;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBElgatoKeyLightSettingsPage : public QWidget
|
||||
|
|
|
|||
|
|
@ -32,3 +32,23 @@ void OpenRGBElgatoLightStripSettingsEntry::changeEvent(QEvent *event)
|
|||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBElgatoLightStripSettingsEntry::loadFromSettings(const json& data)
|
||||
{
|
||||
if(data.contains("ip"))
|
||||
{
|
||||
ui->IPEdit->setText(QString::fromStdString(data["ip"]));
|
||||
}
|
||||
}
|
||||
|
||||
json OpenRGBElgatoLightStripSettingsEntry::saveSettings()
|
||||
{
|
||||
json result;
|
||||
result["ip"] = ui->IPEdit->text().toStdString();
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* OpenRGBElgatoLightStripSettingsEntry::settingsSection()
|
||||
{
|
||||
return "ElgatoLightStripDevices";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include "ui_OpenRGBElgatoLightStripSettingsEntry.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBElgatoLightStripSettingsEntry;
|
||||
class OpenRGBElgatoLightStripSettingsEntryUi;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBElgatoLightStripSettingsEntry : public QDialog
|
||||
|
|
@ -24,6 +27,11 @@ class Ui::OpenRGBElgatoLightStripSettingsEntry : public QDialog
|
|||
public:
|
||||
explicit OpenRGBElgatoLightStripSettingsEntry(QWidget *parent = nullptr);
|
||||
~OpenRGBElgatoLightStripSettingsEntry();
|
||||
void loadFromSettings(const json& data);
|
||||
json saveSettings();
|
||||
const char* settingsSection();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBElgatoLightStripSettingsEntryUi *ui;
|
||||
|
||||
private slots:
|
||||
|
|
|
|||
|
|
@ -33,10 +33,7 @@ OpenRGBElgatoLightStripSettingsPage::OpenRGBElgatoLightStripSettingsPage(QWidget
|
|||
{
|
||||
OpenRGBElgatoLightStripSettingsEntry* entry = new OpenRGBElgatoLightStripSettingsEntry;
|
||||
|
||||
if(elgato_lightstrip_settings["devices"][device_idx].contains("ip"))
|
||||
{
|
||||
entry->ui->IPEdit->setText(QString::fromStdString(elgato_lightstrip_settings["devices"][device_idx]["ip"]));
|
||||
}
|
||||
entry->loadFromSettings(elgato_lightstrip_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
|
|
@ -106,10 +103,7 @@ void Ui::OpenRGBElgatoLightStripSettingsPage::on_SaveElgatoLightStripConfigurati
|
|||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
elgato_lightstrip_settings["devices"][device_idx]["ip"] = entries[device_idx]->ui->IPEdit->text().toStdString();
|
||||
elgato_lightstrip_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("ElgatoLightStripDevices", elgato_lightstrip_settings);
|
||||
|
|
|
|||
|
|
@ -33,3 +33,23 @@ void OpenRGBGoveeSettingsEntry::changeEvent(QEvent *event)
|
|||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBGoveeSettingsEntry::loadFromSettings(const json& data)
|
||||
{
|
||||
if(data.contains("ip"))
|
||||
{
|
||||
ui->IPEdit->setText(QString::fromStdString(data["ip"]));
|
||||
}
|
||||
}
|
||||
|
||||
json OpenRGBGoveeSettingsEntry::saveSettings()
|
||||
{
|
||||
json result;
|
||||
result["ip"] = ui->IPEdit->text().toStdString();
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* OpenRGBGoveeSettingsEntry::settingsSection()
|
||||
{
|
||||
return "GoveeDevices";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,11 +12,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_OpenRGBGoveeSettingsEntry.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBGoveeSettingsEntry;
|
||||
class OpenRGBGoveeSettingsEntryUi;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBGoveeSettingsEntry : public QWidget
|
||||
|
|
@ -26,6 +29,11 @@ class Ui::OpenRGBGoveeSettingsEntry : public QWidget
|
|||
public:
|
||||
explicit OpenRGBGoveeSettingsEntry(QWidget *parent = nullptr);
|
||||
~OpenRGBGoveeSettingsEntry();
|
||||
void loadFromSettings(const json& data);
|
||||
json saveSettings();
|
||||
const char* settingsSection();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBGoveeSettingsEntryUi *ui;
|
||||
|
||||
private slots:
|
||||
|
|
|
|||
|
|
@ -38,10 +38,7 @@ OpenRGBGoveeSettingsPage::OpenRGBGoveeSettingsPage(QWidget *parent) :
|
|||
{
|
||||
OpenRGBGoveeSettingsEntry* entry = new OpenRGBGoveeSettingsEntry;
|
||||
|
||||
if(govee_settings["devices"][device_idx].contains("ip"))
|
||||
{
|
||||
entry->ui->IPEdit->setText(QString::fromStdString(govee_settings["devices"][device_idx]["ip"]));
|
||||
}
|
||||
entry->loadFromSettings(govee_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
|
|
@ -114,10 +111,7 @@ void Ui::OpenRGBGoveeSettingsPage::on_SaveGoveeConfigurationButton_clicked()
|
|||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
govee_settings["devices"][device_idx]["ip"] = entries[device_idx]->ui->IPEdit->text().toStdString();
|
||||
govee_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("GoveeDevices", govee_settings);
|
||||
|
|
|
|||
|
|
@ -31,3 +31,33 @@ void OpenRGBKasaSmartSettingsEntry::changeEvent(QEvent *event)
|
|||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBKasaSmartSettingsEntry::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"]));
|
||||
}
|
||||
}
|
||||
|
||||
json OpenRGBKasaSmartSettingsEntry::saveSettings()
|
||||
{
|
||||
json result;
|
||||
result["ip"] = ui->IPEdit->text().toStdString();
|
||||
result["name"] = ui->NameEdit->text().toStdString();
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* OpenRGBKasaSmartSettingsEntry::settingsSection()
|
||||
{
|
||||
return "KasaSmartDevices";
|
||||
}
|
||||
|
||||
void OpenRGBKasaSmartSettingsEntry::setName(QString name)
|
||||
{
|
||||
ui->NameEdit->setText(name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,15 @@
|
|||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_OpenRGBKasaSmartSettingsEntry.h"
|
||||
#include <QWidget>
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBKasaSmartSettingsEntry;
|
||||
class OpenRGBKasaSmartSettingsEntryUi;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBKasaSmartSettingsEntry : public QWidget
|
||||
|
|
@ -24,6 +28,12 @@ class Ui::OpenRGBKasaSmartSettingsEntry : public QWidget
|
|||
public:
|
||||
explicit OpenRGBKasaSmartSettingsEntry(QWidget *parent = nullptr);
|
||||
~OpenRGBKasaSmartSettingsEntry();
|
||||
void loadFromSettings(const json& data);
|
||||
json saveSettings();
|
||||
const char* settingsSection();
|
||||
void setName(QString name);
|
||||
|
||||
private:
|
||||
Ui::OpenRGBKasaSmartSettingsEntryUi *ui;
|
||||
|
||||
private slots:
|
||||
|
|
|
|||
|
|
@ -36,15 +36,7 @@ OpenRGBKasaSmartSettingsPage::OpenRGBKasaSmartSettingsPage(QWidget *parent) :
|
|||
{
|
||||
OpenRGBKasaSmartSettingsEntry* entry = new OpenRGBKasaSmartSettingsEntry;
|
||||
|
||||
if(KasaSmart_settings["devices"][device_idx].contains("ip"))
|
||||
{
|
||||
entry->ui->IPEdit->setText(QString::fromStdString(KasaSmart_settings["devices"][device_idx]["ip"]));
|
||||
}
|
||||
|
||||
if(KasaSmart_settings["devices"][device_idx].contains("name"))
|
||||
{
|
||||
entry->ui->NameEdit->setText(QString::fromStdString(KasaSmart_settings["devices"][device_idx]["name"]));
|
||||
}
|
||||
entry->loadFromSettings(KasaSmart_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
|
|
@ -75,7 +67,9 @@ void OpenRGBKasaSmartSettingsPage::changeEvent(QEvent *event)
|
|||
void Ui::OpenRGBKasaSmartSettingsPage::on_AddKasaSmartDeviceButton_clicked()
|
||||
{
|
||||
OpenRGBKasaSmartSettingsEntry* entry = new OpenRGBKasaSmartSettingsEntry;
|
||||
entry->ui->NameEdit->setText(QString("KasaSmart%1").arg(entries.size()));
|
||||
|
||||
entry->setName(QString("KasaSmart%1").arg(entries.size()));
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
|
@ -121,8 +115,7 @@ void Ui::OpenRGBKasaSmartSettingsPage::on_SaveKasaSmartConfigurationButton_click
|
|||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
KasaSmart_settings["devices"][device_idx]["ip"] = entries[device_idx]->ui->IPEdit->text().toStdString();
|
||||
KasaSmart_settings["devices"][device_idx]["name"] = entries[device_idx]->ui->NameEdit->text().toStdString();
|
||||
KasaSmart_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("KasaSmartDevices", KasaSmart_settings);
|
||||
|
|
|
|||
|
|
@ -31,3 +31,33 @@ void OpenRGBLIFXSettingsEntry::changeEvent(QEvent *event)
|
|||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBLIFXSettingsEntry::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"]));
|
||||
}
|
||||
}
|
||||
|
||||
json OpenRGBLIFXSettingsEntry::saveSettings()
|
||||
{
|
||||
json result;
|
||||
result["ip"] = ui->IPEdit->text().toStdString();
|
||||
result["name"] = ui->NameEdit->text().toStdString();
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* OpenRGBLIFXSettingsEntry::settingsSection()
|
||||
{
|
||||
return "LIFXDevices";
|
||||
}
|
||||
|
||||
void OpenRGBLIFXSettingsEntry::setName(QString name)
|
||||
{
|
||||
ui->NameEdit->setText(name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,11 +8,14 @@
|
|||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_OpenRGBLIFXSettingsEntry.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBLIFXSettingsEntry;
|
||||
class OpenRGBLIFXSettingsEntryUi;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBLIFXSettingsEntry : public QWidget
|
||||
|
|
@ -22,6 +25,12 @@ class Ui::OpenRGBLIFXSettingsEntry : public QWidget
|
|||
public:
|
||||
explicit OpenRGBLIFXSettingsEntry(QWidget *parent = nullptr);
|
||||
~OpenRGBLIFXSettingsEntry();
|
||||
void loadFromSettings(const json& data);
|
||||
json saveSettings();
|
||||
const char* settingsSection();
|
||||
void setName(QString name);
|
||||
|
||||
private:
|
||||
Ui::OpenRGBLIFXSettingsEntryUi *ui;
|
||||
|
||||
private slots:
|
||||
|
|
|
|||
|
|
@ -36,15 +36,7 @@ OpenRGBLIFXSettingsPage::OpenRGBLIFXSettingsPage(QWidget *parent) :
|
|||
{
|
||||
OpenRGBLIFXSettingsEntry* entry = new OpenRGBLIFXSettingsEntry;
|
||||
|
||||
if(lifx_settings["devices"][device_idx].contains("ip"))
|
||||
{
|
||||
entry->ui->IPEdit->setText(QString::fromStdString(lifx_settings["devices"][device_idx]["ip"]));
|
||||
}
|
||||
|
||||
if(lifx_settings["devices"][device_idx].contains("name"))
|
||||
{
|
||||
entry->ui->NameEdit->setText(QString::fromStdString(lifx_settings["devices"][device_idx]["name"]));
|
||||
}
|
||||
entry->loadFromSettings(lifx_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
|
|
@ -75,7 +67,9 @@ void OpenRGBLIFXSettingsPage::changeEvent(QEvent *event)
|
|||
void Ui::OpenRGBLIFXSettingsPage::on_AddLIFXDeviceButton_clicked()
|
||||
{
|
||||
OpenRGBLIFXSettingsEntry* entry = new OpenRGBLIFXSettingsEntry;
|
||||
entry->ui->NameEdit->setText(QString("LIFX%1").arg(entries.size()));
|
||||
|
||||
entry->setName(QString("LIFX%1").arg(entries.size()));
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
|
@ -118,11 +112,7 @@ void Ui::OpenRGBLIFXSettingsPage::on_SaveLIFXConfigurationButton_clicked()
|
|||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
lifx_settings["devices"][device_idx]["ip"] = entries[device_idx]->ui->IPEdit->text().toStdString();
|
||||
lifx_settings["devices"][device_idx]["name"] = entries[device_idx]->ui->NameEdit->text().toStdString();
|
||||
lifx_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("LIFXDevices", lifx_settings);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBNanoleafSettingsEntry.cpp |
|
||||
| |
|
||||
|
|
@ -106,3 +107,46 @@ void OpenRGBNanoleafSettingsEntry::on_UnpairButton_clicked()
|
|||
ui->PairButton->show();
|
||||
ui->UnpairButton->hide();
|
||||
}
|
||||
|
||||
void OpenRGBNanoleafSettingsEntry::loadFromSettings(const json& data)
|
||||
{
|
||||
address = QString::fromStdString(data["ip"]);
|
||||
port = data["port"];
|
||||
|
||||
ui->IPValue->setText(address);
|
||||
ui->PortValue->setText(QString::fromStdString(std::to_string(port)));
|
||||
|
||||
if(data.contains("auth_token") && data["auth_token"].size())
|
||||
{
|
||||
auth_token = data["auth_token"];
|
||||
ui->AuthKeyValue->setText(QString::fromStdString(auth_token));
|
||||
ui->PairButton->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
auth_token.clear();
|
||||
ui->UnpairButton->hide();
|
||||
}
|
||||
}
|
||||
|
||||
json OpenRGBNanoleafSettingsEntry::saveSettings()
|
||||
{
|
||||
json result;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
result["ip"] = address.toStdString();
|
||||
result["port"] = port;
|
||||
if(!auth_token.empty())
|
||||
{
|
||||
result["auth_token"] = auth_token;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* OpenRGBNanoleafSettingsEntry::settingsSection()
|
||||
{
|
||||
return "NanoleafDevices";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,10 +12,14 @@
|
|||
#include <QWidget>
|
||||
#include "ui_OpenRGBNanoleafSettingsEntry.h"
|
||||
#include "OpenRGBNanoleafScanningThread.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBNanoleafSettingsEntry;
|
||||
class OpenRGBNanoleafSettingsEntryUi;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBNanoleafSettingsEntry : public QWidget
|
||||
|
|
@ -26,10 +30,16 @@ public:
|
|||
explicit OpenRGBNanoleafSettingsEntry(QWidget *parent = nullptr);
|
||||
OpenRGBNanoleafSettingsEntry(QString a_address, int a_port);
|
||||
~OpenRGBNanoleafSettingsEntry();
|
||||
Ui::OpenRGBNanoleafSettingsEntryUi *ui;
|
||||
void loadFromSettings(const json& data);
|
||||
json saveSettings();
|
||||
const char* settingsSection();
|
||||
|
||||
QString address;
|
||||
int port;
|
||||
|
||||
private:
|
||||
Ui::OpenRGBNanoleafSettingsEntryUi *ui;
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
void on_UnpairButton_clicked();
|
||||
|
|
|
|||
|
|
@ -37,3 +37,65 @@ void Ui::OpenRGBPhilipsHueSettingsEntry::on_UnpairButton_clicked()
|
|||
ui->UsernameValue->setText("");
|
||||
ui->ClientKeyValue->setText("");
|
||||
}
|
||||
|
||||
void OpenRGBPhilipsHueSettingsEntry::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 OpenRGBPhilipsHueSettingsEntry::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;
|
||||
}
|
||||
|
||||
const char* OpenRGBPhilipsHueSettingsEntry::settingsSection()
|
||||
{
|
||||
return "PhilipsHueDevices";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,15 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "ui_OpenRGBPhilipsHueSettingsEntry.h"
|
||||
#include <QWidget>
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBPhilipsHueSettingsEntry;
|
||||
class OpenRGBPhilipsHueSettingsEntryUi;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBPhilipsHueSettingsEntry : public QWidget
|
||||
|
|
@ -24,7 +27,13 @@ class Ui::OpenRGBPhilipsHueSettingsEntry : public QWidget
|
|||
public:
|
||||
explicit OpenRGBPhilipsHueSettingsEntry(QWidget *parent = nullptr);
|
||||
~OpenRGBPhilipsHueSettingsEntry();
|
||||
void loadFromSettings(const json& data);
|
||||
json saveSettings();
|
||||
const char* settingsSection();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBPhilipsHueSettingsEntryUi *ui;
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
void on_UnpairButton_clicked();
|
||||
|
|
|
|||
|
|
@ -36,35 +36,7 @@ OpenRGBPhilipsHueSettingsPage::OpenRGBPhilipsHueSettingsPage(QWidget *parent) :
|
|||
{
|
||||
OpenRGBPhilipsHueSettingsEntry* entry = new OpenRGBPhilipsHueSettingsEntry;
|
||||
|
||||
if(hue_settings["bridges"][device_idx].contains("ip"))
|
||||
{
|
||||
entry->ui->IPEdit->setText(QString::fromStdString(hue_settings["bridges"][device_idx]["ip"]));
|
||||
}
|
||||
|
||||
if(hue_settings["bridges"][device_idx].contains("mac"))
|
||||
{
|
||||
entry->ui->MACEdit->setText(QString::fromStdString(hue_settings["bridges"][device_idx]["mac"]));
|
||||
}
|
||||
|
||||
if(hue_settings["bridges"][device_idx].contains("entertainment"))
|
||||
{
|
||||
entry->ui->EntertainmentCheckBox->setChecked(hue_settings["bridges"][device_idx]["entertainment"]);
|
||||
}
|
||||
|
||||
if(hue_settings["bridges"][device_idx].contains("autoconnect"))
|
||||
{
|
||||
entry->ui->AutoConnectCheckBox->setChecked(hue_settings["bridges"][device_idx]["autoconnect"]);
|
||||
}
|
||||
|
||||
if(hue_settings["bridges"][device_idx].contains("username"))
|
||||
{
|
||||
entry->ui->UsernameValue->setText(QString::fromStdString(hue_settings["bridges"][device_idx]["username"]));
|
||||
}
|
||||
|
||||
if(hue_settings["bridges"][device_idx].contains("clientkey"))
|
||||
{
|
||||
entry->ui->ClientKeyValue->setText(QString::fromStdString(hue_settings["bridges"][device_idx]["clientkey"]));
|
||||
}
|
||||
entry->loadFromSettings(hue_settings["bridges"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
|
|
@ -137,23 +109,7 @@ void Ui::OpenRGBPhilipsHueSettingsPage::on_SavePhilipsHueConfigurationButton_cli
|
|||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
hue_settings["bridges"][device_idx]["ip"] = entries[device_idx]->ui->IPEdit->text().toStdString();
|
||||
hue_settings["bridges"][device_idx]["mac"] = entries[device_idx]->ui->MACEdit->text().toStdString();
|
||||
hue_settings["bridges"][device_idx]["entertainment"] = entries[device_idx]->ui->EntertainmentCheckBox->isChecked();
|
||||
hue_settings["bridges"][device_idx]["autoconnect"] = entries[device_idx]->ui->AutoConnectCheckBox->isChecked();
|
||||
|
||||
if(entries[device_idx]->ui->UsernameValue->text() != "")
|
||||
{
|
||||
hue_settings["bridges"][device_idx]["username"] = entries[device_idx]->ui->UsernameValue->text().toStdString();
|
||||
}
|
||||
|
||||
if(entries[device_idx]->ui->ClientKeyValue->text() != "")
|
||||
{
|
||||
hue_settings["bridges"][device_idx]["clientkey"] = entries[device_idx]->ui->ClientKeyValue->text().toStdString();
|
||||
}
|
||||
hue_settings["bridges"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("PhilipsHueDevices", hue_settings);
|
||||
|
|
|
|||
|
|
@ -34,3 +34,45 @@ void OpenRGBPhilipsWizSettingsEntry::changeEvent(QEvent *event)
|
|||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBPhilipsWizSettingsEntry::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 OpenRGBPhilipsWizSettingsEntry::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;
|
||||
}
|
||||
|
||||
const char* OpenRGBPhilipsWizSettingsEntry::settingsSection()
|
||||
{
|
||||
return "PhilipsWizDevices";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_OpenRGBPhilipsWizSettingsEntry.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBPhilipsWizSettingsEntry;
|
||||
class OpenRGBPhilipsWizSettingsEntryUi;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBPhilipsWizSettingsEntry : public QWidget
|
||||
|
|
@ -24,6 +27,11 @@ class Ui::OpenRGBPhilipsWizSettingsEntry : public QWidget
|
|||
public:
|
||||
explicit OpenRGBPhilipsWizSettingsEntry(QWidget *parent = nullptr);
|
||||
~OpenRGBPhilipsWizSettingsEntry();
|
||||
void loadFromSettings(const json& data);
|
||||
json saveSettings();
|
||||
const char* settingsSection();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBPhilipsWizSettingsEntryUi *ui;
|
||||
|
||||
private slots:
|
||||
|
|
|
|||
|
|
@ -36,25 +36,7 @@ OpenRGBPhilipsWizSettingsPage::OpenRGBPhilipsWizSettingsPage(QWidget *parent) :
|
|||
{
|
||||
OpenRGBPhilipsWizSettingsEntry* entry = new OpenRGBPhilipsWizSettingsEntry;
|
||||
|
||||
if(wiz_settings["devices"][device_idx].contains("ip"))
|
||||
{
|
||||
entry->ui->IPEdit->setText(QString::fromStdString(wiz_settings["devices"][device_idx]["ip"]));
|
||||
}
|
||||
|
||||
if(wiz_settings["devices"][device_idx].contains("use_cool_white"))
|
||||
{
|
||||
entry->ui->UseCoolWhiteCheckBox->setChecked(wiz_settings["devices"][device_idx]["use_cool_white"]);
|
||||
}
|
||||
|
||||
if(wiz_settings["devices"][device_idx].contains("use_warm_white"))
|
||||
{
|
||||
entry->ui->UseWarmWhiteCheckBox->setChecked(wiz_settings["devices"][device_idx]["use_warm_white"]);
|
||||
}
|
||||
|
||||
if(wiz_settings["devices"][device_idx].contains("selected_white_strategy"))
|
||||
{
|
||||
entry->ui->WhiteStrategyComboBox->setCurrentText(QString::fromStdString(wiz_settings["devices"][device_idx]["selected_white_strategy"]));
|
||||
}
|
||||
entry->loadFromSettings(wiz_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
|
|
@ -127,13 +109,7 @@ void Ui::OpenRGBPhilipsWizSettingsPage::on_SavePhilipsWizConfigurationButton_cli
|
|||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
wiz_settings["devices"][device_idx]["ip"] = entries[device_idx]->ui->IPEdit->text().toStdString();
|
||||
wiz_settings["devices"][device_idx]["use_cool_white"] = entries[device_idx]->ui->UseCoolWhiteCheckBox->isChecked();
|
||||
wiz_settings["devices"][device_idx]["use_warm_white"] = entries[device_idx]->ui->UseWarmWhiteCheckBox->isChecked();
|
||||
wiz_settings["devices"][device_idx]["selected_white_strategy"] = entries[device_idx]->ui->WhiteStrategyComboBox->currentText().toStdString();
|
||||
wiz_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("PhilipsWizDevices", wiz_settings);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "OpenRGBPluginsEntry.h"
|
||||
#include "ui_OpenRGBPluginsEntry.h"
|
||||
#include "PluginManager.h"
|
||||
|
||||
using namespace Ui;
|
||||
|
||||
|
|
@ -27,6 +28,74 @@ OpenRGBPluginsEntry::~OpenRGBPluginsEntry()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBPluginsEntry::fillFrom(const OpenRGBPluginEntry *plugin)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Fill in plugin information fields |
|
||||
\*---------------------------------------------------------*/
|
||||
ui->NameValue->setText(QString::fromStdString(plugin->info.Name));
|
||||
ui->DescriptionValue->setText(QString::fromStdString(plugin->info.Description));
|
||||
ui->VersionValue->setText(QString::fromStdString(plugin->info.Version));
|
||||
ui->CommitValue->setText(QString::fromStdString(plugin->info.Commit));
|
||||
ui->URLValue->setText(QString::fromStdString(plugin->info.URL));
|
||||
ui->APIVersionValue->setText(QString::number(plugin->api_version));
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| If the plugin is incompatible, highlight the API version |
|
||||
| in red and disable the enable checkbox |
|
||||
\*---------------------------------------------------------*/
|
||||
if(plugin->incompatible)
|
||||
{
|
||||
ui->APIVersionValue->setStyleSheet("QLabel { color : red; }");
|
||||
ui->EnabledCheckBox->setEnabled(false);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Fill in plugin icon |
|
||||
\*---------------------------------------------------------*/
|
||||
QPixmap pixmap(QPixmap::fromImage(plugin->info.Icon));
|
||||
|
||||
ui->IconView->setPixmap(pixmap);
|
||||
ui->IconView->setScaledContents(true);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Fill in plugin path |
|
||||
\*---------------------------------------------------------*/
|
||||
ui->PathValue->setText(QString::fromStdString(plugin->path));
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Fill in plugin enabled status |
|
||||
\*---------------------------------------------------------*/
|
||||
ui->EnabledCheckBox->setChecked((plugin->enabled));
|
||||
|
||||
is_system = plugin->is_system;
|
||||
}
|
||||
|
||||
bool OpenRGBPluginsEntry::isSystem() const
|
||||
{
|
||||
return is_system;
|
||||
}
|
||||
|
||||
bool OpenRGBPluginsEntry::isPluginEnabled() const
|
||||
{
|
||||
return ui->EnabledCheckBox->isChecked();
|
||||
}
|
||||
|
||||
std::string OpenRGBPluginsEntry::getName() const
|
||||
{
|
||||
return ui->NameValue->text().toStdString();
|
||||
}
|
||||
|
||||
std::string OpenRGBPluginsEntry::getDescription() const
|
||||
{
|
||||
return ui->DescriptionValue->text().toStdString();
|
||||
}
|
||||
|
||||
std::string OpenRGBPluginsEntry::getPath() const
|
||||
{
|
||||
return ui->PathValue->text().toStdString();
|
||||
}
|
||||
|
||||
void OpenRGBPluginsEntry::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
|
|
|
|||
|
|
@ -10,15 +10,17 @@
|
|||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_OpenRGBPluginsEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBPluginsEntry;
|
||||
class OpenRGBPluginsEntryUi;
|
||||
}
|
||||
|
||||
typedef void (*EnableClickCallback)(void *, void *);
|
||||
|
||||
struct OpenRGBPluginEntry;
|
||||
|
||||
class Ui::OpenRGBPluginsEntry : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -26,9 +28,13 @@ class Ui::OpenRGBPluginsEntry : public QWidget
|
|||
public:
|
||||
explicit OpenRGBPluginsEntry(QWidget *parent = nullptr);
|
||||
~OpenRGBPluginsEntry();
|
||||
void fillFrom(const OpenRGBPluginEntry* plugin);
|
||||
bool isSystem() const;
|
||||
bool isPluginEnabled() const;
|
||||
std::string getName() const;
|
||||
std::string getDescription() const;
|
||||
std::string getPath() const;
|
||||
|
||||
Ui::OpenRGBPluginsEntryUi * ui;
|
||||
bool is_system;
|
||||
|
||||
void RegisterEnableClickCallback(EnableClickCallback new_callback, void * new_callback_arg);
|
||||
|
||||
|
|
@ -39,4 +45,6 @@ private slots:
|
|||
private:
|
||||
EnableClickCallback EnableClickCallbackVal;
|
||||
void * EnableClickCallbackArg;
|
||||
Ui::OpenRGBPluginsEntryUi * ui;
|
||||
bool is_system;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -60,45 +60,10 @@ void Ui::OpenRGBPluginsPage::RefreshList()
|
|||
/*---------------------------------------------------------*\
|
||||
| Fill in plugin information fields |
|
||||
\*---------------------------------------------------------*/
|
||||
entry->ui->NameValue->setText(QString::fromStdString(plugin.info.Name));
|
||||
entry->ui->DescriptionValue->setText(QString::fromStdString(plugin.info.Description));
|
||||
entry->ui->VersionValue->setText(QString::fromStdString(plugin.info.Version));
|
||||
entry->ui->CommitValue->setText(QString::fromStdString(plugin.info.Commit));
|
||||
entry->ui->URLValue->setText(QString::fromStdString(plugin.info.URL));
|
||||
entry->ui->APIVersionValue->setText(QString::number(plugin.api_version));
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| If the plugin is incompatible, highlight the API version |
|
||||
| in red and disable the enable checkbox |
|
||||
\*---------------------------------------------------------*/
|
||||
if(plugin.incompatible)
|
||||
{
|
||||
entry->ui->APIVersionValue->setStyleSheet("QLabel { color : red; }");
|
||||
entry->ui->EnabledCheckBox->setEnabled(false);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Fill in plugin icon |
|
||||
\*---------------------------------------------------------*/
|
||||
QPixmap pixmap(QPixmap::fromImage(plugin.info.Icon));
|
||||
|
||||
entry->ui->IconView->setPixmap(pixmap);
|
||||
entry->ui->IconView->setScaledContents(true);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Fill in plugin path |
|
||||
\*---------------------------------------------------------*/
|
||||
entry->ui->PathValue->setText(QString::fromStdString(plugin.path));
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Fill in plugin enabled status |
|
||||
\*---------------------------------------------------------*/
|
||||
entry->ui->EnabledCheckBox->setChecked((plugin.enabled));
|
||||
entry->fillFrom(&plugin);
|
||||
|
||||
entry->RegisterEnableClickCallback(EnableClickCallbackFunction, this);
|
||||
|
||||
entry->is_system = plugin.is_system;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Add the entry to the plugin list |
|
||||
\*---------------------------------------------------------*/
|
||||
|
|
@ -213,7 +178,7 @@ void Ui::OpenRGBPluginsPage::on_RemovePluginButton_clicked()
|
|||
/*-----------------------------------------------------*\
|
||||
| Don't allow removing system plugins |
|
||||
\*-----------------------------------------------------*/
|
||||
if(entries[cur_row]->is_system)
|
||||
if(entries[cur_row]->isSystem())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -233,8 +198,8 @@ void Ui::OpenRGBPluginsPage::on_RemovePluginButton_clicked()
|
|||
if((plugin_settings["plugins"][plugin_idx].contains("name"))
|
||||
&&(plugin_settings["plugins"][plugin_idx].contains("description")))
|
||||
{
|
||||
if((plugin_settings["plugins"][plugin_idx]["name"] == entries[cur_row]->ui->NameValue->text().toStdString())
|
||||
&&(plugin_settings["plugins"][plugin_idx]["description"] == entries[cur_row]->ui->DescriptionValue->text().toStdString()))
|
||||
if((plugin_settings["plugins"][plugin_idx]["name"] == entries[cur_row]->getName())
|
||||
&&(plugin_settings["plugins"][plugin_idx]["description"] == entries[cur_row]->getDescription()))
|
||||
{
|
||||
/*-------------------------------------*\
|
||||
| Remove plugin from settings |
|
||||
|
|
@ -248,7 +213,7 @@ void Ui::OpenRGBPluginsPage::on_RemovePluginButton_clicked()
|
|||
/*-----------------------------------------------------*\
|
||||
| Mark plugin to be removed on next restart |
|
||||
\*-----------------------------------------------------*/
|
||||
plugin_settings["plugins_remove"][plugin_settings["plugins_remove"].size()] = entries[cur_row]->ui->PathValue->text().toStdString();
|
||||
plugin_settings["plugins_remove"][plugin_settings["plugins_remove"].size()] = entries[cur_row]->getPath();
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("Plugins", plugin_settings);
|
||||
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
||||
|
|
@ -268,14 +233,14 @@ void Ui::OpenRGBPluginsPage::on_EnableButton_clicked(OpenRGBPluginsEntry* entry)
|
|||
\*-----------------------------------------------------*/
|
||||
std::string name = "";
|
||||
std::string description = "";
|
||||
bool enabled = entry->ui->EnabledCheckBox->isChecked();
|
||||
bool enabled = entry->isPluginEnabled();
|
||||
bool found = false;
|
||||
unsigned int plugin_ct = 0;
|
||||
unsigned int plugin_idx = 0;
|
||||
|
||||
std::string entry_name = entry->ui->NameValue->text().toStdString();
|
||||
std::string entry_desc = entry->ui->DescriptionValue->text().toStdString();
|
||||
std::string entry_path = entry->ui->PathValue->text().toStdString();
|
||||
std::string entry_name = entry->getName();
|
||||
std::string entry_desc = entry->getDescription();
|
||||
std::string entry_path = entry->getPath();
|
||||
|
||||
if(plugin_settings.contains("plugins"))
|
||||
{
|
||||
|
|
@ -352,7 +317,7 @@ void Ui::OpenRGBPluginsPage::on_PluginsList_itemSelectionChanged()
|
|||
| Enable the remove button when there's a selected item |
|
||||
| and the selected item is not a system plugin |
|
||||
\*-----------------------------------------------------*/
|
||||
if(!entries[cur_row]->is_system)
|
||||
if(!entries[cur_row]->isSystem())
|
||||
{
|
||||
ui->RemovePluginButton->setEnabled(!ui->PluginsList->selectedItems().empty());
|
||||
ui->RemovePluginButton->setText("Remove Plugin");
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@
|
|||
|
||||
#include <QWidget>
|
||||
#include "OpenRGBPluginsEntry.h"
|
||||
#include "ui_OpenRGBPluginsPage.h"
|
||||
#include "PluginManager.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBPluginsPage;
|
||||
class OpenRGBPluginsPageUi;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBPluginsPage : public QWidget
|
||||
|
|
|
|||
|
|
@ -31,3 +31,39 @@ void OpenRGBQMKORGBSettingsEntry::changeEvent(QEvent *event)
|
|||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBQMKORGBSettingsEntry::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 OpenRGBQMKORGBSettingsEntry::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;
|
||||
}
|
||||
|
||||
const char* OpenRGBQMKORGBSettingsEntry::settingsSection()
|
||||
{
|
||||
return "QMKOpenRGBDevices";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_OpenRGBQMKORGBSettingsEntry.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBQMKORGBSettingsEntry;
|
||||
class OpenRGBQMKORGBSettingsEntryUi;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBQMKORGBSettingsEntry : public QWidget
|
||||
|
|
@ -27,5 +30,10 @@ private slots:
|
|||
public:
|
||||
explicit OpenRGBQMKORGBSettingsEntry(QWidget *parent = nullptr);
|
||||
~OpenRGBQMKORGBSettingsEntry();
|
||||
void loadFromSettings(const json& data);
|
||||
json saveSettings();
|
||||
const char* settingsSection();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBQMKORGBSettingsEntryUi *ui;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -36,20 +36,7 @@ OpenRGBQMKORGBSettingsPage::OpenRGBQMKORGBSettingsPage(QWidget *parent) :
|
|||
{
|
||||
OpenRGBQMKORGBSettingsEntry* entry = new OpenRGBQMKORGBSettingsEntry;
|
||||
|
||||
if(qmk_settings["devices"][device_idx].contains("name"))
|
||||
{
|
||||
entry->ui->NameEdit->setText(QString::fromStdString(qmk_settings["devices"][device_idx]["name"]));
|
||||
}
|
||||
|
||||
if(qmk_settings["devices"][device_idx].contains("usb_vid"))
|
||||
{
|
||||
entry->ui->USBVIDEdit->setText(QString::fromStdString(qmk_settings["devices"][device_idx]["usb_vid"]));
|
||||
}
|
||||
|
||||
if(qmk_settings["devices"][device_idx].contains("usb_pid"))
|
||||
{
|
||||
entry->ui->USBPIDEdit->setText(QString::fromStdString(qmk_settings["devices"][device_idx]["usb_pid"]));
|
||||
}
|
||||
entry->loadFromSettings(qmk_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
|
|
@ -125,9 +112,7 @@ void Ui::OpenRGBQMKORGBSettingsPage::on_SaveQMKORGBConfigurationButton_clicked()
|
|||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
qmk_settings["devices"][device_idx]["name"] = entries[device_idx]->ui->NameEdit->text().toStdString();
|
||||
qmk_settings["devices"][device_idx]["usb_vid"] = entries[device_idx]->ui->USBVIDEdit->text().toStdString();
|
||||
qmk_settings["devices"][device_idx]["usb_pid"] = entries[device_idx]->ui->USBPIDEdit->text().toStdString();
|
||||
qmk_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("QMKOpenRGBDevices", qmk_settings);
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_OpenRGBQMKORGBSettingsPage.h"
|
||||
#include "OpenRGBQMKORGBSettingsEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBQMKORGBSettingsPage;
|
||||
class OpenRGBQMKORGBSettingsPageUi;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBQMKORGBSettingsPage : public QWidget
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ void OpenRGBSerialSettingsEntry::changeEvent(QEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
void Ui::OpenRGBSerialSettingsEntry::on_ProtocolComboBox_currentIndexChanged(int index)
|
||||
void OpenRGBSerialSettingsEntry::on_ProtocolComboBox_currentIndexChanged(int index)
|
||||
{
|
||||
if(index == 3)
|
||||
{
|
||||
|
|
@ -48,3 +48,83 @@ void Ui::OpenRGBSerialSettingsEntry::on_ProtocolComboBox_currentIndexChanged(int
|
|||
ui->BaudLabel->setText("Baud:");
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBSerialSettingsEntry::loadFromSettings(const json& data)
|
||||
{
|
||||
if(data.contains("name"))
|
||||
{
|
||||
ui->NameEdit->setText(QString::fromStdString(data["name"]));
|
||||
}
|
||||
|
||||
if(data.contains("port"))
|
||||
{
|
||||
ui->PortEdit->setText(QString::fromStdString(data["port"]));
|
||||
}
|
||||
|
||||
if(data.contains("baud"))
|
||||
{
|
||||
ui->BaudEdit->setText(QString::number((int)data["baud"]));
|
||||
}
|
||||
|
||||
if(data.contains("num_leds"))
|
||||
{
|
||||
ui->NumLEDsEdit->setText(QString::number((int)data["num_leds"]));
|
||||
}
|
||||
|
||||
if(data.contains("protocol"))
|
||||
{
|
||||
std::string protocol_string = data["protocol"];
|
||||
|
||||
if(protocol_string == "keyboard_visualizer")
|
||||
{
|
||||
ui->ProtocolComboBox->setCurrentIndex(0);
|
||||
}
|
||||
else if(protocol_string == "adalight")
|
||||
{
|
||||
ui->ProtocolComboBox->setCurrentIndex(1);
|
||||
}
|
||||
else if(protocol_string == "tpm2")
|
||||
{
|
||||
ui->ProtocolComboBox->setCurrentIndex(2);
|
||||
}
|
||||
else if(protocol_string == "basic_i2c")
|
||||
{
|
||||
ui->ProtocolComboBox->setCurrentIndex(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
json OpenRGBSerialSettingsEntry::saveSettings()
|
||||
{
|
||||
json result;
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
result["name"] = ui->NameEdit->text().toStdString();
|
||||
result["port"] = ui->PortEdit->text().toStdString();
|
||||
result["num_leds"] = ui->NumLEDsEdit->text().toUInt();
|
||||
result["baud"] = ui->BaudEdit->text().toUInt();
|
||||
|
||||
switch(ui->ProtocolComboBox->currentIndex())
|
||||
{
|
||||
case 0:
|
||||
result["protocol"] = "keyboard_visualizer";
|
||||
break;
|
||||
case 1:
|
||||
result["protocol"] = "adalight";
|
||||
break;
|
||||
case 2:
|
||||
result["protocol"] = "tpm2";
|
||||
break;
|
||||
case 3:
|
||||
result["protocol"] = "basic_i2c";
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* OpenRGBSerialSettingsEntry::settingsSection()
|
||||
{
|
||||
return "LEDStripDevices";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_OpenRGBSerialSettingsEntry.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBSerialSettingsEntry;
|
||||
class OpenRGBSerialSettingsEntryUi;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBSerialSettingsEntry : public QWidget
|
||||
|
|
@ -29,5 +32,10 @@ private slots:
|
|||
public:
|
||||
explicit OpenRGBSerialSettingsEntry(QWidget *parent = nullptr);
|
||||
~OpenRGBSerialSettingsEntry();
|
||||
void loadFromSettings(const json& data);
|
||||
json saveSettings();
|
||||
const char* settingsSection();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBSerialSettingsEntryUi *ui;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -36,47 +36,7 @@ OpenRGBSerialSettingsPage::OpenRGBSerialSettingsPage(QWidget *parent) :
|
|||
{
|
||||
OpenRGBSerialSettingsEntry* entry = new OpenRGBSerialSettingsEntry;
|
||||
|
||||
if(ledstrip_settings["devices"][device_idx].contains("name"))
|
||||
{
|
||||
entry->ui->NameEdit->setText(QString::fromStdString(ledstrip_settings["devices"][device_idx]["name"]));
|
||||
}
|
||||
|
||||
if(ledstrip_settings["devices"][device_idx].contains("port"))
|
||||
{
|
||||
entry->ui->PortEdit->setText(QString::fromStdString(ledstrip_settings["devices"][device_idx]["port"]));
|
||||
}
|
||||
|
||||
if(ledstrip_settings["devices"][device_idx].contains("baud"))
|
||||
{
|
||||
entry->ui->BaudEdit->setText(QString::number((int)ledstrip_settings["devices"][device_idx]["baud"]));
|
||||
}
|
||||
|
||||
if(ledstrip_settings["devices"][device_idx].contains("num_leds"))
|
||||
{
|
||||
entry->ui->NumLEDsEdit->setText(QString::number((int)ledstrip_settings["devices"][device_idx]["num_leds"]));
|
||||
}
|
||||
|
||||
if(ledstrip_settings["devices"][device_idx].contains("protocol"))
|
||||
{
|
||||
std::string protocol_string = ledstrip_settings["devices"][device_idx]["protocol"];
|
||||
|
||||
if(protocol_string == "keyboard_visualizer")
|
||||
{
|
||||
entry->ui->ProtocolComboBox->setCurrentIndex(0);
|
||||
}
|
||||
else if(protocol_string == "adalight")
|
||||
{
|
||||
entry->ui->ProtocolComboBox->setCurrentIndex(1);
|
||||
}
|
||||
else if(protocol_string == "tpm2")
|
||||
{
|
||||
entry->ui->ProtocolComboBox->setCurrentIndex(2);
|
||||
}
|
||||
else if(protocol_string == "basic_i2c")
|
||||
{
|
||||
entry->ui->ProtocolComboBox->setCurrentIndex(3);
|
||||
}
|
||||
}
|
||||
entry->loadFromSettings(ledstrip_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
|
|
@ -149,29 +109,7 @@ void Ui::OpenRGBSerialSettingsPage::on_SaveSerialConfigurationButton_clicked()
|
|||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
ledstrip_settings["devices"][device_idx]["name"] = entries[device_idx]->ui->NameEdit->text().toStdString();
|
||||
ledstrip_settings["devices"][device_idx]["port"] = entries[device_idx]->ui->PortEdit->text().toStdString();
|
||||
ledstrip_settings["devices"][device_idx]["num_leds"] = entries[device_idx]->ui->NumLEDsEdit->text().toUInt();
|
||||
ledstrip_settings["devices"][device_idx]["baud"] = entries[device_idx]->ui->BaudEdit->text().toUInt();
|
||||
|
||||
switch(entries[device_idx]->ui->ProtocolComboBox->currentIndex())
|
||||
{
|
||||
case 0:
|
||||
ledstrip_settings["devices"][device_idx]["protocol"] = "keyboard_visualizer";
|
||||
break;
|
||||
case 1:
|
||||
ledstrip_settings["devices"][device_idx]["protocol"] = "adalight";
|
||||
break;
|
||||
case 2:
|
||||
ledstrip_settings["devices"][device_idx]["protocol"] = "tpm2";
|
||||
break;
|
||||
case 3:
|
||||
ledstrip_settings["devices"][device_idx]["protocol"] = "basic_i2c";
|
||||
break;
|
||||
}
|
||||
ledstrip_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("LEDStripDevices", ledstrip_settings);
|
||||
|
|
|
|||
|
|
@ -64,3 +64,38 @@ void OpenRGBYeelightSettingsEntry::on_HostIPChooserButton_clicked()
|
|||
ui->HostIPEdit->setText(inp.textValue());
|
||||
}
|
||||
|
||||
void OpenRGBYeelightSettingsEntry::loadFromSettings(const json& data)
|
||||
{
|
||||
if(data.contains("ip"))
|
||||
{
|
||||
ui->IPEdit->setText(QString::fromStdString(data["ip"]));
|
||||
}
|
||||
|
||||
if(data.contains("host_ip"))
|
||||
{
|
||||
ui->HostIPEdit->setText(QString::fromStdString(data["host_ip"]));
|
||||
}
|
||||
|
||||
if(data.contains("music_mode"))
|
||||
{
|
||||
ui->MusicModeCheckBox->setChecked(data["music_mode"]);
|
||||
}
|
||||
}
|
||||
|
||||
json OpenRGBYeelightSettingsEntry::saveSettings()
|
||||
{
|
||||
json result;
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
result["ip"] = ui->IPEdit->text().toStdString();
|
||||
result["host_ip"] = ui->HostIPEdit->text().toStdString();
|
||||
result["music_mode"] = ui->MusicModeCheckBox->isChecked();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* OpenRGBYeelightSettingsEntry::settingsSection()
|
||||
{
|
||||
return "YeelightDevices";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_OpenRGBYeelightSettingsEntry.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBYeelightSettingsEntry;
|
||||
class OpenRGBYeelightSettingsEntryUi;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBYeelightSettingsEntry : public QWidget
|
||||
|
|
@ -24,6 +27,11 @@ class Ui::OpenRGBYeelightSettingsEntry : public QWidget
|
|||
public:
|
||||
explicit OpenRGBYeelightSettingsEntry(QWidget *parent = nullptr);
|
||||
~OpenRGBYeelightSettingsEntry();
|
||||
void loadFromSettings(const json& data);
|
||||
json saveSettings();
|
||||
const char* settingsSection();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBYeelightSettingsEntryUi *ui;
|
||||
|
||||
private slots:
|
||||
|
|
|
|||
|
|
@ -36,20 +36,7 @@ OpenRGBYeelightSettingsPage::OpenRGBYeelightSettingsPage(QWidget *parent) :
|
|||
{
|
||||
OpenRGBYeelightSettingsEntry* entry = new OpenRGBYeelightSettingsEntry;
|
||||
|
||||
if(yeelight_settings["devices"][device_idx].contains("ip"))
|
||||
{
|
||||
entry->ui->IPEdit->setText(QString::fromStdString(yeelight_settings["devices"][device_idx]["ip"]));
|
||||
}
|
||||
|
||||
if(yeelight_settings["devices"][device_idx].contains("host_ip"))
|
||||
{
|
||||
entry->ui->HostIPEdit->setText(QString::fromStdString(yeelight_settings["devices"][device_idx]["host_ip"]));
|
||||
}
|
||||
|
||||
if(yeelight_settings["devices"][device_idx].contains("music_mode"))
|
||||
{
|
||||
entry->ui->MusicModeCheckBox->setChecked(yeelight_settings["devices"][device_idx]["music_mode"]);
|
||||
}
|
||||
entry->loadFromSettings(yeelight_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
|
|
@ -122,12 +109,7 @@ void Ui::OpenRGBYeelightSettingsPage::on_SaveYeelightConfigurationButton_clicked
|
|||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
yeelight_settings["devices"][device_idx]["ip"] = entries[device_idx]->ui->IPEdit->text().toStdString();
|
||||
yeelight_settings["devices"][device_idx]["host_ip"] = entries[device_idx]->ui->HostIPEdit->text().toStdString();
|
||||
yeelight_settings["devices"][device_idx]["music_mode"] = entries[device_idx]->ui->MusicModeCheckBox->isChecked();
|
||||
yeelight_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("YeelightDevices", yeelight_settings);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue