Commit 1f111ad5 authored by Leander Schulten's avatar Leander Schulten
Browse files

Move dmx Classes in own dir and namespace

parent 04e89581
......@@ -18,17 +18,16 @@ QML_DESIGNER_IMPORT_PATH =
SOURCES += \
applicationdata.cpp \
channel.cpp \
dmx/channel.cpp \
gui/channelprogrammeditor.cpp \
gui/colorplot.cpp \
gui/controlitem.cpp \
gui/controlitemdata.cpp \
gui/controlpanel.cpp \
device.cpp \
deviceprototype.cpp \
dmxchannelfilter.cpp \
dmxinterface.cpp \
driver.cpp \
dmx/device.cpp \
dmx/deviceprototype.cpp \
dmx/dmxchannelfilter.cpp \
dmx/driver.cpp \
errornotifier.cpp \
gui/graph.cpp \
gui/gridbackground.cpp \
......@@ -38,11 +37,11 @@ SOURCES += \
gui/mapview.cpp \
modelmanager.cpp \
modelvector.cpp \
namedobject.cpp \
dmx/namedobject.cpp \
gui/oscillogram.cpp \
gui/polygon.cpp \
programm.cpp \
programmprototype.cpp \
dmx/programm.cpp \
dmx/programmprototype.cpp \
programms/dmxconsumer.cpp \
scanner.cpp \
test/testloopprogramm.cpp \
......@@ -92,16 +91,16 @@ DEFINES += _USE_MATH_DEFINES
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
HEADERS += \
deviceprototype.h \
channel.h \
dmx/deviceprototype.h \
dmx/channel.h \
id.h \
device.h \
dmx/device.h \
idbase.h \
programmprototype.h \
programm.h \
dmx/programmprototype.h \
dmx/programm.h \
applicationdata.h \
namedobject.h \
dmxchannelfilter.h \
dmx/namedobject.h \
dmx/dmxchannelfilter.h \
programms/controlpoint.hpp \
programms/scanner.hpp \
scanner.h \
......@@ -116,10 +115,10 @@ HEADERS += \
gui/controlpanel.h \
gui/controlitem.h \
gui/controlitemdata.h \
HardwareInterface.h \
dmx/HardwareInterface.h \
errornotifier.h \
settings.h \
driver.h \
dmx/driver.h \
test/DriverDummy.h \
gui/colorplot.h \
gui/graph.h \
......
......@@ -3,11 +3,11 @@
#include "idbase.h"
#include <QJsonArray>
#include "channel.h"
#include "deviceprototype.h"
#include "device.h"
#include "programmprototype.h"
#include "programm.h"
#include "dmx/channel.h"
#include "dmx/deviceprototype.h"
#include "dmx/device.h"
#include "dmx/programmprototype.h"
#include "dmx/programm.h"
#include "usermanagment.h"
#include "gui/controlpanel.h"
#include "gui/mapview.h"
......@@ -43,10 +43,10 @@ void saveIDBaseObjects(QJsonObject &o,QString entryName ){
QByteArray saveData(){
qDebug()<<"SAVE DATA";
QJsonObject o;
saveIDBaseObjects<DevicePrototype>(o,"DevicePrototypes");
saveIDBaseObjects<Device>(o,"Devices");
saveIDBaseObjects<ProgrammPrototype>(o,"ProgrammPrototypes");
saveIDBaseObjects<Programm>(o,"Programms");
saveIDBaseObjects<DMX::DevicePrototype>(o,"DevicePrototypes");
saveIDBaseObjects<DMX::Device>(o,"Devices");
saveIDBaseObjects<DMX::ProgrammPrototype>(o,"ProgrammPrototypes");
saveIDBaseObjects<DMX::Programm>(o,"Programms");
saveIDBaseObjects<User>(o,"Users");
o.insert("password",QString::fromLatin1(password.toBase64()));
{
......@@ -92,10 +92,10 @@ std::function<void()> loadData(QFile &file){
std::function<void()> loadData(QByteArray data){
const auto o = QJsonDocument::fromJson(data).object();
loadIDBaseObjects<DevicePrototype>(o,"DevicePrototypes");
loadIDBaseObjects<Device>(o,"Devices");
loadIDBaseObjects<ProgrammPrototype>(o,"ProgrammPrototypes");
loadIDBaseObjects<Programm>(o,"Programms");
loadIDBaseObjects<DMX::DevicePrototype>(o,"DevicePrototypes");
loadIDBaseObjects<DMX::Device>(o,"Devices");
loadIDBaseObjects<DMX::ProgrammPrototype>(o,"ProgrammPrototypes");
loadIDBaseObjects<DMX::Programm>(o,"Programms");
password = QByteArray::fromBase64(o["password"].toString().toLatin1());
{//USERS
for(const auto e : o["Users"].toArray()){
......
......@@ -7,6 +7,8 @@
#include <condition_variable>
#include <functional>
namespace DMX{
/**
* @brief The DMXInterface class soll eine Standard schnittstelle für Treiber bereitstellen
*/
......@@ -77,6 +79,6 @@ public:
};
#include "dmxinterface.cpp"
} // namespace DMX
#endif // DMXINTERFACE_H
#include "channel.h"
namespace DMX{
Channel::Channel(const QJsonObject &o):NamedObject(o),IDBase<Channel>(o),index(o["index"].toInt()){}
......@@ -8,3 +10,5 @@ void Channel::writeJsonObject(QJsonObject &o) const{
IDBase<Channel>::writeJsonObject(o);
o.insert("index",index);
}
} // namespace DMX
......@@ -5,6 +5,8 @@
#include "idbase.h"
#include "namedobject.h"
namespace DMX{
/**
* @brief The Channel class give us information about a channel in a devicePrototype
* Eine Klasse die die jeweiligen ChannelInformationen für ein deviecPrototype hält
......@@ -29,4 +31,6 @@ public:
};
} // namespace DMX
#endif // CHANNEL_H
#include "device.h"
#include <QJsonArray>
namespace DMX{
Device::Device(const QJsonObject &o):NamedObject(o),IDBase<Device>(o),
prototype(IDBase<DevicePrototype>::getIDBaseObjectByID(o["prototype"])),
startDMXChannel(o["startDMXChannel"].toInt()),
......@@ -81,3 +83,5 @@ DMXChannelFilter * Device::getFilterForChannelindex(int index){
}
return nullptr;
}
} // namespace DMX
......@@ -6,7 +6,7 @@
#include "namedobject.h"
#include "dmxchannelfilter.h"
namespace DMX{
/**
* @brief The Device class Ein "echtes" Gerät, zb der Laser oben rechts über der Bier Theke
......@@ -69,4 +69,6 @@ signals:
void positionChanged(const QPoint & newPosition);
};
} // namespace DMX
#endif // DEVICE_H
#include "deviceprototype.h"
#include <QJsonArray>
namespace DMX{
void ChannelVector::beginPushBack(int length){
beginInsertRows(QModelIndex(),channels.size(),channels.size()+length);
......@@ -95,3 +96,5 @@ void DevicePrototype::writeJsonObject(QJsonObject &o) const{
}
o.insert("channels",channels);
}
} // namespace DMX
......@@ -7,6 +7,8 @@
#include "channel.h"
#include "idbase.h"
namespace DMX{
class ChannelVector : public QAbstractListModel{
std::vector<Channel*> channels;
public:
......@@ -116,4 +118,6 @@ signals:
};
} // namespace DMX
#endif // DEVICEPROTOTYPE_H
......@@ -2,6 +2,8 @@
#include "programm.h"
#include "device.h"
namespace DMX{
DMXChannelFilter::DMXChannelFilter(const QJsonObject &o):
maxOperation(static_cast<Operation>(o["maxOperation"].toInt())),
minOperation(static_cast<Operation>(o["minOperation"].toInt())),
......@@ -89,3 +91,5 @@ void DMXChannelFilter::filterValues(unsigned char *values, unsigned int numberOf
}
}
}
} // namespace DMX
......@@ -3,6 +3,8 @@
#include <QObject>
namespace DMX{
/**
* @brief The DMXChannelFilter class filter channel values
* Die Klasse kann einen Default value, einen Override value (überschreibt den value vom Programmen)
......@@ -81,4 +83,6 @@ signals:
void shouldOverrideValueChanged(bool);
};
} // namespace DMX
#endif // DMXCHANNEL_H
......@@ -20,13 +20,15 @@
#include <windows.h>
#endif
HardwareInterface * driver = nullptr;
DMX::HardwareInterface * driver = nullptr;
#ifdef LOG_DRIVER
std::ofstream debugOutput;
std::vector<unsigned char> oldData;
#endif
namespace DMX{
namespace Driver {
DMXQMLValue::DMXQMLValue(){
......@@ -215,3 +217,5 @@ namespace Driver {
}
}
}
} // namespace DMX
#include "namedobject.h"
namespace DMX{
} // namespace DMX
......@@ -4,6 +4,8 @@
#include <QObject>
#include <QJsonObject>
namespace DMX{
/**
* @brief The NamedObject class superclass for Every class that will have a name and a description
*/
......@@ -40,4 +42,6 @@ signals:
void descriptionChanged(const QString &);
};
} // namespace DMX
#endif // NAMEDOBJECT_H
......@@ -2,6 +2,7 @@
#include <QJsonArray>
#include <unordered_set>
namespace DMX{
TimeDistortion::TimeDistortion(const QJsonObject &o):enabled(o["enable"].toBool()),distortionCurve(QEasingCurve::Type(o["type"].toInt())),intervall(o["intervall"].toDouble()){
......@@ -150,3 +151,5 @@ void Programm::deviceProgrammDeleted(QObject *d){
}
}
}
} // namespace DMX
......@@ -8,6 +8,8 @@
#include <cmath>
#include "modelvector.h"
namespace DMX{
/**
* @brief The DeviceProgramm class saves a Device in combination with a ProgrammPrototype and an offset
*/
......@@ -56,18 +58,6 @@ public:
ProgrammPrototype * getProgrammPrototyp()const{return programmPrototype;}
private slots:
void programmPrototypeDeleted(QObject *){delete this;}
public:
static void update (const ID &id, const QString &name,const QString &value){
auto d = IDBase<DeviceProgramm>::getIDBaseObjectByID(id);
if(d){
if (name=="offset") {
d->setOffset(value.toDouble());
}else if(name=="programmPrototype"){
auto proto = IDBase<ProgrammPrototype>::getIDBaseObjectByID(value.toLong());
if(proto) d->setProgrammPrototype(proto);
}
}
}
signals:
void offsetChanged();
void speedChanged(double speed);
......@@ -185,4 +175,6 @@ signals:
void deviceProgrammRemoved(DeviceProgramm*);
};
} // namespace DMX
#endif // PROGRAMM_H
......@@ -2,6 +2,7 @@
#include <cmath>
#include <QJsonArray>
namespace DMX{
ProgrammPrototype::ProgrammPrototype(DevicePrototype *devicePrototype, QString name, QString description):NamedObject(name,description),devicePrototype(devicePrototype){
setParent(devicePrototype);
......@@ -167,3 +168,5 @@ ChannelProgramm * ProgrammPrototype::getChannelProgramm(int index){
}
return nullptr;
}
} // namespace DMX
......@@ -4,6 +4,8 @@
#include "deviceprototype.h"
#include <QEasingCurve>
namespace DMX{
/**
* @brief The TimePoint class holds a time and a corresponding value and a QEasingCurve that describe how to interpolate to the next timepoint
*/
......@@ -121,4 +123,6 @@ private slots:
void channelRemoved(Channel *);
};
} // namespace DMX
#endif // PROGRAMMPROTOTYPE_H
#include "HardwareInterface.h"
//void DMXInterface::setValues(unsigned char *values, int size, double time){
// DMXChannelFilter::initValues(values,size);
// Programm::fill(values,size,time);
// DMXChannelFilter::filterValues(values,size);
//}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment