Unified page for Manually Added Devices
parent
d796fcba8f
commit
570cc16c98
@ -0,0 +1,27 @@
|
||||
/*-----------------------------------------------------------------*\
|
||||
| BaseManualDeviceEntry.cpp |
|
||||
| |
|
||||
| Base class to all user-defined device settings entries |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*-----------------------------------------------------------------*/
|
||||
|
||||
#include "BaseManualDeviceEntry.h"
|
||||
|
||||
#include "ManualDevicesTypeManager.h"
|
||||
|
||||
void BaseManualDeviceEntry::setSettingsSection(const std::string& section)
|
||||
{
|
||||
settingsSection = section;
|
||||
}
|
||||
|
||||
std::string BaseManualDeviceEntry::getSettingsSection()
|
||||
{
|
||||
return settingsSection;
|
||||
}
|
||||
|
||||
ManualDeviceTypeRegistrator::ManualDeviceTypeRegistrator(const std::string& name, const std::string& settingsEntry, ManualDeviceEntrySpawnFunction entrySpawnFunction)
|
||||
{
|
||||
ManualDevicesTypeManager::get()->registerType(name, settingsEntry, entrySpawnFunction);
|
||||
};
|
||||
@ -0,0 +1,63 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| ElgatoLightStripSettingsEntry.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB Elgato Light Strips entry |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "ElgatoLightStripSettingsEntry.h"
|
||||
#include "ui_ElgatoLightStripSettingsEntry.h"
|
||||
|
||||
ElgatoLightStripSettingsEntry::ElgatoLightStripSettingsEntry(QWidget *parent) :
|
||||
BaseManualDeviceEntry(parent),
|
||||
ui(new Ui::ElgatoLightStripSettingsEntry)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
}
|
||||
|
||||
ElgatoLightStripSettingsEntry::~ElgatoLightStripSettingsEntry()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ElgatoLightStripSettingsEntry::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void ElgatoLightStripSettingsEntry::loadFromSettings(const json& data)
|
||||
{
|
||||
if(data.contains("ip"))
|
||||
{
|
||||
ui->IPEdit->setText(QString::fromStdString(data["ip"]));
|
||||
}
|
||||
}
|
||||
|
||||
json ElgatoLightStripSettingsEntry::saveSettings()
|
||||
{
|
||||
json result;
|
||||
result["ip"] = ui->IPEdit->text().toStdString();
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ElgatoLightStripSettingsEntry::isDataValid()
|
||||
{
|
||||
// stub
|
||||
return true;
|
||||
}
|
||||
|
||||
static BaseManualDeviceEntry* SpawnElgatoLightStripEntry(const json& data)
|
||||
{
|
||||
ElgatoLightStripSettingsEntry* entry = new ElgatoLightStripSettingsEntry;
|
||||
entry->loadFromSettings(data);
|
||||
return entry;
|
||||
}
|
||||
|
||||
REGISTER_MANUAL_DEVICE_TYPE("Elgato Light Strip", "ElgatoLightStripDevices", SpawnElgatoLightStripEntry);
|
||||
|
||||
@ -0,0 +1,330 @@
|
||||
/*-----------------------------------------------------------------*\
|
||||
| ManualDevicesSettingsPage.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB Manually Added Devices settings page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*-----------------------------------------------------------------*/
|
||||
|
||||
#include "ManualDevicesSettingsPage.h"
|
||||
#include "ui_ManualDevicesSettingsPage.h"
|
||||
|
||||
#include "NanoleafSettingsEntry.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "SettingsManager.h"
|
||||
|
||||
#include <QLineEdit>
|
||||
|
||||
static void ManualDevicesPageReloadCallback(void* this_ptr)
|
||||
{
|
||||
ManualDevicesSettingsPage * this_obj = (ManualDevicesSettingsPage *)this_ptr;
|
||||
|
||||
QMetaObject::invokeMethod(this_obj, "reloadList", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
ManualDevicesSettingsPage::ManualDevicesSettingsPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::ManualDevicesSettingsPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ResourceManager::get()->RegisterDetectionEndCallback(&ManualDevicesPageReloadCallback, this);
|
||||
|
||||
addDeviceMenu = new QMenu(this);
|
||||
ui->addDeviceButton->setMenu(addDeviceMenu);
|
||||
connect(addDeviceMenu, &QMenu::triggered, this, &ManualDevicesSettingsPage::onAddDeviceItemSelected);
|
||||
|
||||
QMenu* saveButtonMenu = new QMenu(this);
|
||||
saveButtonMenu->addAction(ui->ActionSaveAndRescan);
|
||||
saveButtonMenu->addAction(ui->ActionSaveNoRescan);
|
||||
ui->saveConfigurationButton->setMenu(saveButtonMenu);
|
||||
ui->saveConfigurationButton->setDefaultAction(ui->ActionSaveAndRescan);
|
||||
|
||||
reloadList();
|
||||
}
|
||||
|
||||
ManualDevicesSettingsPage::~ManualDevicesSettingsPage()
|
||||
{
|
||||
ResourceManager::get()->UnregisterDetectionEndCallback(&ManualDevicesPageReloadCallback, this);
|
||||
clearList();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ManualDevicesSettingsPage::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
reloadMenu();
|
||||
}
|
||||
}
|
||||
|
||||
void ManualDevicesSettingsPage::on_removeDeviceButton_clicked()
|
||||
{
|
||||
int cur_row = ui->deviceList->currentRow();
|
||||
|
||||
if(cur_row < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* item = ui->deviceList->takeItem(cur_row);
|
||||
|
||||
ui->deviceList->removeItemWidget(item);
|
||||
delete item;
|
||||
|
||||
BaseManualDeviceEntry* entry = entries[cur_row];
|
||||
entries.erase(entries.begin() + cur_row);
|
||||
delete entry;
|
||||
|
||||
setUnsavedChanges(true);
|
||||
}
|
||||
|
||||
void ManualDevicesSettingsPage::saveSettings()
|
||||
{
|
||||
SettingsManager* sm = ResourceManager::get()->GetSettingsManager();
|
||||
|
||||
json result;
|
||||
|
||||
/*-----------------------------------------------------------------------------*\
|
||||
| First, cache the data that will be stored as JSON |
|
||||
| We wrap data into arrays by type (except Nanoleaf) |
|
||||
| Nanoleaf stores it's data as an object with "location" as key for some reason |
|
||||
\*-----------------------------------------------------------------------------*/
|
||||
for(size_t idx = 0; idx < entries.size(); ++idx)
|
||||
{
|
||||
std::string section = entries[idx]->getSettingsSection();
|
||||
if(section == "NanoleafDevices")
|
||||
{
|
||||
NanoleafSettingsEntry* entry = dynamic_cast<NanoleafSettingsEntry*>(entries[idx]);
|
||||
result[section]["devices"][entry->getLocation()] = entries[idx]->saveSettings();
|
||||
}
|
||||
else if(section == "PhilipsHueDevices")
|
||||
{
|
||||
result[section]["bridges"].push_back(entries[idx]->saveSettings());
|
||||
}
|
||||
else
|
||||
{
|
||||
result[section]["devices"].push_back(entries[idx]->saveSettings());
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Transfer data from the cached object into config sections |
|
||||
| Use ALL possible settings entry names, so that those with |
|
||||
| all entries deleted are cleared properly |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
std::vector<ManualDeviceTypeBlock> blocks = ManualDevicesTypeManager::get()->getRegisteredTypes();
|
||||
for(int i = 0; i < blocks.size(); ++i)
|
||||
{
|
||||
sm->SetSettings(blocks[i].settingsSection, result[blocks[i].settingsSection]);
|
||||
}
|
||||
sm->SaveSettings();
|
||||
|
||||
setUnsavedChanges(false);
|
||||
}
|
||||
|
||||
void ManualDevicesSettingsPage::reloadMenu()
|
||||
{
|
||||
std::vector<std::string> names = ManualDevicesTypeManager::get()->getRegisteredTypeNames();
|
||||
|
||||
addDeviceMenu->clear();
|
||||
for(int i = 0; i < names.size(); ++i)
|
||||
{
|
||||
QAction* action = addDeviceMenu->addAction(qApp->translate("ManualDevice", names[i].c_str()));
|
||||
action->setData(QString::fromStdString(names[i]));
|
||||
}
|
||||
}
|
||||
|
||||
void ManualDevicesSettingsPage::reloadList()
|
||||
{
|
||||
clearList();
|
||||
addDeviceMenu->clear();
|
||||
|
||||
std::vector<ManualDeviceTypeBlock> blocks = ManualDevicesTypeManager::get()->getRegisteredTypes();
|
||||
for(int i = 0; i < blocks.size(); ++i)
|
||||
{
|
||||
addEntries(blocks[i]);
|
||||
|
||||
/*------------------------------------------------------------*\
|
||||
| While we have all the data at hand, load in the menu as well |
|
||||
\*------------------------------------------------------------*/
|
||||
QAction* action = addDeviceMenu->addAction(qApp->translate("ManualDevice", blocks[i].name.c_str()));
|
||||
action->setData(QString::fromStdString(blocks[i].name));
|
||||
}
|
||||
|
||||
/*--------------------*\
|
||||
| Refresh button state |
|
||||
\*--------------------*/
|
||||
setUnsavedChanges(false);
|
||||
on_deviceList_itemSelectionChanged();
|
||||
}
|
||||
|
||||
void ManualDevicesSettingsPage::onTextEditChanged()
|
||||
{
|
||||
setUnsavedChanges(true);
|
||||
}
|
||||
|
||||
void ManualDevicesSettingsPage::clearList()
|
||||
{
|
||||
std::vector<BaseManualDeviceEntry*> entries_copy;
|
||||
entries_copy.swap(entries);
|
||||
ui->deviceList->clear();
|
||||
|
||||
for(int i = 0; i < entries_copy.size(); ++i)
|
||||
{
|
||||
delete entries_copy[i];
|
||||
}
|
||||
entries_copy.clear();
|
||||
setUnsavedChanges(true);
|
||||
}
|
||||
|
||||
void ManualDevicesSettingsPage::setUnsavedChanges(bool v)
|
||||
{
|
||||
unsavedChanges = v;
|
||||
ui->saveConfigurationButton->setEnabled(v && checkValidToSave());
|
||||
if(v)
|
||||
{
|
||||
ui->saveConfigurationButton->setStyleSheet("font: bold");
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->saveConfigurationButton->setStyleSheet("");
|
||||
}
|
||||
}
|
||||
|
||||
bool ManualDevicesSettingsPage::checkValidToSave()
|
||||
{
|
||||
for(int i = 0; i < entries.size(); ++i)
|
||||
{
|
||||
if(!entries[i]->isDataValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QListWidgetItem* ManualDevicesSettingsPage::addEntry(BaseManualDeviceEntry* entry)
|
||||
{
|
||||
if(!entry)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Find EVERY QLineEdit in the entry and get notified if ANY |
|
||||
| text in them changes - for validation |
|
||||
| Validation mostly affects the "Save" button state |
|
||||
\*---------------------------------------------------------*/
|
||||
QList<QLineEdit*> textEditList = entry->findChildren<QLineEdit*>(QString(), Qt::FindChildrenRecursively);
|
||||
for(int i = 0; i < textEditList.size(); ++i)
|
||||
{
|
||||
connect(textEditList[i], &QLineEdit::textChanged, this, &ManualDevicesSettingsPage::onTextEditChanged);
|
||||
}
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->deviceList->addItem(item);
|
||||
ui->deviceList->setItemWidget(item, entry);
|
||||
ui->deviceList->show();
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| New entries generally indicate unsaved changes |
|
||||
\*---------------------------------------------------------*/
|
||||
setUnsavedChanges(true);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
void ManualDevicesSettingsPage::addEntries(const ManualDeviceTypeBlock& block)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Spawn list entries for all config entries of one type |
|
||||
\*---------------------------------------------------------*/
|
||||
json settings = ResourceManager::get()->GetSettingsManager()->GetSettings(block.settingsSection);
|
||||
const char* array_name = "devices";
|
||||
if(block.settingsSection == "PhilipsHueDevices")
|
||||
{
|
||||
array_name = "bridges";
|
||||
}
|
||||
|
||||
if(settings.contains(array_name))
|
||||
{
|
||||
json& array_ref = settings[array_name];
|
||||
|
||||
if(!array_ref.is_array() && !array_ref.is_object())
|
||||
{
|
||||
return;
|
||||
}
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Nanoleaf stores it's data as objects with location field as "key" |
|
||||
| everything else is arrays |
|
||||
| For uniformity, use iterators, as if it's always an object |
|
||||
\*-----------------------------------------------------------------*/
|
||||
for(json::const_iterator iter = array_ref.begin(); iter != array_ref.end(); ++iter)
|
||||
{
|
||||
if(!iter.value().empty())
|
||||
{
|
||||
BaseManualDeviceEntry* entry = block.spawn(iter.value());
|
||||
|
||||
/*---------------------------------------------------*\
|
||||
| Note: spawn functions are allowed to return nullptr |
|
||||
\*---------------------------------------------------*/
|
||||
if(entry)
|
||||
{
|
||||
addEntry(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ManualDevicesSettingsPage::onAddDeviceItemSelected(QAction* action)
|
||||
{
|
||||
std::string entryName = action->data().toString().toStdString();
|
||||
BaseManualDeviceEntry* entry = ManualDevicesTypeManager::get()->spawnByTypeName(entryName, json());
|
||||
/*---------------------------------------------------*\
|
||||
| Note: spawn functions are allowed to return nullptr |
|
||||
\*---------------------------------------------------*/
|
||||
if(entry)
|
||||
{
|
||||
QListWidgetItem* item = addEntry(entry);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Scroll to the newly added entry (last one in the list |
|
||||
\*-----------------------------------------------------*/
|
||||
if(item)
|
||||
{
|
||||
ui->deviceList->scrollToItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ManualDevicesSettingsPage::on_deviceList_itemSelectionChanged()
|
||||
{
|
||||
int cur_row = ui->deviceList->currentRow();
|
||||
|
||||
bool anySelected = (cur_row >= 0);
|
||||
ui->removeDeviceButton->setEnabled(anySelected);
|
||||
}
|
||||
|
||||
void ManualDevicesSettingsPage::on_ActionSaveNoRescan_triggered()
|
||||
{
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
void ManualDevicesSettingsPage::on_ActionSaveAndRescan_triggered()
|
||||
{
|
||||
saveSettings();
|
||||
/*---------------*\
|
||||
| Trigger rescan |
|
||||
\*--------------*/
|
||||
ResourceManager::get()->DetectDevices();
|
||||
}
|
||||
|
||||
@ -0,0 +1,61 @@
|
||||
/*-----------------------------------------------------------------*\
|
||||
| ManualDevicesSettingsPage.h |
|
||||
| |
|
||||
| User interface for OpenRGB Manually Added Devices settings page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*-----------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "BaseManualDeviceEntry.h"
|
||||
#include "ManualDevicesTypeManager.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
#include <QWidget>
|
||||
#include <QMenu>
|
||||
#include <QListWidgetItem>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ManualDevicesSettingsPage;
|
||||
}
|
||||
|
||||
class ManualDevicesSettingsPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ManualDevicesSettingsPage(QWidget *parent = nullptr);
|
||||
~ManualDevicesSettingsPage();
|
||||
|
||||
public slots:
|
||||
void reloadList();
|
||||
void reloadMenu();
|
||||
|
||||
private slots:
|
||||
void onTextEditChanged(); // Slot connected to all text edits in all entries; for validation & marking dirty changes
|
||||
void onAddDeviceItemSelected(QAction* action);
|
||||
|
||||
void changeEvent(QEvent *event);
|
||||
|
||||
void on_removeDeviceButton_clicked();
|
||||
void on_deviceList_itemSelectionChanged();
|
||||
void on_ActionSaveNoRescan_triggered();
|
||||
void on_ActionSaveAndRescan_triggered();
|
||||
|
||||
private:
|
||||
Ui::ManualDevicesSettingsPage* ui;
|
||||
std::vector<BaseManualDeviceEntry*> entries;
|
||||
QMenu* addDeviceMenu;
|
||||
bool unsavedChanges;
|
||||
|
||||
QListWidgetItem* addEntry(BaseManualDeviceEntry* entry);
|
||||
void addEntries(const ManualDeviceTypeBlock&);
|
||||
void clearList();
|
||||
void saveSettings();
|
||||
void setUnsavedChanges(bool v);
|
||||
bool checkValidToSave();
|
||||
};
|
||||
@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ManualDevicesSettingsPage</class>
|
||||
<widget class="QWidget" name="ManualDevicesSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Manually Added Devices Settings Page</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="deviceList">
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="addDeviceButton">
|
||||
<property name="text">
|
||||
<string>Add Device...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeDeviceButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="saveConfigurationButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save and Rescan</string>
|
||||
</property>
|
||||
<property name="popupMode">
|
||||
<enum>QToolButton::MenuButtonPopup</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
<action name="ActionSaveAndRescan">
|
||||
<property name="text">
|
||||
<string>Save and Rescan</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="ActionSaveNoRescan">
|
||||
<property name="text">
|
||||
<string>Save without Rescan</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -0,0 +1,80 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| ManualDevicesTypeManager.cpp |
|
||||
| |
|
||||
| OpenRGB Manual Devices Type Manager registers available |
|
||||
| types of Manually Added devices and generates UI |
|
||||
| elements for their settings |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "ManualDevicesTypeManager.h"
|
||||
|
||||
ManualDeviceTypeBlock::ManualDeviceTypeBlock(const std::string& _name, const std::string& _settingsSection, ManualDeviceEntrySpawnFunction _entrySpawnFunction)
|
||||
{
|
||||
name = _name;
|
||||
settingsSection = _settingsSection;
|
||||
entrySpawnFunction = _entrySpawnFunction;
|
||||
}
|
||||
|
||||
BaseManualDeviceEntry* ManualDeviceTypeBlock::spawn(const json& data) const
|
||||
{
|
||||
BaseManualDeviceEntry* result = entrySpawnFunction(data);
|
||||
if(result)
|
||||
{
|
||||
result->setSettingsSection(settingsSection);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ManualDevicesTypeManager* ManualDevicesTypeManager::instance;
|
||||
|
||||
ManualDevicesTypeManager *ManualDevicesTypeManager::get()
|
||||
{
|
||||
if(!instance)
|
||||
{
|
||||
instance = new ManualDevicesTypeManager();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
ManualDevicesTypeManager::ManualDevicesTypeManager()
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
void ManualDevicesTypeManager::registerType(const std::string& name, const std::string& settingsSection, ManualDeviceEntrySpawnFunction entrySpawnFunction)
|
||||
{
|
||||
types.push_back(ManualDeviceTypeBlock(name, settingsSection, entrySpawnFunction));
|
||||
}
|
||||
|
||||
std::vector<ManualDeviceTypeBlock> ManualDevicesTypeManager::getRegisteredTypes()
|
||||
{
|
||||
return types;
|
||||
}
|
||||
|
||||
std::vector<std::string> ManualDevicesTypeManager::getRegisteredTypeNames()
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
result.resize(types.size());
|
||||
|
||||
for(int i = 0; i < types.size(); ++i)
|
||||
{
|
||||
result[i] = types[i].name;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
BaseManualDeviceEntry* ManualDevicesTypeManager::spawnByTypeName(const std::string& typeName, const json& data)
|
||||
{
|
||||
for(int i = 0; i < types.size(); ++i)
|
||||
{
|
||||
if(types[i].name == typeName)
|
||||
{
|
||||
return types[i].spawn(data);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| ManualDevicesTypeManager.h |
|
||||
| |
|
||||
| OpenRGB Manual Devices Type Manager registers UI |
|
||||
| classes for managing Manually Added devices |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "BaseManualDeviceEntry.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
|
||||
class ManualDeviceTypeBlock
|
||||
{
|
||||
public:
|
||||
ManualDeviceTypeBlock(const std::string& name, const std::string& settingsSection, ManualDeviceEntrySpawnFunction entrySpawnFunction);
|
||||
std::string name; // Name as listed in the drop-down list
|
||||
std::string settingsSection; // Settings Section name, as listed in Config file
|
||||
BaseManualDeviceEntry* spawn(const json &data) const;
|
||||
|
||||
private:
|
||||
ManualDeviceEntrySpawnFunction entrySpawnFunction;
|
||||
};
|
||||
|
||||
class ManualDevicesTypeManager
|
||||
{
|
||||
public:
|
||||
static ManualDevicesTypeManager* get();
|
||||
void registerType(const std::string& name, const std::string& settingsSection, ManualDeviceEntrySpawnFunction entrySpawnFunction);
|
||||
|
||||
std::vector<ManualDeviceTypeBlock> getRegisteredTypes();
|
||||
std::vector<std::string> getRegisteredTypeNames();
|
||||
BaseManualDeviceEntry* spawnByTypeName(const std::string& typeName, const json& data);
|
||||
|
||||
private:
|
||||
static ManualDevicesTypeManager* instance;
|
||||
std::vector<ManualDeviceTypeBlock> types;
|
||||
|
||||
ManualDevicesTypeManager();
|
||||
};
|
||||
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>NanoleafScanDialog</class>
|
||||
<widget class="QDialog" name="NanoleafScanDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Nanoleaf Scan Page</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="SyncLabel">
|
||||
<property name="text">
|
||||
<string>To pair, hold the on-off button down for 5-7 seconds until the LED starts flashing in a pattern, a new entry should appear in the list below, then click the "Pair" button on the entry within 30 seconds.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="NanoleafDeviceList">
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="ScanForNanoleafDevicesButton">
|
||||
<property name="text">
|
||||
<string>Scan</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="AddNanoleafDeviceButton">
|
||||
<property name="text">
|
||||
<string>Add manually</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="RemoveNanoleafDeviceButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,115 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBDMXSettingsPage.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB DMX settings page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "OpenRGBDMXSettingsPage.h"
|
||||
#include "ui_OpenRGBDMXSettingsPage.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "SettingsManager.h"
|
||||
|
||||
OpenRGBDMXSettingsPage::OpenRGBDMXSettingsPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBDMXSettingsPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
json dmx_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get DMX settings from settings manager |
|
||||
\*-------------------------------------------------*/
|
||||
dmx_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("DMXDevices");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the DMX settings contains devices, process |
|
||||
\*-------------------------------------------------*/
|
||||
if(dmx_settings.contains("devices"))
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < dmx_settings["devices"].size(); device_idx++)
|
||||
{
|
||||
OpenRGBDMXSettingsEntry* entry = new OpenRGBDMXSettingsEntry;
|
||||
|
||||
entry->loadFromSettings(dmx_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->DMXDeviceList->addItem(item);
|
||||
ui->DMXDeviceList->setItemWidget(item, entry);
|
||||
ui->DMXDeviceList->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OpenRGBDMXSettingsPage::~OpenRGBDMXSettingsPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBDMXSettingsPage::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBDMXSettingsPage::on_AddDMXDeviceButton_clicked()
|
||||
{
|
||||
OpenRGBDMXSettingsEntry* entry = new OpenRGBDMXSettingsEntry;
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->DMXDeviceList->addItem(item);
|
||||
ui->DMXDeviceList->setItemWidget(item, entry);
|
||||
ui->DMXDeviceList->show();
|
||||
}
|
||||
|
||||
void OpenRGBDMXSettingsPage::on_RemoveDMXDeviceButton_clicked()
|
||||
{
|
||||
int cur_row = ui->DMXDeviceList->currentRow();
|
||||
|
||||
if(cur_row < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* item = ui->DMXDeviceList->takeItem(cur_row);
|
||||
|
||||
ui->DMXDeviceList->removeItemWidget(item);
|
||||
delete item;
|
||||
|
||||
delete entries[cur_row];
|
||||
entries.erase(entries.begin() + cur_row);
|
||||
}
|
||||
|
||||
void OpenRGBDMXSettingsPage::on_SaveDMXConfigurationButton_clicked()
|
||||
{
|
||||
json dmx_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get DMX settings from settings manager |
|
||||
\*-------------------------------------------------*/
|
||||
dmx_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("DMXDevices");
|
||||
|
||||
dmx_settings["devices"].clear();
|
||||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
dmx_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("DMXDevices", dmx_settings);
|
||||
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBDMXSettingsPage.h |
|
||||
| |
|
||||
| User interface for OpenRGB DMX settings page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "OpenRGBDMXSettingsEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBDMXSettingsPage;
|
||||
}
|
||||
|
||||
class OpenRGBDMXSettingsPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBDMXSettingsPage(QWidget *parent = nullptr);
|
||||
~OpenRGBDMXSettingsPage();
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
void on_AddDMXDeviceButton_clicked();
|
||||
|
||||
void on_RemoveDMXDeviceButton_clicked();
|
||||
|
||||
void on_SaveDMXConfigurationButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBDMXSettingsPage* ui;
|
||||
std::vector<OpenRGBDMXSettingsEntry*> entries;
|
||||
|
||||
};
|
||||
@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBDMXSettingsPage</class>
|
||||
<widget class="QWidget" name="OpenRGBDMXSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">DMX Settings Page</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="AddDMXDeviceButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="RemoveDMXDeviceButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="SaveDMXConfigurationButton">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="DMXDeviceList">
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,115 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBE131SettingsPage.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB E1.31 settings page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "OpenRGBE131SettingsPage.h"
|
||||
#include "ui_OpenRGBE131SettingsPage.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "SettingsManager.h"
|
||||
|
||||
OpenRGBE131SettingsPage::OpenRGBE131SettingsPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBE131SettingsPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
json e131_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get E1.31 settings from settings manager |
|
||||
\*-------------------------------------------------*/
|
||||
e131_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("E131Devices");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the E1.31 settings contains devices, process |
|
||||
\*-------------------------------------------------*/
|
||||
if(e131_settings.contains("devices"))
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < e131_settings["devices"].size(); device_idx++)
|
||||
{
|
||||
OpenRGBE131SettingsEntry* entry = new OpenRGBE131SettingsEntry;
|
||||
|
||||
entry->loadFromSettings(e131_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->E131DeviceList->addItem(item);
|
||||
ui->E131DeviceList->setItemWidget(item, entry);
|
||||
ui->E131DeviceList->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OpenRGBE131SettingsPage::~OpenRGBE131SettingsPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBE131SettingsPage::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBE131SettingsPage::on_AddE131DeviceButton_clicked()
|
||||
{
|
||||
OpenRGBE131SettingsEntry* entry = new OpenRGBE131SettingsEntry;
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->E131DeviceList->addItem(item);
|
||||
ui->E131DeviceList->setItemWidget(item, entry);
|
||||
ui->E131DeviceList->show();
|
||||
}
|
||||
|
||||
void OpenRGBE131SettingsPage::on_RemoveE131DeviceButton_clicked()
|
||||
{
|
||||
int cur_row = ui->E131DeviceList->currentRow();
|
||||
|
||||
if(cur_row < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* item = ui->E131DeviceList->takeItem(cur_row);
|
||||
|
||||
ui->E131DeviceList->removeItemWidget(item);
|
||||
delete item;
|
||||
|
||||
delete entries[cur_row];
|
||||
entries.erase(entries.begin() + cur_row);
|
||||
}
|
||||
|
||||
void OpenRGBE131SettingsPage::on_SaveE131ConfigurationButton_clicked()
|
||||
{
|
||||
json e131_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get E1.31 settings from settings manager |
|
||||
\*-------------------------------------------------*/
|
||||
e131_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("E131Devices");
|
||||
|
||||
e131_settings["devices"].clear();
|
||||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
e131_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("E131Devices", e131_settings);
|
||||
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBE131SettingsPage.h |
|
||||
| |
|
||||
| User interface for OpenRGB E1.31 settings page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_OpenRGBE131SettingsPage.h"
|
||||
#include "OpenRGBE131SettingsEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBE131SettingsPage;
|
||||
}
|
||||
|
||||
class OpenRGBE131SettingsPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBE131SettingsPage(QWidget *parent = nullptr);
|
||||
~OpenRGBE131SettingsPage();
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
void on_AddE131DeviceButton_clicked();
|
||||
|
||||
void on_RemoveE131DeviceButton_clicked();
|
||||
|
||||
void on_SaveE131ConfigurationButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBE131SettingsPage *ui;
|
||||
std::vector<OpenRGBE131SettingsEntry*> entries;
|
||||
};
|
||||
@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBE131SettingsPage</class>
|
||||
<widget class="QWidget" name="OpenRGBE131SettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">E.131 Settings Page</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="AddE131DeviceButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="RemoveE131DeviceButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="SaveE131ConfigurationButton">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="E131DeviceList">
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,109 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBElgatoKeyLightSettingsPage.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB Elgato Key Light page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "OpenRGBElgatoKeyLightSettingsPage.h"
|
||||
#include "ui_OpenRGBElgatoKeyLightSettingsPage.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "SettingsManager.h"
|
||||
|
||||
OpenRGBElgatoKeyLightSettingsPage::OpenRGBElgatoKeyLightSettingsPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBElgatoKeyLightSettingsPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
json elgato_keylight_settings;
|
||||
|
||||
elgato_keylight_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("ElgatoKeyLightDevices");
|
||||
|
||||
/*---------------------------------------------------------------*\
|
||||
| If the Elgato Key Light settings contains devices, process |
|
||||
\*---------------------------------------------------------------*/
|
||||
if(elgato_keylight_settings.contains("devices"))
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < elgato_keylight_settings["devices"].size(); device_idx++)
|
||||
{
|
||||
OpenRGBElgatoKeyLightSettingsEntry* entry = new OpenRGBElgatoKeyLightSettingsEntry;
|
||||
|
||||
entry->loadFromSettings(elgato_keylight_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->ElgatoKeyLightDeviceList->addItem(item);
|
||||
ui->ElgatoKeyLightDeviceList->setItemWidget(item, entry);
|
||||
ui->ElgatoKeyLightDeviceList->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OpenRGBElgatoKeyLightSettingsPage::~OpenRGBElgatoKeyLightSettingsPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBElgatoKeyLightSettingsPage::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBElgatoKeyLightSettingsPage::on_AddElgatoKeyLightDeviceButton_clicked()
|
||||
{
|
||||
OpenRGBElgatoKeyLightSettingsEntry* entry = new OpenRGBElgatoKeyLightSettingsEntry;
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->ElgatoKeyLightDeviceList->addItem(item);
|
||||
ui->ElgatoKeyLightDeviceList->setItemWidget(item, entry);
|
||||
ui->ElgatoKeyLightDeviceList->show();
|
||||
}
|
||||
|
||||
void OpenRGBElgatoKeyLightSettingsPage::on_RemoveElgatoKeyLightDeviceButton_clicked()
|
||||
{
|
||||
int cur_row = ui->ElgatoKeyLightDeviceList->currentRow();
|
||||
|
||||
if(cur_row < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* item = ui->ElgatoKeyLightDeviceList->takeItem(cur_row);
|
||||
|
||||
ui->ElgatoKeyLightDeviceList->removeItemWidget(item);
|
||||
delete item;
|
||||
|
||||
delete entries[cur_row];
|
||||
entries.erase(entries.begin() + cur_row);
|
||||
}
|
||||
|
||||
void OpenRGBElgatoKeyLightSettingsPage::on_SaveElgatoKeyLightConfigurationButton_clicked()
|
||||
{
|
||||
json elgato_keylight_settings;
|
||||
|
||||
elgato_keylight_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("ElgatoKeyLightDevices");
|
||||
|
||||
elgato_keylight_settings["devices"].clear();
|
||||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
elgato_keylight_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("ElgatoKeyLightDevices", elgato_keylight_settings);
|
||||
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBElgatoKeyLightSettingsPage.h |
|
||||
| |
|
||||
| User interface for OpenRGB Elgato Key Light page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "OpenRGBElgatoKeyLightSettingsEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBElgatoKeyLightSettingsPage;
|
||||
}
|
||||
|
||||
class OpenRGBElgatoKeyLightSettingsPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBElgatoKeyLightSettingsPage(QWidget *parent = nullptr);
|
||||
~OpenRGBElgatoKeyLightSettingsPage();
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
void on_AddElgatoKeyLightDeviceButton_clicked();
|
||||
|
||||
void on_RemoveElgatoKeyLightDeviceButton_clicked();
|
||||
|
||||
void on_SaveElgatoKeyLightConfigurationButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBElgatoKeyLightSettingsPage *ui;
|
||||
std::vector<OpenRGBElgatoKeyLightSettingsEntry*> entries;
|
||||
};
|
||||
@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBElgatoKeyLightSettingsPage</class>
|
||||
<widget class="QWidget" name="OpenRGBElgatoKeyLightSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Elgato Key Light Settings Page</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="ElgatoKeyLightDeviceList"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="AddElgatoKeyLightDeviceButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="RemoveElgatoKeyLightDeviceButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="SaveElgatoKeyLightConfigurationButton">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,52 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBElgatoLightStripSettingsEntry.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB Elgato Light Strips entry |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "OpenRGBElgatoLightStripSettingsEntry.h"
|
||||
#include "ui_OpenRGBElgatoLightStripSettingsEntry.h"
|
||||
|
||||
OpenRGBElgatoLightStripSettingsEntry::OpenRGBElgatoLightStripSettingsEntry(QWidget *parent) :
|
||||
BaseManualDeviceEntry(parent),
|
||||
ui(new Ui::OpenRGBElgatoLightStripSettingsEntry)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
}
|
||||
|
||||
OpenRGBElgatoLightStripSettingsEntry::~OpenRGBElgatoLightStripSettingsEntry()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBElgatoLightStripSettingsEntry::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
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";
|
||||
}
|
||||
@ -1,109 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBElgatoLightStripSettingsPage.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB Elgato Light Strips page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "OpenRGBElgatoLightStripSettingsPage.h"
|
||||
#include "ui_OpenRGBElgatoLightStripSettingsPage.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "SettingsManager.h"
|
||||
|
||||
OpenRGBElgatoLightStripSettingsPage::OpenRGBElgatoLightStripSettingsPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBElgatoLightStripSettingsPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
json elgato_lightstrip_settings;
|
||||
|
||||
elgato_lightstrip_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("ElgatoLightStripDevices");
|
||||
|
||||
/*---------------------------------------------------------------*\
|
||||
| If the Elgato Light Strip settings contains devices, process |
|
||||
\*---------------------------------------------------------------*/
|
||||
if(elgato_lightstrip_settings.contains("devices"))
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < elgato_lightstrip_settings["devices"].size(); device_idx++)
|
||||
{
|
||||
OpenRGBElgatoLightStripSettingsEntry* entry = new OpenRGBElgatoLightStripSettingsEntry;
|
||||
|
||||
entry->loadFromSettings(elgato_lightstrip_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->ElgatoLightStripDeviceList->addItem(item);
|
||||
ui->ElgatoLightStripDeviceList->setItemWidget(item, entry);
|
||||
ui->ElgatoLightStripDeviceList->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OpenRGBElgatoLightStripSettingsPage::~OpenRGBElgatoLightStripSettingsPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBElgatoLightStripSettingsPage::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBElgatoLightStripSettingsPage::on_AddElgatoLightStripDeviceButton_clicked()
|
||||
{
|
||||
OpenRGBElgatoLightStripSettingsEntry* entry = new OpenRGBElgatoLightStripSettingsEntry;
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->ElgatoLightStripDeviceList->addItem(item);
|
||||
ui->ElgatoLightStripDeviceList->setItemWidget(item, entry);
|
||||
ui->ElgatoLightStripDeviceList->show();
|
||||
}
|
||||
|
||||
void OpenRGBElgatoLightStripSettingsPage::on_RemoveElgatoLightStripDeviceButton_clicked()
|
||||
{
|
||||
int cur_row = ui->ElgatoLightStripDeviceList->currentRow();
|
||||
|
||||
if(cur_row < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* item = ui->ElgatoLightStripDeviceList->takeItem(cur_row);
|
||||
|
||||
ui->ElgatoLightStripDeviceList->removeItemWidget(item);
|
||||
delete item;
|
||||
|
||||
delete entries[cur_row];
|
||||
entries.erase(entries.begin() + cur_row);
|
||||
}
|
||||
|
||||
void OpenRGBElgatoLightStripSettingsPage::on_SaveElgatoLightStripConfigurationButton_clicked()
|
||||
{
|
||||
json elgato_lightstrip_settings;
|
||||
|
||||
elgato_lightstrip_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("ElgatoLightStripDevices");
|
||||
|
||||
elgato_lightstrip_settings["devices"].clear();
|
||||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
elgato_lightstrip_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("ElgatoLightStripDevices", elgato_lightstrip_settings);
|
||||
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBElgatoLightStripSettingsPage.h |
|
||||
| |
|
||||
| User interface for OpenRGB Elgato Light Strips page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "OpenRGBElgatoLightStripSettingsEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBElgatoLightStripSettingsPage;
|
||||
}
|
||||
|
||||
class OpenRGBElgatoLightStripSettingsPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBElgatoLightStripSettingsPage(QWidget *parent = nullptr);
|
||||
~OpenRGBElgatoLightStripSettingsPage();
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
void on_AddElgatoLightStripDeviceButton_clicked();
|
||||
|
||||
void on_RemoveElgatoLightStripDeviceButton_clicked();
|
||||
|
||||
void on_SaveElgatoLightStripConfigurationButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBElgatoLightStripSettingsPage *ui;
|
||||
std::vector<OpenRGBElgatoLightStripSettingsEntry*> entries;
|
||||
};
|
||||
@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBElgatoLightStripSettingsPage</class>
|
||||
<widget class="QWidget" name="OpenRGBElgatoLightStripSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Elgato Light Strip Settings Page</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="ElgatoLightStripDeviceList"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="AddElgatoLightStripDeviceButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="RemoveElgatoLightStripDeviceButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="SaveElgatoLightStripConfigurationButton">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,117 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBGoveeSettingsPage.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB Govee settings page |
|
||||
| |
|
||||
| Adam Honse (calcprogrammer1@gmail.com) 15 May 2025 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "OpenRGBGoveeSettingsPage.h"
|
||||
#include "ui_OpenRGBGoveeSettingsPage.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "SettingsManager.h"
|
||||
|
||||
OpenRGBGoveeSettingsPage::OpenRGBGoveeSettingsPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBGoveeSettingsPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
json govee_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get Govee settings |
|
||||
\*-------------------------------------------------*/
|
||||
govee_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("GoveeDevices");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the Govee settings contains devices, process |
|
||||
\*-------------------------------------------------*/
|
||||
if(govee_settings.contains("devices"))
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < govee_settings["devices"].size(); device_idx++)
|
||||
{
|
||||
OpenRGBGoveeSettingsEntry* entry = new OpenRGBGoveeSettingsEntry;
|
||||
|
||||
entry->loadFromSettings(govee_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->GoveeDeviceList->addItem(item);
|
||||
ui->GoveeDeviceList->setItemWidget(item, entry);
|
||||
ui->GoveeDeviceList->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OpenRGBGoveeSettingsPage::~OpenRGBGoveeSettingsPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBGoveeSettingsPage::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBGoveeSettingsPage::on_AddGoveeDeviceButton_clicked()
|
||||
{
|
||||
OpenRGBGoveeSettingsEntry* entry = new OpenRGBGoveeSettingsEntry;
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->GoveeDeviceList->addItem(item);
|
||||
ui->GoveeDeviceList->setItemWidget(item, entry);
|
||||
ui->GoveeDeviceList->show();
|
||||
}
|
||||
|
||||
void OpenRGBGoveeSettingsPage::on_RemoveGoveeDeviceButton_clicked()
|
||||
{
|
||||
int cur_row = ui->GoveeDeviceList->currentRow();
|
||||
|
||||
if(cur_row < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* item = ui->GoveeDeviceList->takeItem(cur_row);
|
||||
|
||||
ui->GoveeDeviceList->removeItemWidget(item);
|
||||
delete item;
|
||||
|
||||
delete entries[cur_row];
|
||||
entries.erase(entries.begin() + cur_row);
|
||||
}
|
||||
|
||||
void OpenRGBGoveeSettingsPage::on_SaveGoveeConfigurationButton_clicked()
|
||||
{
|
||||
json govee_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get Govee settings |
|
||||
\*-------------------------------------------------*/
|
||||
govee_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("GoveeDevices");
|
||||
|
||||
govee_settings["devices"].clear();
|
||||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
govee_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("GoveeDevices", govee_settings);
|
||||
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBGoveeSettingsPage.h |
|
||||
| |
|
||||
| User interface for OpenRGB Govee settings page |
|
||||
| |
|
||||
| Adam Honse (calcprogrammer1@gmail.com) 15 May 2025 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "OpenRGBGoveeSettingsEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBGoveeSettingsPage;
|
||||
}
|
||||
|
||||
class OpenRGBGoveeSettingsPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBGoveeSettingsPage(QWidget *parent = nullptr);
|
||||
~OpenRGBGoveeSettingsPage();
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
void on_AddGoveeDeviceButton_clicked();
|
||||
|
||||
void on_RemoveGoveeDeviceButton_clicked();
|
||||
|
||||
void on_SaveGoveeConfigurationButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBGoveeSettingsPage *ui;
|
||||
std::vector<OpenRGBGoveeSettingsEntry*> entries;
|
||||
|
||||
};
|
||||
@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBGoveeSettingsPage</class>
|
||||
<widget class="QWidget" name="OpenRGBGoveeSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Philips Wiz Settings Page</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="AddGoveeDeviceButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="RemoveGoveeDeviceButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="SaveGoveeConfigurationButton">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="GoveeDeviceList">
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,121 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBKasaSmartSettingsPage.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB Kasa Smart settings page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "OpenRGBKasaSmartSettingsPage.h"
|
||||
#include "ui_OpenRGBKasaSmartSettingsPage.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "SettingsManager.h"
|
||||
|
||||
OpenRGBKasaSmartSettingsPage::OpenRGBKasaSmartSettingsPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBKasaSmartSettingsPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
json KasaSmart_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get KasaSmart settings |
|
||||
\*-------------------------------------------------*/
|
||||
KasaSmart_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("KasaSmartDevices");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the Wiz settings contains devices, process |
|
||||
\*-------------------------------------------------*/
|
||||
if(KasaSmart_settings.contains("devices"))
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < KasaSmart_settings["devices"].size(); device_idx++)
|
||||
{
|
||||
OpenRGBKasaSmartSettingsEntry* entry = new OpenRGBKasaSmartSettingsEntry;
|
||||
|
||||
entry->loadFromSettings(KasaSmart_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->KasaSmartDeviceList->addItem(item);
|
||||
ui->KasaSmartDeviceList->setItemWidget(item, entry);
|
||||
ui->KasaSmartDeviceList->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OpenRGBKasaSmartSettingsPage::~OpenRGBKasaSmartSettingsPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBKasaSmartSettingsPage::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBKasaSmartSettingsPage::on_AddKasaSmartDeviceButton_clicked()
|
||||
{
|
||||
OpenRGBKasaSmartSettingsEntry* entry = new OpenRGBKasaSmartSettingsEntry;
|
||||
|
||||
entry->setName(QString("KasaSmart%1").arg(entries.size()));
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->KasaSmartDeviceList->addItem(item);
|
||||
ui->KasaSmartDeviceList->setItemWidget(item, entry);
|
||||
ui->KasaSmartDeviceList->show();
|
||||
}
|
||||
|
||||
void OpenRGBKasaSmartSettingsPage::on_RemoveKasaSmartDeviceButton_clicked()
|
||||
{
|
||||
int cur_row = ui->KasaSmartDeviceList->currentRow();
|
||||
|
||||
if(cur_row < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* item = ui->KasaSmartDeviceList->takeItem(cur_row);
|
||||
|
||||
ui->KasaSmartDeviceList->removeItemWidget(item);
|
||||
delete item;
|
||||
|
||||
delete entries[cur_row];
|
||||
entries.erase(entries.begin() + cur_row);
|
||||
}
|
||||
|
||||
void OpenRGBKasaSmartSettingsPage::on_SaveKasaSmartConfigurationButton_clicked()
|
||||
{
|
||||
json KasaSmart_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get KasaSmart settings |
|
||||
\*-------------------------------------------------*/
|
||||
KasaSmart_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("KasaSmartDevices");
|
||||
|
||||
KasaSmart_settings["devices"].clear();
|
||||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
KasaSmart_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("KasaSmartDevices", KasaSmart_settings);
|
||||
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBKasaSmartSettingsPage.h |
|
||||
| |
|
||||
| User interface for OpenRGB Kasa Smart settings page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <QWidget>
|
||||
#include "OpenRGBKasaSmartSettingsEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBKasaSmartSettingsPage;
|
||||
}
|
||||
|
||||
class OpenRGBKasaSmartSettingsPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBKasaSmartSettingsPage(QWidget *parent = nullptr);
|
||||
~OpenRGBKasaSmartSettingsPage();
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
void on_AddKasaSmartDeviceButton_clicked();
|
||||
|
||||
void on_RemoveKasaSmartDeviceButton_clicked();
|
||||
|
||||
void on_SaveKasaSmartConfigurationButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBKasaSmartSettingsPage *ui;
|
||||
std::vector<OpenRGBKasaSmartSettingsEntry*> entries;
|
||||
|
||||
};
|
||||
@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBKasaSmartSettingsPage</class>
|
||||
<widget class="QWidget" name="OpenRGBKasaSmartSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Kasa Smart Settings Page</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="AddKasaSmartDeviceButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="RemoveKasaSmartDeviceButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="SaveKasaSmartConfigurationButton">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="KasaSmartDeviceList">
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,118 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBLIFXSettingsPage.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB LIFX settings page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "OpenRGBLIFXSettingsPage.h"
|
||||
#include "ui_OpenRGBLIFXSettingsPage.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "SettingsManager.h"
|
||||
|
||||
OpenRGBLIFXSettingsPage::OpenRGBLIFXSettingsPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBLIFXSettingsPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
json lifx_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get LIFX settings |
|
||||
\*-------------------------------------------------*/
|
||||
lifx_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("LIFXDevices");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the Wiz settings contains devices, process |
|
||||
\*-------------------------------------------------*/
|
||||
if(lifx_settings.contains("devices"))
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < lifx_settings["devices"].size(); device_idx++)
|
||||
{
|
||||
OpenRGBLIFXSettingsEntry* entry = new OpenRGBLIFXSettingsEntry;
|
||||
|
||||
entry->loadFromSettings(lifx_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->LIFXDeviceList->addItem(item);
|
||||
ui->LIFXDeviceList->setItemWidget(item, entry);
|
||||
ui->LIFXDeviceList->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OpenRGBLIFXSettingsPage::~OpenRGBLIFXSettingsPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBLIFXSettingsPage::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBLIFXSettingsPage::on_AddLIFXDeviceButton_clicked()
|
||||
{
|
||||
OpenRGBLIFXSettingsEntry* entry = new OpenRGBLIFXSettingsEntry;
|
||||
|
||||
entry->setName(QString("LIFX%1").arg(entries.size()));
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->LIFXDeviceList->addItem(item);
|
||||
ui->LIFXDeviceList->setItemWidget(item, entry);
|
||||
ui->LIFXDeviceList->show();
|
||||
}
|
||||
|
||||
void OpenRGBLIFXSettingsPage::on_RemoveLIFXDeviceButton_clicked()
|
||||
{
|
||||
int cur_row = ui->LIFXDeviceList->currentRow();
|
||||
|
||||
if(cur_row < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* item = ui->LIFXDeviceList->takeItem(cur_row);
|
||||
|
||||
ui->LIFXDeviceList->removeItemWidget(item);
|
||||
delete item;
|
||||
|
||||
delete entries[cur_row];
|
||||
entries.erase(entries.begin() + cur_row);
|
||||
}
|
||||
|
||||
void OpenRGBLIFXSettingsPage::on_SaveLIFXConfigurationButton_clicked()
|
||||
{
|
||||
json lifx_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get LIFX settings |
|
||||
\*-------------------------------------------------*/
|
||||
lifx_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("LIFXDevices");
|
||||
|
||||
lifx_settings["devices"].clear();
|
||||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
lifx_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("LIFXDevices", lifx_settings);
|
||||
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBLIFXSettingsPage.h |
|
||||
| |
|
||||
| User interface for OpenRGB LIFX settings page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "OpenRGBLIFXSettingsEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBLIFXSettingsPage;
|
||||
}
|
||||
|
||||
class OpenRGBLIFXSettingsPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBLIFXSettingsPage(QWidget *parent = nullptr);
|
||||
~OpenRGBLIFXSettingsPage();
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
void on_AddLIFXDeviceButton_clicked();
|
||||
|
||||
void on_RemoveLIFXDeviceButton_clicked();
|
||||
|
||||
void on_SaveLIFXConfigurationButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBLIFXSettingsPage *ui;
|
||||
std::vector<OpenRGBLIFXSettingsEntry*> entries;
|
||||
|
||||
};
|
||||
@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBLIFXSettingsPage</class>
|
||||
<widget class="QWidget" name="OpenRGBLIFXSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">LIFX Settings Page</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="AddLIFXDeviceButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="RemoveLIFXDeviceButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="SaveLIFXConfigurationButton">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="LIFXDeviceList">
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,62 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBNanoleafSettingsPage</class>
|
||||
<widget class="QWidget" name="OpenRGBNanoleafSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Nanoleaf Settings Page</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="AddNanoleafDeviceButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="RemoveNanoleafDeviceButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="ScanForNanoleafDevicesButton">
|
||||
<property name="text">
|
||||
<string>Scan</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="NanoleafDeviceList">
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QLabel" name="SyncLabel">
|
||||
<property name="text">
|
||||
<string>To pair, hold the on-off button down for 5-7 seconds until the LED starts flashing in a pattern, then click the "Pair" button within 30 seconds.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,115 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBPhilipsHueSettingsPage.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB Philips Hue settings page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "OpenRGBPhilipsHueSettingsPage.h"
|
||||
#include "ui_OpenRGBPhilipsHueSettingsPage.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "SettingsManager.h"
|
||||
|
||||
OpenRGBPhilipsHueSettingsPage::OpenRGBPhilipsHueSettingsPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBPhilipsHueSettingsPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
json hue_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get Philips Hue settings |
|
||||
\*-------------------------------------------------*/
|
||||
hue_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("PhilipsHueDevices");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the Hue settings contains bridges, process |
|
||||
\*-------------------------------------------------*/
|
||||
if(hue_settings.contains("bridges"))
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < hue_settings["bridges"].size(); device_idx++)
|
||||
{
|
||||
OpenRGBPhilipsHueSettingsEntry* entry = new OpenRGBPhilipsHueSettingsEntry;
|
||||
|
||||
entry->loadFromSettings(hue_settings["bridges"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->PhilipsHueDeviceList->addItem(item);
|
||||
ui->PhilipsHueDeviceList->setItemWidget(item, entry);
|
||||
ui->PhilipsHueDeviceList->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OpenRGBPhilipsHueSettingsPage::~OpenRGBPhilipsHueSettingsPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBPhilipsHueSettingsPage::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBPhilipsHueSettingsPage::on_AddPhilipsHueDeviceButton_clicked()
|
||||
{
|
||||
OpenRGBPhilipsHueSettingsEntry* entry = new OpenRGBPhilipsHueSettingsEntry;
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->PhilipsHueDeviceList->addItem(item);
|
||||
ui->PhilipsHueDeviceList->setItemWidget(item, entry);
|
||||
ui->PhilipsHueDeviceList->show();
|
||||
}
|
||||
|
||||
void OpenRGBPhilipsHueSettingsPage::on_RemovePhilipsHueDeviceButton_clicked()
|
||||
{
|
||||
int cur_row = ui->PhilipsHueDeviceList->currentRow();
|
||||
|
||||
if(cur_row < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* item = ui->PhilipsHueDeviceList->takeItem(cur_row);
|
||||
|
||||
ui->PhilipsHueDeviceList->removeItemWidget(item);
|
||||
delete item;
|
||||
|
||||
delete entries[cur_row];
|
||||
entries.erase(entries.begin() + cur_row);
|
||||
}
|
||||
|
||||
void OpenRGBPhilipsHueSettingsPage::on_SavePhilipsHueConfigurationButton_clicked()
|
||||
{
|
||||
json hue_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get Philips Hue settings |
|
||||
\*-------------------------------------------------*/
|
||||
hue_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("PhilipsHueDevices");
|
||||
|
||||
hue_settings["bridges"].clear();
|
||||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
hue_settings["bridges"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("PhilipsHueDevices", hue_settings);
|
||||
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBPhilipsHueSettingsPage.h |
|
||||
| |
|
||||
| User interface for OpenRGB Philips Hue settings page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "OpenRGBPhilipsHueSettingsEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBPhilipsHueSettingsPage;
|
||||
}
|
||||
|
||||
class OpenRGBPhilipsHueSettingsPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBPhilipsHueSettingsPage(QWidget *parent = nullptr);
|
||||
~OpenRGBPhilipsHueSettingsPage();
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
void on_AddPhilipsHueDeviceButton_clicked();
|
||||
|
||||
void on_RemovePhilipsHueDeviceButton_clicked();
|
||||
|
||||
void on_SavePhilipsHueConfigurationButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBPhilipsHueSettingsPage *ui;
|
||||
std::vector<OpenRGBPhilipsHueSettingsEntry*> entries;
|
||||
};
|
||||
@ -1,62 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBPhilipsHueSettingsPage</class>
|
||||
<widget class="QWidget" name="OpenRGBPhilipsHueSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Philips Hue Settings Page</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="RemovePhilipsHueDeviceButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="AddPhilipsHueDeviceButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="PhilipsHueDeviceList">
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="SavePhilipsHueConfigurationButton">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QLabel" name="SyncLabel">
|
||||
<property name="text">
|
||||
<string>After adding a Hue entry and saving, restart OpenRGB and press the Sync button on your Hue bridge to pair it.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,115 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBPhilipsWizSettingsPage.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB Philips Wiz settings page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "OpenRGBPhilipsWizSettingsPage.h"
|
||||
#include "ui_OpenRGBPhilipsWizSettingsPage.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "SettingsManager.h"
|
||||
|
||||
OpenRGBPhilipsWizSettingsPage::OpenRGBPhilipsWizSettingsPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBPhilipsWizSettingsPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
json wiz_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get Philips Wiz settings |
|
||||
\*-------------------------------------------------*/
|
||||
wiz_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("PhilipsWizDevices");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the Wiz settings contains devices, process |
|
||||
\*-------------------------------------------------*/
|
||||
if(wiz_settings.contains("devices"))
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < wiz_settings["devices"].size(); device_idx++)
|
||||
{
|
||||
OpenRGBPhilipsWizSettingsEntry* entry = new OpenRGBPhilipsWizSettingsEntry;
|
||||
|
||||
entry->loadFromSettings(wiz_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->PhilipsWizDeviceList->addItem(item);
|
||||
ui->PhilipsWizDeviceList->setItemWidget(item, entry);
|
||||
ui->PhilipsWizDeviceList->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OpenRGBPhilipsWizSettingsPage::~OpenRGBPhilipsWizSettingsPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBPhilipsWizSettingsPage::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBPhilipsWizSettingsPage::on_AddPhilipsWizDeviceButton_clicked()
|
||||
{
|
||||
OpenRGBPhilipsWizSettingsEntry* entry = new OpenRGBPhilipsWizSettingsEntry;
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->PhilipsWizDeviceList->addItem(item);
|
||||
ui->PhilipsWizDeviceList->setItemWidget(item, entry);
|
||||
ui->PhilipsWizDeviceList->show();
|
||||
}
|
||||
|
||||
void OpenRGBPhilipsWizSettingsPage::on_RemovePhilipsWizDeviceButton_clicked()
|
||||
{
|
||||
int cur_row = ui->PhilipsWizDeviceList->currentRow();
|
||||
|
||||
if(cur_row < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* item = ui->PhilipsWizDeviceList->takeItem(cur_row);
|
||||
|
||||
ui->PhilipsWizDeviceList->removeItemWidget(item);
|
||||
delete item;
|
||||
|
||||
delete entries[cur_row];
|
||||
entries.erase(entries.begin() + cur_row);
|
||||
}
|
||||
|
||||
void OpenRGBPhilipsWizSettingsPage::on_SavePhilipsWizConfigurationButton_clicked()
|
||||
{
|
||||
json wiz_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get Philips Wiz settings |
|
||||
\*-------------------------------------------------*/
|
||||
wiz_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("PhilipsWizDevices");
|
||||
|
||||
wiz_settings["devices"].clear();
|
||||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
wiz_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("PhilipsWizDevices", wiz_settings);
|
||||
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBPhilipsWizSettingsPage.h |
|
||||
| |
|
||||
| User interface for OpenRGB Philips Wiz settings page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "OpenRGBPhilipsWizSettingsEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBPhilipsWizSettingsPage;
|
||||
}
|
||||
|
||||
class OpenRGBPhilipsWizSettingsPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBPhilipsWizSettingsPage(QWidget *parent = nullptr);
|
||||
~OpenRGBPhilipsWizSettingsPage();
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
void on_AddPhilipsWizDeviceButton_clicked();
|
||||
|
||||
void on_RemovePhilipsWizDeviceButton_clicked();
|
||||
|
||||
void on_SavePhilipsWizConfigurationButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBPhilipsWizSettingsPage *ui;
|
||||
std::vector<OpenRGBPhilipsWizSettingsEntry*> entries;
|
||||
|
||||
};
|
||||
@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBPhilipsWizSettingsPage</class>
|
||||
<widget class="QWidget" name="OpenRGBPhilipsWizSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Philips Wiz Settings Page</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="AddPhilipsWizDeviceButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="RemovePhilipsWizDeviceButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="SavePhilipsWizConfigurationButton">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="PhilipsWizDeviceList">
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,118 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBQMKORGBSettingsPage.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB QMK device configuration page|
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "OpenRGBQMKORGBSettingsPage.h"
|
||||
#include "ui_OpenRGBQMKORGBSettingsPage.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "SettingsManager.h"
|
||||
|
||||
OpenRGBQMKORGBSettingsPage::OpenRGBQMKORGBSettingsPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBQMKORGBSettingsPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
json qmk_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get QMKOpenRGB settings |
|
||||
\*-------------------------------------------------*/
|
||||
qmk_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("QMKOpenRGBDevices");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the LEDStrip settings contains devices, process|
|
||||
\*-------------------------------------------------*/
|
||||
if(qmk_settings.contains("devices"))
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < qmk_settings["devices"].size(); device_idx++)
|
||||
{
|
||||
OpenRGBQMKORGBSettingsEntry* entry = new OpenRGBQMKORGBSettingsEntry;
|
||||
|
||||
entry->loadFromSettings(qmk_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->QMKORGBDeviceList->addItem(item);
|
||||
ui->QMKORGBDeviceList->setItemWidget(item, entry);
|
||||
ui->QMKORGBDeviceList->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OpenRGBQMKORGBSettingsPage::~OpenRGBQMKORGBSettingsPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBQMKORGBSettingsPage::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBQMKORGBSettingsPage::on_AddQMKORGBDeviceButton_clicked()
|
||||
{
|
||||
OpenRGBQMKORGBSettingsEntry* entry = new OpenRGBQMKORGBSettingsEntry;
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->QMKORGBDeviceList->addItem(item);
|
||||
ui->QMKORGBDeviceList->setItemWidget(item, entry);
|
||||
ui->QMKORGBDeviceList->show();
|
||||
}
|
||||
|
||||
void OpenRGBQMKORGBSettingsPage::on_RemoveQMKORGBDeviceButton_clicked()
|
||||
{
|
||||
int cur_row = ui->QMKORGBDeviceList->currentRow();
|
||||
|
||||
if(cur_row < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* item = ui->QMKORGBDeviceList->takeItem(cur_row);
|
||||
|
||||
ui->QMKORGBDeviceList->removeItemWidget(item);
|
||||
delete item;
|
||||
|
||||
delete entries[cur_row];
|
||||
entries.erase(entries.begin() + cur_row);
|
||||
}
|
||||
|
||||
void OpenRGBQMKORGBSettingsPage::on_SaveQMKORGBConfigurationButton_clicked()
|
||||
{
|
||||
json qmk_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get QMKOpenRGB settings |
|
||||
\*-------------------------------------------------*/
|
||||
qmk_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("QMKOpenRGBDevices");
|
||||
|
||||
qmk_settings["devices"].clear();
|
||||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Required parameters |
|
||||
\*-------------------------------------------------*/
|
||||
qmk_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("QMKOpenRGBDevices", qmk_settings);
|
||||
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBQMKORGBSettingsPage.h |
|
||||
| |
|
||||
| User interface for OpenRGB QMK device configuration page|
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "OpenRGBQMKORGBSettingsEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBQMKORGBSettingsPage;
|
||||
}
|
||||
|
||||
class OpenRGBQMKORGBSettingsPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBQMKORGBSettingsPage(QWidget *parent = nullptr);
|
||||
~OpenRGBQMKORGBSettingsPage();
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
void on_AddQMKORGBDeviceButton_clicked();
|
||||
|
||||
void on_RemoveQMKORGBDeviceButton_clicked();
|
||||
|
||||
void on_SaveQMKORGBConfigurationButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBQMKORGBSettingsPage *ui;
|
||||
std::vector<OpenRGBQMKORGBSettingsEntry*> entries;
|
||||
|
||||
};
|
||||
@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBQMKORGBSettingsPage</class>
|
||||
<widget class="QWidget" name="OpenRGBQMKORGBSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">OpenRGB QMK Settings Page</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="AddQMKORGBDeviceButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="RemoveQMKORGBDeviceButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="SaveQMKORGBConfigurationButton">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="QMKORGBDeviceList">
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,115 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBSerialSettingsPage.cpp |
|
||||
| |
|
||||
| User interface for serial device configuration page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "OpenRGBSerialSettingsPage.h"
|
||||
#include "ui_OpenRGBSerialSettingsPage.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "SettingsManager.h"
|
||||
|
||||
OpenRGBSerialSettingsPage::OpenRGBSerialSettingsPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBSerialSettingsPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
json ledstrip_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get LED Strip settings from settings manager |
|
||||
\*-------------------------------------------------*/
|
||||
ledstrip_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("LEDStripDevices");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the LEDStrip settings contains devices, process|
|
||||
\*-------------------------------------------------*/
|
||||
if(ledstrip_settings.contains("devices"))
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < ledstrip_settings["devices"].size(); device_idx++)
|
||||
{
|
||||
OpenRGBSerialSettingsEntry* entry = new OpenRGBSerialSettingsEntry;
|
||||
|
||||
entry->loadFromSettings(ledstrip_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->SerialDeviceList->addItem(item);
|
||||
ui->SerialDeviceList->setItemWidget(item, entry);
|
||||
ui->SerialDeviceList->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OpenRGBSerialSettingsPage::~OpenRGBSerialSettingsPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBSerialSettingsPage::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBSerialSettingsPage::on_AddSerialDeviceButton_clicked()
|
||||
{
|
||||
OpenRGBSerialSettingsEntry* entry = new OpenRGBSerialSettingsEntry;
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->SerialDeviceList->addItem(item);
|
||||
ui->SerialDeviceList->setItemWidget(item, entry);
|
||||
ui->SerialDeviceList->show();
|
||||
}
|
||||
|
||||
void OpenRGBSerialSettingsPage::on_RemoveSerialDeviceButton_clicked()
|
||||
{
|
||||
int cur_row = ui->SerialDeviceList->currentRow();
|
||||
|
||||
if(cur_row < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* item = ui->SerialDeviceList->takeItem(cur_row);
|
||||
|
||||
ui->SerialDeviceList->removeItemWidget(item);
|
||||
delete item;
|
||||
|
||||
delete entries[cur_row];
|
||||
entries.erase(entries.begin() + cur_row);
|
||||
}
|
||||
|
||||
void OpenRGBSerialSettingsPage::on_SaveSerialConfigurationButton_clicked()
|
||||
{
|
||||
json ledstrip_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get E1.31 settings from settings manager |
|
||||
\*-------------------------------------------------*/
|
||||
ledstrip_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("LEDStripDevices");
|
||||
|
||||
ledstrip_settings["devices"].clear();
|
||||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
ledstrip_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("LEDStripDevices", ledstrip_settings);
|
||||
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
||||
}
|
||||
@ -1,41 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBSerialSettingsPage.h |
|
||||
| |
|
||||
| User interface for serial device configuration page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "OpenRGBSerialSettingsEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBSerialSettingsPage;
|
||||
}
|
||||
|
||||
class OpenRGBSerialSettingsPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBSerialSettingsPage(QWidget *parent = nullptr);
|
||||
~OpenRGBSerialSettingsPage();
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
void on_AddSerialDeviceButton_clicked();
|
||||
|
||||
void on_RemoveSerialDeviceButton_clicked();
|
||||
|
||||
void on_SaveSerialConfigurationButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBSerialSettingsPage *ui;
|
||||
std::vector<OpenRGBSerialSettingsEntry*> entries;
|
||||
|
||||
};
|
||||
@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBSerialSettingsPage</class>
|
||||
<widget class="QWidget" name="OpenRGBSerialSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Serial Settings Page</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="AddSerialDeviceButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="RemoveSerialDeviceButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="SaveSerialConfigurationButton">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="SerialDeviceList">
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,115 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBYeelightSettingsPage.cpp |
|
||||
| |
|
||||
| User interface for configuring Yeelight settings |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "OpenRGBYeelightSettingsPage.h"
|
||||
#include "ui_OpenRGBYeelightSettingsPage.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "SettingsManager.h"
|
||||
|
||||
OpenRGBYeelightSettingsPage::OpenRGBYeelightSettingsPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBYeelightSettingsPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
json yeelight_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get Philips Wiz settings |
|
||||
\*-------------------------------------------------*/
|
||||
yeelight_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("YeelightDevices");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the Wiz settings contains devices, process |
|
||||
\*-------------------------------------------------*/
|
||||
if(yeelight_settings.contains("devices"))
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < yeelight_settings["devices"].size(); device_idx++)
|
||||
{
|
||||
OpenRGBYeelightSettingsEntry* entry = new OpenRGBYeelightSettingsEntry;
|
||||
|
||||
entry->loadFromSettings(yeelight_settings["devices"][device_idx]);
|
||||
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->YeelightDeviceList->addItem(item);
|
||||
ui->YeelightDeviceList->setItemWidget(item, entry);
|
||||
ui->YeelightDeviceList->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OpenRGBYeelightSettingsPage::~OpenRGBYeelightSettingsPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBYeelightSettingsPage::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBYeelightSettingsPage::on_AddYeelightDeviceButton_clicked()
|
||||
{
|
||||
OpenRGBYeelightSettingsEntry* entry = new OpenRGBYeelightSettingsEntry;
|
||||
entries.push_back(entry);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->YeelightDeviceList->addItem(item);
|
||||
ui->YeelightDeviceList->setItemWidget(item, entry);
|
||||
ui->YeelightDeviceList->show();
|
||||
}
|
||||
|
||||
void OpenRGBYeelightSettingsPage::on_RemoveYeelightDeviceButton_clicked()
|
||||
{
|
||||
int cur_row = ui->YeelightDeviceList->currentRow();
|
||||
|
||||
if(cur_row < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* item = ui->YeelightDeviceList->takeItem(cur_row);
|
||||
|
||||
ui->YeelightDeviceList->removeItemWidget(item);
|
||||
delete item;
|
||||
|
||||
delete entries[cur_row];
|
||||
entries.erase(entries.begin() + cur_row);
|
||||
}
|
||||
|
||||
void OpenRGBYeelightSettingsPage::on_SaveYeelightConfigurationButton_clicked()
|
||||
{
|
||||
json yeelight_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get Philips Wiz settings |
|
||||
\*-------------------------------------------------*/
|
||||
yeelight_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("YeelightDevices");
|
||||
|
||||
yeelight_settings["devices"].clear();
|
||||
|
||||
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
|
||||
{
|
||||
yeelight_settings["devices"][device_idx] = entries[device_idx]->saveSettings();
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("YeelightDevices", yeelight_settings);
|
||||
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBYeelightSettingsPage.h |
|
||||
| |
|
||||
| User interface for configuring Yeelight settings |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "OpenRGBYeelightSettingsEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBYeelightSettingsPage;
|
||||
}
|
||||
|
||||
class OpenRGBYeelightSettingsPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBYeelightSettingsPage(QWidget *parent = nullptr);
|
||||
~OpenRGBYeelightSettingsPage();
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
void on_AddYeelightDeviceButton_clicked();
|
||||
|
||||
void on_RemoveYeelightDeviceButton_clicked();
|
||||
|
||||
void on_SaveYeelightConfigurationButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBYeelightSettingsPage *ui;
|
||||
std::vector<OpenRGBYeelightSettingsEntry*> entries;
|
||||
};
|
||||
@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBYeelightSettingsPage</class>
|
||||
<widget class="QWidget" name="OpenRGBYeelightSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Yeelight Settings Page</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="AddYeelightDeviceButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="RemoveYeelightDeviceButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="SaveYeelightConfigurationButton">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="YeelightDeviceList">
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue