diff --git a/networkpacketcomposer.pro b/networkpacketcomposer.pro deleted file mode 100644 index c724c8b..0000000 --- a/networkpacketcomposer.pro +++ /dev/null @@ -1,35 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2015-01-06T11:56:33 -# -#------------------------------------------------- - -QT += core gui - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -QMAKE_CXXFLAGS += -std=c++14 - -TARGET = networkpacketcomposer -TEMPLATE = app - - -SOURCES += main.cpp\ - mainwindow.cpp \ - flowlayout.cpp \ - guidededitorelement.cpp \ - abstractguidededitormodel.cpp \ - guidededitorview.cpp \ - guidededitorlayer.cpp \ - guidededitorelementview.cpp - -HEADERS += mainwindow.h \ - flowlayout.h \ - guidededitorelement.h \ - abstractguidededitormodel.h \ - guidededitorview.h \ - guidededitorlayer.h \ - guidededitorelementview.h - -INCLUDEPATH += $$PWD/../QtGuidedEditor -DEPENDPATH += $$PWD/../QtGuidedEditor diff --git a/src/editor/CMakeLists.txt b/src/editor/CMakeLists.txt index 042095c..cc9ce41 100644 --- a/src/editor/CMakeLists.txt +++ b/src/editor/CMakeLists.txt @@ -2,15 +2,14 @@ set(HEADERS abstractguidededitormodel.h guidededitorelement.h guidededitorelementview.h - guidededitorlayer.h - guidededitorlayer.h + guidededitorgroup.h flowlayout.h ) set(SOURCES guidededitorelementview.cpp guidededitorelement.cpp abstractguidededitormodel.cpp - guidededitorlayer.cpp + guidededitorgroup.cpp guidededitorview.cpp flowlayout.cpp ) diff --git a/src/editor/guidededitorelement.cpp b/src/editor/guidededitorelement.cpp index 935bf3c..43d791c 100644 --- a/src/editor/guidededitorelement.cpp +++ b/src/editor/guidededitorelement.cpp @@ -70,6 +70,16 @@ QString GuidedEditorElement::getValue() const void GuidedEditorElement::setValue(const QString &value) { - this->value = value; + this->value = value; +} + +GuidedEditorGroup *GuidedEditorElement::getGroup() const +{ + return this->group; +} + +void GuidedEditorElement::setGroup(GuidedEditorGroup *group) +{ + this->group = group; } diff --git a/src/editor/guidededitorelement.h b/src/editor/guidededitorelement.h index b62a19d..f0faf86 100644 --- a/src/editor/guidededitorelement.h +++ b/src/editor/guidededitorelement.h @@ -2,6 +2,7 @@ #define EDITORELEMENT_H #include #include +#include "guidededitorgroup.h" enum class ElementType { @@ -13,7 +14,6 @@ class GuidedEditorElement : public QObject Q_OBJECT public: - explicit GuidedEditorElement(); ~GuidedEditorElement(); @@ -35,6 +35,9 @@ public: QString getValue() const; void setValue(const QString &value); + GuidedEditorGroup* getGroup() const; + void setGroup(GuidedEditorGroup* group); + private: QString title; QString description; @@ -42,6 +45,7 @@ private: QString syntaxregex; ElementType type; QString value; + GuidedEditorGroup* group; }; diff --git a/src/editor/guidededitorelementview.h b/src/editor/guidededitorelementview.h index 5f00e25..ec2eb86 100644 --- a/src/editor/guidededitorelementview.h +++ b/src/editor/guidededitorelementview.h @@ -9,7 +9,7 @@ #include #include "guidededitorelement.h" -#include "guidededitorlayer.h" +#include "guidededitorgroup.h" class GuidedEditorElementView : public QWidget @@ -41,7 +41,7 @@ private: QComboBox* combobox; QLabel* staticLabel; // layer information - GuidedEditorLayer* layer; + GuidedEditorGroup* group; }; diff --git a/src/editor/guidededitorgroup.cpp b/src/editor/guidededitorgroup.cpp new file mode 100644 index 0000000..4ccc5b7 --- /dev/null +++ b/src/editor/guidededitorgroup.cpp @@ -0,0 +1,29 @@ +#include "guidededitorgroup.h" +#include "cstdlib" +#include + +GuidedEditorGroup::GuidedEditorGroup(QObject *parent) : QObject(parent) +{ + this->color = new QColor(rand()%20*10+50, rand()%20*10+50, rand()%20*10+50); +} + +QString GuidedEditorGroup::getTitle() const +{ + return title; +} + +void GuidedEditorGroup::setTitle(const QString &value) +{ + title = value; +} + +QColor GuidedEditorGroup::getColor() const +{ + return *color; +} + +void GuidedEditorGroup::setColor(QColor *value) +{ + color = value; +} + diff --git a/src/editor/guidededitorlayer.h b/src/editor/guidededitorgroup.h similarity index 60% rename from src/editor/guidededitorlayer.h rename to src/editor/guidededitorgroup.h index 5354cb4..28fa20a 100644 --- a/src/editor/guidededitorlayer.h +++ b/src/editor/guidededitorgroup.h @@ -5,22 +5,22 @@ #include #include -class GuidedEditorLayer : public QObject +class GuidedEditorGroup : public QObject { Q_OBJECT public: - explicit GuidedEditorLayer(QObject *parent = 0); - GuidedEditorLayer(QString title, QObject *parent = 0); + explicit GuidedEditorGroup(QObject *parent = 0); + GuidedEditorGroup(QString title, QObject *parent = 0); QString getTitle() const; void setTitle(const QString &value); QColor getColor() const; - void setColor(const QColor &value); + void setColor(QColor *value); private: QString title; - QColor color; + QColor *color; signals: diff --git a/src/editor/guidededitorlayer.cpp b/src/editor/guidededitorlayer.cpp deleted file mode 100644 index feb4248..0000000 --- a/src/editor/guidededitorlayer.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "guidededitorlayer.h" - -GuidedEditorLayer::GuidedEditorLayer(QObject *parent) : QObject(parent) -{ - -} - -QString GuidedEditorLayer::getTitle() const -{ - return title; -} - -void GuidedEditorLayer::setTitle(const QString &value) -{ - title = value; -} - -QColor GuidedEditorLayer::getColor() const -{ - return color; -} - -void GuidedEditorLayer::setColor(const QColor &value) -{ - color = value; -} -