2023-02-15 01:12:19 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
2023-02-15 21:54:26 +01:00
|
|
|
#include <algorithm>
|
2023-02-15 01:12:19 +01:00
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QVector3D>
|
2023-02-15 21:54:26 +01:00
|
|
|
#include <QMetaEnum>
|
|
|
|
|
#include <QMetaType>
|
|
|
|
|
|
|
|
|
|
namespace hilfe {
|
|
|
|
|
Q_NAMESPACE
|
|
|
|
|
enum class LightTypeRegisterType
|
|
|
|
|
{
|
|
|
|
|
Dummy,
|
|
|
|
|
Dimmer,
|
|
|
|
|
Red,
|
|
|
|
|
Green,
|
|
|
|
|
Blue,
|
|
|
|
|
White,
|
|
|
|
|
Strobo,
|
|
|
|
|
Shutter
|
|
|
|
|
};
|
|
|
|
|
Q_ENUM_NS(LightTypeRegisterType)
|
|
|
|
|
} // namespace hilfe
|
|
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(hilfe::LightTypeRegisterType)
|
|
|
|
|
|
|
|
|
|
using LightTypeRegisterType = hilfe::LightTypeRegisterType;
|
|
|
|
|
|
|
|
|
|
struct LightTypeRegisterConfig
|
|
|
|
|
{
|
|
|
|
|
LightTypeRegisterType type;
|
|
|
|
|
};
|
2023-02-15 01:12:19 +01:00
|
|
|
|
|
|
|
|
struct LightTypeConfig
|
|
|
|
|
{
|
|
|
|
|
int id;
|
|
|
|
|
QString name;
|
2023-02-15 21:54:26 +01:00
|
|
|
std::vector<LightTypeRegisterConfig> registers;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class LightTypesContainer : public std::vector<LightTypeConfig>
|
|
|
|
|
{
|
|
|
|
|
using base_t = std::vector<LightTypeConfig>;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
using base_t::base_t;
|
|
|
|
|
|
|
|
|
|
LightTypeConfig *findById(int id)
|
|
|
|
|
{
|
|
|
|
|
auto iter = std::find_if(std::begin(*this), std::end(*this),
|
|
|
|
|
[&id](const LightTypeConfig &lightType){ return lightType.id == id; });
|
|
|
|
|
return iter != std::end(*this) ? &*iter : nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const LightTypeConfig *findById(int id) const
|
|
|
|
|
{
|
|
|
|
|
auto iter = std::find_if(std::begin(*this), std::end(*this),
|
|
|
|
|
[&id](const LightTypeConfig &lightType){ return lightType.id == id; });
|
|
|
|
|
return iter != std::end(*this) ? &*iter : nullptr;
|
|
|
|
|
}
|
2023-02-15 01:12:19 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct LightConfig
|
|
|
|
|
{
|
|
|
|
|
int id;
|
|
|
|
|
QString name;
|
|
|
|
|
int lightTypeId;
|
|
|
|
|
int address;
|
|
|
|
|
QVector3D position;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct LightProject
|
|
|
|
|
{
|
2023-02-15 21:54:26 +01:00
|
|
|
LightTypesContainer lightTypes;
|
2023-02-15 01:12:19 +01:00
|
|
|
std::vector<LightConfig> lights;
|
|
|
|
|
};
|