Added base class for all Manually Added Devices settings Entries

This commit is contained in:
Dmitry Kychanov 2025-06-10 10:32:30 +04:00
parent fc26902d1d
commit c09d41bd40
29 changed files with 67 additions and 81 deletions

View file

@ -0,0 +1,26 @@
/*-----------------------------------------------------------------*\
| BaseManualDeviceEntry.h |
| |
| Base class to all user-defined device settings entries |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-only |
\*-----------------------------------------------------------------*/
#pragma once
#include <QWidget>
#include "nlohmann/json.hpp"
using json = nlohmann::json;
class BaseManualDeviceEntry: public QWidget
{
Q_OBJECT
public:
explicit BaseManualDeviceEntry(QWidget *parent = nullptr): QWidget(parent) {}
virtual void loadFromSettings(const json& data) = 0;
virtual json saveSettings() = 0;
virtual const char* settingsSection() = 0;
};

View file

@ -13,7 +13,7 @@
using namespace Ui; using namespace Ui;
OpenRGBDMXSettingsEntry::OpenRGBDMXSettingsEntry(QWidget *parent) : OpenRGBDMXSettingsEntry::OpenRGBDMXSettingsEntry(QWidget *parent) :
QWidget(parent), BaseManualDeviceEntry(parent),
ui(new Ui::OpenRGBDMXSettingsEntryUi) ui(new Ui::OpenRGBDMXSettingsEntryUi)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -9,10 +9,7 @@
#pragma once #pragma once
#include <QWidget> #include "BaseManualDeviceEntry.h"
#include "nlohmann/json.hpp"
using json = nlohmann::json;
namespace Ui namespace Ui
{ {
@ -20,7 +17,7 @@ namespace Ui
class OpenRGBDMXSettingsEntryUi; class OpenRGBDMXSettingsEntryUi;
} }
class Ui::OpenRGBDMXSettingsEntry : public QWidget class Ui::OpenRGBDMXSettingsEntry : public BaseManualDeviceEntry
{ {
Q_OBJECT Q_OBJECT

View file

@ -13,7 +13,7 @@
using namespace Ui; using namespace Ui;
OpenRGBE131SettingsEntry::OpenRGBE131SettingsEntry(QWidget *parent) : OpenRGBE131SettingsEntry::OpenRGBE131SettingsEntry(QWidget *parent) :
QWidget(parent), BaseManualDeviceEntry(parent),
ui(new Ui::OpenRGBE131SettingsEntryUi) ui(new Ui::OpenRGBE131SettingsEntryUi)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -9,10 +9,7 @@
#pragma once #pragma once
#include <QWidget> #include "BaseManualDeviceEntry.h"
#include "nlohmann/json.hpp"
using json = nlohmann::json;
namespace Ui namespace Ui
{ {
@ -20,7 +17,7 @@ namespace Ui
class OpenRGBE131SettingsEntryUi; class OpenRGBE131SettingsEntryUi;
} }
class Ui::OpenRGBE131SettingsEntry : public QWidget class Ui::OpenRGBE131SettingsEntry : public BaseManualDeviceEntry
{ {
Q_OBJECT Q_OBJECT

View file

@ -13,7 +13,7 @@
using namespace Ui; using namespace Ui;
OpenRGBElgatoKeyLightSettingsEntry::OpenRGBElgatoKeyLightSettingsEntry(QWidget *parent) : OpenRGBElgatoKeyLightSettingsEntry::OpenRGBElgatoKeyLightSettingsEntry(QWidget *parent) :
QDialog(parent), BaseManualDeviceEntry(parent),
ui(new Ui::OpenRGBElgatoKeyLightSettingsEntryUi) ui(new Ui::OpenRGBElgatoKeyLightSettingsEntryUi)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -9,10 +9,7 @@
#pragma once #pragma once
#include <QDialog> #include "BaseManualDeviceEntry.h"
#include "nlohmann/json.hpp"
using json = nlohmann::json;
namespace Ui namespace Ui
{ {
@ -20,7 +17,7 @@ namespace Ui
class OpenRGBElgatoKeyLightSettingsEntryUi; class OpenRGBElgatoKeyLightSettingsEntryUi;
} }
class Ui::OpenRGBElgatoKeyLightSettingsEntry : public QDialog class Ui::OpenRGBElgatoKeyLightSettingsEntry : public BaseManualDeviceEntry
{ {
Q_OBJECT Q_OBJECT

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>OpenRGBElgatoKeyLightSettingsEntryUi</class> <class>OpenRGBElgatoKeyLightSettingsEntryUi</class>
<widget class="QDialog" name="OpenRGBElgatoKeyLightSettingsEntryUi"> <widget class="QWidget" name="OpenRGBElgatoKeyLightSettingsEntryUi">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

View file

@ -13,7 +13,7 @@
using namespace Ui; using namespace Ui;
OpenRGBElgatoLightStripSettingsEntry::OpenRGBElgatoLightStripSettingsEntry(QWidget *parent) : OpenRGBElgatoLightStripSettingsEntry::OpenRGBElgatoLightStripSettingsEntry(QWidget *parent) :
QDialog(parent), BaseManualDeviceEntry(parent),
ui(new Ui::OpenRGBElgatoLightStripSettingsEntryUi) ui(new Ui::OpenRGBElgatoLightStripSettingsEntryUi)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -9,10 +9,7 @@
#pragma once #pragma once
#include <QDialog> #include "BaseManualDeviceEntry.h"
#include "nlohmann/json.hpp"
using json = nlohmann::json;
namespace Ui namespace Ui
{ {
@ -20,7 +17,7 @@ namespace Ui
class OpenRGBElgatoLightStripSettingsEntryUi; class OpenRGBElgatoLightStripSettingsEntryUi;
} }
class Ui::OpenRGBElgatoLightStripSettingsEntry : public QDialog class Ui::OpenRGBElgatoLightStripSettingsEntry : public BaseManualDeviceEntry
{ {
Q_OBJECT Q_OBJECT

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>OpenRGBElgatoLightStripSettingsEntryUi</class> <class>OpenRGBElgatoLightStripSettingsEntryUi</class>
<widget class="QDialog" name="OpenRGBElgatoLightStripSettingsEntryUi"> <widget class="QWidget" name="OpenRGBElgatoLightStripSettingsEntryUi">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

View file

@ -15,7 +15,7 @@
using namespace Ui; using namespace Ui;
OpenRGBGoveeSettingsEntry::OpenRGBGoveeSettingsEntry(QWidget *parent) : OpenRGBGoveeSettingsEntry::OpenRGBGoveeSettingsEntry(QWidget *parent) :
QWidget(parent), BaseManualDeviceEntry(parent),
ui(new Ui::OpenRGBGoveeSettingsEntryUi) ui(new Ui::OpenRGBGoveeSettingsEntryUi)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -11,10 +11,7 @@
#pragma once #pragma once
#include <QWidget> #include "BaseManualDeviceEntry.h"
#include "nlohmann/json.hpp"
using json = nlohmann::json;
namespace Ui namespace Ui
{ {
@ -22,7 +19,7 @@ namespace Ui
class OpenRGBGoveeSettingsEntryUi; class OpenRGBGoveeSettingsEntryUi;
} }
class Ui::OpenRGBGoveeSettingsEntry : public QWidget class Ui::OpenRGBGoveeSettingsEntry : public BaseManualDeviceEntry
{ {
Q_OBJECT Q_OBJECT

View file

@ -13,7 +13,7 @@
using namespace Ui; using namespace Ui;
OpenRGBKasaSmartSettingsEntry::OpenRGBKasaSmartSettingsEntry(QWidget *parent) : OpenRGBKasaSmartSettingsEntry::OpenRGBKasaSmartSettingsEntry(QWidget *parent) :
QWidget(parent), BaseManualDeviceEntry(parent),
ui(new Ui::OpenRGBKasaSmartSettingsEntryUi) ui(new Ui::OpenRGBKasaSmartSettingsEntryUi)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -9,11 +9,7 @@
#pragma once #pragma once
#include <QWidget> #include "BaseManualDeviceEntry.h"
#include <QWidget>
#include "nlohmann/json.hpp"
using json = nlohmann::json;
namespace Ui namespace Ui
{ {
@ -21,7 +17,7 @@ namespace Ui
class OpenRGBKasaSmartSettingsEntryUi; class OpenRGBKasaSmartSettingsEntryUi;
} }
class Ui::OpenRGBKasaSmartSettingsEntry : public QWidget class Ui::OpenRGBKasaSmartSettingsEntry : public BaseManualDeviceEntry
{ {
Q_OBJECT Q_OBJECT

View file

@ -13,7 +13,7 @@
using namespace Ui; using namespace Ui;
OpenRGBLIFXSettingsEntry::OpenRGBLIFXSettingsEntry(QWidget *parent) : OpenRGBLIFXSettingsEntry::OpenRGBLIFXSettingsEntry(QWidget *parent) :
QWidget(parent), BaseManualDeviceEntry(parent),
ui(new Ui::OpenRGBLIFXSettingsEntryUi) ui(new Ui::OpenRGBLIFXSettingsEntryUi)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -7,10 +7,7 @@
| SPDX-License-Identifier: GPL-2.0-only | | SPDX-License-Identifier: GPL-2.0-only |
\*---------------------------------------------------------*/ \*---------------------------------------------------------*/
#include <QWidget> #include "BaseManualDeviceEntry.h"
#include "nlohmann/json.hpp"
using json = nlohmann::json;
namespace Ui namespace Ui
{ {
@ -18,7 +15,7 @@ namespace Ui
class OpenRGBLIFXSettingsEntryUi; class OpenRGBLIFXSettingsEntryUi;
} }
class Ui::OpenRGBLIFXSettingsEntry : public QWidget class Ui::OpenRGBLIFXSettingsEntry : public BaseManualDeviceEntry
{ {
Q_OBJECT Q_OBJECT

View file

@ -17,7 +17,7 @@
using namespace Ui; using namespace Ui;
OpenRGBNanoleafSettingsEntry::OpenRGBNanoleafSettingsEntry(QWidget *parent) : OpenRGBNanoleafSettingsEntry::OpenRGBNanoleafSettingsEntry(QWidget *parent) :
QWidget(parent), BaseManualDeviceEntry(parent),
ui(new Ui::OpenRGBNanoleafSettingsEntryUi), ui(new Ui::OpenRGBNanoleafSettingsEntryUi),
paired(false) paired(false)
{ {

View file

@ -9,12 +9,9 @@
#pragma once #pragma once
#include <QWidget> #include "BaseManualDeviceEntry.h"
#include "ui_OpenRGBNanoleafSettingsEntry.h" #include "ui_OpenRGBNanoleafSettingsEntry.h"
#include "OpenRGBNanoleafScanningThread.h" #include "OpenRGBNanoleafScanningThread.h"
#include "nlohmann/json.hpp"
using json = nlohmann::json;
namespace Ui namespace Ui
{ {
@ -22,7 +19,7 @@ namespace Ui
class OpenRGBNanoleafSettingsEntryUi; class OpenRGBNanoleafSettingsEntryUi;
} }
class Ui::OpenRGBNanoleafSettingsEntry : public QWidget class Ui::OpenRGBNanoleafSettingsEntry : public BaseManualDeviceEntry
{ {
Q_OBJECT Q_OBJECT

View file

@ -13,7 +13,7 @@
using namespace Ui; using namespace Ui;
OpenRGBPhilipsHueSettingsEntry::OpenRGBPhilipsHueSettingsEntry(QWidget *parent) : OpenRGBPhilipsHueSettingsEntry::OpenRGBPhilipsHueSettingsEntry(QWidget *parent) :
QWidget(parent), BaseManualDeviceEntry(parent),
ui(new Ui::OpenRGBPhilipsHueSettingsEntryUi) ui(new Ui::OpenRGBPhilipsHueSettingsEntryUi)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -9,10 +9,7 @@
#pragma once #pragma once
#include <QWidget> #include "BaseManualDeviceEntry.h"
#include "nlohmann/json.hpp"
using json = nlohmann::json;
namespace Ui namespace Ui
{ {
@ -20,7 +17,7 @@ namespace Ui
class OpenRGBPhilipsHueSettingsEntryUi; class OpenRGBPhilipsHueSettingsEntryUi;
} }
class Ui::OpenRGBPhilipsHueSettingsEntry : public QWidget class Ui::OpenRGBPhilipsHueSettingsEntry : public BaseManualDeviceEntry
{ {
Q_OBJECT Q_OBJECT

View file

@ -13,7 +13,7 @@
using namespace Ui; using namespace Ui;
OpenRGBPhilipsWizSettingsEntry::OpenRGBPhilipsWizSettingsEntry(QWidget *parent) : OpenRGBPhilipsWizSettingsEntry::OpenRGBPhilipsWizSettingsEntry(QWidget *parent) :
QWidget(parent), BaseManualDeviceEntry(parent),
ui(new Ui::OpenRGBPhilipsWizSettingsEntryUi) ui(new Ui::OpenRGBPhilipsWizSettingsEntryUi)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -9,10 +9,7 @@
#pragma once #pragma once
#include <QWidget> #include "BaseManualDeviceEntry.h"
#include "nlohmann/json.hpp"
using json = nlohmann::json;
namespace Ui namespace Ui
{ {
@ -20,7 +17,7 @@ namespace Ui
class OpenRGBPhilipsWizSettingsEntryUi; class OpenRGBPhilipsWizSettingsEntryUi;
} }
class Ui::OpenRGBPhilipsWizSettingsEntry : public QWidget class Ui::OpenRGBPhilipsWizSettingsEntry : public BaseManualDeviceEntry
{ {
Q_OBJECT Q_OBJECT

View file

@ -13,7 +13,7 @@
using namespace Ui; using namespace Ui;
OpenRGBQMKORGBSettingsEntry::OpenRGBQMKORGBSettingsEntry(QWidget *parent) : OpenRGBQMKORGBSettingsEntry::OpenRGBQMKORGBSettingsEntry(QWidget *parent) :
QWidget(parent), BaseManualDeviceEntry(parent),
ui(new Ui::OpenRGBQMKORGBSettingsEntryUi) ui(new Ui::OpenRGBQMKORGBSettingsEntryUi)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -9,10 +9,7 @@
#pragma once #pragma once
#include <QWidget> #include "BaseManualDeviceEntry.h"
#include "nlohmann/json.hpp"
using json = nlohmann::json;
namespace Ui namespace Ui
{ {
@ -20,7 +17,7 @@ namespace Ui
class OpenRGBQMKORGBSettingsEntryUi; class OpenRGBQMKORGBSettingsEntryUi;
} }
class Ui::OpenRGBQMKORGBSettingsEntry : public QWidget class Ui::OpenRGBQMKORGBSettingsEntry : public BaseManualDeviceEntry
{ {
Q_OBJECT Q_OBJECT

View file

@ -13,7 +13,7 @@
using namespace Ui; using namespace Ui;
OpenRGBSerialSettingsEntry::OpenRGBSerialSettingsEntry(QWidget *parent) : OpenRGBSerialSettingsEntry::OpenRGBSerialSettingsEntry(QWidget *parent) :
QWidget(parent), BaseManualDeviceEntry(parent),
ui(new Ui::OpenRGBSerialSettingsEntryUi) ui(new Ui::OpenRGBSerialSettingsEntryUi)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -9,10 +9,7 @@
#pragma once #pragma once
#include <QWidget> #include "BaseManualDeviceEntry.h"
#include "nlohmann/json.hpp"
using json = nlohmann::json;
namespace Ui namespace Ui
{ {
@ -20,7 +17,7 @@ namespace Ui
class OpenRGBSerialSettingsEntryUi; class OpenRGBSerialSettingsEntryUi;
} }
class Ui::OpenRGBSerialSettingsEntry : public QWidget class Ui::OpenRGBSerialSettingsEntry : public BaseManualDeviceEntry
{ {
Q_OBJECT Q_OBJECT

View file

@ -15,7 +15,7 @@
using namespace Ui; using namespace Ui;
OpenRGBYeelightSettingsEntry::OpenRGBYeelightSettingsEntry(QWidget *parent) : OpenRGBYeelightSettingsEntry::OpenRGBYeelightSettingsEntry(QWidget *parent) :
QWidget(parent), BaseManualDeviceEntry(parent),
ui(new Ui::OpenRGBYeelightSettingsEntryUi) ui(new Ui::OpenRGBYeelightSettingsEntryUi)
{ {
ui->setupUi(this); ui->setupUi(this);

View file

@ -9,10 +9,7 @@
#pragma once #pragma once
#include <QWidget> #include "BaseManualDeviceEntry.h"
#include "nlohmann/json.hpp"
using json = nlohmann::json;
namespace Ui namespace Ui
{ {
@ -20,7 +17,7 @@ namespace Ui
class OpenRGBYeelightSettingsEntryUi; class OpenRGBYeelightSettingsEntryUi;
} }
class Ui::OpenRGBYeelightSettingsEntry : public QWidget class Ui::OpenRGBYeelightSettingsEntry : public BaseManualDeviceEntry
{ {
Q_OBJECT Q_OBJECT