mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2025-12-23 23:37:48 -05:00
Remove original device pages
This commit is contained in:
15
main.cpp
15
main.cpp
@@ -7,18 +7,15 @@
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <vector>
|
||||
#include "ResourceManager.h"
|
||||
#include "NetworkServer.h"
|
||||
#include "LogManager.h"
|
||||
#include "cli.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <thread>
|
||||
#include "cli.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "NetworkClient.h"
|
||||
#include "NetworkServer.h"
|
||||
#include "ProfileManager.h"
|
||||
#include "RGBController.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include "LogManager.h"
|
||||
|
||||
#ifdef _MACOSX_X86_X64
|
||||
#include "macUSPCIOAccess.h"
|
||||
|
||||
@@ -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>
|
||||
@@ -490,75 +490,9 @@ OpenRGBDialog::OpenRGBDialog(QWidget *parent) : QMainWindow(parent), ui(new Ui::
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add the Manually Added Devices settings page |
|
||||
| NOTE: The blocks below are to be removed later |
|
||||
\*-----------------------------------------------------*/
|
||||
AddManualDevicesSettingsPage();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add the DMX settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
AddDMXSettingsPage();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add the E1.31 settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
AddE131SettingsPage();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add the Govee settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
AddGoveeSettingsPage();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add the Kasa Smart settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
AddKasaSmartSettingsPage();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add the LIFX settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
AddLIFXSettingsPage();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add the Serial settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
AddSerialSettingsPage();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add the QMK OpenRGB Protocol settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
AddQMKORGBSettingsPage();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add the Philips Hue settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
AddPhilipsHueSettingsPage();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add the Philips Wiz settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
AddPhilipsWizSettingsPage();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add the Yeelight settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
AddYeelightSettingsPage();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add the Nanoleaf settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
AddNanoleafSettingsPage();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add the ElgatoKeyLight settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
AddElgatoKeyLightSettingsPage();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add the ElgatoLightStrip settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
AddElgatoLightStripSettingsPage();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add the SMBus Tools page if enabled |
|
||||
\*-----------------------------------------------------*/
|
||||
@@ -832,227 +766,6 @@ void OpenRGBDialog::AddManualDevicesSettingsPage()
|
||||
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
|
||||
}
|
||||
|
||||
void OpenRGBDialog::AddDMXSettingsPage()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the Settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
DMXSettingsPage = new OpenRGBDMXSettingsPage();
|
||||
|
||||
ui->SettingsTabBar->addTab(DMXSettingsPage, "");
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the tab label |
|
||||
\*-----------------------------------------------------*/
|
||||
TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::serial, tr("DMX Devices"), (char *)"DMX Devices", (char *)context);
|
||||
|
||||
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
|
||||
}
|
||||
|
||||
void OpenRGBDialog::AddE131SettingsPage()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the Settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
E131SettingsPage = new OpenRGBE131SettingsPage();
|
||||
|
||||
ui->SettingsTabBar->addTab(E131SettingsPage, "");
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the tab label |
|
||||
\*-----------------------------------------------------*/
|
||||
TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::data, tr("E1.31 Devices"), (char *)"E1.31 Devices", (char *)context);
|
||||
|
||||
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
|
||||
}
|
||||
|
||||
void OpenRGBDialog::AddGoveeSettingsPage()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the Settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
GoveeSettingsPage = new OpenRGBGoveeSettingsPage();
|
||||
|
||||
ui->SettingsTabBar->addTab(GoveeSettingsPage, "");
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the tab label |
|
||||
\*-----------------------------------------------------*/
|
||||
TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::bulb, tr("Govee Devices"), (char *)"Govee Devices", (char *)context);
|
||||
|
||||
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
|
||||
}
|
||||
|
||||
void OpenRGBDialog::AddKasaSmartSettingsPage()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the Settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
KasaSmartSettingsPage = new OpenRGBKasaSmartSettingsPage();
|
||||
|
||||
ui->SettingsTabBar->addTab(KasaSmartSettingsPage, "");
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the tab label |
|
||||
\*-----------------------------------------------------*/
|
||||
TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::bulb, tr("Kasa Smart Devices"), (char *)"Kasa Smart Devices", (char *)context);
|
||||
|
||||
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
|
||||
}
|
||||
|
||||
void OpenRGBDialog::AddLIFXSettingsPage()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the Settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
LIFXSettingsPage = new OpenRGBLIFXSettingsPage();
|
||||
|
||||
ui->SettingsTabBar->addTab(LIFXSettingsPage, "");
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the tab label |
|
||||
\*-----------------------------------------------------*/
|
||||
TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::bulb, tr("LIFX Devices"), (char *)"LIFX Devices", (char *)context);
|
||||
|
||||
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
|
||||
}
|
||||
|
||||
void OpenRGBDialog::AddPhilipsHueSettingsPage()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the Settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
PhilipsHueSettingsPage = new OpenRGBPhilipsHueSettingsPage();
|
||||
|
||||
ui->SettingsTabBar->addTab(PhilipsHueSettingsPage, "");
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the tab label |
|
||||
\*-----------------------------------------------------*/
|
||||
TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::bulb, tr("Philips Hue Devices"), (char *)"Philips Hue Devices", (char *)context);
|
||||
|
||||
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
|
||||
}
|
||||
|
||||
void OpenRGBDialog::AddPhilipsWizSettingsPage()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the Settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
PhilipsWizSettingsPage = new OpenRGBPhilipsWizSettingsPage();
|
||||
|
||||
ui->SettingsTabBar->addTab(PhilipsWizSettingsPage, "");
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the tab label |
|
||||
\*-----------------------------------------------------*/
|
||||
TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::bulb, tr("Philips Wiz Devices"), (char *)"Philips Wiz Devices", (char *)context);
|
||||
|
||||
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
|
||||
}
|
||||
|
||||
void OpenRGBDialog::AddQMKORGBSettingsPage()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the Settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
QMKORGBSettingsPage = new OpenRGBQMKORGBSettingsPage();
|
||||
|
||||
ui->SettingsTabBar->addTab(QMKORGBSettingsPage, "");
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the tab label |
|
||||
\*-----------------------------------------------------*/
|
||||
TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::keyboard, tr("OpenRGB QMK Protocol"), (char *)"OpenRGB QMK Protocol", (char *)context);
|
||||
|
||||
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
|
||||
}
|
||||
|
||||
void OpenRGBDialog::AddSerialSettingsPage()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the Settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
SerialSettingsPage = new OpenRGBSerialSettingsPage();
|
||||
|
||||
ui->SettingsTabBar->addTab(SerialSettingsPage, "");
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the tab label |
|
||||
\*-----------------------------------------------------*/
|
||||
TabLabel* SerialSettingsTabLabel = new TabLabel(OpenRGBFont::serial, tr("Serial Devices"), (char *)"Serial Devices", (char *)context);
|
||||
|
||||
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SerialSettingsTabLabel);
|
||||
}
|
||||
|
||||
void OpenRGBDialog::AddYeelightSettingsPage()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the Settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
YeelightSettingsPage = new OpenRGBYeelightSettingsPage();
|
||||
|
||||
ui->SettingsTabBar->addTab(YeelightSettingsPage, "");
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the tab label |
|
||||
\*-----------------------------------------------------*/
|
||||
TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::bulb, tr("Yeelight Devices"), (char *)"Yeelight Devices", (char *)context);
|
||||
|
||||
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
|
||||
}
|
||||
|
||||
void OpenRGBDialog::AddNanoleafSettingsPage()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the Settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
NanoleafSettingsPage = new OpenRGBNanoleafSettingsPage();
|
||||
|
||||
ui->SettingsTabBar->addTab(NanoleafSettingsPage, "");
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the tab label |
|
||||
\*-----------------------------------------------------*/
|
||||
TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::bulb, tr("Nanoleaf Devices"), (char *)"Nanoleaf Devices", (char *)context);
|
||||
|
||||
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
|
||||
}
|
||||
|
||||
void OpenRGBDialog::AddElgatoKeyLightSettingsPage()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the Settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
ElgatoKeyLightSettingsPage = new OpenRGBElgatoKeyLightSettingsPage();
|
||||
|
||||
ui->SettingsTabBar->addTab(ElgatoKeyLightSettingsPage, "");
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the tab label |
|
||||
\*-----------------------------------------------------*/
|
||||
TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::bulb, tr("Elgato KeyLight Devices"), (char *)"Elgato KeyLight Devices", (char *)context);
|
||||
|
||||
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
|
||||
}
|
||||
|
||||
void OpenRGBDialog::AddElgatoLightStripSettingsPage()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the Settings page |
|
||||
\*-----------------------------------------------------*/
|
||||
ElgatoLightStripSettingsPage = new OpenRGBElgatoLightStripSettingsPage();
|
||||
|
||||
ui->SettingsTabBar->addTab(ElgatoLightStripSettingsPage, "");
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the tab label |
|
||||
\*-----------------------------------------------------*/
|
||||
TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::bulb, tr("Elgato LightStrip Devices"), (char *)"Elgato LightStrip Devices", (char *)context);
|
||||
|
||||
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
|
||||
}
|
||||
|
||||
void OpenRGBDialog::AddPlugin(OpenRGBPluginEntry* plugin)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
|
||||
@@ -24,21 +24,6 @@
|
||||
#include "OpenRGBSettingsPage.h"
|
||||
#include "ManualDevicesSettingsPage/ManualDevicesSettingsPage.h"
|
||||
|
||||
// Manual devices pages - to be removed later
|
||||
#include "OpenRGBDMXSettingsPage/OpenRGBDMXSettingsPage.h"
|
||||
#include "OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.h"
|
||||
#include "OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsPage.h"
|
||||
#include "OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsPage.h"
|
||||
#include "OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsPage.h"
|
||||
#include "OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsPage.h"
|
||||
#include "OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsPage.h"
|
||||
#include "OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.h"
|
||||
#include "OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsPage.h"
|
||||
#include "OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsPage.h"
|
||||
#include "OpenRGBSerialSettingsPage/OpenRGBSerialSettingsPage.h"
|
||||
#include "OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsPage.h"
|
||||
#include "OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsPage.h"
|
||||
|
||||
#include "PluginManager.h"
|
||||
#include "SuspendResume.h"
|
||||
|
||||
@@ -103,20 +88,6 @@ private:
|
||||
OpenRGBSettingsPage *SettingsPage;
|
||||
|
||||
ManualDevicesSettingsPage *manualDevicesPage;
|
||||
// Manual devices pages - to be removed later
|
||||
OpenRGBDMXSettingsPage *DMXSettingsPage;
|
||||
OpenRGBE131SettingsPage *E131SettingsPage;
|
||||
OpenRGBElgatoKeyLightSettingsPage *ElgatoKeyLightSettingsPage;
|
||||
OpenRGBElgatoLightStripSettingsPage *ElgatoLightStripSettingsPage;
|
||||
OpenRGBGoveeSettingsPage *GoveeSettingsPage;
|
||||
OpenRGBKasaSmartSettingsPage *KasaSmartSettingsPage;
|
||||
OpenRGBLIFXSettingsPage *LIFXSettingsPage;
|
||||
OpenRGBPhilipsHueSettingsPage *PhilipsHueSettingsPage;
|
||||
OpenRGBPhilipsWizSettingsPage *PhilipsWizSettingsPage;
|
||||
OpenRGBQMKORGBSettingsPage *QMKORGBSettingsPage;
|
||||
OpenRGBSerialSettingsPage *SerialSettingsPage;
|
||||
OpenRGBYeelightSettingsPage *YeelightSettingsPage;
|
||||
OpenRGBNanoleafSettingsPage *NanoleafSettingsPage;
|
||||
|
||||
bool ShowI2CTools = false;
|
||||
bool plugins_loaded = false;
|
||||
@@ -140,21 +111,6 @@ private:
|
||||
void AddConsolePage();
|
||||
void AddManualDevicesSettingsPage();
|
||||
|
||||
// Manual devices pages - to be removed later
|
||||
void AddDMXSettingsPage();
|
||||
void AddE131SettingsPage();
|
||||
void AddElgatoKeyLightSettingsPage();
|
||||
void AddElgatoLightStripSettingsPage();
|
||||
void AddGoveeSettingsPage();
|
||||
void AddKasaSmartSettingsPage();
|
||||
void AddLIFXSettingsPage();
|
||||
void AddPhilipsHueSettingsPage();
|
||||
void AddPhilipsWizSettingsPage();
|
||||
void AddQMKORGBSettingsPage();
|
||||
void AddSerialSettingsPage();
|
||||
void AddYeelightSettingsPage();
|
||||
void AddNanoleafSettingsPage();
|
||||
|
||||
void ClearDevicesList();
|
||||
void UpdateDevicesList();
|
||||
void UpdateProfileList();
|
||||
|
||||
@@ -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,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,165 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBNanoleafSettingsPage.cpp |
|
||||
| |
|
||||
| User interface for OpenRGB Nanoleaf settings page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "OpenRGBNanoleafSettingsPage.h"
|
||||
#include "ui_OpenRGBNanoleafSettingsPage.h"
|
||||
#include "OpenRGBNanoleafNewDeviceDialog.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "SettingsManager.h"
|
||||
#include "LogManager.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
OpenRGBNanoleafSettingsPage::OpenRGBNanoleafSettingsPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBNanoleafSettingsPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
json nanoleaf_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("NanoleafDevices");
|
||||
|
||||
if(nanoleaf_settings.contains("devices"))
|
||||
{
|
||||
for(json::const_iterator it = nanoleaf_settings["devices"].begin(); it != nanoleaf_settings["devices"].end(); ++it)
|
||||
{
|
||||
const json& device = it.value();
|
||||
const std::string& location = it.key();
|
||||
|
||||
if(device.contains("ip") && device.contains("port"))
|
||||
{
|
||||
OpenRGBNanoleafSettingsEntry* entry = new OpenRGBNanoleafSettingsEntry(QString::fromStdString(device["ip"]), device["port"]);
|
||||
|
||||
entries[location] = entry;
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->NanoleafDeviceList->addItem(item);
|
||||
ui->NanoleafDeviceList->setItemWidget(item, entry);
|
||||
ui->NanoleafDeviceList->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OpenRGBNanoleafSettingsPage::~OpenRGBNanoleafSettingsPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBNanoleafSettingsPage::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBNanoleafSettingsPage::on_AddNanoleafDeviceButton_clicked()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Open a popup to manually add a device by setting ip |
|
||||
| and port |
|
||||
\*-----------------------------------------------------*/
|
||||
OpenRGBNanoleafNewDeviceDialog dialog;
|
||||
NanoleafDevice device = dialog.show();
|
||||
if(!device.ip.empty())
|
||||
{
|
||||
LOG_TRACE("[%s] Add %s:%d", "Nanoleaf", device.ip.c_str(), device.port);
|
||||
std::string location = device.ip+":"+std::to_string(device.port);
|
||||
|
||||
if(entries.find(location) == entries.end())
|
||||
{
|
||||
OpenRGBNanoleafSettingsEntry* entry = new OpenRGBNanoleafSettingsEntry(QString::fromUtf8(device.ip.c_str()), device.port);
|
||||
|
||||
entries[location] = entry;
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->NanoleafDeviceList->addItem(item);
|
||||
ui->NanoleafDeviceList->setItemWidget(item, entry);
|
||||
ui->NanoleafDeviceList->show();
|
||||
|
||||
json nanoleaf_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("NanoleafDevices");
|
||||
nanoleaf_settings["devices"][location]["ip"] = device.ip;
|
||||
nanoleaf_settings["devices"][location]["port"] = device.port;
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("NanoleafDevices", nanoleaf_settings);
|
||||
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBNanoleafSettingsPage::on_RemoveNanoleafDeviceButton_clicked()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Remove the selected device |
|
||||
\*-------------------------------------------------*/
|
||||
int cur_row = ui->NanoleafDeviceList->currentRow();
|
||||
|
||||
if(cur_row < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* item = ui->NanoleafDeviceList->item(cur_row);
|
||||
OpenRGBNanoleafSettingsEntry* entry = (OpenRGBNanoleafSettingsEntry*) ui->NanoleafDeviceList->itemWidget(item);
|
||||
std::string location = entry->getLocation();
|
||||
LOG_TRACE("[%s] Remove %s", "Nanoleaf", location.c_str());
|
||||
|
||||
ui->NanoleafDeviceList->removeItemWidget(item);
|
||||
delete item;
|
||||
|
||||
delete entries[location];
|
||||
entries.erase(location);
|
||||
|
||||
json nanoleaf_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("NanoleafDevices");
|
||||
nanoleaf_settings["devices"].erase(location);
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("NanoleafDevices", nanoleaf_settings);
|
||||
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
||||
}
|
||||
|
||||
void OpenRGBNanoleafSettingsPage::on_ScanForNanoleafDevicesButton_clicked()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Create a worker thread for the mDNS query and hookup |
|
||||
| callbacks for when it finds devices |
|
||||
\*-----------------------------------------------------*/
|
||||
OpenRGBNanoleafScanningThread *scanThread = new OpenRGBNanoleafScanningThread;
|
||||
|
||||
connect(scanThread, SIGNAL(DeviceFound(QString, int)),
|
||||
SLOT(on_DeviceFound(QString, int)));
|
||||
|
||||
connect(scanThread, SIGNAL(finished()),
|
||||
scanThread, SLOT(deleteLater()));
|
||||
|
||||
scanThread->start();
|
||||
}
|
||||
|
||||
void OpenRGBNanoleafSettingsPage::on_DeviceFound(QString address, int port)
|
||||
{
|
||||
std::string location = address.toStdString()+":"+std::to_string(port);
|
||||
|
||||
if(entries.find(location) == entries.end())
|
||||
{
|
||||
OpenRGBNanoleafSettingsEntry* entry = new OpenRGBNanoleafSettingsEntry(address, port);
|
||||
|
||||
entries[location] = entry;
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
|
||||
item->setSizeHint(entry->sizeHint());
|
||||
|
||||
ui->NanoleafDeviceList->addItem(item);
|
||||
ui->NanoleafDeviceList->setItemWidget(item, entry);
|
||||
ui->NanoleafDeviceList->show();
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBNanoleafSettingsPage.h |
|
||||
| |
|
||||
| User interface for OpenRGB Nanoleaf settings page |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "OpenRGBNanoleafSettingsEntry.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBNanoleafSettingsPage;
|
||||
}
|
||||
|
||||
class OpenRGBNanoleafSettingsPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBNanoleafSettingsPage(QWidget *parent = nullptr);
|
||||
~OpenRGBNanoleafSettingsPage();
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
void on_AddNanoleafDeviceButton_clicked();
|
||||
void on_RemoveNanoleafDeviceButton_clicked();
|
||||
void on_ScanForNanoleafDevicesButton_clicked();
|
||||
void on_DeviceFound(QString address, int port);
|
||||
|
||||
private:
|
||||
Ui::OpenRGBNanoleafSettingsPage *ui;
|
||||
std::map<std::string, OpenRGBNanoleafSettingsEntry*> entries;
|
||||
};
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user