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;
OpenRGBDMXSettingsEntry::OpenRGBDMXSettingsEntry(QWidget *parent) :
QWidget(parent),
BaseManualDeviceEntry(parent),
ui(new Ui::OpenRGBDMXSettingsEntryUi)
{
ui->setupUi(this);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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