Commit 04e89581 authored by Leander Schulten's avatar Leander Schulten
Browse files

Move GUI classes into gui folder and namespace

parent ec12091d
......@@ -19,28 +19,28 @@ QML_DESIGNER_IMPORT_PATH =
SOURCES += \
applicationdata.cpp \
channel.cpp \
channelprogrammeditor.cpp \
colorplot.cpp \
controlitem.cpp \
controlitemdata.cpp \
controlpanel.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 \
errornotifier.cpp \
graph.cpp \
gridbackground.cpp \
gui/graph.cpp \
gui/gridbackground.cpp \
id.cpp \
main.cpp \
mapeditor.cpp \
mapview.cpp \
gui/mapeditor.cpp \
gui/mapview.cpp \
modelmanager.cpp \
modelvector.cpp \
namedobject.cpp \
oscillogram.cpp \
polygon.cpp \
gui/oscillogram.cpp \
gui/polygon.cpp \
programm.cpp \
programmprototype.cpp \
programms/dmxconsumer.cpp \
......@@ -60,7 +60,7 @@ SOURCES += \
codeeditorhelper.cpp \
test/testmodulecontroller.cpp \
test/testprogrammblock.cpp \
programblockeditor.cpp \
gui/programblockeditor.cpp \
audio/sample.cpp \
test/testsampleclass.cpp \
audio/audiocapturemanager.cpp \
......@@ -106,24 +106,24 @@ HEADERS += \
programms/scanner.hpp \
scanner.h \
usermanagment.h \
channelprogrammeditor.h \
gui/channelprogrammeditor.h \
modelmanager.h \
mapview.h \
polygon.h \
mapeditor.h \
gridbackground.h \
gui/mapview.h \
gui/polygon.h \
gui/mapeditor.h \
gui/gridbackground.h \
modelvector.h \
controlpanel.h \
controlitem.h \
controlitemdata.h \
gui/controlpanel.h \
gui/controlitem.h \
gui/controlitemdata.h \
HardwareInterface.h \
errornotifier.h \
settings.h \
driver.h \
test/DriverDummy.h \
colorplot.h \
graph.h \
oscillogram.h \
gui/colorplot.h \
gui/graph.h \
gui/oscillogram.h \
programms/types.h \
programms/dmxconsumer.h \
programms/module.h \
......@@ -144,7 +144,7 @@ HEADERS += \
programms/program.hpp \
test/testmodulecontroller.h \
test/testprogrammblock.h \
programblockeditor.h \
gui/programblockeditor.h \
audio/sample.h \
test/testsampleclass.h \
audio/audiocapturemanager.h \
......
......@@ -9,8 +9,8 @@
#include "programmprototype.h"
#include "programm.h"
#include "usermanagment.h"
#include "controlpanel.h"
#include "mapview.h"
#include "gui/controlpanel.h"
#include "gui/mapview.h"
#include <QCryptographicHash>
#include "programms/modulemanager.h"
#include "programms/programblock.h"
......@@ -51,7 +51,7 @@ QByteArray saveData(){
o.insert("password",QString::fromLatin1(password.toBase64()));
{
QJsonObject u;
ControlPanel::getLastCreated()->writeJsonObject(u);
GUI::ControlPanel::getLastCreated()->writeJsonObject(u);
o.insert("ControlPanel",u);
}{
QJsonObject u;
......@@ -117,7 +117,7 @@ std::function<void()> loadData(QByteArray data){
return [=](){
GUI::MapView::getLastCreated()->loadFromJsonObject(o["MapView"].toObject());
Modules::ProgramBlockManager::readFromJsonObject(o["ProgramBlockManager"].toObject());
ControlPanel::getLastCreated()->loadFromJsonObject(o["ControlPanel"].toObject());
GUI::ControlPanel::getLastCreated()->loadFromJsonObject(o["ControlPanel"].toObject());
};
}
......
#include "audiocapturemanager.h"
#include "graph.h"
#include "colorplot.h"
#include "oscillogram.h"
#include "gui/graph.h"
#include "gui/colorplot.h"
#include "gui/oscillogram.h"
#include <algorithm>
namespace Audio {
......@@ -12,8 +12,8 @@ AudioCaptureManager::AudioCaptureManager():audiofft(sample.size())
void AudioCaptureManager::initCallback(int channels){
this->channels = channels;
if(Colorplot::getLast())
Colorplot::getLast()->setBlockSize(512);
if(GUI::Colorplot::getLast())
GUI::Colorplot::getLast()->setBlockSize(512);
}
void AudioCaptureManager::dataCallback(float* data, unsigned int frames, bool*done){
......@@ -39,17 +39,17 @@ void AudioCaptureManager::dataCallback(float* data, unsigned int frames, bool*do
//db scale
std::transform(fftoutput.begin(),fftoutput.end(),fftoutput.begin(),[](auto i){return 10*std::log10(1+i);});
if(Graph::getLast())
Graph::getLast()->showData(fftoutput.data(),fftoutput.size());
if(Colorplot::getLast()){
Colorplot::getLast()->startBlock();
if(GUI::Graph::getLast())
GUI::Graph::getLast()->showData(fftoutput.data(),fftoutput.size());
if(GUI::Colorplot::getLast()){
GUI::Colorplot::getLast()->startBlock();
for (int i = 0; i < 512; ++i) {
Colorplot::getLast()->pushDataToBlock(fftoutput.at(i));
GUI::Colorplot::getLast()->pushDataToBlock(fftoutput.at(i));
}
Colorplot::getLast()->endBlock();
GUI::Colorplot::getLast()->endBlock();
}
if(Oscillogram::getLast())
Oscillogram::getLast()->showData(sample.data(),sample.size());
if(GUI::Oscillogram::getLast())
GUI::Oscillogram::getLast()->showData(sample.data(),sample.size());
}
......
......@@ -4,6 +4,8 @@
#include <QSGFlatColorMaterial>
#include <QSGVertexColorMaterial>
namespace GUI{
CurrentTimePointWrapper::CurrentTimePointWrapper(ChannelProgrammEditor *editor):editor(editor){}
void CurrentTimePointWrapper::setValue(unsigned char value){
......@@ -660,3 +662,5 @@ TimePoint * ChannelProgrammEditor::getCurrentTimePoint(){
QString ChannelProgrammEditor::getTooltipText()const{
return "Hold N and click to create a new TimePoint-\nHold D and click to delete a Timepoint.\nUse dragging to move the time points.";
}
} // namespace GUI
......@@ -5,6 +5,8 @@
#include <QFlags>
#include <programmprototype.h>
namespace GUI{
class ChannelProgrammEditor;
class CurrentTimePointWrapper : public QObject{
......@@ -118,4 +120,6 @@ signals:
void rightClick(int x, int y);
};
} // namespace GUI
#endif // CHANNELPROGRAMMEDITOR_H
......@@ -3,6 +3,7 @@
#include <QSGGeometryNode>
#include <QSGVertexColorMaterial>
namespace GUI{
Colorplot::Colorplot():haveNewData(false)
{
......@@ -92,3 +93,5 @@ QSGNode * Colorplot::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *){
return node;
}
} // namespace GUI
......@@ -6,6 +6,8 @@
#include <list>
#include <mutex>
namespace GUI{
class Colorplot : public QQuickItem
{
Q_OBJECT
......@@ -75,5 +77,6 @@ signals:
public slots:
};
} // namespace GUI
#endif // COLORPLOT_H
#include "controlitem.h"
#include <cmath>
namespace GUI{
ControlItem::ControlItem()
{
setAcceptedMouseButtons(Qt::LeftButton|Qt::RightButton);
......@@ -124,3 +126,4 @@ void ControlItem::hoverLeaveEvent(QHoverEvent *event){
emit settingVisibleChange(false);
}
} // namespace GUI
......@@ -4,6 +4,8 @@
#include <QQuickItem>
#include "controlitemdata.h"
namespace GUI{
/**
* @brief The ControlItem class is the base for ControlItems like the SwitchControlItem or the DimmerControlItem
*/
......@@ -66,4 +68,6 @@ signals:
public slots:
};
} // namespace GUI
#endif // CONTROLITEM_H
#include "controlitemdata.h"
#include <QJsonArray>
namespace GUI{
ControlItemData::ControlItemData(Type t,QObject *parent) : QObject(parent),type(t)
{
......@@ -290,6 +292,7 @@ ProgramBlockControlItemData::ProgramBlockControlItemData(const QJsonObject &o,QO
return;
}
}
throw std::runtime_error("No ProgramBlock with id " + std::to_string(id.value()) + " exists.");
}
void ProgramBlockControlItemData::writeJsonObject(QJsonObject &o){
......@@ -310,3 +313,5 @@ void ProgramBlockControlItemData::setProgramBlock(Modules::ProgramBlock *p){
emit programBlockChanged();
}
}
} // namespace GUI
......@@ -6,6 +6,8 @@
#include "device.h"
#include "programms/programblock.h"
namespace GUI{
class ControlItemData : public QObject
{
Q_OBJECT
......@@ -212,4 +214,6 @@ signals:
void programBlockChanged();
};
} // namespace GUI
#endif // CONTROLITEMDATA_H
......@@ -5,6 +5,7 @@
#include <exception>
#include <QQmlContext>
namespace GUI{
ControlPanel * ControlPanel::lastCreated = nullptr;
QQmlEngine * ControlPanel::engine = nullptr;
......@@ -100,3 +101,5 @@ void ControlPanel::hoverLeaveEvent(QHoverEvent *event){
Q_UNUSED(event)
emit exitMenuArea();
}
} // namespace GUI
......@@ -6,6 +6,8 @@
#include "programms/programblock.h"
#include "controlitemdata.h"
namespace GUI{
/**
* @brief The ControlPanel is the Component, that holds multiple ControlItems
*/
......@@ -65,4 +67,6 @@ protected:
public slots:
};
} // namespace GUI
#endif // CONTROLPANEL_H
......@@ -3,6 +3,8 @@
#include <QSGGeometryNode>
#include <cmath>
namespace GUI{
Graph::Graph():haveNewData(false)
{
setFlag(ItemHasContents);
......@@ -101,3 +103,5 @@ QSGNode * Graph::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *){
return node;
}
} // namespace GUI
......@@ -3,6 +3,8 @@
#include <QQuickItem>
namespace GUI{
class Graph : public QQuickItem
{
Q_OBJECT
......@@ -35,4 +37,6 @@ signals:
public slots:
};
} // namespace GUI
#endif // GRAPH_H
......@@ -2,6 +2,8 @@
#include "QSGFlatColorMaterial"
#include <QSGGeometryNode>
namespace GUI{
GridBackground::GridBackground()
{
setFlag(ItemHasContents);
......@@ -109,3 +111,5 @@ QSGNode * GridBackground::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
return node;
}
} // namespace GUI
......@@ -3,6 +3,8 @@
#include <QQuickItem>
namespace GUI{
class GridBackground : public QQuickItem
{
int distanceBetweenLines = 15;
......@@ -17,4 +19,6 @@ protected:
virtual QSGNode * updatePaintNode(QSGNode *, UpdatePaintNodeData *)override;
};
} // namespace GUI
#endif // GRIDBACKGROUND_H
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