diff --git a/main.cpp b/main.cpp index ef6bb82f4..598906b11 100644 --- a/main.cpp +++ b/main.cpp @@ -7,18 +7,15 @@ | SPDX-License-Identifier: GPL-2.0-only | \*---------------------------------------------------------*/ -#include +#include "ResourceManager.h" +#include "NetworkServer.h" +#include "LogManager.h" +#include "cli.h" + +#include #include #include #include -#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" diff --git a/qt/ManualDevicesSettingsPage/BaseManualDeviceEntry.cpp b/qt/ManualDevicesSettingsPage/BaseManualDeviceEntry.cpp new file mode 100644 index 000000000..262c13d13 --- /dev/null +++ b/qt/ManualDevicesSettingsPage/BaseManualDeviceEntry.cpp @@ -0,0 +1,27 @@ +/*-----------------------------------------------------------------*\ +| BaseManualDeviceEntry.cpp | +| | +| Base class to all user-defined device settings entries | +| | +| This file is part of the OpenRGB project | +| SPDX-License-Identifier: GPL-2.0-only | +\*-----------------------------------------------------------------*/ + +#include "BaseManualDeviceEntry.h" + +#include "ManualDevicesTypeManager.h" + +void BaseManualDeviceEntry::setSettingsSection(const std::string& section) +{ + settingsSection = section; +} + +std::string BaseManualDeviceEntry::getSettingsSection() +{ + return settingsSection; +} + +ManualDeviceTypeRegistrator::ManualDeviceTypeRegistrator(const std::string& name, const std::string& settingsEntry, ManualDeviceEntrySpawnFunction entrySpawnFunction) +{ + ManualDevicesTypeManager::get()->registerType(name, settingsEntry, entrySpawnFunction); +}; diff --git a/qt/BaseManualDeviceEntry.h b/qt/ManualDevicesSettingsPage/BaseManualDeviceEntry.h similarity index 57% rename from qt/BaseManualDeviceEntry.h rename to qt/ManualDevicesSettingsPage/BaseManualDeviceEntry.h index 82950560f..d2acb9cbe 100644 --- a/qt/BaseManualDeviceEntry.h +++ b/qt/ManualDevicesSettingsPage/BaseManualDeviceEntry.h @@ -20,7 +20,22 @@ class BaseManualDeviceEntry: public QWidget public: explicit BaseManualDeviceEntry(QWidget *parent = nullptr): QWidget(parent) {} - virtual void loadFromSettings(const json& data) = 0; virtual json saveSettings() = 0; - virtual const char* settingsSection() = 0; + virtual bool isDataValid() = 0; + + void setSettingsSection(const std::string& section); + std::string getSettingsSection(); + +private: + std::string settingsSection; }; + +typedef std::function ManualDeviceEntrySpawnFunction; + +class ManualDeviceTypeRegistrator +{ +public: + ManualDeviceTypeRegistrator(const std::string& name, const std::string& settingsEntry, ManualDeviceEntrySpawnFunction entrySpawnFunction); +}; + +#define REGISTER_MANUAL_DEVICE_TYPE(name, settingsEntry, func) static ManualDeviceTypeRegistrator device_detector_obj_##func(name, settingsEntry, func) diff --git a/qt/OpenRGBDMXSettingsPage/OpenRGBDMXSettingsEntry.cpp b/qt/ManualDevicesSettingsPage/DMXSettingsEntry/DMXSettingsEntry.cpp similarity index 78% rename from qt/OpenRGBDMXSettingsPage/OpenRGBDMXSettingsEntry.cpp rename to qt/ManualDevicesSettingsPage/DMXSettingsEntry/DMXSettingsEntry.cpp index 0fdbc6199..85eecb645 100644 --- a/qt/OpenRGBDMXSettingsPage/OpenRGBDMXSettingsEntry.cpp +++ b/qt/ManualDevicesSettingsPage/DMXSettingsEntry/DMXSettingsEntry.cpp @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBDMXSettingsEntry.cpp | +| DMXSettingsEntry.cpp | | | | User interface for OpenRGB DMX settings entry | | | @@ -7,22 +7,22 @@ | SPDX-License-Identifier: GPL-2.0-only | \*---------------------------------------------------------*/ -#include "OpenRGBDMXSettingsEntry.h" -#include "ui_OpenRGBDMXSettingsEntry.h" +#include "DMXSettingsEntry.h" +#include "ui_DMXSettingsEntry.h" -OpenRGBDMXSettingsEntry::OpenRGBDMXSettingsEntry(QWidget *parent) : +DMXSettingsEntry::DMXSettingsEntry(QWidget *parent) : BaseManualDeviceEntry(parent), - ui(new Ui::OpenRGBDMXSettingsEntry) + ui(new Ui::DMXSettingsEntry) { ui->setupUi(this); } -OpenRGBDMXSettingsEntry::~OpenRGBDMXSettingsEntry() +DMXSettingsEntry::~DMXSettingsEntry() { delete ui; } -void OpenRGBDMXSettingsEntry::changeEvent(QEvent *event) +void DMXSettingsEntry::changeEvent(QEvent *event) { if(event->type() == QEvent::LanguageChange) { @@ -30,7 +30,7 @@ void OpenRGBDMXSettingsEntry::changeEvent(QEvent *event) } } -void OpenRGBDMXSettingsEntry::loadFromSettings(const json& data) +void DMXSettingsEntry::loadFromSettings(const json& data) { if(data.contains("name")) { @@ -68,7 +68,7 @@ void OpenRGBDMXSettingsEntry::loadFromSettings(const json& data) } } -json OpenRGBDMXSettingsEntry::saveSettings() +json DMXSettingsEntry::saveSettings() { json result; /*-------------------------------------------------*\ @@ -96,7 +96,17 @@ json OpenRGBDMXSettingsEntry::saveSettings() return result; } -const char* OpenRGBDMXSettingsEntry::settingsSection() +bool DMXSettingsEntry::isDataValid() { - return "DMXDevices"; + // stub + return true; } + +static BaseManualDeviceEntry* SpawnDMXEntry(const json& data) +{ + DMXSettingsEntry* entry = new DMXSettingsEntry; + entry->loadFromSettings(data); + return entry; +} + +REGISTER_MANUAL_DEVICE_TYPE("DMX", "DMXDevices", SpawnDMXEntry); diff --git a/qt/OpenRGBDMXSettingsPage/OpenRGBDMXSettingsEntry.h b/qt/ManualDevicesSettingsPage/DMXSettingsEntry/DMXSettingsEntry.h similarity index 60% rename from qt/OpenRGBDMXSettingsPage/OpenRGBDMXSettingsEntry.h rename to qt/ManualDevicesSettingsPage/DMXSettingsEntry/DMXSettingsEntry.h index 0e49172a7..807afc8a5 100644 --- a/qt/OpenRGBDMXSettingsPage/OpenRGBDMXSettingsEntry.h +++ b/qt/ManualDevicesSettingsPage/DMXSettingsEntry/DMXSettingsEntry.h @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBDMXSettingsEntry.h | +| DMXSettingsEntry.h | | | | User interface for OpenRGB DMX settings entry | | | @@ -13,23 +13,23 @@ namespace Ui { - class OpenRGBDMXSettingsEntry; + class DMXSettingsEntry; } -class OpenRGBDMXSettingsEntry : public BaseManualDeviceEntry +class DMXSettingsEntry : public BaseManualDeviceEntry { Q_OBJECT public: - explicit OpenRGBDMXSettingsEntry(QWidget *parent = nullptr); - ~OpenRGBDMXSettingsEntry(); + explicit DMXSettingsEntry(QWidget *parent = nullptr); + ~DMXSettingsEntry(); void loadFromSettings(const json& data); - json saveSettings(); - const char* settingsSection(); + json saveSettings() override; + bool isDataValid() override; private: - Ui::OpenRGBDMXSettingsEntry *ui; + Ui::DMXSettingsEntry *ui; private slots: - void changeEvent(QEvent *event); + void changeEvent(QEvent *event) override; }; diff --git a/qt/OpenRGBDMXSettingsPage/OpenRGBDMXSettingsEntry.ui b/qt/ManualDevicesSettingsPage/DMXSettingsEntry/DMXSettingsEntry.ui similarity index 96% rename from qt/OpenRGBDMXSettingsPage/OpenRGBDMXSettingsEntry.ui rename to qt/ManualDevicesSettingsPage/DMXSettingsEntry/DMXSettingsEntry.ui index 340bec8c5..ba0b00805 100644 --- a/qt/OpenRGBDMXSettingsPage/OpenRGBDMXSettingsEntry.ui +++ b/qt/ManualDevicesSettingsPage/DMXSettingsEntry/DMXSettingsEntry.ui @@ -1,7 +1,7 @@ - OpenRGBDMXSettingsEntry - + DMXSettingsEntry + 0 @@ -23,7 +23,7 @@ - + DMX Device diff --git a/qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsEntry.cpp b/qt/ManualDevicesSettingsPage/E131SettingsEntry/E131SettingsEntry.cpp similarity index 89% rename from qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsEntry.cpp rename to qt/ManualDevicesSettingsPage/E131SettingsEntry/E131SettingsEntry.cpp index b58106546..07f271721 100644 --- a/qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsEntry.cpp +++ b/qt/ManualDevicesSettingsPage/E131SettingsEntry/E131SettingsEntry.cpp @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBE131SettingsEntry.cpp | +| E131SettingsEntry.cpp | | | | User interface for OpenRGB E1.31 settings entry | | | @@ -7,12 +7,12 @@ | SPDX-License-Identifier: GPL-2.0-only | \*---------------------------------------------------------*/ -#include "OpenRGBE131SettingsEntry.h" -#include "ui_OpenRGBE131SettingsEntry.h" +#include "E131SettingsEntry.h" +#include "ui_E131SettingsEntry.h" -OpenRGBE131SettingsEntry::OpenRGBE131SettingsEntry(QWidget *parent) : +E131SettingsEntry::E131SettingsEntry(QWidget *parent) : BaseManualDeviceEntry(parent), - ui(new Ui::OpenRGBE131SettingsEntry) + ui(new Ui::E131SettingsEntry) { ui->setupUi(this); @@ -39,12 +39,12 @@ OpenRGBE131SettingsEntry::OpenRGBE131SettingsEntry(QWidget *parent) : HideMatrixSettings(); } -OpenRGBE131SettingsEntry::~OpenRGBE131SettingsEntry() +E131SettingsEntry::~E131SettingsEntry() { delete ui; } -void OpenRGBE131SettingsEntry::changeEvent(QEvent *event) +void E131SettingsEntry::changeEvent(QEvent *event) { if(event->type() == QEvent::LanguageChange) { @@ -52,7 +52,7 @@ void OpenRGBE131SettingsEntry::changeEvent(QEvent *event) } } -void OpenRGBE131SettingsEntry::HideMatrixSettings() +void E131SettingsEntry::HideMatrixSettings() { ui->MatrixWidthLabel->setDisabled(true); ui->MatrixWidthEdit->setDisabled(true); @@ -64,7 +64,7 @@ void OpenRGBE131SettingsEntry::HideMatrixSettings() ui->MatrixOrderComboBox->setDisabled(true); } -void OpenRGBE131SettingsEntry::ShowMatrixSettings() +void E131SettingsEntry::ShowMatrixSettings() { ui->MatrixWidthLabel->setDisabled(false); ui->MatrixWidthEdit->setDisabled(false); @@ -76,7 +76,7 @@ void OpenRGBE131SettingsEntry::ShowMatrixSettings() ui->MatrixOrderComboBox->setDisabled(false); } -void OpenRGBE131SettingsEntry::on_TypeComboBox_currentIndexChanged(int index) +void E131SettingsEntry::on_TypeComboBox_currentIndexChanged(int index) { if(index == 2) { @@ -88,7 +88,7 @@ void OpenRGBE131SettingsEntry::on_TypeComboBox_currentIndexChanged(int index) } } -void OpenRGBE131SettingsEntry::loadFromSettings(const json& data) +void E131SettingsEntry::loadFromSettings(const json& data) { if(data.contains("name")) { @@ -243,7 +243,7 @@ void OpenRGBE131SettingsEntry::loadFromSettings(const json& data) } } -json OpenRGBE131SettingsEntry::saveSettings() +json E131SettingsEntry::saveSettings() { json result; /*-------------------------------------------------*\ @@ -284,7 +284,19 @@ json OpenRGBE131SettingsEntry::saveSettings() return result; } -const char* OpenRGBE131SettingsEntry::settingsSection() +bool E131SettingsEntry::isDataValid() { - return "E131Devices"; + // stub + return true; } + +static BaseManualDeviceEntry* SpawnE131Entry(const json& data) +{ + E131SettingsEntry* entry = new E131SettingsEntry; + entry->loadFromSettings(data); + return entry; +} + +static const char* E131DeviceName = QT_TRANSLATE_NOOP("ManualDevice", "E1.31 (including WLED)"); + +REGISTER_MANUAL_DEVICE_TYPE(E131DeviceName, "E131Devices", SpawnE131Entry); diff --git a/qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsEntry.h b/qt/ManualDevicesSettingsPage/E131SettingsEntry/E131SettingsEntry.h similarity index 64% rename from qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsEntry.h rename to qt/ManualDevicesSettingsPage/E131SettingsEntry/E131SettingsEntry.h index 83044c832..408b380c1 100644 --- a/qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsEntry.h +++ b/qt/ManualDevicesSettingsPage/E131SettingsEntry/E131SettingsEntry.h @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBE131SettingsEntry.h | +| E131SettingsEntry.h | | | | User interface for OpenRGB E1.31 settings entry | | | @@ -13,28 +13,28 @@ namespace Ui { - class OpenRGBE131SettingsEntry; + class E131SettingsEntry; } -class OpenRGBE131SettingsEntry : public BaseManualDeviceEntry +class E131SettingsEntry : public BaseManualDeviceEntry { Q_OBJECT public: - explicit OpenRGBE131SettingsEntry(QWidget *parent = nullptr); - ~OpenRGBE131SettingsEntry(); + explicit E131SettingsEntry(QWidget *parent = nullptr); + ~E131SettingsEntry(); void loadFromSettings(const json& data); - json saveSettings(); - const char* settingsSection(); + json saveSettings() override; + bool isDataValid() override; private: - Ui::OpenRGBE131SettingsEntry *ui; + Ui::E131SettingsEntry *ui; private: void HideMatrixSettings(); void ShowMatrixSettings(); private slots: - void changeEvent(QEvent *event); + void changeEvent(QEvent *event) override; void on_TypeComboBox_currentIndexChanged(int index); }; diff --git a/qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsEntry.ui b/qt/ManualDevicesSettingsPage/E131SettingsEntry/E131SettingsEntry.ui similarity index 97% rename from qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsEntry.ui rename to qt/ManualDevicesSettingsPage/E131SettingsEntry/E131SettingsEntry.ui index f2a0d46e1..9932b9229 100644 --- a/qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsEntry.ui +++ b/qt/ManualDevicesSettingsPage/E131SettingsEntry/E131SettingsEntry.ui @@ -1,13 +1,13 @@ - OpenRGBE131SettingsEntry - + E131SettingsEntry + 0 0 531 - 237 + 256 @@ -23,7 +23,7 @@ - + E1.31 Device diff --git a/qt/OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsEntry.cpp b/qt/ManualDevicesSettingsPage/ElgatoKeyLightSettingsEntry/ElgatoKeyLightSettingsEntry.cpp similarity index 50% rename from qt/OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsEntry.cpp rename to qt/ManualDevicesSettingsPage/ElgatoKeyLightSettingsEntry/ElgatoKeyLightSettingsEntry.cpp index c8c8171ed..46941dde3 100644 --- a/qt/OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsEntry.cpp +++ b/qt/ManualDevicesSettingsPage/ElgatoKeyLightSettingsEntry/ElgatoKeyLightSettingsEntry.cpp @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBElgatoKeyLightSettingsEntry.cpp | +| ElgatoKeyLightSettingsEntry.cpp | | | | User interface for OpenRGB Elgato Key Light entry | | | @@ -7,23 +7,23 @@ | SPDX-License-Identifier: GPL-2.0-only | \*---------------------------------------------------------*/ -#include "OpenRGBElgatoKeyLightSettingsEntry.h" -#include "ui_OpenRGBElgatoKeyLightSettingsEntry.h" +#include "ElgatoKeyLightSettingsEntry.h" +#include "ui_ElgatoKeyLightSettingsEntry.h" -OpenRGBElgatoKeyLightSettingsEntry::OpenRGBElgatoKeyLightSettingsEntry(QWidget *parent) : +ElgatoKeyLightSettingsEntry::ElgatoKeyLightSettingsEntry(QWidget *parent) : BaseManualDeviceEntry(parent), - ui(new Ui::OpenRGBElgatoKeyLightSettingsEntry) + ui(new Ui::ElgatoKeyLightSettingsEntry) { ui->setupUi(this); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); } -OpenRGBElgatoKeyLightSettingsEntry::~OpenRGBElgatoKeyLightSettingsEntry() +ElgatoKeyLightSettingsEntry::~ElgatoKeyLightSettingsEntry() { delete ui; } -void OpenRGBElgatoKeyLightSettingsEntry::changeEvent(QEvent *event) +void ElgatoKeyLightSettingsEntry::changeEvent(QEvent *event) { if(event->type() == QEvent::LanguageChange) { @@ -31,7 +31,7 @@ void OpenRGBElgatoKeyLightSettingsEntry::changeEvent(QEvent *event) } } -void OpenRGBElgatoKeyLightSettingsEntry::loadFromSettings(const json& data) +void ElgatoKeyLightSettingsEntry::loadFromSettings(const json& data) { if(data.contains("ip")) { @@ -39,14 +39,24 @@ void OpenRGBElgatoKeyLightSettingsEntry::loadFromSettings(const json& data) } } -json OpenRGBElgatoKeyLightSettingsEntry::saveSettings() +json ElgatoKeyLightSettingsEntry::saveSettings() { json result; result["ip"] = ui->IPEdit->text().toStdString(); return result; } -const char* OpenRGBElgatoKeyLightSettingsEntry::settingsSection() +bool ElgatoKeyLightSettingsEntry::isDataValid() { - return "ElgatoKeyLightDevices"; + // stub + return true; } + +static BaseManualDeviceEntry* SpawnElgatoKeyLightEntry(const json& data) +{ + ElgatoKeyLightSettingsEntry* entry = new ElgatoKeyLightSettingsEntry; + entry->loadFromSettings(data); + return entry; +} + +REGISTER_MANUAL_DEVICE_TYPE("Elgato Key Light", "ElgatoKeyLightDevices", SpawnElgatoKeyLightEntry); diff --git a/qt/OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsEntry.h b/qt/ManualDevicesSettingsPage/ElgatoKeyLightSettingsEntry/ElgatoKeyLightSettingsEntry.h similarity index 57% rename from qt/OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsEntry.h rename to qt/ManualDevicesSettingsPage/ElgatoKeyLightSettingsEntry/ElgatoKeyLightSettingsEntry.h index 48fbf73df..5f3b00fca 100644 --- a/qt/OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsEntry.h +++ b/qt/ManualDevicesSettingsPage/ElgatoKeyLightSettingsEntry/ElgatoKeyLightSettingsEntry.h @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBElgatoKeyLightSettingsEntry.h | +| ElgatoKeyLightSettingsEntry.h | | | | User interface for OpenRGB Elgato Key Light entry | | | @@ -13,23 +13,23 @@ namespace Ui { - class OpenRGBElgatoKeyLightSettingsEntry; + class ElgatoKeyLightSettingsEntry; } -class OpenRGBElgatoKeyLightSettingsEntry : public BaseManualDeviceEntry +class ElgatoKeyLightSettingsEntry : public BaseManualDeviceEntry { Q_OBJECT public: - explicit OpenRGBElgatoKeyLightSettingsEntry(QWidget *parent = nullptr); - ~OpenRGBElgatoKeyLightSettingsEntry(); + explicit ElgatoKeyLightSettingsEntry(QWidget *parent = nullptr); + ~ElgatoKeyLightSettingsEntry(); void loadFromSettings(const json& data); - json saveSettings(); - const char* settingsSection(); + json saveSettings() override; + bool isDataValid() override; private: - Ui::OpenRGBElgatoKeyLightSettingsEntry *ui; + Ui::ElgatoKeyLightSettingsEntry *ui; private slots: - void changeEvent(QEvent *event); + void changeEvent(QEvent *event) override; }; diff --git a/qt/OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsEntry.ui b/qt/ManualDevicesSettingsPage/ElgatoKeyLightSettingsEntry/ElgatoKeyLightSettingsEntry.ui similarity index 84% rename from qt/OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsEntry.ui rename to qt/ManualDevicesSettingsPage/ElgatoKeyLightSettingsEntry/ElgatoKeyLightSettingsEntry.ui index 4d0a25245..acac434e8 100644 --- a/qt/OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsEntry.ui +++ b/qt/ManualDevicesSettingsPage/ElgatoKeyLightSettingsEntry/ElgatoKeyLightSettingsEntry.ui @@ -1,13 +1,13 @@ - OpenRGBElgatoKeyLightSettingsEntry - + ElgatoKeyLightSettingsEntry + 0 0 225 - 85 + 108 @@ -17,7 +17,7 @@ - + Elgato Key Light diff --git a/qt/ManualDevicesSettingsPage/ElgatoLightStripSettingsEntry/ElgatoLightStripSettingsEntry.cpp b/qt/ManualDevicesSettingsPage/ElgatoLightStripSettingsEntry/ElgatoLightStripSettingsEntry.cpp new file mode 100644 index 000000000..7e89719ba --- /dev/null +++ b/qt/ManualDevicesSettingsPage/ElgatoLightStripSettingsEntry/ElgatoLightStripSettingsEntry.cpp @@ -0,0 +1,63 @@ +/*---------------------------------------------------------*\ +| ElgatoLightStripSettingsEntry.cpp | +| | +| User interface for OpenRGB Elgato Light Strips entry | +| | +| This file is part of the OpenRGB project | +| SPDX-License-Identifier: GPL-2.0-only | +\*---------------------------------------------------------*/ + +#include "ElgatoLightStripSettingsEntry.h" +#include "ui_ElgatoLightStripSettingsEntry.h" + +ElgatoLightStripSettingsEntry::ElgatoLightStripSettingsEntry(QWidget *parent) : + BaseManualDeviceEntry(parent), + ui(new Ui::ElgatoLightStripSettingsEntry) +{ + ui->setupUi(this); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); +} + +ElgatoLightStripSettingsEntry::~ElgatoLightStripSettingsEntry() +{ + delete ui; +} + +void ElgatoLightStripSettingsEntry::changeEvent(QEvent *event) +{ + if(event->type() == QEvent::LanguageChange) + { + ui->retranslateUi(this); + } +} + +void ElgatoLightStripSettingsEntry::loadFromSettings(const json& data) +{ + if(data.contains("ip")) + { + ui->IPEdit->setText(QString::fromStdString(data["ip"])); + } +} + +json ElgatoLightStripSettingsEntry::saveSettings() +{ + json result; + result["ip"] = ui->IPEdit->text().toStdString(); + return result; +} + +bool ElgatoLightStripSettingsEntry::isDataValid() +{ + // stub + return true; +} + +static BaseManualDeviceEntry* SpawnElgatoLightStripEntry(const json& data) +{ + ElgatoLightStripSettingsEntry* entry = new ElgatoLightStripSettingsEntry; + entry->loadFromSettings(data); + return entry; +} + +REGISTER_MANUAL_DEVICE_TYPE("Elgato Light Strip", "ElgatoLightStripDevices", SpawnElgatoLightStripEntry); + diff --git a/qt/OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsEntry.h b/qt/ManualDevicesSettingsPage/ElgatoLightStripSettingsEntry/ElgatoLightStripSettingsEntry.h similarity index 56% rename from qt/OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsEntry.h rename to qt/ManualDevicesSettingsPage/ElgatoLightStripSettingsEntry/ElgatoLightStripSettingsEntry.h index daaadc378..2b0c5339f 100644 --- a/qt/OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsEntry.h +++ b/qt/ManualDevicesSettingsPage/ElgatoLightStripSettingsEntry/ElgatoLightStripSettingsEntry.h @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBElgatoLightStripSettingsEntry.h | +| ElgatoLightStripSettingsEntry.h | | | | User interface for OpenRGB Elgato Light Strips entry | | | @@ -13,23 +13,23 @@ namespace Ui { - class OpenRGBElgatoLightStripSettingsEntry; + class ElgatoLightStripSettingsEntry; } -class OpenRGBElgatoLightStripSettingsEntry : public BaseManualDeviceEntry +class ElgatoLightStripSettingsEntry : public BaseManualDeviceEntry { Q_OBJECT public: - explicit OpenRGBElgatoLightStripSettingsEntry(QWidget *parent = nullptr); - ~OpenRGBElgatoLightStripSettingsEntry(); + explicit ElgatoLightStripSettingsEntry(QWidget *parent = nullptr); + ~ElgatoLightStripSettingsEntry(); void loadFromSettings(const json& data); - json saveSettings(); - const char* settingsSection(); + json saveSettings() override; + bool isDataValid() override; private: - Ui::OpenRGBElgatoLightStripSettingsEntry *ui; + Ui::ElgatoLightStripSettingsEntry *ui; private slots: - void changeEvent(QEvent *event); + void changeEvent(QEvent *event) override; }; diff --git a/qt/OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsEntry.ui b/qt/ManualDevicesSettingsPage/ElgatoLightStripSettingsEntry/ElgatoLightStripSettingsEntry.ui similarity index 84% rename from qt/OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsEntry.ui rename to qt/ManualDevicesSettingsPage/ElgatoLightStripSettingsEntry/ElgatoLightStripSettingsEntry.ui index 41186dd6b..716747c27 100644 --- a/qt/OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsEntry.ui +++ b/qt/ManualDevicesSettingsPage/ElgatoLightStripSettingsEntry/ElgatoLightStripSettingsEntry.ui @@ -1,13 +1,13 @@ - OpenRGBElgatoLightStripSettingsEntry - + ElgatoLightStripSettingsEntry + 0 0 225 - 85 + 108 @@ -17,7 +17,7 @@ - + Elgato Light Strip diff --git a/qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsEntry.cpp b/qt/ManualDevicesSettingsPage/GoveeSettingsEntry/GoveeSettingsEntry.cpp similarity index 55% rename from qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsEntry.cpp rename to qt/ManualDevicesSettingsPage/GoveeSettingsEntry/GoveeSettingsEntry.cpp index 2cea3b290..da04fab77 100644 --- a/qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsEntry.cpp +++ b/qt/ManualDevicesSettingsPage/GoveeSettingsEntry/GoveeSettingsEntry.cpp @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBGoveeSettingsEntry.cpp | +| GoveeSettingsEntry.cpp | | | | User interface for OpenRGB Govee settings entry | | | @@ -9,22 +9,22 @@ | SPDX-License-Identifier: GPL-2.0-only | \*---------------------------------------------------------*/ -#include "OpenRGBGoveeSettingsEntry.h" -#include "ui_OpenRGBGoveeSettingsEntry.h" +#include "GoveeSettingsEntry.h" +#include "ui_GoveeSettingsEntry.h" -OpenRGBGoveeSettingsEntry::OpenRGBGoveeSettingsEntry(QWidget *parent) : +GoveeSettingsEntry::GoveeSettingsEntry(QWidget *parent) : BaseManualDeviceEntry(parent), - ui(new Ui::OpenRGBGoveeSettingsEntry) + ui(new Ui::GoveeSettingsEntry) { ui->setupUi(this); } -OpenRGBGoveeSettingsEntry::~OpenRGBGoveeSettingsEntry() +GoveeSettingsEntry::~GoveeSettingsEntry() { delete ui; } -void OpenRGBGoveeSettingsEntry::changeEvent(QEvent *event) +void GoveeSettingsEntry::changeEvent(QEvent *event) { if(event->type() == QEvent::LanguageChange) { @@ -32,7 +32,7 @@ void OpenRGBGoveeSettingsEntry::changeEvent(QEvent *event) } } -void OpenRGBGoveeSettingsEntry::loadFromSettings(const json& data) +void GoveeSettingsEntry::loadFromSettings(const json& data) { if(data.contains("ip")) { @@ -40,14 +40,24 @@ void OpenRGBGoveeSettingsEntry::loadFromSettings(const json& data) } } -json OpenRGBGoveeSettingsEntry::saveSettings() +json GoveeSettingsEntry::saveSettings() { json result; result["ip"] = ui->IPEdit->text().toStdString(); return result; } -const char* OpenRGBGoveeSettingsEntry::settingsSection() +bool GoveeSettingsEntry::isDataValid() { - return "GoveeDevices"; + // stub + return true; } + +static BaseManualDeviceEntry* SpawnGoveeSettingsEntry(const json& data) +{ + GoveeSettingsEntry* entry = new GoveeSettingsEntry; + entry->loadFromSettings(data); + return entry; +} + +REGISTER_MANUAL_DEVICE_TYPE("Govee", "GoveeDevices", SpawnGoveeSettingsEntry); diff --git a/qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsEntry.h b/qt/ManualDevicesSettingsPage/GoveeSettingsEntry/GoveeSettingsEntry.h similarity index 64% rename from qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsEntry.h rename to qt/ManualDevicesSettingsPage/GoveeSettingsEntry/GoveeSettingsEntry.h index f68b7af40..7764d0bfb 100644 --- a/qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsEntry.h +++ b/qt/ManualDevicesSettingsPage/GoveeSettingsEntry/GoveeSettingsEntry.h @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBGoveeSettingsEntry.h | +| GoveeSettingsEntry.h | | | | User interface for OpenRGB Govee settings entry | | | @@ -15,23 +15,23 @@ namespace Ui { - class OpenRGBGoveeSettingsEntry; + class GoveeSettingsEntry; } -class OpenRGBGoveeSettingsEntry : public BaseManualDeviceEntry +class GoveeSettingsEntry : public BaseManualDeviceEntry { Q_OBJECT public: - explicit OpenRGBGoveeSettingsEntry(QWidget *parent = nullptr); - ~OpenRGBGoveeSettingsEntry(); + explicit GoveeSettingsEntry(QWidget *parent = nullptr); + ~GoveeSettingsEntry(); void loadFromSettings(const json& data); - json saveSettings(); - const char* settingsSection(); + json saveSettings() override; + bool isDataValid() override; private: - Ui::OpenRGBGoveeSettingsEntry *ui; + Ui::GoveeSettingsEntry *ui; private slots: - void changeEvent(QEvent *event); + void changeEvent(QEvent *event) override; }; diff --git a/qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsEntry.ui b/qt/ManualDevicesSettingsPage/GoveeSettingsEntry/GoveeSettingsEntry.ui similarity index 87% rename from qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsEntry.ui rename to qt/ManualDevicesSettingsPage/GoveeSettingsEntry/GoveeSettingsEntry.ui index 8cea71370..8c761722a 100644 --- a/qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsEntry.ui +++ b/qt/ManualDevicesSettingsPage/GoveeSettingsEntry/GoveeSettingsEntry.ui @@ -1,13 +1,13 @@ - OpenRGBGoveeSettingsEntry - + GoveeSettingsEntry + 0 0 328 - 72 + 81 @@ -23,7 +23,7 @@ - + Govee Device diff --git a/qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsEntry.cpp b/qt/ManualDevicesSettingsPage/KasaSmartSettingsEntry/KasaSmartSettingsEntry.cpp similarity index 54% rename from qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsEntry.cpp rename to qt/ManualDevicesSettingsPage/KasaSmartSettingsEntry/KasaSmartSettingsEntry.cpp index f3391e211..3588f21e5 100644 --- a/qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsEntry.cpp +++ b/qt/ManualDevicesSettingsPage/KasaSmartSettingsEntry/KasaSmartSettingsEntry.cpp @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBKasaSmartSettingsEntry.cpp | +| KasaSmartSettingsEntry.cpp | | | | User interface for OpenRGB Kasa Smart settings entry | | | @@ -7,22 +7,22 @@ | SPDX-License-Identifier: GPL-2.0-only | \*---------------------------------------------------------*/ -#include "OpenRGBKasaSmartSettingsEntry.h" -#include "ui_OpenRGBKasaSmartSettingsEntry.h" +#include "KasaSmartSettingsEntry.h" +#include "ui_KasaSmartSettingsEntry.h" -OpenRGBKasaSmartSettingsEntry::OpenRGBKasaSmartSettingsEntry(QWidget *parent) : +KasaSmartSettingsEntry::KasaSmartSettingsEntry(QWidget *parent) : BaseManualDeviceEntry(parent), - ui(new Ui::OpenRGBKasaSmartSettingsEntry) + ui(new Ui::KasaSmartSettingsEntry) { ui->setupUi(this); } -OpenRGBKasaSmartSettingsEntry::~OpenRGBKasaSmartSettingsEntry() +KasaSmartSettingsEntry::~KasaSmartSettingsEntry() { delete ui; } -void OpenRGBKasaSmartSettingsEntry::changeEvent(QEvent *event) +void KasaSmartSettingsEntry::changeEvent(QEvent *event) { if(event->type() == QEvent::LanguageChange) { @@ -30,7 +30,7 @@ void OpenRGBKasaSmartSettingsEntry::changeEvent(QEvent *event) } } -void OpenRGBKasaSmartSettingsEntry::loadFromSettings(const json& data) +void KasaSmartSettingsEntry::loadFromSettings(const json& data) { if(data.contains("ip")) { @@ -42,7 +42,7 @@ void OpenRGBKasaSmartSettingsEntry::loadFromSettings(const json& data) } } -json OpenRGBKasaSmartSettingsEntry::saveSettings() +json KasaSmartSettingsEntry::saveSettings() { json result; result["ip"] = ui->IPEdit->text().toStdString(); @@ -50,12 +50,22 @@ json OpenRGBKasaSmartSettingsEntry::saveSettings() return result; } -const char* OpenRGBKasaSmartSettingsEntry::settingsSection() -{ - return "KasaSmartDevices"; -} - -void OpenRGBKasaSmartSettingsEntry::setName(QString name) +void KasaSmartSettingsEntry::setName(QString name) { ui->NameEdit->setText(name); } + +bool KasaSmartSettingsEntry::isDataValid() +{ + // stub + return true; +} + +static BaseManualDeviceEntry* SpawnKasaSmartSettingsEntry(const json& data) +{ + KasaSmartSettingsEntry* entry = new KasaSmartSettingsEntry; + entry->loadFromSettings(data); + return entry; +} + +REGISTER_MANUAL_DEVICE_TYPE("Kasa Smart", "KasaSmartDevices", SpawnKasaSmartSettingsEntry); diff --git a/qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsEntry.h b/qt/ManualDevicesSettingsPage/KasaSmartSettingsEntry/KasaSmartSettingsEntry.h similarity index 60% rename from qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsEntry.h rename to qt/ManualDevicesSettingsPage/KasaSmartSettingsEntry/KasaSmartSettingsEntry.h index 18ab3f327..1eaa9ee38 100644 --- a/qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsEntry.h +++ b/qt/ManualDevicesSettingsPage/KasaSmartSettingsEntry/KasaSmartSettingsEntry.h @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBKasaSmartSettingsEntry.h | +| KasaSmartSettingsEntry.h | | | | User interface for OpenRGB Kasa Smart settings entry | | | @@ -13,24 +13,25 @@ namespace Ui { - class OpenRGBKasaSmartSettingsEntry; + class KasaSmartSettingsEntry; } -class OpenRGBKasaSmartSettingsEntry : public BaseManualDeviceEntry +class KasaSmartSettingsEntry : public BaseManualDeviceEntry { Q_OBJECT public: - explicit OpenRGBKasaSmartSettingsEntry(QWidget *parent = nullptr); - ~OpenRGBKasaSmartSettingsEntry(); + explicit KasaSmartSettingsEntry(QWidget *parent = nullptr); + ~KasaSmartSettingsEntry(); void loadFromSettings(const json& data); - json saveSettings(); - const char* settingsSection(); void setName(QString name); + json saveSettings() override; + bool isDataValid() override; + private: - Ui::OpenRGBKasaSmartSettingsEntry *ui; + Ui::KasaSmartSettingsEntry *ui; private slots: - void changeEvent(QEvent *event); + void changeEvent(QEvent *event) override; }; diff --git a/qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsEntry.ui b/qt/ManualDevicesSettingsPage/KasaSmartSettingsEntry/KasaSmartSettingsEntry.ui similarity index 89% rename from qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsEntry.ui rename to qt/ManualDevicesSettingsPage/KasaSmartSettingsEntry/KasaSmartSettingsEntry.ui index ccf0bd753..91bc1613e 100644 --- a/qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsEntry.ui +++ b/qt/ManualDevicesSettingsPage/KasaSmartSettingsEntry/KasaSmartSettingsEntry.ui @@ -1,12 +1,12 @@ - OpenRGBKasaSmartSettingsEntry - + KasaSmartSettingsEntry + 0 0 - 190 + 216 89 @@ -23,7 +23,7 @@ - + Kasa Smart Device diff --git a/qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsEntry.cpp b/qt/ManualDevicesSettingsPage/LIFXSettingsEntry/LIFXSettingsEntry.cpp similarity index 56% rename from qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsEntry.cpp rename to qt/ManualDevicesSettingsPage/LIFXSettingsEntry/LIFXSettingsEntry.cpp index 60b87a46f..709e0e1f2 100644 --- a/qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsEntry.cpp +++ b/qt/ManualDevicesSettingsPage/LIFXSettingsEntry/LIFXSettingsEntry.cpp @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBLIFXSettingsEntry.cpp | +| LIFXSettingsEntry.cpp | | | | User interface for OpenRGB LIFX settings entry | | | @@ -7,22 +7,22 @@ | SPDX-License-Identifier: GPL-2.0-only | \*---------------------------------------------------------*/ -#include "OpenRGBLIFXSettingsEntry.h" -#include "ui_OpenRGBLIFXSettingsEntry.h" +#include "LIFXSettingsEntry.h" +#include "ui_LIFXSettingsEntry.h" -OpenRGBLIFXSettingsEntry::OpenRGBLIFXSettingsEntry(QWidget *parent) : +LIFXSettingsEntry::LIFXSettingsEntry(QWidget *parent) : BaseManualDeviceEntry(parent), - ui(new Ui::OpenRGBLIFXSettingsEntry) + ui(new Ui::LIFXSettingsEntry) { ui->setupUi(this); } -OpenRGBLIFXSettingsEntry::~OpenRGBLIFXSettingsEntry() +LIFXSettingsEntry::~LIFXSettingsEntry() { delete ui; } -void OpenRGBLIFXSettingsEntry::changeEvent(QEvent *event) +void LIFXSettingsEntry::changeEvent(QEvent *event) { if(event->type() == QEvent::LanguageChange) { @@ -30,7 +30,7 @@ void OpenRGBLIFXSettingsEntry::changeEvent(QEvent *event) } } -void OpenRGBLIFXSettingsEntry::loadFromSettings(const json& data) +void LIFXSettingsEntry::loadFromSettings(const json& data) { if(data.contains("ip")) { @@ -42,7 +42,7 @@ void OpenRGBLIFXSettingsEntry::loadFromSettings(const json& data) } } -json OpenRGBLIFXSettingsEntry::saveSettings() +json LIFXSettingsEntry::saveSettings() { json result; result["ip"] = ui->IPEdit->text().toStdString(); @@ -50,12 +50,22 @@ json OpenRGBLIFXSettingsEntry::saveSettings() return result; } -const char* OpenRGBLIFXSettingsEntry::settingsSection() -{ - return "LIFXDevices"; -} - -void OpenRGBLIFXSettingsEntry::setName(QString name) +void LIFXSettingsEntry::setName(QString name) { ui->NameEdit->setText(name); } + +bool LIFXSettingsEntry::isDataValid() +{ + // stub + return true; +} + +static BaseManualDeviceEntry* SpawnLIFXSettingsEntry(const json& data) +{ + LIFXSettingsEntry* entry = new LIFXSettingsEntry; + entry->loadFromSettings(data); + return entry; +} + +REGISTER_MANUAL_DEVICE_TYPE("LIFX", "LIFXDevices", SpawnLIFXSettingsEntry); diff --git a/qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsEntry.h b/qt/ManualDevicesSettingsPage/LIFXSettingsEntry/LIFXSettingsEntry.h similarity index 61% rename from qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsEntry.h rename to qt/ManualDevicesSettingsPage/LIFXSettingsEntry/LIFXSettingsEntry.h index 122d349b8..0a817166b 100644 --- a/qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsEntry.h +++ b/qt/ManualDevicesSettingsPage/LIFXSettingsEntry/LIFXSettingsEntry.h @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBLIFXSettingsEntry.h | +| LIFXSettingsEntry.h | | | | User interface for OpenRGB LIFX settings entry | | | @@ -11,24 +11,25 @@ namespace Ui { - class OpenRGBLIFXSettingsEntry; + class LIFXSettingsEntry; } -class OpenRGBLIFXSettingsEntry : public BaseManualDeviceEntry +class LIFXSettingsEntry : public BaseManualDeviceEntry { Q_OBJECT public: - explicit OpenRGBLIFXSettingsEntry(QWidget *parent = nullptr); - ~OpenRGBLIFXSettingsEntry(); + explicit LIFXSettingsEntry(QWidget *parent = nullptr); + ~LIFXSettingsEntry(); void loadFromSettings(const json& data); - json saveSettings(); - const char* settingsSection(); void setName(QString name); + json saveSettings() override; + bool isDataValid() override; + private: - Ui::OpenRGBLIFXSettingsEntry *ui; + Ui::LIFXSettingsEntry *ui; private slots: - void changeEvent(QEvent *event); + void changeEvent(QEvent *event) override; }; diff --git a/qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsEntry.ui b/qt/ManualDevicesSettingsPage/LIFXSettingsEntry/LIFXSettingsEntry.ui similarity index 90% rename from qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsEntry.ui rename to qt/ManualDevicesSettingsPage/LIFXSettingsEntry/LIFXSettingsEntry.ui index 9b6129db4..73d6f2296 100644 --- a/qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsEntry.ui +++ b/qt/ManualDevicesSettingsPage/LIFXSettingsEntry/LIFXSettingsEntry.ui @@ -1,12 +1,12 @@ - OpenRGBLIFXSettingsEntry - + LIFXSettingsEntry + 0 0 - 190 + 216 89 @@ -23,7 +23,7 @@ - + LIFX Device diff --git a/qt/ManualDevicesSettingsPage/ManualDevicesSettingsPage.cpp b/qt/ManualDevicesSettingsPage/ManualDevicesSettingsPage.cpp new file mode 100644 index 000000000..92779960f --- /dev/null +++ b/qt/ManualDevicesSettingsPage/ManualDevicesSettingsPage.cpp @@ -0,0 +1,330 @@ +/*-----------------------------------------------------------------*\ +| ManualDevicesSettingsPage.cpp | +| | +| User interface for OpenRGB Manually Added Devices settings page | +| | +| This file is part of the OpenRGB project | +| SPDX-License-Identifier: GPL-2.0-only | +\*-----------------------------------------------------------------*/ + +#include "ManualDevicesSettingsPage.h" +#include "ui_ManualDevicesSettingsPage.h" + +#include "NanoleafSettingsEntry.h" +#include "ResourceManager.h" +#include "SettingsManager.h" + +#include + +static void ManualDevicesPageReloadCallback(void* this_ptr) +{ + ManualDevicesSettingsPage * this_obj = (ManualDevicesSettingsPage *)this_ptr; + + QMetaObject::invokeMethod(this_obj, "reloadList", Qt::QueuedConnection); +} + +ManualDevicesSettingsPage::ManualDevicesSettingsPage(QWidget *parent) : + QWidget(parent), + ui(new Ui::ManualDevicesSettingsPage) +{ + ui->setupUi(this); + ResourceManager::get()->RegisterDetectionEndCallback(&ManualDevicesPageReloadCallback, this); + + addDeviceMenu = new QMenu(this); + ui->addDeviceButton->setMenu(addDeviceMenu); + connect(addDeviceMenu, &QMenu::triggered, this, &ManualDevicesSettingsPage::onAddDeviceItemSelected); + + QMenu* saveButtonMenu = new QMenu(this); + saveButtonMenu->addAction(ui->ActionSaveAndRescan); + saveButtonMenu->addAction(ui->ActionSaveNoRescan); + ui->saveConfigurationButton->setMenu(saveButtonMenu); + ui->saveConfigurationButton->setDefaultAction(ui->ActionSaveAndRescan); + + reloadList(); +} + +ManualDevicesSettingsPage::~ManualDevicesSettingsPage() +{ + ResourceManager::get()->UnregisterDetectionEndCallback(&ManualDevicesPageReloadCallback, this); + clearList(); + delete ui; +} + +void ManualDevicesSettingsPage::changeEvent(QEvent *event) +{ + if(event->type() == QEvent::LanguageChange) + { + ui->retranslateUi(this); + reloadMenu(); + } +} + +void ManualDevicesSettingsPage::on_removeDeviceButton_clicked() +{ + int cur_row = ui->deviceList->currentRow(); + + if(cur_row < 0) + { + return; + } + + QListWidgetItem* item = ui->deviceList->takeItem(cur_row); + + ui->deviceList->removeItemWidget(item); + delete item; + + BaseManualDeviceEntry* entry = entries[cur_row]; + entries.erase(entries.begin() + cur_row); + delete entry; + + setUnsavedChanges(true); +} + +void ManualDevicesSettingsPage::saveSettings() +{ + SettingsManager* sm = ResourceManager::get()->GetSettingsManager(); + + json result; + + /*-----------------------------------------------------------------------------*\ + | First, cache the data that will be stored as JSON | + | We wrap data into arrays by type (except Nanoleaf) | + | Nanoleaf stores it's data as an object with "location" as key for some reason | + \*-----------------------------------------------------------------------------*/ + for(size_t idx = 0; idx < entries.size(); ++idx) + { + std::string section = entries[idx]->getSettingsSection(); + if(section == "NanoleafDevices") + { + NanoleafSettingsEntry* entry = dynamic_cast(entries[idx]); + result[section]["devices"][entry->getLocation()] = entries[idx]->saveSettings(); + } + else if(section == "PhilipsHueDevices") + { + result[section]["bridges"].push_back(entries[idx]->saveSettings()); + } + else + { + result[section]["devices"].push_back(entries[idx]->saveSettings()); + } + } + + /*---------------------------------------------------------*\ + | Transfer data from the cached object into config sections | + | Use ALL possible settings entry names, so that those with | + | all entries deleted are cleared properly | + \*---------------------------------------------------------*/ + + std::vector blocks = ManualDevicesTypeManager::get()->getRegisteredTypes(); + for(int i = 0; i < blocks.size(); ++i) + { + sm->SetSettings(blocks[i].settingsSection, result[blocks[i].settingsSection]); + } + sm->SaveSettings(); + + setUnsavedChanges(false); +} + +void ManualDevicesSettingsPage::reloadMenu() +{ + std::vector names = ManualDevicesTypeManager::get()->getRegisteredTypeNames(); + + addDeviceMenu->clear(); + for(int i = 0; i < names.size(); ++i) + { + QAction* action = addDeviceMenu->addAction(qApp->translate("ManualDevice", names[i].c_str())); + action->setData(QString::fromStdString(names[i])); + } +} + +void ManualDevicesSettingsPage::reloadList() +{ + clearList(); + addDeviceMenu->clear(); + + std::vector blocks = ManualDevicesTypeManager::get()->getRegisteredTypes(); + for(int i = 0; i < blocks.size(); ++i) + { + addEntries(blocks[i]); + + /*------------------------------------------------------------*\ + | While we have all the data at hand, load in the menu as well | + \*------------------------------------------------------------*/ + QAction* action = addDeviceMenu->addAction(qApp->translate("ManualDevice", blocks[i].name.c_str())); + action->setData(QString::fromStdString(blocks[i].name)); + } + + /*--------------------*\ + | Refresh button state | + \*--------------------*/ + setUnsavedChanges(false); + on_deviceList_itemSelectionChanged(); +} + +void ManualDevicesSettingsPage::onTextEditChanged() +{ + setUnsavedChanges(true); +} + +void ManualDevicesSettingsPage::clearList() +{ + std::vector entries_copy; + entries_copy.swap(entries); + ui->deviceList->clear(); + + for(int i = 0; i < entries_copy.size(); ++i) + { + delete entries_copy[i]; + } + entries_copy.clear(); + setUnsavedChanges(true); +} + +void ManualDevicesSettingsPage::setUnsavedChanges(bool v) +{ + unsavedChanges = v; + ui->saveConfigurationButton->setEnabled(v && checkValidToSave()); + if(v) + { + ui->saveConfigurationButton->setStyleSheet("font: bold"); + } + else + { + ui->saveConfigurationButton->setStyleSheet(""); + } +} + +bool ManualDevicesSettingsPage::checkValidToSave() +{ + for(int i = 0; i < entries.size(); ++i) + { + if(!entries[i]->isDataValid()) + { + return false; + } + } + return true; +} + +QListWidgetItem* ManualDevicesSettingsPage::addEntry(BaseManualDeviceEntry* entry) +{ + if(!entry) + { + return nullptr; + } + + /*---------------------------------------------------------*\ + | Find EVERY QLineEdit in the entry and get notified if ANY | + | text in them changes - for validation | + | Validation mostly affects the "Save" button state | + \*---------------------------------------------------------*/ + QList textEditList = entry->findChildren(QString(), Qt::FindChildrenRecursively); + for(int i = 0; i < textEditList.size(); ++i) + { + connect(textEditList[i], &QLineEdit::textChanged, this, &ManualDevicesSettingsPage::onTextEditChanged); + } + + QListWidgetItem* item = new QListWidgetItem; + + item->setSizeHint(entry->sizeHint()); + + ui->deviceList->addItem(item); + ui->deviceList->setItemWidget(item, entry); + ui->deviceList->show(); + + entries.push_back(entry); + + /*---------------------------------------------------------*\ + | New entries generally indicate unsaved changes | + \*---------------------------------------------------------*/ + setUnsavedChanges(true); + + return item; +} + +void ManualDevicesSettingsPage::addEntries(const ManualDeviceTypeBlock& block) +{ + /*---------------------------------------------------------*\ + | Spawn list entries for all config entries of one type | + \*---------------------------------------------------------*/ + json settings = ResourceManager::get()->GetSettingsManager()->GetSettings(block.settingsSection); + const char* array_name = "devices"; + if(block.settingsSection == "PhilipsHueDevices") + { + array_name = "bridges"; + } + + if(settings.contains(array_name)) + { + json& array_ref = settings[array_name]; + + if(!array_ref.is_array() && !array_ref.is_object()) + { + return; + } + /*-----------------------------------------------------------------*\ + | Nanoleaf stores it's data as objects with location field as "key" | + | everything else is arrays | + | For uniformity, use iterators, as if it's always an object | + \*-----------------------------------------------------------------*/ + for(json::const_iterator iter = array_ref.begin(); iter != array_ref.end(); ++iter) + { + if(!iter.value().empty()) + { + BaseManualDeviceEntry* entry = block.spawn(iter.value()); + + /*---------------------------------------------------*\ + | Note: spawn functions are allowed to return nullptr | + \*---------------------------------------------------*/ + if(entry) + { + addEntry(entry); + } + } + } + } +} + +void ManualDevicesSettingsPage::onAddDeviceItemSelected(QAction* action) +{ + std::string entryName = action->data().toString().toStdString(); + BaseManualDeviceEntry* entry = ManualDevicesTypeManager::get()->spawnByTypeName(entryName, json()); + /*---------------------------------------------------*\ + | Note: spawn functions are allowed to return nullptr | + \*---------------------------------------------------*/ + if(entry) + { + QListWidgetItem* item = addEntry(entry); + + /*-----------------------------------------------------*\ + | Scroll to the newly added entry (last one in the list | + \*-----------------------------------------------------*/ + if(item) + { + ui->deviceList->scrollToItem(item); + } + } +} + +void ManualDevicesSettingsPage::on_deviceList_itemSelectionChanged() +{ + int cur_row = ui->deviceList->currentRow(); + + bool anySelected = (cur_row >= 0); + ui->removeDeviceButton->setEnabled(anySelected); +} + +void ManualDevicesSettingsPage::on_ActionSaveNoRescan_triggered() +{ + saveSettings(); +} + +void ManualDevicesSettingsPage::on_ActionSaveAndRescan_triggered() +{ + saveSettings(); + /*---------------*\ + | Trigger rescan | + \*--------------*/ + ResourceManager::get()->DetectDevices(); +} + diff --git a/qt/ManualDevicesSettingsPage/ManualDevicesSettingsPage.h b/qt/ManualDevicesSettingsPage/ManualDevicesSettingsPage.h new file mode 100644 index 000000000..37cba73a9 --- /dev/null +++ b/qt/ManualDevicesSettingsPage/ManualDevicesSettingsPage.h @@ -0,0 +1,61 @@ +/*-----------------------------------------------------------------*\ +| ManualDevicesSettingsPage.h | +| | +| User interface for OpenRGB Manually Added Devices settings page | +| | +| This file is part of the OpenRGB project | +| SPDX-License-Identifier: GPL-2.0-only | +\*-----------------------------------------------------------------*/ + +#pragma once + +#include "BaseManualDeviceEntry.h" +#include "ManualDevicesTypeManager.h" +#include "nlohmann/json.hpp" +#include +#include +#include + +using json = nlohmann::json; + +namespace Ui +{ + class ManualDevicesSettingsPage; +} + +class ManualDevicesSettingsPage : public QWidget +{ + Q_OBJECT + +public: + explicit ManualDevicesSettingsPage(QWidget *parent = nullptr); + ~ManualDevicesSettingsPage(); + +public slots: + void reloadList(); + void reloadMenu(); + +private slots: + void onTextEditChanged(); // Slot connected to all text edits in all entries; for validation & marking dirty changes + void onAddDeviceItemSelected(QAction* action); + + void changeEvent(QEvent *event); + + void on_removeDeviceButton_clicked(); + void on_deviceList_itemSelectionChanged(); + void on_ActionSaveNoRescan_triggered(); + void on_ActionSaveAndRescan_triggered(); + +private: + Ui::ManualDevicesSettingsPage* ui; + std::vector entries; + QMenu* addDeviceMenu; + bool unsavedChanges; + + QListWidgetItem* addEntry(BaseManualDeviceEntry* entry); + void addEntries(const ManualDeviceTypeBlock&); + void clearList(); + void saveSettings(); + void setUnsavedChanges(bool v); + bool checkValidToSave(); +}; diff --git a/qt/ManualDevicesSettingsPage/ManualDevicesSettingsPage.ui b/qt/ManualDevicesSettingsPage/ManualDevicesSettingsPage.ui new file mode 100644 index 000000000..2d5ea0fe4 --- /dev/null +++ b/qt/ManualDevicesSettingsPage/ManualDevicesSettingsPage.ui @@ -0,0 +1,72 @@ + + + ManualDevicesSettingsPage + + + + 0 + 0 + 400 + 300 + + + + Manually Added Devices Settings Page + + + + + + QAbstractItemView::ScrollPerPixel + + + + + + + + + Add Device... + + + + + + + Remove + + + + + + + + 0 + 0 + + + + Save and Rescan + + + QToolButton::MenuButtonPopup + + + + + + + + + Save and Rescan + + + + + Save without Rescan + + + + + + diff --git a/qt/ManualDevicesSettingsPage/ManualDevicesTypeManager.cpp b/qt/ManualDevicesSettingsPage/ManualDevicesTypeManager.cpp new file mode 100644 index 000000000..e70166598 --- /dev/null +++ b/qt/ManualDevicesSettingsPage/ManualDevicesTypeManager.cpp @@ -0,0 +1,80 @@ +/*---------------------------------------------------------*\ +| ManualDevicesTypeManager.cpp | +| | +| OpenRGB Manual Devices Type Manager registers available | +| types of Manually Added devices and generates UI | +| elements for their settings | +| | +| This file is part of the OpenRGB project | +| SPDX-License-Identifier: GPL-2.0-only | +\*---------------------------------------------------------*/ + +#include "ManualDevicesTypeManager.h" + +ManualDeviceTypeBlock::ManualDeviceTypeBlock(const std::string& _name, const std::string& _settingsSection, ManualDeviceEntrySpawnFunction _entrySpawnFunction) +{ + name = _name; + settingsSection = _settingsSection; + entrySpawnFunction = _entrySpawnFunction; +} + +BaseManualDeviceEntry* ManualDeviceTypeBlock::spawn(const json& data) const +{ + BaseManualDeviceEntry* result = entrySpawnFunction(data); + if(result) + { + result->setSettingsSection(settingsSection); + } + return result; +} + +ManualDevicesTypeManager* ManualDevicesTypeManager::instance; + +ManualDevicesTypeManager *ManualDevicesTypeManager::get() +{ + if(!instance) + { + instance = new ManualDevicesTypeManager(); + } + + return instance; +} + +ManualDevicesTypeManager::ManualDevicesTypeManager() +{ + ; +} + +void ManualDevicesTypeManager::registerType(const std::string& name, const std::string& settingsSection, ManualDeviceEntrySpawnFunction entrySpawnFunction) +{ + types.push_back(ManualDeviceTypeBlock(name, settingsSection, entrySpawnFunction)); +} + +std::vector ManualDevicesTypeManager::getRegisteredTypes() +{ + return types; +} + +std::vector ManualDevicesTypeManager::getRegisteredTypeNames() +{ + std::vector result; + result.resize(types.size()); + + for(int i = 0; i < types.size(); ++i) + { + result[i] = types[i].name; + } + return result; +} + +BaseManualDeviceEntry* ManualDevicesTypeManager::spawnByTypeName(const std::string& typeName, const json& data) +{ + for(int i = 0; i < types.size(); ++i) + { + if(types[i].name == typeName) + { + return types[i].spawn(data); + } + } + return nullptr; +} diff --git a/qt/ManualDevicesSettingsPage/ManualDevicesTypeManager.h b/qt/ManualDevicesSettingsPage/ManualDevicesTypeManager.h new file mode 100644 index 000000000..5770c8876 --- /dev/null +++ b/qt/ManualDevicesSettingsPage/ManualDevicesTypeManager.h @@ -0,0 +1,50 @@ +/*---------------------------------------------------------*\ +| ManualDevicesTypeManager.h | +| | +| OpenRGB Manual Devices Type Manager registers UI | +| classes for managing Manually Added devices | +| | +| This file is part of the OpenRGB project | +| SPDX-License-Identifier: GPL-2.0-only | +\*---------------------------------------------------------*/ + +#pragma once + +#include "BaseManualDeviceEntry.h" + +#include +#include + +#include "nlohmann/json.hpp" + +using json = nlohmann::json; + + +class ManualDeviceTypeBlock +{ +public: + ManualDeviceTypeBlock(const std::string& name, const std::string& settingsSection, ManualDeviceEntrySpawnFunction entrySpawnFunction); + std::string name; // Name as listed in the drop-down list + std::string settingsSection; // Settings Section name, as listed in Config file + BaseManualDeviceEntry* spawn(const json &data) const; + +private: + ManualDeviceEntrySpawnFunction entrySpawnFunction; +}; + +class ManualDevicesTypeManager +{ + public: + static ManualDevicesTypeManager* get(); + void registerType(const std::string& name, const std::string& settingsSection, ManualDeviceEntrySpawnFunction entrySpawnFunction); + + std::vector getRegisteredTypes(); + std::vector getRegisteredTypeNames(); + BaseManualDeviceEntry* spawnByTypeName(const std::string& typeName, const json& data); + + private: + static ManualDevicesTypeManager* instance; + std::vector types; + + ManualDevicesTypeManager(); +}; diff --git a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafNewDeviceDialog.cpp b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafNewDeviceDialog.cpp similarity index 70% rename from qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafNewDeviceDialog.cpp rename to qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafNewDeviceDialog.cpp index 17ca48751..ae5c69ed5 100644 --- a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafNewDeviceDialog.cpp +++ b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafNewDeviceDialog.cpp @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBNanoleafNewDeviceDialog.cpp | +| NanoleafNewDeviceDialog.cpp | | | | User interface for OpenRGB Nanoleaf dialog | | | @@ -9,27 +9,27 @@ #include #include "ResourceManager.h" -#include "OpenRGBNanoleafNewDeviceDialog.h" -#include "ui_OpenRGBNanoleafNewDeviceDialog.h" +#include "NanoleafNewDeviceDialog.h" +#include "ui_NanoleafNewDeviceDialog.h" #ifdef _WIN32 #include #endif -OpenRGBNanoleafNewDeviceDialog::OpenRGBNanoleafNewDeviceDialog(QWidget *parent) : - QDialog(parent), ui(new Ui::OpenRGBNanoleafNewDeviceDialog) +NanoleafNewDeviceDialog::NanoleafNewDeviceDialog(QWidget *parent) : + QDialog(parent), ui(new Ui::NanoleafNewDeviceDialog) { ui->setupUi(this); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); ui->devicePortEdit->setText("16021"); } -OpenRGBNanoleafNewDeviceDialog::~OpenRGBNanoleafNewDeviceDialog() +NanoleafNewDeviceDialog::~NanoleafNewDeviceDialog() { delete ui; } -void OpenRGBNanoleafNewDeviceDialog::changeEvent(QEvent *event) +void NanoleafNewDeviceDialog::changeEvent(QEvent *event) { if(event->type() == QEvent::LanguageChange) { @@ -37,7 +37,7 @@ void OpenRGBNanoleafNewDeviceDialog::changeEvent(QEvent *event) } } -NanoleafDevice OpenRGBNanoleafNewDeviceDialog::show() +NanoleafDevice NanoleafNewDeviceDialog::show() { NanoleafDevice return_device; diff --git a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafNewDeviceDialog.h b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafNewDeviceDialog.h similarity index 66% rename from qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafNewDeviceDialog.h rename to qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafNewDeviceDialog.h index 252ad6b96..4129ce07e 100644 --- a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafNewDeviceDialog.h +++ b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafNewDeviceDialog.h @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBNanoleafNewDeviceDialog.h | +| NanoleafNewDeviceDialog.h | | | | User interface for OpenRGB Nanoleaf dialog | | | @@ -8,7 +8,6 @@ \*---------------------------------------------------------*/ #include -#include "OpenRGBDialog.h" struct NanoleafDevice { @@ -18,21 +17,21 @@ struct NanoleafDevice namespace Ui { -class OpenRGBNanoleafNewDeviceDialog; + class NanoleafNewDeviceDialog; } -class OpenRGBNanoleafNewDeviceDialog : public QDialog +class NanoleafNewDeviceDialog : public QDialog { Q_OBJECT public: - explicit OpenRGBNanoleafNewDeviceDialog(QWidget *parent = nullptr); - ~OpenRGBNanoleafNewDeviceDialog(); + explicit NanoleafNewDeviceDialog(QWidget *parent = nullptr); + ~NanoleafNewDeviceDialog(); NanoleafDevice show(); private: - Ui::OpenRGBNanoleafNewDeviceDialog *ui; + Ui::NanoleafNewDeviceDialog *ui; private slots: void changeEvent(QEvent *event); diff --git a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafNewDeviceDialog.ui b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafNewDeviceDialog.ui similarity index 89% rename from qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafNewDeviceDialog.ui rename to qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafNewDeviceDialog.ui index 06b1f355e..2feacbe8d 100644 --- a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafNewDeviceDialog.ui +++ b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafNewDeviceDialog.ui @@ -1,7 +1,7 @@ - OpenRGBNanoleafNewDeviceDialog - + NanoleafNewDeviceDialog + 0 @@ -57,7 +57,7 @@ buttonBox accepted() - OpenRGBNanoleafNewDeviceDialog + NanoleafNewDeviceDialog accept() @@ -73,7 +73,7 @@ buttonBox rejected() - OpenRGBNanoleafNewDeviceDialog + NanoleafNewDeviceDialog reject() diff --git a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsPage.cpp b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafScanDialog.cpp similarity index 60% rename from qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsPage.cpp rename to qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafScanDialog.cpp index fff4c27cb..540391861 100644 --- a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsPage.cpp +++ b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafScanDialog.cpp @@ -1,60 +1,36 @@ /*---------------------------------------------------------*\ -| OpenRGBNanoleafSettingsPage.cpp | +| NanoleafScanDialog.cpp | | | -| User interface for OpenRGB Nanoleaf settings page | +| User interface for Nanoleaf scan & pairing 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 "NanoleafScanDialog.h" +#include "ui_NanoleafScanDialog.h" + +#include "NanoleafNewDeviceDialog.h" #include "ResourceManager.h" #include "SettingsManager.h" #include "LogManager.h" using json = nlohmann::json; -OpenRGBNanoleafSettingsPage::OpenRGBNanoleafSettingsPage(QWidget *parent) : - QWidget(parent), - ui(new Ui::OpenRGBNanoleafSettingsPage) +NanoleafScanDialog::NanoleafScanDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::NanoleafScanDialog) { 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(); - } - } - } + on_NanoleafDeviceList_itemSelectionChanged(); // Refresh button state } -OpenRGBNanoleafSettingsPage::~OpenRGBNanoleafSettingsPage() +NanoleafScanDialog::~NanoleafScanDialog() { delete ui; } -void OpenRGBNanoleafSettingsPage::changeEvent(QEvent *event) +void NanoleafScanDialog::changeEvent(QEvent *event) { if(event->type() == QEvent::LanguageChange) { @@ -62,13 +38,13 @@ void OpenRGBNanoleafSettingsPage::changeEvent(QEvent *event) } } -void OpenRGBNanoleafSettingsPage::on_AddNanoleafDeviceButton_clicked() +void NanoleafScanDialog::on_AddNanoleafDeviceButton_clicked() { /*-----------------------------------------------------*\ | Open a popup to manually add a device by setting ip | | and port | \*-----------------------------------------------------*/ - OpenRGBNanoleafNewDeviceDialog dialog; + NanoleafNewDeviceDialog dialog; NanoleafDevice device = dialog.show(); if(!device.ip.empty()) { @@ -77,7 +53,7 @@ void OpenRGBNanoleafSettingsPage::on_AddNanoleafDeviceButton_clicked() if(entries.find(location) == entries.end()) { - OpenRGBNanoleafSettingsEntry* entry = new OpenRGBNanoleafSettingsEntry(QString::fromUtf8(device.ip.c_str()), device.port); + NanoleafSettingsEntry* entry = new NanoleafSettingsEntry(QString::fromUtf8(device.ip.c_str()), device.port); entries[location] = entry; @@ -98,7 +74,7 @@ void OpenRGBNanoleafSettingsPage::on_AddNanoleafDeviceButton_clicked() } } -void OpenRGBNanoleafSettingsPage::on_RemoveNanoleafDeviceButton_clicked() +void NanoleafScanDialog::on_RemoveNanoleafDeviceButton_clicked() { /*-------------------------------------------------*\ | Remove the selected device | @@ -111,13 +87,12 @@ void OpenRGBNanoleafSettingsPage::on_RemoveNanoleafDeviceButton_clicked() } QListWidgetItem* item = ui->NanoleafDeviceList->item(cur_row); - OpenRGBNanoleafSettingsEntry* entry = (OpenRGBNanoleafSettingsEntry*) ui->NanoleafDeviceList->itemWidget(item); - LOG_TRACE("[%s] Remove %s:%d", "Nanoleaf", entry->address.toStdString().c_str(), entry->port); + NanoleafSettingsEntry* entry = (NanoleafSettingsEntry*) ui->NanoleafDeviceList->itemWidget(item); ui->NanoleafDeviceList->removeItemWidget(item); delete item; - std::string location = entry->address.toStdString()+":"+std::to_string(entry->port); + std::string location = entry->getLocation(); delete entries[location]; entries.erase(location); @@ -127,13 +102,13 @@ void OpenRGBNanoleafSettingsPage::on_RemoveNanoleafDeviceButton_clicked() ResourceManager::get()->GetSettingsManager()->SaveSettings(); } -void OpenRGBNanoleafSettingsPage::on_ScanForNanoleafDevicesButton_clicked() +void NanoleafScanDialog::on_ScanForNanoleafDevicesButton_clicked() { /*-----------------------------------------------------*\ | Create a worker thread for the mDNS query and hookup | | callbacks for when it finds devices | \*-----------------------------------------------------*/ - OpenRGBNanoleafScanningThread *scanThread = new OpenRGBNanoleafScanningThread; + NanoleafScanningThread *scanThread = new NanoleafScanningThread; connect(scanThread, SIGNAL(DeviceFound(QString, int)), SLOT(on_DeviceFound(QString, int))); @@ -144,13 +119,13 @@ void OpenRGBNanoleafSettingsPage::on_ScanForNanoleafDevicesButton_clicked() scanThread->start(); } -void OpenRGBNanoleafSettingsPage::on_DeviceFound(QString address, int port) +void NanoleafScanDialog::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); + NanoleafSettingsEntry* entry = new NanoleafSettingsEntry(address, port); entries[location] = entry; @@ -163,3 +138,12 @@ void OpenRGBNanoleafSettingsPage::on_DeviceFound(QString address, int port) ui->NanoleafDeviceList->show(); } } + +void NanoleafScanDialog::on_NanoleafDeviceList_itemSelectionChanged() +{ + int cur_row = ui->NanoleafDeviceList->currentRow(); + + bool anySelected = (cur_row >= 0); + ui->RemoveNanoleafDeviceButton->setEnabled(anySelected); +} + diff --git a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsPage.h b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafScanDialog.h similarity index 58% rename from qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsPage.h rename to qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafScanDialog.h index 4cc7abd29..7ad5b79e5 100644 --- a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsPage.h +++ b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafScanDialog.h @@ -1,7 +1,7 @@ /*---------------------------------------------------------*\ -| OpenRGBNanoleafSettingsPage.h | +| NanoleafScanDialog.h | | | -| User interface for OpenRGB Nanoleaf settings page | +| User interface for OpenRGB Nanoleaf scan & pairing page | | | | This file is part of the OpenRGB project | | SPDX-License-Identifier: GPL-2.0-only | @@ -9,21 +9,21 @@ #pragma once -#include -#include "OpenRGBNanoleafSettingsEntry.h" +#include +#include "NanoleafSettingsEntry.h" namespace Ui { - class OpenRGBNanoleafSettingsPage; + class NanoleafScanDialog; } -class OpenRGBNanoleafSettingsPage : public QWidget + class NanoleafScanDialog : public QDialog { Q_OBJECT public: - explicit OpenRGBNanoleafSettingsPage(QWidget *parent = nullptr); - ~OpenRGBNanoleafSettingsPage(); + explicit NanoleafScanDialog(QWidget *parent = nullptr); + ~NanoleafScanDialog(); private slots: void changeEvent(QEvent *event); @@ -32,7 +32,9 @@ private slots: void on_ScanForNanoleafDevicesButton_clicked(); void on_DeviceFound(QString address, int port); + void on_NanoleafDeviceList_itemSelectionChanged(); + private: - Ui::OpenRGBNanoleafSettingsPage *ui; - std::map entries; + Ui::NanoleafScanDialog *ui; + std::map entries; }; diff --git a/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafScanDialog.ui b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafScanDialog.ui new file mode 100644 index 000000000..7bc211cc7 --- /dev/null +++ b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafScanDialog.ui @@ -0,0 +1,66 @@ + + + NanoleafScanDialog + + + + 0 + 0 + 400 + 300 + + + + Nanoleaf Scan Page + + + + + + To pair, hold the on-off button down for 5-7 seconds until the LED starts flashing in a pattern, a new entry should appear in the list below, then click the "Pair" button on the entry within 30 seconds. + + + Qt::AlignCenter + + + true + + + + + + + QAbstractItemView::ScrollPerPixel + + + + + + + + + Scan + + + + + + + Add manually + + + + + + + Remove + + + + + + + + + + diff --git a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafScanningThread.cpp b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafScanningThread.cpp similarity index 96% rename from qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafScanningThread.cpp rename to qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafScanningThread.cpp index 29ff889e9..779cc4626 100644 --- a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafScanningThread.cpp +++ b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafScanningThread.cpp @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBNanoleafScanningThread.cpp | +| NanoleafScanningThread.cpp | | | | OpenRGB Nanoleaf scanning thread | | | @@ -22,7 +22,7 @@ #include "mdns.h" -#include "OpenRGBNanoleafScanningThread.h" +#include "NanoleafScanningThread.h" static char namebuffer[256]; @@ -366,13 +366,13 @@ static int query_callback( mdns_string_t addrstr = ipv4_address_to_string(namebuffer, sizeof(namebuffer), &address, sizeof(address)); - (static_cast(user_data))->EmitDeviceFound(addrstr.str, address.sin_port); + (static_cast(user_data))->EmitDeviceFound(addrstr.str, address.sin_port); } return 0; } -void OpenRGBNanoleafScanningThread::EmitDeviceFound(QString address, int port) +void NanoleafScanningThread::EmitDeviceFound(QString address, int port) { emit DeviceFound(address, port); } @@ -380,7 +380,7 @@ void OpenRGBNanoleafScanningThread::EmitDeviceFound(QString address, int port) /*-----------------------------------------------------*\ | Send a mDNS query | \*-----------------------------------------------------*/ -int OpenRGBNanoleafScanningThread::SendMDNSQuery() +int NanoleafScanningThread::SendMDNSQuery() { const char* service = "_nanoleafapi._tcp.local."; mdns_record_type record = MDNS_RECORDTYPE_PTR; @@ -471,7 +471,7 @@ int OpenRGBNanoleafScanningThread::SendMDNSQuery() return 0; } -void OpenRGBNanoleafScanningThread::run() +void NanoleafScanningThread::run() { SendMDNSQuery(); } diff --git a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafScanningThread.h b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafScanningThread.h similarity index 84% rename from qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafScanningThread.h rename to qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafScanningThread.h index ac89da2ac..ded6e881a 100644 --- a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafScanningThread.h +++ b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafScanningThread.h @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBNanoleafScanningThread.h | +| NanoleafScanningThread.h | | | | OpenRGB Nanoleaf scanning thread | | | @@ -9,7 +9,7 @@ #include -class OpenRGBNanoleafScanningThread : public QThread +class NanoleafScanningThread : public QThread { Q_OBJECT diff --git a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsEntry.cpp b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafSettingsEntry.cpp similarity index 70% rename from qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsEntry.cpp rename to qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafSettingsEntry.cpp index 3cf49a68e..82e176687 100644 --- a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsEntry.cpp +++ b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafSettingsEntry.cpp @@ -1,6 +1,5 @@ - /*---------------------------------------------------------*\ -| OpenRGBNanoleafSettingsEntry.cpp | +| NanoleafSettingsEntry.cpp | | | | User interface for OpenRGB Nanoleaf settings entry | | | @@ -8,26 +7,28 @@ | SPDX-License-Identifier: GPL-2.0-only | \*---------------------------------------------------------*/ -#include "OpenRGBNanoleafSettingsEntry.h" -#include "ui_OpenRGBNanoleafSettingsEntry.h" +#include "NanoleafSettingsEntry.h" +#include "ui_NanoleafSettingsEntry.h" + +#include "NanoleafScanDialog.h" #include "ResourceManager.h" #include "SettingsManager.h" #include "NanoleafController.h" -OpenRGBNanoleafSettingsEntry::OpenRGBNanoleafSettingsEntry(QWidget *parent) : +NanoleafSettingsEntry::NanoleafSettingsEntry(QWidget *parent) : BaseManualDeviceEntry(parent), - ui(new Ui::OpenRGBNanoleafSettingsEntry), + ui(new Ui::NanoleafSettingsEntry), paired(false) { ui->setupUi(this); } -OpenRGBNanoleafSettingsEntry::OpenRGBNanoleafSettingsEntry(QString a_address, int a_port) : - OpenRGBNanoleafSettingsEntry(nullptr) +NanoleafSettingsEntry::NanoleafSettingsEntry(QString a_address, int a_port) : + NanoleafSettingsEntry(nullptr) { address = a_address; port = a_port; - const std::string location = address.toStdString()+":"+std::to_string(port); + const std::string location = getLocation(); ui->IPValue->setText(address); ui->PortValue->setText(QString::fromStdString(std::to_string(a_port))); @@ -49,12 +50,12 @@ OpenRGBNanoleafSettingsEntry::OpenRGBNanoleafSettingsEntry(QString a_address, in } } -OpenRGBNanoleafSettingsEntry::~OpenRGBNanoleafSettingsEntry() +NanoleafSettingsEntry::~NanoleafSettingsEntry() { delete ui; } -void OpenRGBNanoleafSettingsEntry::changeEvent(QEvent *event) +void NanoleafSettingsEntry::changeEvent(QEvent *event) { if(event->type() == QEvent::LanguageChange) { @@ -62,14 +63,14 @@ void OpenRGBNanoleafSettingsEntry::changeEvent(QEvent *event) } } -void OpenRGBNanoleafSettingsEntry::on_PairButton_clicked() +void NanoleafSettingsEntry::on_PairButton_clicked() { try { auth_token = NanoleafController::Pair(address.toStdString(), port); // Save auth token. - const std::string location = address.toStdString()+":"+std::to_string(port); + std::string location = getLocation(); json nanoleaf_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("NanoleafDevices"); nanoleaf_settings["devices"][location]["ip"] = address.toStdString(); nanoleaf_settings["devices"][location]["port"] = port; @@ -90,11 +91,11 @@ void OpenRGBNanoleafSettingsEntry::on_PairButton_clicked() } } -void OpenRGBNanoleafSettingsEntry::on_UnpairButton_clicked() +void NanoleafSettingsEntry::on_UnpairButton_clicked() { NanoleafController::Unpair(address.toStdString(), port, auth_token); - const std::string location = address.toStdString()+":"+std::to_string(port); + std::string location = getLocation(); json nanoleaf_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("NanoleafDevices"); nanoleaf_settings["devices"].erase(location); ResourceManager::get()->GetSettingsManager()->SetSettings("NanoleafDevices", nanoleaf_settings); @@ -106,7 +107,7 @@ void OpenRGBNanoleafSettingsEntry::on_UnpairButton_clicked() ui->UnpairButton->hide(); } -void OpenRGBNanoleafSettingsEntry::loadFromSettings(const json& data) +void NanoleafSettingsEntry::loadFromSettings(const json& data) { address = QString::fromStdString(data["ip"]); port = data["port"]; @@ -127,7 +128,7 @@ void OpenRGBNanoleafSettingsEntry::loadFromSettings(const json& data) } } -json OpenRGBNanoleafSettingsEntry::saveSettings() +json NanoleafSettingsEntry::saveSettings() { json result; @@ -144,7 +145,33 @@ json OpenRGBNanoleafSettingsEntry::saveSettings() return result; } -const char* OpenRGBNanoleafSettingsEntry::settingsSection() +std::string NanoleafSettingsEntry::getLocation() { - return "NanoleafDevices"; + return (address.toStdString() + ":" + std::to_string(port)); } + +bool NanoleafSettingsEntry::isDataValid() +{ + // stub + return true; +} + +static BaseManualDeviceEntry* SpawnNanoleafSettingsEntry(const json& data) +{ + if(data.empty()) + { + // A special case: we open a new scanning dialog instead of returning a new entry + // The caller should be able to handle this + NanoleafScanDialog scanPage; + scanPage.exec(); + return nullptr; + } + else + { + NanoleafSettingsEntry* entry = new NanoleafSettingsEntry; + entry->loadFromSettings(data); + return entry; + } +} + +REGISTER_MANUAL_DEVICE_TYPE("Nanoleaf", "NanoleafDevices", SpawnNanoleafSettingsEntry); diff --git a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsEntry.h b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafSettingsEntry.h similarity index 58% rename from qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsEntry.h rename to qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafSettingsEntry.h index 8391aff39..a2307153b 100644 --- a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsEntry.h +++ b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafSettingsEntry.h @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBNanoleafSettingsEntry.h | +| NanoleafSettingsEntry.h | | | | User interface for OpenRGB Nanoleaf settings entry | | | @@ -10,37 +10,36 @@ #pragma once #include "BaseManualDeviceEntry.h" -#include "OpenRGBNanoleafScanningThread.h" +#include "NanoleafScanningThread.h" namespace Ui { - class OpenRGBNanoleafSettingsEntry; + class NanoleafSettingsEntry; } -class OpenRGBNanoleafSettingsEntry : public BaseManualDeviceEntry +class NanoleafSettingsEntry : public BaseManualDeviceEntry { Q_OBJECT public: - explicit OpenRGBNanoleafSettingsEntry(QWidget *parent = nullptr); - OpenRGBNanoleafSettingsEntry(QString a_address, int a_port); - ~OpenRGBNanoleafSettingsEntry(); + explicit NanoleafSettingsEntry(QWidget *parent = nullptr); + NanoleafSettingsEntry(QString a_address, int a_port); + ~NanoleafSettingsEntry(); void loadFromSettings(const json& data); - json saveSettings(); - const char* settingsSection(); + std::string getLocation(); - QString address; - int port; - -private: - Ui::OpenRGBNanoleafSettingsEntry *ui; + json saveSettings() override; + bool isDataValid() override; private slots: - void changeEvent(QEvent *event); + void changeEvent(QEvent *event) override; void on_UnpairButton_clicked(); void on_PairButton_clicked(); private: + Ui::NanoleafSettingsEntry *ui; + QString address; + int port; std::string auth_token; bool paired; }; diff --git a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsEntry.ui b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafSettingsEntry.ui similarity index 94% rename from qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsEntry.ui rename to qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafSettingsEntry.ui index d3d4abb5a..4f8e50649 100644 --- a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsEntry.ui +++ b/qt/ManualDevicesSettingsPage/NanoleafSettingsEntry/NanoleafSettingsEntry.ui @@ -1,7 +1,7 @@ - OpenRGBNanoleafSettingsEntry - + NanoleafSettingsEntry + 0 @@ -23,7 +23,7 @@ - + Nanoleaf Device diff --git a/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsEntry.cpp b/qt/ManualDevicesSettingsPage/PhilipsHueSettingsEntry/PhilipsHueSettingsEntry.cpp similarity index 70% rename from qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsEntry.cpp rename to qt/ManualDevicesSettingsPage/PhilipsHueSettingsEntry/PhilipsHueSettingsEntry.cpp index abdd3d827..925f15a1f 100644 --- a/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsEntry.cpp +++ b/qt/ManualDevicesSettingsPage/PhilipsHueSettingsEntry/PhilipsHueSettingsEntry.cpp @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBPhilipsHueSettingsEntry.cpp | +| PhilipsHueSettingsEntry.cpp | | | | User interface for OpenRGB Philips Hue settings entry | | | @@ -7,22 +7,22 @@ | SPDX-License-Identifier: GPL-2.0-only | \*---------------------------------------------------------*/ -#include "OpenRGBPhilipsHueSettingsEntry.h" -#include "ui_OpenRGBPhilipsHueSettingsEntry.h" +#include "PhilipsHueSettingsEntry.h" +#include "ui_PhilipsHueSettingsEntry.h" -OpenRGBPhilipsHueSettingsEntry::OpenRGBPhilipsHueSettingsEntry(QWidget *parent) : +PhilipsHueSettingsEntry::PhilipsHueSettingsEntry(QWidget *parent) : BaseManualDeviceEntry(parent), - ui(new Ui::OpenRGBPhilipsHueSettingsEntry) + ui(new Ui::PhilipsHueSettingsEntry) { ui->setupUi(this); } -OpenRGBPhilipsHueSettingsEntry::~OpenRGBPhilipsHueSettingsEntry() +PhilipsHueSettingsEntry::~PhilipsHueSettingsEntry() { delete ui; } -void OpenRGBPhilipsHueSettingsEntry::changeEvent(QEvent *event) +void PhilipsHueSettingsEntry::changeEvent(QEvent *event) { if(event->type() == QEvent::LanguageChange) { @@ -30,13 +30,13 @@ void OpenRGBPhilipsHueSettingsEntry::changeEvent(QEvent *event) } } -void OpenRGBPhilipsHueSettingsEntry::on_UnpairButton_clicked() +void PhilipsHueSettingsEntry::on_UnpairButton_clicked() { ui->UsernameValue->setText(""); ui->ClientKeyValue->setText(""); } -void OpenRGBPhilipsHueSettingsEntry::loadFromSettings(const json& data) +void PhilipsHueSettingsEntry::loadFromSettings(const json& data) { if(data.contains("ip")) { @@ -69,7 +69,7 @@ void OpenRGBPhilipsHueSettingsEntry::loadFromSettings(const json& data) } } -json OpenRGBPhilipsHueSettingsEntry::saveSettings() +json PhilipsHueSettingsEntry::saveSettings() { json result; /*-------------------------------------------------*\ @@ -93,7 +93,17 @@ json OpenRGBPhilipsHueSettingsEntry::saveSettings() return result; } -const char* OpenRGBPhilipsHueSettingsEntry::settingsSection() +bool PhilipsHueSettingsEntry::isDataValid() { - return "PhilipsHueDevices"; + // stub + return true; } + +static BaseManualDeviceEntry* SpawnPhilipsHueSettingsEntry(const json& data) +{ + PhilipsHueSettingsEntry* entry = new PhilipsHueSettingsEntry; + entry->loadFromSettings(data); + return entry; +} + +REGISTER_MANUAL_DEVICE_TYPE("Philips Hue", "PhilipsHueDevices", SpawnPhilipsHueSettingsEntry); diff --git a/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsEntry.h b/qt/ManualDevicesSettingsPage/PhilipsHueSettingsEntry/PhilipsHueSettingsEntry.h similarity index 60% rename from qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsEntry.h rename to qt/ManualDevicesSettingsPage/PhilipsHueSettingsEntry/PhilipsHueSettingsEntry.h index f6870cc35..f5876e9e4 100644 --- a/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsEntry.h +++ b/qt/ManualDevicesSettingsPage/PhilipsHueSettingsEntry/PhilipsHueSettingsEntry.h @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBPhilipsHueSettingsEntry.h | +| PhilipsHueSettingsEntry.h | | | | User interface for OpenRGB Philips Hue settings entry | | | @@ -13,24 +13,24 @@ namespace Ui { - class OpenRGBPhilipsHueSettingsEntry; + class PhilipsHueSettingsEntry; } -class OpenRGBPhilipsHueSettingsEntry : public BaseManualDeviceEntry +class PhilipsHueSettingsEntry : public BaseManualDeviceEntry { Q_OBJECT public: - explicit OpenRGBPhilipsHueSettingsEntry(QWidget *parent = nullptr); - ~OpenRGBPhilipsHueSettingsEntry(); + explicit PhilipsHueSettingsEntry(QWidget *parent = nullptr); + ~PhilipsHueSettingsEntry(); void loadFromSettings(const json& data); - json saveSettings(); - const char* settingsSection(); + json saveSettings() override; + bool isDataValid() override; private: - Ui::OpenRGBPhilipsHueSettingsEntry *ui; + Ui::PhilipsHueSettingsEntry *ui; private slots: - void changeEvent(QEvent *event); + void changeEvent(QEvent *event) override; void on_UnpairButton_clicked(); }; diff --git a/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsEntry.ui b/qt/ManualDevicesSettingsPage/PhilipsHueSettingsEntry/PhilipsHueSettingsEntry.ui similarity index 95% rename from qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsEntry.ui rename to qt/ManualDevicesSettingsPage/PhilipsHueSettingsEntry/PhilipsHueSettingsEntry.ui index f8bae7bf0..4e952cf23 100644 --- a/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsEntry.ui +++ b/qt/ManualDevicesSettingsPage/PhilipsHueSettingsEntry/PhilipsHueSettingsEntry.ui @@ -1,13 +1,13 @@ - OpenRGBPhilipsHueSettingsEntry - + PhilipsHueSettingsEntry + 0 0 297 - 228 + 260 @@ -23,7 +23,7 @@ - + Philips Hue Bridge diff --git a/qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsEntry.cpp b/qt/ManualDevicesSettingsPage/PhilipsWizSettingsEntry/PhilipsWizSettingsEntry.cpp similarity index 68% rename from qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsEntry.cpp rename to qt/ManualDevicesSettingsPage/PhilipsWizSettingsEntry/PhilipsWizSettingsEntry.cpp index 46445675d..cc69c65cd 100644 --- a/qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsEntry.cpp +++ b/qt/ManualDevicesSettingsPage/PhilipsWizSettingsEntry/PhilipsWizSettingsEntry.cpp @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBPhilipsWizSettingsEntry.cpp | +| PhilipsWizSettingsEntry.cpp | | | | User interface for OpenRGB Philips Wiz settings entry | | | @@ -7,12 +7,12 @@ | SPDX-License-Identifier: GPL-2.0-only | \*---------------------------------------------------------*/ -#include "OpenRGBPhilipsWizSettingsEntry.h" -#include "ui_OpenRGBPhilipsWizSettingsEntry.h" +#include "PhilipsWizSettingsEntry.h" +#include "ui_PhilipsWizSettingsEntry.h" -OpenRGBPhilipsWizSettingsEntry::OpenRGBPhilipsWizSettingsEntry(QWidget *parent) : +PhilipsWizSettingsEntry::PhilipsWizSettingsEntry(QWidget *parent) : BaseManualDeviceEntry(parent), - ui(new Ui::OpenRGBPhilipsWizSettingsEntry) + ui(new Ui::PhilipsWizSettingsEntry) { ui->setupUi(this); @@ -20,12 +20,12 @@ OpenRGBPhilipsWizSettingsEntry::OpenRGBPhilipsWizSettingsEntry(QWidget *parent) ui->WhiteStrategyComboBox->addItem(tr("Minimum")); } -OpenRGBPhilipsWizSettingsEntry::~OpenRGBPhilipsWizSettingsEntry() +PhilipsWizSettingsEntry::~PhilipsWizSettingsEntry() { delete ui; } -void OpenRGBPhilipsWizSettingsEntry::changeEvent(QEvent *event) +void PhilipsWizSettingsEntry::changeEvent(QEvent *event) { if(event->type() == QEvent::LanguageChange) { @@ -33,7 +33,7 @@ void OpenRGBPhilipsWizSettingsEntry::changeEvent(QEvent *event) } } -void OpenRGBPhilipsWizSettingsEntry::loadFromSettings(const json& data) +void PhilipsWizSettingsEntry::loadFromSettings(const json& data) { if(data.contains("ip")) { @@ -56,7 +56,7 @@ void OpenRGBPhilipsWizSettingsEntry::loadFromSettings(const json& data) } } -json OpenRGBPhilipsWizSettingsEntry::saveSettings() +json PhilipsWizSettingsEntry::saveSettings() { json result; /*-------------------------------------------------*\ @@ -70,7 +70,17 @@ json OpenRGBPhilipsWizSettingsEntry::saveSettings() return result; } -const char* OpenRGBPhilipsWizSettingsEntry::settingsSection() +bool PhilipsWizSettingsEntry::isDataValid() { - return "PhilipsWizDevices"; + // stub + return true; } + +static BaseManualDeviceEntry* SpawnPhilipsWizSettingsEntry(const json& data) +{ + PhilipsWizSettingsEntry* entry = new PhilipsWizSettingsEntry; + entry->loadFromSettings(data); + return entry; +} + +REGISTER_MANUAL_DEVICE_TYPE("Philips Wiz", "PhilipsWizDevices", SpawnPhilipsWizSettingsEntry); diff --git a/qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsEntry.h b/qt/ManualDevicesSettingsPage/PhilipsWizSettingsEntry/PhilipsWizSettingsEntry.h similarity index 58% rename from qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsEntry.h rename to qt/ManualDevicesSettingsPage/PhilipsWizSettingsEntry/PhilipsWizSettingsEntry.h index a3ecd1dee..905369d73 100644 --- a/qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsEntry.h +++ b/qt/ManualDevicesSettingsPage/PhilipsWizSettingsEntry/PhilipsWizSettingsEntry.h @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBPhilipsWizSettingsEntry.h | +| PhilipsWizSettingsEntry.h | | | | User interface for OpenRGB Philips Wiz settings entry | | | @@ -13,23 +13,23 @@ namespace Ui { - class OpenRGBPhilipsWizSettingsEntry; + class PhilipsWizSettingsEntry; } -class OpenRGBPhilipsWizSettingsEntry : public BaseManualDeviceEntry +class PhilipsWizSettingsEntry : public BaseManualDeviceEntry { Q_OBJECT public: - explicit OpenRGBPhilipsWizSettingsEntry(QWidget *parent = nullptr); - ~OpenRGBPhilipsWizSettingsEntry(); + explicit PhilipsWizSettingsEntry(QWidget *parent = nullptr); + ~PhilipsWizSettingsEntry(); void loadFromSettings(const json& data); - json saveSettings(); - const char* settingsSection(); + json saveSettings() override; + bool isDataValid() override; private: - Ui::OpenRGBPhilipsWizSettingsEntry *ui; + Ui::PhilipsWizSettingsEntry *ui; private slots: - void changeEvent(QEvent *event); + void changeEvent(QEvent *event) override; }; diff --git a/qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsEntry.ui b/qt/ManualDevicesSettingsPage/PhilipsWizSettingsEntry/PhilipsWizSettingsEntry.ui similarity index 90% rename from qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsEntry.ui rename to qt/ManualDevicesSettingsPage/PhilipsWizSettingsEntry/PhilipsWizSettingsEntry.ui index ef8d15817..7d46dd9a7 100644 --- a/qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsEntry.ui +++ b/qt/ManualDevicesSettingsPage/PhilipsWizSettingsEntry/PhilipsWizSettingsEntry.ui @@ -1,13 +1,13 @@ - OpenRGBPhilipsWizSettingsEntry - + PhilipsWizSettingsEntry + 0 0 - 246 - 82 + 327 + 149 @@ -23,7 +23,7 @@ - + Philips Wiz Device diff --git a/qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsEntry.cpp b/qt/ManualDevicesSettingsPage/QMKORGBSettingsEntry/QMKORGBSettingsEntry.cpp similarity index 60% rename from qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsEntry.cpp rename to qt/ManualDevicesSettingsPage/QMKORGBSettingsEntry/QMKORGBSettingsEntry.cpp index 897f07f7a..d17ee783f 100644 --- a/qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsEntry.cpp +++ b/qt/ManualDevicesSettingsPage/QMKORGBSettingsEntry/QMKORGBSettingsEntry.cpp @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBQMKORGBSettingsEntry.cpp | +| QMKORGBSettingsEntry.cpp | | | | User interface entry for OpenRGB QMK configuration | | | @@ -7,22 +7,22 @@ | SPDX-License-Identifier: GPL-2.0-only | \*---------------------------------------------------------*/ -#include "OpenRGBQMKORGBSettingsEntry.h" -#include "ui_OpenRGBQMKORGBSettingsEntry.h" +#include "QMKORGBSettingsEntry.h" +#include "ui_QMKORGBSettingsEntry.h" -OpenRGBQMKORGBSettingsEntry::OpenRGBQMKORGBSettingsEntry(QWidget *parent) : +QMKORGBSettingsEntry::QMKORGBSettingsEntry(QWidget *parent) : BaseManualDeviceEntry(parent), - ui(new Ui::OpenRGBQMKORGBSettingsEntry) + ui(new Ui::QMKORGBSettingsEntry) { ui->setupUi(this); } -OpenRGBQMKORGBSettingsEntry::~OpenRGBQMKORGBSettingsEntry() +QMKORGBSettingsEntry::~QMKORGBSettingsEntry() { delete ui; } -void OpenRGBQMKORGBSettingsEntry::changeEvent(QEvent *event) +void QMKORGBSettingsEntry::changeEvent(QEvent *event) { if(event->type() == QEvent::LanguageChange) { @@ -30,7 +30,7 @@ void OpenRGBQMKORGBSettingsEntry::changeEvent(QEvent *event) } } -void OpenRGBQMKORGBSettingsEntry::loadFromSettings(const json& data) +void QMKORGBSettingsEntry::loadFromSettings(const json& data) { if(data.contains("name")) { @@ -48,7 +48,7 @@ void OpenRGBQMKORGBSettingsEntry::loadFromSettings(const json& data) } } -json OpenRGBQMKORGBSettingsEntry::saveSettings() +json QMKORGBSettingsEntry::saveSettings() { json result; /*-------------------------------------------------*\ @@ -61,7 +61,19 @@ json OpenRGBQMKORGBSettingsEntry::saveSettings() return result; } -const char* OpenRGBQMKORGBSettingsEntry::settingsSection() +bool QMKORGBSettingsEntry::isDataValid() { - return "QMKOpenRGBDevices"; + // stub + return true; } + +static BaseManualDeviceEntry* SpawnQMKORGBSettingsEntry(const json& data) +{ + QMKORGBSettingsEntry* entry = new QMKORGBSettingsEntry; + entry->loadFromSettings(data); + return entry; +} + +static const char* QMKDeviceName = QT_TRANSLATE_NOOP("ManualDevice", "QMK (built with ORGB support)"); + +REGISTER_MANUAL_DEVICE_TYPE(QMKDeviceName, "QMKOpenRGBDevices", SpawnQMKORGBSettingsEntry); diff --git a/qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsEntry.h b/qt/ManualDevicesSettingsPage/QMKORGBSettingsEntry/QMKORGBSettingsEntry.h similarity index 63% rename from qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsEntry.h rename to qt/ManualDevicesSettingsPage/QMKORGBSettingsEntry/QMKORGBSettingsEntry.h index ff7a4622e..52af4d6a2 100644 --- a/qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsEntry.h +++ b/qt/ManualDevicesSettingsPage/QMKORGBSettingsEntry/QMKORGBSettingsEntry.h @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBQMKORGBSettingsEntry.h | +| QMKORGBSettingsEntry.h | | | | User interface entry for OpenRGB QMK configuration | | | @@ -13,10 +13,10 @@ namespace Ui { - class OpenRGBQMKORGBSettingsEntry; + class QMKORGBSettingsEntry; } -class OpenRGBQMKORGBSettingsEntry : public BaseManualDeviceEntry +class QMKORGBSettingsEntry : public BaseManualDeviceEntry { Q_OBJECT @@ -24,12 +24,12 @@ private slots: void changeEvent(QEvent *event); public: - explicit OpenRGBQMKORGBSettingsEntry(QWidget *parent = nullptr); - ~OpenRGBQMKORGBSettingsEntry(); + explicit QMKORGBSettingsEntry(QWidget *parent = nullptr); + ~QMKORGBSettingsEntry(); void loadFromSettings(const json& data); - json saveSettings(); - const char* settingsSection(); + json saveSettings() override; + bool isDataValid() override; private: - Ui::OpenRGBQMKORGBSettingsEntry *ui; + Ui::QMKORGBSettingsEntry *ui; }; diff --git a/qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsEntry.ui b/qt/ManualDevicesSettingsPage/QMKORGBSettingsEntry/QMKORGBSettingsEntry.ui similarity index 90% rename from qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsEntry.ui rename to qt/ManualDevicesSettingsPage/QMKORGBSettingsEntry/QMKORGBSettingsEntry.ui index be585ac05..df0b4c766 100644 --- a/qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsEntry.ui +++ b/qt/ManualDevicesSettingsPage/QMKORGBSettingsEntry/QMKORGBSettingsEntry.ui @@ -1,7 +1,7 @@ - OpenRGBQMKORGBSettingsEntry - + QMKORGBSettingsEntry + 0 @@ -17,13 +17,13 @@ - OpenRGB QMK Settings Entry + QMK Settings Entry - + QMK Device diff --git a/qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsEntry.cpp b/qt/ManualDevicesSettingsPage/SerialSettingsEntry/SerialSettingsEntry.cpp similarity index 74% rename from qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsEntry.cpp rename to qt/ManualDevicesSettingsPage/SerialSettingsEntry/SerialSettingsEntry.cpp index ed9502770..1f2c09ed2 100644 --- a/qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsEntry.cpp +++ b/qt/ManualDevicesSettingsPage/SerialSettingsEntry/SerialSettingsEntry.cpp @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBSerialSettingsEntry.cpp | +| SerialSettingsEntry.cpp | | | | User interface entry for serial device configuration | | | @@ -7,12 +7,12 @@ | SPDX-License-Identifier: GPL-2.0-only | \*---------------------------------------------------------*/ -#include "OpenRGBSerialSettingsEntry.h" -#include "ui_OpenRGBSerialSettingsEntry.h" +#include "SerialSettingsEntry.h" +#include "ui_SerialSettingsEntry.h" -OpenRGBSerialSettingsEntry::OpenRGBSerialSettingsEntry(QWidget *parent) : +SerialSettingsEntry::SerialSettingsEntry(QWidget *parent) : BaseManualDeviceEntry(parent), - ui(new Ui::OpenRGBSerialSettingsEntry) + ui(new Ui::SerialSettingsEntry) { ui->setupUi(this); @@ -22,12 +22,12 @@ OpenRGBSerialSettingsEntry::OpenRGBSerialSettingsEntry(QWidget *parent) : ui->ProtocolComboBox->addItem("Basic I2C"); } -OpenRGBSerialSettingsEntry::~OpenRGBSerialSettingsEntry() +SerialSettingsEntry::~SerialSettingsEntry() { delete ui; } -void OpenRGBSerialSettingsEntry::changeEvent(QEvent *event) +void SerialSettingsEntry::changeEvent(QEvent *event) { if(event->type() == QEvent::LanguageChange) { @@ -35,7 +35,7 @@ void OpenRGBSerialSettingsEntry::changeEvent(QEvent *event) } } -void OpenRGBSerialSettingsEntry::on_ProtocolComboBox_currentIndexChanged(int index) +void SerialSettingsEntry::on_ProtocolComboBox_currentIndexChanged(int index) { if(index == 3) { @@ -47,7 +47,7 @@ void OpenRGBSerialSettingsEntry::on_ProtocolComboBox_currentIndexChanged(int ind } } -void OpenRGBSerialSettingsEntry::loadFromSettings(const json& data) +void SerialSettingsEntry::loadFromSettings(const json& data) { if(data.contains("name")) { @@ -92,7 +92,7 @@ void OpenRGBSerialSettingsEntry::loadFromSettings(const json& data) } } -json OpenRGBSerialSettingsEntry::saveSettings() +json SerialSettingsEntry::saveSettings() { json result; /*-------------------------------------------------*\ @@ -122,7 +122,19 @@ json OpenRGBSerialSettingsEntry::saveSettings() return result; } -const char* OpenRGBSerialSettingsEntry::settingsSection() +bool SerialSettingsEntry::isDataValid() { - return "LEDStripDevices"; + // stub + return true; } + +static BaseManualDeviceEntry* SpawnSerialSettingsEntry(const json& data) +{ + SerialSettingsEntry* entry = new SerialSettingsEntry; + entry->loadFromSettings(data); + return entry; +} + +static const char* SerialDeviceName = QT_TRANSLATE_NOOP("ManualDevice", "Serial Device"); + +REGISTER_MANUAL_DEVICE_TYPE(SerialDeviceName, "LEDStripDevices", SpawnSerialSettingsEntry); diff --git a/qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsEntry.h b/qt/ManualDevicesSettingsPage/SerialSettingsEntry/SerialSettingsEntry.h similarity index 62% rename from qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsEntry.h rename to qt/ManualDevicesSettingsPage/SerialSettingsEntry/SerialSettingsEntry.h index b10b41ed3..6f9c2ac60 100644 --- a/qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsEntry.h +++ b/qt/ManualDevicesSettingsPage/SerialSettingsEntry/SerialSettingsEntry.h @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBSerialSettingsEntry.h | +| SerialSettingsEntry.h | | | | User interface entry for serial device configuration | | | @@ -13,25 +13,25 @@ namespace Ui { - class OpenRGBSerialSettingsEntry; + class SerialSettingsEntry; } -class OpenRGBSerialSettingsEntry : public BaseManualDeviceEntry +class SerialSettingsEntry : public BaseManualDeviceEntry { Q_OBJECT private slots: - void changeEvent(QEvent *event); + void changeEvent(QEvent *event) override; void on_ProtocolComboBox_currentIndexChanged(int index); public: - explicit OpenRGBSerialSettingsEntry(QWidget *parent = nullptr); - ~OpenRGBSerialSettingsEntry(); + explicit SerialSettingsEntry(QWidget *parent = nullptr); + ~SerialSettingsEntry(); void loadFromSettings(const json& data); - json saveSettings(); - const char* settingsSection(); + json saveSettings() override; + bool isDataValid() override; private: - Ui::OpenRGBSerialSettingsEntry *ui; + Ui::SerialSettingsEntry *ui; }; diff --git a/qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsEntry.ui b/qt/ManualDevicesSettingsPage/SerialSettingsEntry/SerialSettingsEntry.ui similarity index 95% rename from qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsEntry.ui rename to qt/ManualDevicesSettingsPage/SerialSettingsEntry/SerialSettingsEntry.ui index ea33ad217..52a431573 100644 --- a/qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsEntry.ui +++ b/qt/ManualDevicesSettingsPage/SerialSettingsEntry/SerialSettingsEntry.ui @@ -1,7 +1,7 @@ - OpenRGBSerialSettingsEntry - + SerialSettingsEntry + 0 @@ -23,7 +23,7 @@ - + Serial Device diff --git a/qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsEntry.cpp b/qt/ManualDevicesSettingsPage/YeelightSettingsEntry/YeelightSettingsEntry.cpp similarity index 70% rename from qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsEntry.cpp rename to qt/ManualDevicesSettingsPage/YeelightSettingsEntry/YeelightSettingsEntry.cpp index 9eecd72ba..0bb882551 100644 --- a/qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsEntry.cpp +++ b/qt/ManualDevicesSettingsPage/YeelightSettingsEntry/YeelightSettingsEntry.cpp @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBYeelightSettingsEntry.cpp | +| YeelightSettingsEntry.cpp | | | | User interface for Yeelight settings entry | | | @@ -8,23 +8,23 @@ \*---------------------------------------------------------*/ #include -#include "OpenRGBYeelightSettingsEntry.h" -#include "ui_OpenRGBYeelightSettingsEntry.h" +#include "YeelightSettingsEntry.h" +#include "ui_YeelightSettingsEntry.h" #include "net_port.h" -OpenRGBYeelightSettingsEntry::OpenRGBYeelightSettingsEntry(QWidget *parent) : +YeelightSettingsEntry::YeelightSettingsEntry(QWidget *parent) : BaseManualDeviceEntry(parent), - ui(new Ui::OpenRGBYeelightSettingsEntry) + ui(new Ui::YeelightSettingsEntry) { ui->setupUi(this); } -OpenRGBYeelightSettingsEntry::~OpenRGBYeelightSettingsEntry() +YeelightSettingsEntry::~YeelightSettingsEntry() { delete ui; } -void OpenRGBYeelightSettingsEntry::changeEvent(QEvent *event) +void YeelightSettingsEntry::changeEvent(QEvent *event) { if(event->type() == QEvent::LanguageChange) { @@ -32,7 +32,7 @@ void OpenRGBYeelightSettingsEntry::changeEvent(QEvent *event) } } -void OpenRGBYeelightSettingsEntry::on_HostIPChooserButton_clicked() +void YeelightSettingsEntry::on_HostIPChooserButton_clicked() { char hostname[256]; gethostname(hostname, 256); @@ -62,7 +62,7 @@ void OpenRGBYeelightSettingsEntry::on_HostIPChooserButton_clicked() ui->HostIPEdit->setText(inp.textValue()); } -void OpenRGBYeelightSettingsEntry::loadFromSettings(const json& data) +void YeelightSettingsEntry::loadFromSettings(const json& data) { if(data.contains("ip")) { @@ -80,7 +80,7 @@ void OpenRGBYeelightSettingsEntry::loadFromSettings(const json& data) } } -json OpenRGBYeelightSettingsEntry::saveSettings() +json YeelightSettingsEntry::saveSettings() { json result; /*-------------------------------------------------*\ @@ -93,7 +93,17 @@ json OpenRGBYeelightSettingsEntry::saveSettings() return result; } -const char* OpenRGBYeelightSettingsEntry::settingsSection() +bool YeelightSettingsEntry::isDataValid() { - return "YeelightDevices"; + // stub + return true; } + +static BaseManualDeviceEntry* SpawnYeelightSettingsEntry(const json& data) +{ + YeelightSettingsEntry* entry = new YeelightSettingsEntry; + entry->loadFromSettings(data); + return entry; +} + +REGISTER_MANUAL_DEVICE_TYPE("Yeelight", "YeelightDevices", SpawnYeelightSettingsEntry); diff --git a/qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsEntry.h b/qt/ManualDevicesSettingsPage/YeelightSettingsEntry/YeelightSettingsEntry.h similarity index 60% rename from qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsEntry.h rename to qt/ManualDevicesSettingsPage/YeelightSettingsEntry/YeelightSettingsEntry.h index 7938b2a0f..0773afb98 100644 --- a/qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsEntry.h +++ b/qt/ManualDevicesSettingsPage/YeelightSettingsEntry/YeelightSettingsEntry.h @@ -1,5 +1,5 @@ /*---------------------------------------------------------*\ -| OpenRGBYeelightSettingsEntry.h | +| YeelightSettingsEntry.h | | | | User interface for Yeelight settings entry | | | @@ -13,24 +13,24 @@ namespace Ui { - class OpenRGBYeelightSettingsEntry; + class YeelightSettingsEntry; } -class OpenRGBYeelightSettingsEntry : public BaseManualDeviceEntry +class YeelightSettingsEntry : public BaseManualDeviceEntry { Q_OBJECT public: - explicit OpenRGBYeelightSettingsEntry(QWidget *parent = nullptr); - ~OpenRGBYeelightSettingsEntry(); + explicit YeelightSettingsEntry(QWidget *parent = nullptr); + ~YeelightSettingsEntry(); void loadFromSettings(const json& data); - json saveSettings(); - const char* settingsSection(); + json saveSettings() override; + bool isDataValid() override; private: - Ui::OpenRGBYeelightSettingsEntry *ui; + Ui::YeelightSettingsEntry *ui; private slots: - void changeEvent(QEvent *event); + void changeEvent(QEvent *event) override; void on_HostIPChooserButton_clicked(); }; diff --git a/qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsEntry.ui b/qt/ManualDevicesSettingsPage/YeelightSettingsEntry/YeelightSettingsEntry.ui similarity index 94% rename from qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsEntry.ui rename to qt/ManualDevicesSettingsPage/YeelightSettingsEntry/YeelightSettingsEntry.ui index 0a65a8895..cfed2dbb9 100644 --- a/qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsEntry.ui +++ b/qt/ManualDevicesSettingsPage/YeelightSettingsEntry/YeelightSettingsEntry.ui @@ -1,7 +1,7 @@ - OpenRGBYeelightSettingsEntry - + YeelightSettingsEntry + 0 @@ -23,7 +23,7 @@ - + Yeelight Device diff --git a/qt/OpenRGBDMXSettingsPage/OpenRGBDMXSettingsPage.cpp b/qt/OpenRGBDMXSettingsPage/OpenRGBDMXSettingsPage.cpp deleted file mode 100644 index 89c8c55f5..000000000 --- a/qt/OpenRGBDMXSettingsPage/OpenRGBDMXSettingsPage.cpp +++ /dev/null @@ -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(); -} diff --git a/qt/OpenRGBDMXSettingsPage/OpenRGBDMXSettingsPage.h b/qt/OpenRGBDMXSettingsPage/OpenRGBDMXSettingsPage.h deleted file mode 100644 index 7820ecb77..000000000 --- a/qt/OpenRGBDMXSettingsPage/OpenRGBDMXSettingsPage.h +++ /dev/null @@ -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 -#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 entries; - -}; diff --git a/qt/OpenRGBDMXSettingsPage/OpenRGBDMXSettingsPage.ui b/qt/OpenRGBDMXSettingsPage/OpenRGBDMXSettingsPage.ui deleted file mode 100644 index 142d188b4..000000000 --- a/qt/OpenRGBDMXSettingsPage/OpenRGBDMXSettingsPage.ui +++ /dev/null @@ -1,49 +0,0 @@ - - - OpenRGBDMXSettingsPage - - - - 0 - 0 - 400 - 300 - - - - DMX Settings Page - - - - - - Add - - - - - - - Remove - - - - - - - Save - - - - - - - QAbstractItemView::ScrollPerPixel - - - - - - - - diff --git a/qt/OpenRGBDevicePage/OpenRGBDevicePage.cpp b/qt/OpenRGBDevicePage/OpenRGBDevicePage.cpp index 063b487af..3f104165f 100644 --- a/qt/OpenRGBDevicePage/OpenRGBDevicePage.cpp +++ b/qt/OpenRGBDevicePage/OpenRGBDevicePage.cpp @@ -7,12 +7,10 @@ | SPDX-License-Identifier: GPL-2.0-only | \*---------------------------------------------------------*/ -#include "OpenRGBDialog.h" #include "OpenRGBDevicePage.h" #include "OpenRGBZoneResizeDialog.h" #include "ResourceManager.h" #include "SettingsManager.h" -#include "hsv.h" #include "ui_OpenRGBDevicePage.h" static void UpdateCallback(void * this_ptr) diff --git a/qt/OpenRGBDialog/OpenRGBDialog.cpp b/qt/OpenRGBDialog/OpenRGBDialog.cpp index 12859ac7a..cd83bb974 100644 --- a/qt/OpenRGBDialog/OpenRGBDialog.cpp +++ b/qt/OpenRGBDialog/OpenRGBDialog.cpp @@ -489,69 +489,9 @@ OpenRGBDialog::OpenRGBDialog(QWidget *parent) : QMainWindow(parent), ui(new Ui:: AddPluginsPage(); /*-----------------------------------------------------*\ - | Add the DMX settings page | + | Add the Manually Added Devices 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(); + AddManualDevicesSettingsPage(); /*-----------------------------------------------------*\ | Add the SMBus Tools page if enabled | @@ -809,223 +749,19 @@ void OpenRGBDialog::AddSettingsPage() connect(this, SIGNAL(ProfileListChanged()), SettingsPage, SLOT(UpdateProfiles())); } -void OpenRGBDialog::AddDMXSettingsPage() +void OpenRGBDialog::AddManualDevicesSettingsPage() { /*-----------------------------------------------------*\ | Create the Settings page | \*-----------------------------------------------------*/ - DMXSettingsPage = new OpenRGBDMXSettingsPage(); + manualDevicesPage = new ManualDevicesSettingsPage(); - ui->SettingsTabBar->addTab(DMXSettingsPage, ""); + ui->SettingsTabBar->addTab(manualDevicesPage, ""); /*-----------------------------------------------------*\ | 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); + TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::bulb, tr("Manually Added Devices"), (char *)"Manually Added Devices", (char *)context); ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel); } diff --git a/qt/OpenRGBDialog/OpenRGBDialog.h b/qt/OpenRGBDialog/OpenRGBDialog.h index 400a37f9f..2dc13e4d7 100644 --- a/qt/OpenRGBDialog/OpenRGBDialog.h +++ b/qt/OpenRGBDialog/OpenRGBDialog.h @@ -10,7 +10,6 @@ #pragma once #include -#include #include #include #include @@ -23,19 +22,8 @@ #include "OpenRGBSystemInfoPage.h" #include "OpenRGBSupportedDevicesPage.h" #include "OpenRGBSettingsPage.h" -#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 "ManualDevicesSettingsPage/ManualDevicesSettingsPage.h" + #include "PluginManager.h" #include "SuspendResume.h" @@ -98,19 +86,8 @@ private: OpenRGBSoftwareInfoPage *SoftInfoPage; OpenRGBSupportedDevicesPage *SupportedPage; OpenRGBSettingsPage *SettingsPage; - 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; + + ManualDevicesSettingsPage *manualDevicesPage; bool ShowI2CTools = false; bool plugins_loaded = false; @@ -130,21 +107,9 @@ private: void AddSoftwareInfoPage(); void AddSupportedDevicesPage(); void AddSettingsPage(); - 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 AddPluginsPage(); void AddConsolePage(); + void AddManualDevicesSettingsPage(); void ClearDevicesList(); void UpdateDevicesList(); diff --git a/qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.cpp b/qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.cpp deleted file mode 100644 index bf7d69965..000000000 --- a/qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.cpp +++ /dev/null @@ -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(); -} diff --git a/qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.h b/qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.h deleted file mode 100644 index c72a90f6b..000000000 --- a/qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.h +++ /dev/null @@ -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 -#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 entries; -}; diff --git a/qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.ui b/qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.ui deleted file mode 100644 index e60ee3b88..000000000 --- a/qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.ui +++ /dev/null @@ -1,49 +0,0 @@ - - - OpenRGBE131SettingsPage - - - - 0 - 0 - 400 - 300 - - - - E.131 Settings Page - - - - - - Add - - - - - - - Remove - - - - - - - Save - - - - - - - QAbstractItemView::ScrollPerPixel - - - - - - - - diff --git a/qt/OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsPage.cpp b/qt/OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsPage.cpp deleted file mode 100644 index 7a1f7b4c8..000000000 --- a/qt/OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsPage.cpp +++ /dev/null @@ -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(); -} diff --git a/qt/OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsPage.h b/qt/OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsPage.h deleted file mode 100644 index e8f9714db..000000000 --- a/qt/OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsPage.h +++ /dev/null @@ -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 -#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 entries; -}; diff --git a/qt/OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsPage.ui b/qt/OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsPage.ui deleted file mode 100644 index e2c1a0cda..000000000 --- a/qt/OpenRGBElgatoKeyLightSettingsPage/OpenRGBElgatoKeyLightSettingsPage.ui +++ /dev/null @@ -1,45 +0,0 @@ - - - OpenRGBElgatoKeyLightSettingsPage - - - - 0 - 0 - 400 - 300 - - - - Elgato Key Light Settings Page - - - - - - - - - Add - - - - - - - Remove - - - - - - - Save - - - - - - - - diff --git a/qt/OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsEntry.cpp b/qt/OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsEntry.cpp deleted file mode 100644 index 62bea5d9b..000000000 --- a/qt/OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsEntry.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/*---------------------------------------------------------*\ -| OpenRGBElgatoLightStripSettingsEntry.cpp | -| | -| User interface for OpenRGB Elgato Light Strips entry | -| | -| This file is part of the OpenRGB project | -| SPDX-License-Identifier: GPL-2.0-only | -\*---------------------------------------------------------*/ - -#include "OpenRGBElgatoLightStripSettingsEntry.h" -#include "ui_OpenRGBElgatoLightStripSettingsEntry.h" - -OpenRGBElgatoLightStripSettingsEntry::OpenRGBElgatoLightStripSettingsEntry(QWidget *parent) : - BaseManualDeviceEntry(parent), - ui(new Ui::OpenRGBElgatoLightStripSettingsEntry) -{ - ui->setupUi(this); - setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); -} - -OpenRGBElgatoLightStripSettingsEntry::~OpenRGBElgatoLightStripSettingsEntry() -{ - delete ui; -} - -void OpenRGBElgatoLightStripSettingsEntry::changeEvent(QEvent *event) -{ - if(event->type() == QEvent::LanguageChange) - { - ui->retranslateUi(this); - } -} - -void OpenRGBElgatoLightStripSettingsEntry::loadFromSettings(const json& data) -{ - if(data.contains("ip")) - { - ui->IPEdit->setText(QString::fromStdString(data["ip"])); - } -} - -json OpenRGBElgatoLightStripSettingsEntry::saveSettings() -{ - json result; - result["ip"] = ui->IPEdit->text().toStdString(); - return result; -} - -const char* OpenRGBElgatoLightStripSettingsEntry::settingsSection() -{ - return "ElgatoLightStripDevices"; -} diff --git a/qt/OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsPage.cpp b/qt/OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsPage.cpp deleted file mode 100644 index 2d74b1477..000000000 --- a/qt/OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsPage.cpp +++ /dev/null @@ -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(); -} diff --git a/qt/OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsPage.h b/qt/OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsPage.h deleted file mode 100644 index 9ffeec407..000000000 --- a/qt/OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsPage.h +++ /dev/null @@ -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 -#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 entries; -}; diff --git a/qt/OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsPage.ui b/qt/OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsPage.ui deleted file mode 100644 index fc5e4d160..000000000 --- a/qt/OpenRGBElgatoLightStripSettingsPage/OpenRGBElgatoLightStripSettingsPage.ui +++ /dev/null @@ -1,45 +0,0 @@ - - - OpenRGBElgatoLightStripSettingsPage - - - - 0 - 0 - 400 - 300 - - - - Elgato Light Strip Settings Page - - - - - - - - - Add - - - - - - - Remove - - - - - - - Save - - - - - - - - diff --git a/qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsPage.cpp b/qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsPage.cpp deleted file mode 100644 index 5ed190955..000000000 --- a/qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsPage.cpp +++ /dev/null @@ -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(); -} diff --git a/qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsPage.h b/qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsPage.h deleted file mode 100644 index cdf384c08..000000000 --- a/qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsPage.h +++ /dev/null @@ -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 -#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 entries; - -}; diff --git a/qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsPage.ui b/qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsPage.ui deleted file mode 100644 index 9804cd468..000000000 --- a/qt/OpenRGBGoveeSettingsPage/OpenRGBGoveeSettingsPage.ui +++ /dev/null @@ -1,49 +0,0 @@ - - - OpenRGBGoveeSettingsPage - - - - 0 - 0 - 400 - 300 - - - - Philips Wiz Settings Page - - - - - - Add - - - - - - - Remove - - - - - - - Save - - - - - - - QAbstractItemView::ScrollPerPixel - - - - - - - - diff --git a/qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsPage.cpp b/qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsPage.cpp deleted file mode 100644 index bb34b840a..000000000 --- a/qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsPage.cpp +++ /dev/null @@ -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(); -} diff --git a/qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsPage.h b/qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsPage.h deleted file mode 100644 index badd155b7..000000000 --- a/qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsPage.h +++ /dev/null @@ -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 -#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 entries; - -}; diff --git a/qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsPage.ui b/qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsPage.ui deleted file mode 100644 index 6e89fa4ef..000000000 --- a/qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsPage.ui +++ /dev/null @@ -1,49 +0,0 @@ - - - OpenRGBKasaSmartSettingsPage - - - - 0 - 0 - 400 - 300 - - - - Kasa Smart Settings Page - - - - - - Add - - - - - - - Remove - - - - - - - Save - - - - - - - QAbstractItemView::ScrollPerPixel - - - - - - - - diff --git a/qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsPage.cpp b/qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsPage.cpp deleted file mode 100644 index 28a65a940..000000000 --- a/qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsPage.cpp +++ /dev/null @@ -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(); -} diff --git a/qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsPage.h b/qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsPage.h deleted file mode 100644 index 2c96857c8..000000000 --- a/qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsPage.h +++ /dev/null @@ -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 -#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 entries; - -}; diff --git a/qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsPage.ui b/qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsPage.ui deleted file mode 100644 index 5eee7a258..000000000 --- a/qt/OpenRGBLIFXSettingsPage/OpenRGBLIFXSettingsPage.ui +++ /dev/null @@ -1,49 +0,0 @@ - - - OpenRGBLIFXSettingsPage - - - - 0 - 0 - 400 - 300 - - - - LIFX Settings Page - - - - - - Add - - - - - - - Remove - - - - - - - Save - - - - - - - QAbstractItemView::ScrollPerPixel - - - - - - - - diff --git a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsPage.ui b/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsPage.ui deleted file mode 100644 index ded7cb6da..000000000 --- a/qt/OpenRGBNanoleafSettingsPage/OpenRGBNanoleafSettingsPage.ui +++ /dev/null @@ -1,62 +0,0 @@ - - - OpenRGBNanoleafSettingsPage - - - - 0 - 0 - 400 - 300 - - - - Nanoleaf Settings Page - - - - - - Add - - - - - - - Remove - - - - - - - Scan - - - - - - - QAbstractItemView::ScrollPerPixel - - - - - - - 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. - - - Qt::AlignCenter - - - true - - - - - - - - diff --git a/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.cpp b/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.cpp deleted file mode 100644 index d26c3e0b8..000000000 --- a/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.cpp +++ /dev/null @@ -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(); -} diff --git a/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.h b/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.h deleted file mode 100644 index a9aeb0987..000000000 --- a/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.h +++ /dev/null @@ -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 -#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 entries; -}; diff --git a/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.ui b/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.ui deleted file mode 100644 index 34dc3339b..000000000 --- a/qt/OpenRGBPhilipsHueSettingsPage/OpenRGBPhilipsHueSettingsPage.ui +++ /dev/null @@ -1,62 +0,0 @@ - - - OpenRGBPhilipsHueSettingsPage - - - - 0 - 0 - 400 - 300 - - - - Philips Hue Settings Page - - - - - - Remove - - - - - - - Add - - - - - - - QAbstractItemView::ScrollPerPixel - - - - - - - Save - - - - - - - After adding a Hue entry and saving, restart OpenRGB and press the Sync button on your Hue bridge to pair it. - - - Qt::AlignCenter - - - true - - - - - - - - diff --git a/qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsPage.cpp b/qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsPage.cpp deleted file mode 100644 index ff2be322e..000000000 --- a/qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsPage.cpp +++ /dev/null @@ -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(); -} diff --git a/qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsPage.h b/qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsPage.h deleted file mode 100644 index 5efcff27b..000000000 --- a/qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsPage.h +++ /dev/null @@ -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 -#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 entries; - -}; diff --git a/qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsPage.ui b/qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsPage.ui deleted file mode 100644 index f42bf1c6e..000000000 --- a/qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsPage.ui +++ /dev/null @@ -1,49 +0,0 @@ - - - OpenRGBPhilipsWizSettingsPage - - - - 0 - 0 - 400 - 300 - - - - Philips Wiz Settings Page - - - - - - Add - - - - - - - Remove - - - - - - - Save - - - - - - - QAbstractItemView::ScrollPerPixel - - - - - - - - diff --git a/qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsPage.cpp b/qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsPage.cpp deleted file mode 100644 index 785df2de4..000000000 --- a/qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsPage.cpp +++ /dev/null @@ -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(); -} diff --git a/qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsPage.h b/qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsPage.h deleted file mode 100644 index 3b4253769..000000000 --- a/qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsPage.h +++ /dev/null @@ -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 -#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 entries; - -}; diff --git a/qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsPage.ui b/qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsPage.ui deleted file mode 100644 index 935540a62..000000000 --- a/qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsPage.ui +++ /dev/null @@ -1,49 +0,0 @@ - - - OpenRGBQMKORGBSettingsPage - - - - 0 - 0 - 400 - 300 - - - - OpenRGB QMK Settings Page - - - - - - Add - - - - - - - Remove - - - - - - - Save - - - - - - - QAbstractItemView::ScrollPerPixel - - - - - - - - diff --git a/qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsPage.cpp b/qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsPage.cpp deleted file mode 100644 index c05836f15..000000000 --- a/qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsPage.cpp +++ /dev/null @@ -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(); -} diff --git a/qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsPage.h b/qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsPage.h deleted file mode 100644 index a3cc07a7c..000000000 --- a/qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsPage.h +++ /dev/null @@ -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 - -#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 entries; - -}; diff --git a/qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsPage.ui b/qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsPage.ui deleted file mode 100644 index 6d5cfda78..000000000 --- a/qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsPage.ui +++ /dev/null @@ -1,49 +0,0 @@ - - - OpenRGBSerialSettingsPage - - - - 0 - 0 - 400 - 300 - - - - Serial Settings Page - - - - - - Add - - - - - - - Remove - - - - - - - Save - - - - - - - QAbstractItemView::ScrollPerPixel - - - - - - - - diff --git a/qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsPage.cpp b/qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsPage.cpp deleted file mode 100644 index 52a91ffc4..000000000 --- a/qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsPage.cpp +++ /dev/null @@ -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(); -} diff --git a/qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsPage.h b/qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsPage.h deleted file mode 100644 index 07aa1587b..000000000 --- a/qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsPage.h +++ /dev/null @@ -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 -#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 entries; -}; diff --git a/qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsPage.ui b/qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsPage.ui deleted file mode 100644 index d2e2e7a63..000000000 --- a/qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsPage.ui +++ /dev/null @@ -1,49 +0,0 @@ - - - OpenRGBYeelightSettingsPage - - - - 0 - 0 - 400 - 300 - - - - Yeelight Settings Page - - - - - - Add - - - - - - - Remove - - - - - - - Save - - - - - - - QAbstractItemView::ScrollPerPixel - - - - - - - - diff --git a/qt/i18n/OpenRGB_en_AU.ts b/qt/i18n/OpenRGB_en_AU.ts index e08aa48b5..91f360818 100644 --- a/qt/i18n/OpenRGB_en_AU.ts +++ b/qt/i18n/OpenRGB_en_AU.ts @@ -1,6 +1,41 @@ + + DMXSettingsEntry + + DMX Device + + + + Brightness Channel: + + + + Blue Channel: + + + + Name: + + + + Green Channel: + + + + Red Channel: + + + + Keepalive Time: + + + + Port: + + + DetectorTableModel @@ -12,6 +47,263 @@ + + E131SettingsEntry + + E1.31 Device + + + + Start Channel: + + + + Number of LEDs: + + + + Start Universe: + + + + Name: + + + + Matrix Order: + + + + Matrix Height: + + + + Matrix Width: + + + + Type: + + + + IP (Unicast): + + + + Universe Size: + + + + Keepalive Time: + + + + RGB Order: + + + + Single + + + + Linear + + + + Matrix + + + + Horizontal Top Left + + + + Horizontal Top Right + + + + Horizontal Bottom Left + + + + Horizontal Bottom Right + + + + Vertical Top Left + + + + Vertical Top Right + + + + Vertical Bottom Left + + + + Vertical Bottom Right + + + + + ElgatoKeyLightSettingsEntry + + Elgato Key Light + + + + IP: + + + + + ElgatoLightStripSettingsEntry + + Elgato Light Strip + + + + IP: + + + + + GoveeSettingsEntry + + Govee Device + + + + IP: + + + + + KasaSmartSettingsEntry + + Kasa Smart Device + + + + IP: + + + + Name + + + + + LIFXSettingsEntry + + LIFX Device + + + + IP: + + + + Name + + + + + ManualDevice + + E1.31 (including WLED) + + + + QMK (built with ORGB support) + + + + Serial Device + + + + + ManualDevicesSettingsPage + + Add Device... + + + + Remove + + + + Save and Rescan + + + + Save without Rescan + + + + + NanoleafNewDeviceDialog + + New Nanoleaf device + + + + IP address: + + + + Port: + + + + + NanoleafScanDialog + + To pair, hold the on-off button down for 5-7 seconds until the LED starts flashing in a pattern, a new entry should appear in the list below, then click the "Pair" button on the entry within 30 seconds. + + + + Scan + + + + Add manually + + + + Remove + + + + + NanoleafSettingsEntry + + Nanoleaf Device + + + + IP: + + + + Port: + + + + Auth Key: + + + + Unpair + + + + Pair + + + OpenRGBClientInfoPage @@ -58,52 +350,6 @@ - - OpenRGBDMXSettingsEntry - - Brightness Channel: - - - - Blue Channel: - - - - Name: - - - - Green Channel: - - - - Red Channel: - - - - Keepalive Time: - - - - Port: - - - - - OpenRGBDMXSettingsPage - - Add - - - - Remove - - - - Save - - - OpenRGBDeviceInfoPage @@ -428,30 +674,6 @@ General Settings - - E1.31 Devices - - - - Philips Hue Devices - - - - Philips Wiz Devices - - - - OpenRGB QMK Protocol - - - - Serial Devices - - - - Yeelight Devices - - SMBus Tools @@ -472,216 +694,16 @@ Log Console - - LIFX Devices - - - - Nanoleaf Devices - - - - Elgato KeyLight Devices - - - - Elgato LightStrip Devices - - Supported Devices - - DMX Devices - - - - Kasa Smart Devices - - About OpenRGB - Govee Devices - - - - - OpenRGBE131SettingsEntry - - Start Channel: - - - - Number of LEDs: - - - - Start Universe: - - - - Name: - - - - Matrix Order: - - - - Matrix Height: - - - - Matrix Width: - - - - Type: - - - - IP (Unicast): - - - - Universe Size: - - - - Keepalive Time: - - - - RGB Order: - - - - Single - - - - Linear - - - - Matrix - - - - Horizontal Top Left - - - - Horizontal Top Right - - - - Horizontal Bottom Left - - - - Horizontal Bottom Right - - - - Vertical Top Left - - - - Vertical Top Right - - - - Vertical Bottom Left - - - - Vertical Bottom Right - - - - - OpenRGBE131SettingsPage - - Add - - - - Remove - - - - Save - - - - - OpenRGBElgatoKeyLightSettingsEntry - - IP: - - - - - OpenRGBElgatoKeyLightSettingsPage - - Add - - - - Remove - - - - Save - - - - - OpenRGBElgatoLightStripSettingsEntry - - IP: - - - - - OpenRGBElgatoLightStripSettingsPage - - Add - - - - Remove - - - - Save - - - - - OpenRGBGoveeSettingsEntry - - IP: - - - - - OpenRGBGoveeSettingsPage - - Add - - - - Remove - - - - Save + Manually Added Devices @@ -708,207 +730,6 @@ - - OpenRGBKasaSmartSettingsEntry - - IP: - - - - Name - - - - - OpenRGBKasaSmartSettingsPage - - Add - - - - Remove - - - - Save - - - - - OpenRGBLIFXSettingsEntry - - IP: - - - - Name - - - - - OpenRGBLIFXSettingsPage - - Add - - - - Remove - - - - Save - - - - - OpenRGBNanoleafNewDeviceDialog - - New Nanoleaf device - - - - IP address: - - - - Port: - - - - - OpenRGBNanoleafSettingsEntry - - IP: - - - - Port: - - - - Auth Key: - - - - Unpair - - - - Pair - - - - - OpenRGBNanoleafSettingsPage - - Scan - - - - 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. - - - - Add - - - - Remove - - - - - OpenRGBPhilipsHueSettingsEntry - - IP: - - - - Entertainment Mode: - - - - Username: - - - - Client Key: - - - - Unpair Bridge - - - - MAC: - - - - Auto Connect Group: - - - - - OpenRGBPhilipsHueSettingsPage - - Remove - - - - Add - - - - Save - - - - After adding a Hue entry and saving, restart OpenRGB and press the Sync button on your Hue bridge to pair it. - - - - - OpenRGBPhilipsWizSettingsEntry - - IP: - - - - Use Cool White - - - - Use Warm White - - - - White Strategy: - - - - Average - - - - Minimum - - - - - OpenRGBPhilipsWizSettingsPage - - Add - - - - Remove - - - - Save - - - OpenRGBPluginsEntry @@ -1006,74 +827,6 @@ - - OpenRGBQMKORGBSettingsEntry - - Name: - - - - USB PID: - - - - USB VID: - - - - - OpenRGBQMKORGBSettingsPage - - Add - - - - Remove - - - - Save - - - - - OpenRGBSerialSettingsEntry - - Baud: - - - - Name: - - - - Number of LEDs: - - - - Port: - - - - Protocol: - - - - - OpenRGBSerialSettingsPage - - Add - - - - Remove - - - - Save - - - OpenRGBServerInfoPage @@ -1131,10 +884,6 @@ Load Window Geometry - - 90000 - - Run Zone Checks on Rescan @@ -1425,52 +1174,6 @@ - - OpenRGBYeelightSettingsEntry - - IP: - - - - ? - - - - Music Mode: - - - - Override host IP: - - - - Left blank for auto discovering host ip - - - - Choose an IP... - - - - Choose the correct IP for the host - - - - - OpenRGBYeelightSettingsPage - - Add - - - - Remove - - - - Save - - - OpenRGBZoneResizeDialog @@ -1529,6 +1232,91 @@ + + PhilipsHueSettingsEntry + + Philips Hue Bridge + + + + Entertainment Mode: + + + + Auto Connect Group: + + + + IP: + + + + Client Key: + + + + Username: + + + + MAC: + + + + Unpair Bridge + + + + + PhilipsWizSettingsEntry + + Philips Wiz Device + + + + Use Cool White + + + + Use Warm White + + + + IP: + + + + White Strategy: + + + + Average + + + + Minimum + + + + + QMKORGBSettingsEntry + + QMK Device + + + + Name: + + + + USB PID: + + + + USB VID: + + + ResourceManager @@ -1548,6 +1336,33 @@ + + SerialSettingsEntry + + Serial Device + + + + Baud: + + + + Name: + + + + Number of LEDs: + + + + Port: + + + + Protocol: + + + TabLabel @@ -1555,4 +1370,39 @@ + + YeelightSettingsEntry + + Yeelight Device + + + + IP: + + + + ? + + + + Music Mode: + + + + Override host IP: + + + + Left blank for auto discovering host ip + + + + Choose an IP... + + + + Choose the correct IP for the host + + + diff --git a/qt/i18n/OpenRGB_en_GB.ts b/qt/i18n/OpenRGB_en_GB.ts index 262682309..b66cb61c7 100644 --- a/qt/i18n/OpenRGB_en_GB.ts +++ b/qt/i18n/OpenRGB_en_GB.ts @@ -1,6 +1,41 @@ + + DMXSettingsEntry + + DMX Device + + + + Brightness Channel: + + + + Blue Channel: + + + + Name: + + + + Green Channel: + + + + Red Channel: + + + + Keepalive Time: + + + + Port: + + + DetectorTableModel @@ -12,6 +47,263 @@ + + E131SettingsEntry + + E1.31 Device + + + + Start Channel: + + + + Number of LEDs: + + + + Start Universe: + + + + Name: + + + + Matrix Order: + + + + Matrix Height: + + + + Matrix Width: + + + + Type: + + + + IP (Unicast): + + + + Universe Size: + + + + Keepalive Time: + + + + RGB Order: + + + + Single + + + + Linear + + + + Matrix + + + + Horizontal Top Left + + + + Horizontal Top Right + + + + Horizontal Bottom Left + + + + Horizontal Bottom Right + + + + Vertical Top Left + + + + Vertical Top Right + + + + Vertical Bottom Left + + + + Vertical Bottom Right + + + + + ElgatoKeyLightSettingsEntry + + Elgato Key Light + + + + IP: + + + + + ElgatoLightStripSettingsEntry + + Elgato Light Strip + + + + IP: + + + + + GoveeSettingsEntry + + Govee Device + + + + IP: + + + + + KasaSmartSettingsEntry + + Kasa Smart Device + + + + IP: + + + + Name + + + + + LIFXSettingsEntry + + LIFX Device + + + + IP: + + + + Name + + + + + ManualDevice + + E1.31 (including WLED) + + + + QMK (built with ORGB support) + + + + Serial Device + + + + + ManualDevicesSettingsPage + + Add Device... + + + + Remove + + + + Save and Rescan + + + + Save without Rescan + + + + + NanoleafNewDeviceDialog + + New Nanoleaf device + + + + IP address: + + + + Port: + + + + + NanoleafScanDialog + + To pair, hold the on-off button down for 5-7 seconds until the LED starts flashing in a pattern, a new entry should appear in the list below, then click the "Pair" button on the entry within 30 seconds. + + + + Scan + + + + Add manually + + + + Remove + + + + + NanoleafSettingsEntry + + Nanoleaf Device + + + + IP: + + + + Port: + + + + Auth Key: + + + + Unpair + + + + Pair + + + OpenRGBClientInfoPage @@ -58,52 +350,6 @@ - - OpenRGBDMXSettingsEntry - - Brightness Channel: - - - - Blue Channel: - - - - Name: - - - - Green Channel: - - - - Red Channel: - - - - Keepalive Time: - - - - Port: - - - - - OpenRGBDMXSettingsPage - - Add - - - - Remove - - - - Save - - - OpenRGBDeviceInfoPage @@ -428,30 +674,6 @@ General Settings - - E1.31 Devices - - - - Philips Hue Devices - - - - Philips Wiz Devices - - - - OpenRGB QMK Protocol - - - - Serial Devices - - - - Yeelight Devices - - SMBus Tools @@ -472,216 +694,16 @@ Log Console - - LIFX Devices - - - - Nanoleaf Devices - - - - Elgato KeyLight Devices - - - - Elgato LightStrip Devices - - Supported Devices - - DMX Devices - - - - Kasa Smart Devices - - About OpenRGB - Govee Devices - - - - - OpenRGBE131SettingsEntry - - Start Channel: - - - - Number of LEDs: - - - - Start Universe: - - - - Name: - - - - Matrix Order: - - - - Matrix Height: - - - - Matrix Width: - - - - Type: - - - - IP (Unicast): - - - - Universe Size: - - - - Keepalive Time: - - - - RGB Order: - - - - Single - - - - Linear - - - - Matrix - - - - Horizontal Top Left - - - - Horizontal Top Right - - - - Horizontal Bottom Left - - - - Horizontal Bottom Right - - - - Vertical Top Left - - - - Vertical Top Right - - - - Vertical Bottom Left - - - - Vertical Bottom Right - - - - - OpenRGBE131SettingsPage - - Add - - - - Remove - - - - Save - - - - - OpenRGBElgatoKeyLightSettingsEntry - - IP: - - - - - OpenRGBElgatoKeyLightSettingsPage - - Add - - - - Remove - - - - Save - - - - - OpenRGBElgatoLightStripSettingsEntry - - IP: - - - - - OpenRGBElgatoLightStripSettingsPage - - Add - - - - Remove - - - - Save - - - - - OpenRGBGoveeSettingsEntry - - IP: - - - - - OpenRGBGoveeSettingsPage - - Add - - - - Remove - - - - Save + Manually Added Devices @@ -708,207 +730,6 @@ - - OpenRGBKasaSmartSettingsEntry - - IP: - - - - Name - - - - - OpenRGBKasaSmartSettingsPage - - Add - - - - Remove - - - - Save - - - - - OpenRGBLIFXSettingsEntry - - IP: - - - - Name - - - - - OpenRGBLIFXSettingsPage - - Add - - - - Remove - - - - Save - - - - - OpenRGBNanoleafNewDeviceDialog - - New Nanoleaf device - - - - IP address: - - - - Port: - - - - - OpenRGBNanoleafSettingsEntry - - IP: - - - - Port: - - - - Auth Key: - - - - Unpair - - - - Pair - - - - - OpenRGBNanoleafSettingsPage - - Scan - - - - 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. - - - - Add - - - - Remove - - - - - OpenRGBPhilipsHueSettingsEntry - - IP: - - - - Entertainment Mode: - - - - Username: - - - - Client Key: - - - - Unpair Bridge - - - - MAC: - - - - Auto Connect Group: - - - - - OpenRGBPhilipsHueSettingsPage - - Remove - - - - Add - - - - Save - - - - After adding a Hue entry and saving, restart OpenRGB and press the Sync button on your Hue bridge to pair it. - - - - - OpenRGBPhilipsWizSettingsEntry - - IP: - - - - Use Cool White - - - - Use Warm White - - - - White Strategy: - - - - Average - - - - Minimum - - - - - OpenRGBPhilipsWizSettingsPage - - Add - - - - Remove - - - - Save - - - OpenRGBPluginsEntry @@ -1006,74 +827,6 @@ - - OpenRGBQMKORGBSettingsEntry - - Name: - - - - USB PID: - - - - USB VID: - - - - - OpenRGBQMKORGBSettingsPage - - Add - - - - Remove - - - - Save - - - - - OpenRGBSerialSettingsEntry - - Baud: - - - - Name: - - - - Number of LEDs: - - - - Port: - - - - Protocol: - - - - - OpenRGBSerialSettingsPage - - Add - - - - Remove - - - - Save - - - OpenRGBServerInfoPage @@ -1131,10 +884,6 @@ Load Window Geometry - - 90000 - - Run Zone Checks on Rescan @@ -1425,52 +1174,6 @@ - - OpenRGBYeelightSettingsEntry - - IP: - - - - ? - - - - Music Mode: - - - - Override host IP: - - - - Left blank for auto discovering host ip - - - - Choose an IP... - - - - Choose the correct IP for the host - - - - - OpenRGBYeelightSettingsPage - - Add - - - - Remove - - - - Save - - - OpenRGBZoneResizeDialog @@ -1529,6 +1232,91 @@ + + PhilipsHueSettingsEntry + + Philips Hue Bridge + + + + Entertainment Mode: + + + + Auto Connect Group: + + + + IP: + + + + Client Key: + + + + Username: + + + + MAC: + + + + Unpair Bridge + + + + + PhilipsWizSettingsEntry + + Philips Wiz Device + + + + Use Cool White + + + + Use Warm White + + + + IP: + + + + White Strategy: + + + + Average + + + + Minimum + + + + + QMKORGBSettingsEntry + + QMK Device + + + + Name: + + + + USB PID: + + + + USB VID: + + + ResourceManager @@ -1548,6 +1336,33 @@ + + SerialSettingsEntry + + Serial Device + + + + Baud: + + + + Name: + + + + Number of LEDs: + + + + Port: + + + + Protocol: + + + TabLabel @@ -1555,4 +1370,39 @@ + + YeelightSettingsEntry + + Yeelight Device + + + + IP: + + + + ? + + + + Music Mode: + + + + Override host IP: + + + + Left blank for auto discovering host ip + + + + Choose an IP... + + + + Choose the correct IP for the host + + + diff --git a/qt/i18n/OpenRGB_en_US.ts b/qt/i18n/OpenRGB_en_US.ts index bc12dec59..119d5a98e 100644 --- a/qt/i18n/OpenRGB_en_US.ts +++ b/qt/i18n/OpenRGB_en_US.ts @@ -1,6 +1,41 @@ + + DMXSettingsEntry + + DMX Device + + + + Brightness Channel: + + + + Blue Channel: + + + + Name: + + + + Green Channel: + + + + Red Channel: + + + + Keepalive Time: + + + + Port: + + + DetectorTableModel @@ -12,6 +47,263 @@ + + E131SettingsEntry + + E1.31 Device + + + + Start Channel: + + + + Number of LEDs: + + + + Start Universe: + + + + Name: + + + + Matrix Order: + + + + Matrix Height: + + + + Matrix Width: + + + + Type: + + + + IP (Unicast): + + + + Universe Size: + + + + Keepalive Time: + + + + RGB Order: + + + + Single + + + + Linear + + + + Matrix + + + + Horizontal Top Left + + + + Horizontal Top Right + + + + Horizontal Bottom Left + + + + Horizontal Bottom Right + + + + Vertical Top Left + + + + Vertical Top Right + + + + Vertical Bottom Left + + + + Vertical Bottom Right + + + + + ElgatoKeyLightSettingsEntry + + Elgato Key Light + + + + IP: + + + + + ElgatoLightStripSettingsEntry + + Elgato Light Strip + + + + IP: + + + + + GoveeSettingsEntry + + Govee Device + + + + IP: + + + + + KasaSmartSettingsEntry + + Kasa Smart Device + + + + IP: + + + + Name + + + + + LIFXSettingsEntry + + LIFX Device + + + + IP: + + + + Name + + + + + ManualDevice + + E1.31 (including WLED) + + + + QMK (built with ORGB support) + + + + Serial Device + + + + + ManualDevicesSettingsPage + + Add Device... + + + + Remove + + + + Save and Rescan + + + + Save without Rescan + + + + + NanoleafNewDeviceDialog + + New Nanoleaf device + + + + IP address: + + + + Port: + + + + + NanoleafScanDialog + + To pair, hold the on-off button down for 5-7 seconds until the LED starts flashing in a pattern, a new entry should appear in the list below, then click the "Pair" button on the entry within 30 seconds. + + + + Scan + + + + Add manually + + + + Remove + + + + + NanoleafSettingsEntry + + Nanoleaf Device + + + + IP: + + + + Port: + + + + Auth Key: + + + + Unpair + + + + Pair + + + OpenRGBClientInfoPage @@ -58,52 +350,6 @@ - - OpenRGBDMXSettingsEntry - - Brightness Channel: - - - - Blue Channel: - - - - Name: - - - - Green Channel: - - - - Red Channel: - - - - Keepalive Time: - - - - Port: - - - - - OpenRGBDMXSettingsPage - - Add - - - - Remove - - - - Save - - - OpenRGBDeviceInfoPage @@ -428,38 +674,6 @@ General Settings - - DMX Devices - - - - E1.31 Devices - - - - Kasa Smart Devices - - - - Philips Hue Devices - - - - Philips Wiz Devices - - - - OpenRGB QMK Protocol - - - - Serial Devices - - - - Yeelight Devices - - SMBus Tools @@ -480,22 +694,6 @@ Log Console - - LIFX Devices - - - - Nanoleaf Devices - - - - Elgato KeyLight Devices - - - - Elgato LightStrip Devices - - Supported Devices @@ -505,183 +703,7 @@ - Govee Devices - - - - - OpenRGBE131SettingsEntry - - Start Channel: - - - - Number of LEDs: - - - - Start Universe: - - - - Name: - - - - Matrix Order: - - - - Matrix Height: - - - - Matrix Width: - - - - Type: - - - - IP (Unicast): - - - - Universe Size: - - - - Keepalive Time: - - - - RGB Order: - - - - Single - - - - Linear - - - - Matrix - - - - Horizontal Top Left - - - - Horizontal Top Right - - - - Horizontal Bottom Left - - - - Horizontal Bottom Right - - - - Vertical Top Left - - - - Vertical Top Right - - - - Vertical Bottom Left - - - - Vertical Bottom Right - - - - - OpenRGBE131SettingsPage - - Add - - - - Remove - - - - Save - - - - - OpenRGBElgatoKeyLightSettingsEntry - - IP: - - - - - OpenRGBElgatoKeyLightSettingsPage - - Add - - - - Remove - - - - Save - - - - - OpenRGBElgatoLightStripSettingsEntry - - IP: - - - - - OpenRGBElgatoLightStripSettingsPage - - Add - - - - Remove - - - - Save - - - - - OpenRGBGoveeSettingsEntry - - IP: - - - - - OpenRGBGoveeSettingsPage - - Add - - - - Remove - - - - Save + Manually Added Devices @@ -708,207 +730,6 @@ - - OpenRGBKasaSmartSettingsEntry - - IP: - - - - Name - - - - - OpenRGBKasaSmartSettingsPage - - Add - - - - Remove - - - - Save - - - - - OpenRGBLIFXSettingsEntry - - IP: - - - - Name - - - - - OpenRGBLIFXSettingsPage - - Add - - - - Remove - - - - Save - - - - - OpenRGBNanoleafNewDeviceDialog - - New Nanoleaf device - - - - IP address: - - - - Port: - - - - - OpenRGBNanoleafSettingsEntry - - IP: - - - - Port: - - - - Auth Key: - - - - Unpair - - - - Pair - - - - - OpenRGBNanoleafSettingsPage - - Add - - - - Remove - - - - Scan - - - - 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. - - - - - OpenRGBPhilipsHueSettingsEntry - - IP: - - - - Entertainment Mode: - - - - Username: - - - - Client Key: - - - - Unpair Bridge - - - - MAC: - - - - Auto Connect Group: - - - - - OpenRGBPhilipsHueSettingsPage - - Remove - - - - Add - - - - Save - - - - After adding a Hue entry and saving, restart OpenRGB and press the Sync button on your Hue bridge to pair it. - - - - - OpenRGBPhilipsWizSettingsEntry - - IP: - - - - Use Cool White - - - - Use Warm White - - - - White Strategy: - - - - Average - - - - Minimum - - - - - OpenRGBPhilipsWizSettingsPage - - Add - - - - Remove - - - - Save - - - OpenRGBPluginsEntry @@ -1006,74 +827,6 @@ - - OpenRGBQMKORGBSettingsEntry - - Name: - - - - USB PID: - - - - USB VID: - - - - - OpenRGBQMKORGBSettingsPage - - Add - - - - Remove - - - - Save - - - - - OpenRGBSerialSettingsEntry - - Baud: - - - - Name: - - - - Number of LEDs: - - - - Port: - - - - Protocol: - - - - - OpenRGBSerialSettingsPage - - Add - - - - Remove - - - - Save - - - OpenRGBServerInfoPage @@ -1131,10 +884,6 @@ Load Window Geometry - - 90000 - - Run Zone Checks on Rescan @@ -1425,52 +1174,6 @@ - - OpenRGBYeelightSettingsEntry - - IP: - - - - ? - - - - Music Mode: - - - - Override host IP: - - - - Left blank for auto discovering host ip - - - - Choose an IP... - - - - Choose the correct IP for the host - - - - - OpenRGBYeelightSettingsPage - - Add - - - - Remove - - - - Save - - - OpenRGBZoneResizeDialog @@ -1529,6 +1232,91 @@ + + PhilipsHueSettingsEntry + + Philips Hue Bridge + + + + Entertainment Mode: + + + + Auto Connect Group: + + + + IP: + + + + Client Key: + + + + Username: + + + + MAC: + + + + Unpair Bridge + + + + + PhilipsWizSettingsEntry + + Philips Wiz Device + + + + Use Cool White + + + + Use Warm White + + + + IP: + + + + White Strategy: + + + + Average + + + + Minimum + + + + + QMKORGBSettingsEntry + + QMK Device + + + + Name: + + + + USB PID: + + + + USB VID: + + + ResourceManager @@ -1548,6 +1336,33 @@ + + SerialSettingsEntry + + Serial Device + + + + Baud: + + + + Name: + + + + Number of LEDs: + + + + Port: + + + + Protocol: + + + TabLabel @@ -1555,4 +1370,39 @@ + + YeelightSettingsEntry + + Yeelight Device + + + + IP: + + + + ? + + + + Music Mode: + + + + Override host IP: + + + + Left blank for auto discovering host ip + + + + Choose an IP... + + + + Choose the correct IP for the host + + + diff --git a/qt/i18n/OpenRGB_ru_RU.ts b/qt/i18n/OpenRGB_ru_RU.ts index b6b58a12e..e6b37a359 100644 --- a/qt/i18n/OpenRGB_ru_RU.ts +++ b/qt/i18n/OpenRGB_ru_RU.ts @@ -1,6 +1,41 @@ + + DMXSettingsEntry + + DMX Device + + + + Brightness Channel: + Канал яркости: + + + Blue Channel: + Канал синего цвета: + + + Name: + Название: + + + Green Channel: + Канал зелёного цвета: + + + Red Channel: + Канал красного цвета: + + + Keepalive Time: + Таймаут: + + + Port: + Порт: + + DetectorTableModel @@ -12,6 +47,263 @@ Обнаружение + + E131SettingsEntry + + E1.31 Device + + + + Start Channel: + Начальный канал: + + + Number of LEDs: + Количество светодиодов: + + + Start Universe: + Начальная вселенная: + + + Name: + Название: + + + Matrix Order: + Порядок матрицы: + + + Matrix Height: + Высота матрицы: + + + Matrix Width: + Ширина матрицы: + + + Type: + Тип: + + + IP (Unicast): + IP (одноадресный): + + + Universe Size: + Размер вселенной: + + + Keepalive Time: + Таймаут: + + + RGB Order: + Порядок RGB: + + + Single + Однородная область + + + Linear + Линейная область + + + Matrix + Матрица + + + Horizontal Top Left + Горизонтально, слева направо и сверху вниз + + + Horizontal Top Right + Горизонтально, справа налево и сверху вниз + + + Horizontal Bottom Left + Горизонтально, слева направо и снизу вверх + + + Horizontal Bottom Right + Горизонтально, справа налево и снизу вверх + + + Vertical Top Left + Вертикально, сверху вниз и слева направо + + + Vertical Top Right + Вертикально, сверху вниз и справа налево + + + Vertical Bottom Left + Вертикально, снизу вверх и слева направо + + + Vertical Bottom Right + Вертикально, снизу вверх и справа налево + + + + ElgatoKeyLightSettingsEntry + + Elgato Key Light + + + + IP: + IP: + + + + ElgatoLightStripSettingsEntry + + Elgato Light Strip + + + + IP: + IP: + + + + GoveeSettingsEntry + + Govee Device + + + + IP: + IP: + + + + KasaSmartSettingsEntry + + Kasa Smart Device + + + + IP: + IP: + + + Name + Название + + + + LIFXSettingsEntry + + LIFX Device + + + + IP: + IP: + + + Name + Название + + + + ManualDevice + + E1.31 (including WLED) + E1.31 (включая WLED) + + + QMK (built with ORGB support) + QMK (собранное с поддержкой ORGB) + + + Serial Device + Устройство последовательного порта (Arduino) + + + + ManualDevicesSettingsPage + + Add Device... + Добавить устройство... + + + Remove + Удалить + + + Save and Rescan + Сохранить и обновить список устройств + + + Save without Rescan + Сохранить без обновления + + + + NanoleafNewDeviceDialog + + New Nanoleaf device + Добавить устройство Nanoleaf + + + IP address: + IP: + + + Port: + Порт: + + + + NanoleafScanDialog + + To pair, hold the on-off button down for 5-7 seconds until the LED starts flashing in a pattern, a new entry should appear in the list below, then click the "Pair" button on the entry within 30 seconds. + Для сопряжения, удерживайте кнопку "Вкл-выкл." 5-7 секунд, пока светодиод не начнёт мигать, после чего в списке ниже появится новая строка, на которой в течение 30 секунд нужно нажать кнопку "Связать". + + + Scan + Сканировать + + + Add manually + Добавить вручную + + + Remove + Удалить + + + + NanoleafSettingsEntry + + Nanoleaf Device + + + + IP: + IP: + + + Port: + Порт: + + + Auth Key: + Ключ авторизации: + + + Unpair + Разъединить + + + Pair + Связать + + OpenRGBClientInfoPage @@ -58,52 +350,6 @@ Очистить лог - - OpenRGBDMXSettingsEntry - - Brightness Channel: - Канал яркости: - - - Blue Channel: - Канал синего цвета: - - - Name: - Название: - - - Green Channel: - Канал зелёного цвета: - - - Red Channel: - Канал красного цвета: - - - Keepalive Time: - Таймаут: - - - Port: - Порт: - - - - OpenRGBDMXSettingsPage - - Add - Добавить - - - Remove - Удалить - - - Save - Сохранить - - OpenRGBDeviceInfoPage @@ -425,10 +671,6 @@ Plugins Подключаемые модули - - Software - Приложение - Supported Devices Поддерживаемые устройства @@ -437,38 +679,6 @@ General Settings Общие настройки - - DMX Devices - Устройства DMX - - - E1.31 Devices - Устройства E1.31 - - - Kasa Smart Devices - Устройства Kasa Smart - - - Philips Hue Devices - Устройства Philips Hue - - - Philips Wiz Devices - Устройства Philips Wiz - - - OpenRGB QMK Protocol - Протокол OpenRGB QMK - - - Serial Devices - Устройства последовательного порта - - - Yeelight Devices - Устройства Yeelight - SMBus Tools Инструменты SMBus @@ -489,206 +699,13 @@ Log Console Консоль журналирования - - LIFX Devices - Устройства LIFX - - - Nanoleaf Devices - Устройства Nanoleaf - - - Elgato KeyLight Devices - Устройства Elgato KeyLight - - - Elgato LightStrip Devices - Устройства Elgato LightStrip - About OpenRGB - + О программе OpenRGB - Govee Devices - - - - - OpenRGBE131SettingsEntry - - Start Channel: - Начальный канал: - - - Number of LEDs: - Количество светодиодов: - - - Start Universe: - Not sure if the term should be translated - Начальная вселенная: - - - Name: - Название: - - - Matrix Order: - Порядок матрицы: - - - Matrix Height: - Высота матрицы: - - - Matrix Width: - Ширина матрицы: - - - Type: - Тип: - - - IP (Unicast): - IP (одноадресный): - - - Universe Size: - Размер вселенной: - - - Keepalive Time: - Таймаут: - - - RGB Order: - Порядок RGB: - - - Single - Однородная область - - - Linear - Линейная область - - - Matrix - Матрица - - - Horizontal Top Left - Горизонтально, слева направо и сверху вниз - - - Horizontal Top Right - Горизонтально, справа налево и сверху вниз - - - Horizontal Bottom Left - Горизонтально, слева направо и снизу вверх - - - Horizontal Bottom Right - Горизонтально, справа налево и снизу вверх - - - Vertical Top Left - Вертикально, сверху вниз и слева направо - - - Vertical Top Right - Вертикально, сверху вниз и справа налево - - - Vertical Bottom Left - Вертикально, снизу вверх и слева направо - - - Vertical Bottom Right - Вертикально, снизу вверх и справа налево - - - - OpenRGBE131SettingsPage - - Add - Добавить - - - Remove - Удалить - - - Save - Сохранить - - - - OpenRGBElgatoKeyLightSettingsEntry - - IP: - IP: - - - - OpenRGBElgatoKeyLightSettingsPage - - Add - Добавить - - - Remove - Удалить - - - Save - Сохранить - - - - OpenRGBElgatoLightStripSettingsEntry - - IP: - IP: - - - - OpenRGBElgatoLightStripSettingsPage - - Add - Добавить - - - Remove - Удалить - - - Save - Сохранить - - - - OpenRGBGoveeSettingsEntry - - IP: - IP: - - - - OpenRGBGoveeSettingsPage - - Add - Добавить - - - Remove - Удалить - - - Save - Сохранить + Manually Added Devices + Добавляемые вручную устройства @@ -714,207 +731,6 @@ Изготовитель - - OpenRGBKasaSmartSettingsEntry - - IP: - IP: - - - Name - Название - - - - OpenRGBKasaSmartSettingsPage - - Add - Добавить - - - Remove - Удалить - - - Save - Сохранить - - - - OpenRGBLIFXSettingsEntry - - IP: - IP: - - - Name - Название - - - - OpenRGBLIFXSettingsPage - - Add - Добавить - - - Remove - Удалить - - - Save - Сохранить - - - - OpenRGBNanoleafNewDeviceDialog - - New Nanoleaf device - Добавить устройство Nanoleaf - - - IP address: - IP: - - - Port: - Порт: - - - - OpenRGBNanoleafSettingsEntry - - IP: - IP: - - - Port: - Порт: - - - Auth Key: - Ключ авторизации: - - - Unpair - Разъединить - - - Pair - Связать - - - - OpenRGBNanoleafSettingsPage - - Add - Добавить - - - Remove - Удалить - - - Scan - Сканировать - - - 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. - Для выполнения сопряжения, удерживайте кнопку включения/выключения в течение 5-7 секунд пока не начнётся мерцание светодиодов, а затем в течение 30 секунд щёлкните кнопку "Связать" ("Pair"). - - - - OpenRGBPhilipsHueSettingsEntry - - IP: - IP: - - - Entertainment Mode: - Развлекательный режим: - - - Username: - Имя пользователя: - - - Client Key: - Ключ клиента: - - - Unpair Bridge - Разорвать мост - - - MAC: - MAC: - - - Auto Connect Group: - Автоматически подключаться к этой группе: - - - - OpenRGBPhilipsHueSettingsPage - - Remove - Удалить - - - Add - Добавить - - - Save - Сохранить - - - After adding a Hue entry and saving, restart OpenRGB and press the Sync button on your Hue bridge to pair it. - После добавления устройств Hue и сохранения, перезапустите OpenRGB, затем нажмите кнопку Sync на мосте Hue bridge для установления связи. - - - - OpenRGBPhilipsWizSettingsEntry - - Use Cool White - Холодный белый - - - Use Warm White - Тёплый белый - - - IP: - - - - White Strategy: - Расчёт белого: - - - Average - По среднему - - - Minimum - По наименьшему - - - - OpenRGBPhilipsWizSettingsPage - - Add - Добавить - - - Remove - Удалить - - - Save - Сохранить - - OpenRGBPluginsEntry @@ -1012,74 +828,6 @@ Создать новый профиль: - - OpenRGBQMKORGBSettingsEntry - - Name: - Название: - - - USB PID: - - - - USB VID: - - - - - OpenRGBQMKORGBSettingsPage - - Add - Добавить - - - Remove - Удалить - - - Save - Сохранить - - - - OpenRGBSerialSettingsEntry - - Baud: - Бод: - - - Name: - Название: - - - Number of LEDs: - Количество светодиодов: - - - Port: - Порт: - - - Protocol: - Протокол: - - - - OpenRGBSerialSettingsPage - - Add - Добавить - - - Remove - Удалить - - - Save - Сохранить - - OpenRGBServerInfoPage @@ -1137,10 +885,6 @@ Load Window Geometry Загружать геометрию окна - - 90000 - - Run Zone Checks on Rescan Проверять области при повторном сканировании @@ -1327,11 +1071,11 @@ Qt Version: - + Версия Qt: OS Version: - + Версия ОС: OS Version Value @@ -1339,23 +1083,23 @@ GNU General Public License, version 2 - + License: - + Лицензия: Copyright: - + Авторское право: Adam Honse, OpenRGB Team - + Adam Honse, команда OpenRGB <b>OpenRGB</b>, an open-source RGB control utility - + <b>OpenRGB</b>, открытый инструментарий управления RGB-подсветкой @@ -1432,52 +1176,6 @@ Размер: - - OpenRGBYeelightSettingsEntry - - IP: - - - - ? - - - - Music Mode: - Режим захвата звука: - - - Override host IP: - Указать IP-адрес узла: - - - Left blank for auto discovering host ip - Оставьте пустым для автообнаружения IP узла - - - Choose an IP... - Выберите IP адрес… - - - Choose the correct IP for the host - Выберите правильный IP адрес узла - - - - OpenRGBYeelightSettingsPage - - Add - Добавить - - - Remove - Удалить - - - Save - Сохранить - - OpenRGBZoneResizeDialog @@ -1536,6 +1234,91 @@ Размер + + PhilipsHueSettingsEntry + + Philips Hue Bridge + + + + Entertainment Mode: + Развлекательный режим: + + + Auto Connect Group: + Автоматически подключаться к этой группе: + + + IP: + IP: + + + Client Key: + Ключ клиента: + + + Username: + Имя пользователя: + + + MAC: + MAC: + + + Unpair Bridge + Разорвать сопряжение с мостом + + + + PhilipsWizSettingsEntry + + Philips Wiz Device + + + + Use Cool White + Холодный белый + + + Use Warm White + Тёплый белый + + + IP: + IP: + + + White Strategy: + Расчёт белого: + + + Average + По среднему + + + Minimum + По наименьшему + + + + QMKORGBSettingsEntry + + QMK Device + + + + Name: + Название: + + + USB PID: + + + + USB VID: + + + ResourceManager @@ -1557,6 +1340,33 @@ <h2>ВНИМАНИЕ:</h2><p>Обнаружено несколько файлов с правилами udev для OpenRGB.</p><p>Файл 60-openrgb.rules установлен как в /etc/udev/rules.d, так и в /usr/lib/udev/rules.d.</p><p>Несколько наборов правил могут конфликтовать между собой, рекомендуется удалить один из них.</p> + + SerialSettingsEntry + + Serial Device + Устройство последовательного порта (Arduino) + + + Baud: + Скорость (бод): + + + Name: + Название: + + + Number of LEDs: + Количество светодиодов: + + + Port: + Порт: + + + Protocol: + Протокол: + + TabLabel @@ -1564,4 +1374,39 @@ название устройства + + YeelightSettingsEntry + + Yeelight Device + + + + IP: + IP: + + + ? + + + + Music Mode: + Режим захвата звука: + + + Override host IP: + Указать IP-адрес узла: + + + Left blank for auto discovering host ip + Оставьте пустым для автообнаружения IP узла + + + Choose an IP... + Выберите IP адрес… + + + Choose the correct IP for the host + Выберите правильный IP адрес узла + +