@@ -0,0 +1,24 | |||
|
1 | #ifndef SCIQLOP_IVISUALIZATIONWIDGET_H | |
|
2 | #define SCIQLOP_IVISUALIZATIONWIDGET_H | |
|
3 | ||
|
4 | #include "Visualization/IVisualizationWidgetVisitor.h" | |
|
5 | ||
|
6 | #include <QString> | |
|
7 | #include <memory> | |
|
8 | ||
|
9 | /** | |
|
10 | * @brief The IVisualizationWidget handles the visualization widget. | |
|
11 | */ | |
|
12 | class IVisualizationWidget { | |
|
13 | ||
|
14 | public: | |
|
15 | virtual ~IVisualizationWidget() = default; | |
|
16 | ||
|
17 | /// Initializes the plugin | |
|
18 | virtual void accept(IVisualizationWidget *visitor) = 0; | |
|
19 | virtual void close() = 0; | |
|
20 | virtual QString name() const = 0; | |
|
21 | }; | |
|
22 | ||
|
23 | ||
|
24 | #endif // SCIQLOP_IVISUALIZATIONWIDGET_H |
@@ -0,0 +1,25 | |||
|
1 | #ifndef SCIQLOP_IVISUALIZATIONWIDGETVISITOR_H | |
|
2 | #define SCIQLOP_IVISUALIZATIONWIDGETVISITOR_H | |
|
3 | ||
|
4 | ||
|
5 | class VisualizationWidget; | |
|
6 | class VisualizationTabWidget; | |
|
7 | class VisualizationZoneWidget; | |
|
8 | class VisualizationGraphWidget; | |
|
9 | ||
|
10 | /** | |
|
11 | * @brief The IVisualizationWidgetVisitor handles the visualization widget vistor pattern. | |
|
12 | */ | |
|
13 | class IVisualizationWidgetVisitor { | |
|
14 | ||
|
15 | public: | |
|
16 | virtual ~IVisualizationWidgetVisitor() = default; | |
|
17 | ||
|
18 | virtual void visit(VisualizationWidget *widget) = 0; | |
|
19 | virtual void visit(VisualizationTabWidget *tabWidget) = 0; | |
|
20 | virtual void visit(VisualizationZoneWidget *zoneWidget) = 0; | |
|
21 | virtual void visit(VisualizationGraphWidget *graphWidget) = 0; | |
|
22 | }; | |
|
23 | ||
|
24 | ||
|
25 | #endif // SCIQLOP_IVISUALIZATIONWIDGETVISITOR_H |
@@ -1,21 +1,39 | |||
|
1 | 1 | #ifndef SCIQLOP_VISUALIZATIONGRAPHWIDGET_H |
|
2 | 2 | #define SCIQLOP_VISUALIZATIONGRAPHWIDGET_H |
|
3 | 3 | |
|
4 | #include "Visualization/IVisualizationWidget.h" | |
|
5 | ||
|
4 | 6 | #include <QWidget> |
|
5 | 7 | |
|
8 | #include <memory> | |
|
9 | ||
|
10 | #include <Common/spimpl.h> | |
|
11 | ||
|
12 | class Variable; | |
|
13 | ||
|
6 | 14 | namespace Ui { |
|
7 | 15 | class VisualizationGraphWidget; |
|
8 | 16 | } // namespace Ui |
|
9 | 17 | |
|
10 | class VisualizationGraphWidget : public QWidget { | |
|
18 | class VisualizationGraphWidget : public QWidget, public IVisualizationWidget { | |
|
11 | 19 | Q_OBJECT |
|
12 | 20 | |
|
13 | 21 | public: |
|
14 | 22 | explicit VisualizationGraphWidget(QWidget *parent = 0); |
|
15 | 23 | virtual ~VisualizationGraphWidget(); |
|
16 | 24 | |
|
25 | void addVariable(std::shared_ptr<Variable> variable); | |
|
26 | ||
|
27 | // IVisualizationWidget interface | |
|
28 | void accept(IVisualizationWidget *visitor) override; | |
|
29 | void close() override; | |
|
30 | QString name() const; | |
|
31 | ||
|
17 | 32 | private: |
|
18 | 33 | Ui::VisualizationGraphWidget *ui; |
|
34 | ||
|
35 | class VisualizationGraphWidgetPrivate; | |
|
36 | spimpl::unique_impl_ptr<VisualizationGraphWidgetPrivate> impl; | |
|
19 | 37 | }; |
|
20 | 38 | |
|
21 | 39 | #endif // SCIQLOP_VISUALIZATIONGRAPHWIDGET_H |
@@ -1,19 +1,37 | |||
|
1 | 1 | #ifndef SCIQLOP_VISUALIZATIONTABWIDGET_H |
|
2 | 2 | #define SCIQLOP_VISUALIZATIONTABWIDGET_H |
|
3 | 3 | |
|
4 | #include "Visualization/IVisualizationWidget.h" | |
|
5 | ||
|
4 | 6 | #include <QWidget> |
|
5 | 7 | |
|
8 | class VisualizationZoneWidget; | |
|
9 | ||
|
6 | 10 | namespace Ui { |
|
7 | 11 | class VisualizationTabWidget; |
|
8 | 12 | } // namespace Ui |
|
9 | 13 | |
|
10 | class VisualizationTabWidget : public QWidget { | |
|
14 | class VisualizationTabWidget : public QWidget, public IVisualizationWidget { | |
|
11 | 15 | Q_OBJECT |
|
12 | 16 | |
|
13 | 17 | public: |
|
14 | 18 | explicit VisualizationTabWidget(QWidget *parent = 0); |
|
15 | 19 | virtual ~VisualizationTabWidget(); |
|
16 | 20 | |
|
21 | /// Add a zone widget | |
|
22 | void addZone(VisualizationZoneWidget *zoneWidget); | |
|
23 | ||
|
24 | /// Create a zone using a Variable | |
|
25 | VisualizationZoneWidget *createZone(); | |
|
26 | ||
|
27 | /// Remove a zone | |
|
28 | void removeZone(VisualizationZoneWidget *zone); | |
|
29 | ||
|
30 | // IVisualizationWidget interface | |
|
31 | void accept(IVisualizationWidget *visitor) override; | |
|
32 | void close() override; | |
|
33 | QString name() const override; | |
|
34 | ||
|
17 | 35 | private: |
|
18 | 36 | Ui::VisualizationTabWidget *ui; |
|
19 | 37 | }; |
@@ -1,22 +1,40 | |||
|
1 | 1 | #ifndef SCIQLOP_VISUALIZATIONWIDGET_H |
|
2 | 2 | #define SCIQLOP_VISUALIZATIONWIDGET_H |
|
3 | 3 | |
|
4 | #include "Visualization/IVisualizationWidget.h" | |
|
5 | ||
|
4 | 6 | #include <QLoggingCategory> |
|
5 | 7 | #include <QWidget> |
|
6 | 8 | |
|
9 | class VisualizationTabWidget; | |
|
10 | ||
|
7 | 11 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationWidget) |
|
8 | 12 | |
|
9 | 13 | namespace Ui { |
|
10 | 14 | class VisualizationWidget; |
|
11 | 15 | } // namespace Ui |
|
12 | 16 | |
|
13 | class VisualizationWidget : public QWidget { | |
|
17 | class VisualizationWidget : public QWidget, public IVisualizationWidget { | |
|
14 | 18 | Q_OBJECT |
|
15 | 19 | |
|
16 | 20 | public: |
|
17 | 21 | explicit VisualizationWidget(QWidget *parent = 0); |
|
18 | 22 | virtual ~VisualizationWidget(); |
|
19 | 23 | |
|
24 | /// Add a zone widget | |
|
25 | virtual void addTab(VisualizationTabWidget *tabWidget); | |
|
26 | ||
|
27 | /// Create a tab using a Variable | |
|
28 | VisualizationTabWidget *createTab(); | |
|
29 | ||
|
30 | /// Remove a tab | |
|
31 | void removeTab(VisualizationTabWidget *tab); | |
|
32 | ||
|
33 | // IVisualizationWidget interface | |
|
34 | void accept(IVisualizationWidget *visitor) override; | |
|
35 | void close() override; | |
|
36 | QString name() const; | |
|
37 | ||
|
20 | 38 | private: |
|
21 | 39 | Ui::VisualizationWidget *ui; |
|
22 | 40 | }; |
@@ -1,19 +1,37 | |||
|
1 | 1 | #ifndef SCIQLOP_VISUALIZATIONZONEWIDGET_H |
|
2 | 2 | #define SCIQLOP_VISUALIZATIONZONEWIDGET_H |
|
3 | 3 | |
|
4 | #include "Visualization/IVisualizationWidget.h" | |
|
5 | ||
|
6 | class VisualizationGraphWidget; | |
|
7 | ||
|
4 | 8 | #include <QWidget> |
|
5 | 9 | |
|
6 | 10 | namespace Ui { |
|
7 | 11 | class VisualizationZoneWidget; |
|
8 | 12 | } // Ui |
|
9 | 13 | |
|
10 | class VisualizationZoneWidget : public QWidget { | |
|
14 | class VisualizationZoneWidget : public QWidget, public IVisualizationWidget { | |
|
11 | 15 | Q_OBJECT |
|
12 | 16 | |
|
13 | 17 | public: |
|
14 | 18 | explicit VisualizationZoneWidget(QWidget *parent = 0); |
|
15 | 19 | virtual ~VisualizationZoneWidget(); |
|
16 | 20 | |
|
21 | /// Add a graph widget | |
|
22 | void addGraph(VisualizationGraphWidget *graphWidget); | |
|
23 | ||
|
24 | /// Create a graph using a Variable | |
|
25 | VisualizationGraphWidget *createGraph(); | |
|
26 | ||
|
27 | /// Remove a graph | |
|
28 | void removeGraph(VisualizationGraphWidget *graph); | |
|
29 | ||
|
30 | // IVisualizationWidget interface | |
|
31 | void accept(IVisualizationWidget *visitor) override; | |
|
32 | void close() override; | |
|
33 | QString name() const override; | |
|
34 | ||
|
17 | 35 | private: |
|
18 | 36 | Ui::VisualizationZoneWidget *ui; |
|
19 | 37 | }; |
@@ -1,8 +1,21 | |||
|
1 | 1 | #include "Visualization/VisualizationGraphWidget.h" |
|
2 | 2 | #include "ui_VisualizationGraphWidget.h" |
|
3 | 3 | |
|
4 | #include <Variable/Variable.h> | |
|
5 | ||
|
6 | #include <unordered_map> | |
|
7 | ||
|
8 | struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate { | |
|
9 | ||
|
10 | // 1 variable -> n qcpplot | |
|
11 | std::unordered_map<std::shared_ptr<Variable>, std::unique_ptr<QCPAbstractPlottable> > | |
|
12 | m_VariableToPlotMap; | |
|
13 | }; | |
|
14 | ||
|
4 | 15 | VisualizationGraphWidget::VisualizationGraphWidget(QWidget *parent) |
|
5 | : QWidget(parent), ui(new Ui::VisualizationGraphWidget) | |
|
16 | : QWidget{parent}, | |
|
17 | ui{new Ui::VisualizationGraphWidget}, | |
|
18 | impl{spimpl::make_unique_impl<VisualizationGraphWidgetPrivate>()} | |
|
6 | 19 | { |
|
7 | 20 | ui->setupUi(this); |
|
8 | 21 | } |
@@ -11,3 +24,24 VisualizationGraphWidget::~VisualizationGraphWidget() | |||
|
11 | 24 | { |
|
12 | 25 | delete ui; |
|
13 | 26 | } |
|
27 | ||
|
28 | void VisualizationGraphWidget::addVariable(std::shared_ptr<Variable> variable) | |
|
29 | { | |
|
30 | // todo: first check is variable contains data then check how many plot have to be created | |
|
31 | } | |
|
32 | ||
|
33 | void VisualizationGraphWidget::accept(IVisualizationWidget *visitor) | |
|
34 | { | |
|
35 | // TODO: manage the visitor | |
|
36 | } | |
|
37 | ||
|
38 | void VisualizationGraphWidget::close() | |
|
39 | { | |
|
40 | // The main view cannot be directly closed. | |
|
41 | return; | |
|
42 | } | |
|
43 | ||
|
44 | QString VisualizationGraphWidget::name() const | |
|
45 | { | |
|
46 | return QStringLiteral("MainView"); | |
|
47 | } |
@@ -1,6 +1,9 | |||
|
1 | 1 | #include "Visualization/VisualizationTabWidget.h" |
|
2 | 2 | #include "ui_VisualizationTabWidget.h" |
|
3 | 3 | |
|
4 | #include "Visualization/VisualizationZoneWidget.h" | |
|
5 | ||
|
6 | ||
|
4 | 7 | VisualizationTabWidget::VisualizationTabWidget(QWidget *parent) |
|
5 | 8 | : QWidget{parent}, ui{new Ui::VisualizationTabWidget} |
|
6 | 9 | { |
@@ -11,3 +14,36 VisualizationTabWidget::~VisualizationTabWidget() | |||
|
11 | 14 | { |
|
12 | 15 | delete ui; |
|
13 | 16 | } |
|
17 | ||
|
18 | void VisualizationTabWidget::addZone(VisualizationZoneWidget *zoneWidget) | |
|
19 | { | |
|
20 | this->layout()->addWidget(zoneWidget); | |
|
21 | } | |
|
22 | ||
|
23 | VisualizationZoneWidget *VisualizationTabWidget::createZone() | |
|
24 | { | |
|
25 | auto zoneWidget = new VisualizationZoneWidget{this}; | |
|
26 | this->addZone(zoneWidget); | |
|
27 | ||
|
28 | return zoneWidget; | |
|
29 | } | |
|
30 | ||
|
31 | void VisualizationTabWidget::removeZone(VisualizationZoneWidget *zone) | |
|
32 | { | |
|
33 | } | |
|
34 | ||
|
35 | void VisualizationTabWidget::accept(IVisualizationWidget *visitor) | |
|
36 | { | |
|
37 | // TODO: manage the visitor | |
|
38 | } | |
|
39 | ||
|
40 | void VisualizationTabWidget::close() | |
|
41 | { | |
|
42 | // The main view cannot be directly closed. | |
|
43 | return; | |
|
44 | } | |
|
45 | ||
|
46 | QString VisualizationTabWidget::name() const | |
|
47 | { | |
|
48 | return QStringLiteral("MainView"); | |
|
49 | } |
@@ -1,12 +1,11 | |||
|
1 | 1 | #include "Visualization/VisualizationWidget.h" |
|
2 | 2 | #include "Visualization/VisualizationTabWidget.h" |
|
3 | #include "Visualization/qcustomplot.h" | |
|
4 | ||
|
3 | 5 | #include "ui_VisualizationWidget.h" |
|
4 | 6 | |
|
5 | #include <QDebug> | |
|
6 | 7 | #include <QToolButton> |
|
7 | 8 | |
|
8 | #include "iostream" | |
|
9 | ||
|
10 | 9 | Q_LOGGING_CATEGORY(LOG_VisualizationWidget, "VisualizationWidget") |
|
11 | 10 | |
|
12 | 11 | VisualizationWidget::VisualizationWidget(QWidget *parent) |
@@ -41,3 +40,35 VisualizationWidget::~VisualizationWidget() | |||
|
41 | 40 | { |
|
42 | 41 | delete ui; |
|
43 | 42 | } |
|
43 | ||
|
44 | void VisualizationWidget::addTab(VisualizationTabWidget *tabWidget) | |
|
45 | { | |
|
46 | // NOTE: check is this method has to be deleted because of its dupplicated version visible as | |
|
47 | // lambda function (in the constructor) | |
|
48 | } | |
|
49 | ||
|
50 | VisualizationTabWidget *VisualizationWidget::createTab() | |
|
51 | { | |
|
52 | } | |
|
53 | ||
|
54 | void VisualizationWidget::removeTab(VisualizationTabWidget *tab) | |
|
55 | { | |
|
56 | // NOTE: check is this method has to be deleted because of its dupplicated version visible as | |
|
57 | // lambda function (in the constructor) | |
|
58 | } | |
|
59 | ||
|
60 | void VisualizationWidget::accept(IVisualizationWidget *visitor) | |
|
61 | { | |
|
62 | // TODO: manage the visitor | |
|
63 | } | |
|
64 | ||
|
65 | void VisualizationWidget::close() | |
|
66 | { | |
|
67 | // The main view cannot be directly closed. | |
|
68 | return; | |
|
69 | } | |
|
70 | ||
|
71 | QString VisualizationWidget::name() const | |
|
72 | { | |
|
73 | return QStringLiteral("MainView"); | |
|
74 | } |
@@ -1,6 +1,8 | |||
|
1 | 1 | #include "Visualization/VisualizationZoneWidget.h" |
|
2 | 2 | #include "ui_VisualizationZoneWidget.h" |
|
3 | 3 | |
|
4 | #include "Visualization/VisualizationGraphWidget.h" | |
|
5 | ||
|
4 | 6 | VisualizationZoneWidget::VisualizationZoneWidget(QWidget *parent) |
|
5 | 7 | : QWidget{parent}, ui{new Ui::VisualizationZoneWidget} |
|
6 | 8 | { |
@@ -11,3 +13,36 VisualizationZoneWidget::~VisualizationZoneWidget() | |||
|
11 | 13 | { |
|
12 | 14 | delete ui; |
|
13 | 15 | } |
|
16 | ||
|
17 | void VisualizationZoneWidget::addGraph(VisualizationGraphWidget *graphWidget) | |
|
18 | { | |
|
19 | ui->visualizationZoneFrame->layout()->addWidget(graphWidget); | |
|
20 | } | |
|
21 | ||
|
22 | VisualizationGraphWidget *VisualizationZoneWidget::createGraph() | |
|
23 | { | |
|
24 | auto graphWidget = new VisualizationGraphWidget{this}; | |
|
25 | this->addGraph(graphWidget); | |
|
26 | ||
|
27 | return graphWidget; | |
|
28 | } | |
|
29 | ||
|
30 | void VisualizationZoneWidget::removeGraph(VisualizationGraphWidget *graph) | |
|
31 | { | |
|
32 | } | |
|
33 | ||
|
34 | void VisualizationZoneWidget::accept(IVisualizationWidget *visitor) | |
|
35 | { | |
|
36 | // TODO: manage the visitor | |
|
37 | } | |
|
38 | ||
|
39 | void VisualizationZoneWidget::close() | |
|
40 | { | |
|
41 | // The main view cannot be directly closed. | |
|
42 | return; | |
|
43 | } | |
|
44 | ||
|
45 | QString VisualizationZoneWidget::name() const | |
|
46 | { | |
|
47 | return QStringLiteral("MainView"); | |
|
48 | } |
|
1 | NO CONTENT: file renamed from gui/ui/sidepane/SqpSidePane.ui to gui/ui/Sidepane/SqpSidePane.ui |
@@ -1,9 +1,7 | |||
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
|
1 | 2 | <ui version="4.0"> |
|
2 | <author/> | |
|
3 | <comment/> | |
|
4 | <exportmacro/> | |
|
5 | 3 | <class>VisualizationGraphWidget</class> |
|
6 |
<widget name="VisualizationGraph |
|
|
4 | <widget class="QWidget" name="VisualizationGraphWidget"> | |
|
7 | 5 | <property name="geometry"> |
|
8 | 6 | <rect> |
|
9 | 7 | <x>0</x> |
@@ -15,7 +13,20 | |||
|
15 | 13 | <property name="windowTitle"> |
|
16 | 14 | <string>Form</string> |
|
17 | 15 | </property> |
|
16 | <layout class="QVBoxLayout" name="verticalLayout"> | |
|
17 | <item> | |
|
18 | <widget class="QCustomPlot" name="widget" native="true"/> | |
|
19 | </item> | |
|
20 | </layout> | |
|
18 | 21 | </widget> |
|
19 | <pixmapfunction/> | |
|
22 | <customwidgets> | |
|
23 | <customwidget> | |
|
24 | <class>QCustomPlot</class> | |
|
25 | <extends>QWidget</extends> | |
|
26 | <header>Visualization/qcustomplot.h</header> | |
|
27 | <container>1</container> | |
|
28 | </customwidget> | |
|
29 | </customwidgets> | |
|
30 | <resources/> | |
|
20 | 31 | <connections/> |
|
21 | 32 | </ui> |
@@ -1,9 +1,7 | |||
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
|
1 | 2 | <ui version="4.0"> |
|
2 | <author/> | |
|
3 | <comment/> | |
|
4 | <exportmacro/> | |
|
5 | 3 | <class>VisualizationTabWidget</class> |
|
6 |
<widget name="VisualizationTab |
|
|
4 | <widget class="QWidget" name="VisualizationTabWidget"> | |
|
7 | 5 | <property name="geometry"> |
|
8 | 6 | <rect> |
|
9 | 7 | <x>0</x> |
@@ -15,7 +13,8 | |||
|
15 | 13 | <property name="windowTitle"> |
|
16 | 14 | <string>Form</string> |
|
17 | 15 | </property> |
|
16 | <layout class="QVBoxLayout" name="verticalLayout"/> | |
|
18 | 17 | </widget> |
|
19 | <pixmapfunction/> | |
|
18 | <resources/> | |
|
20 | 19 | <connections/> |
|
21 | 20 | </ui> |
|
1 | NO CONTENT: file renamed from gui/ui/visualization/VisualizationWidget.ui to gui/ui/Visualization/VisualizationWidget.ui |
@@ -1,9 +1,7 | |||
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
|
1 | 2 | <ui version="4.0"> |
|
2 | <author/> | |
|
3 | <comment/> | |
|
4 | <exportmacro/> | |
|
5 | 3 | <class>VisualizationZoneWidget</class> |
|
6 |
<widget name="VisualizationZone |
|
|
4 | <widget class="QWidget" name="VisualizationZoneWidget"> | |
|
7 | 5 | <property name="geometry"> |
|
8 | 6 | <rect> |
|
9 | 7 | <x>0</x> |
@@ -15,7 +13,20 | |||
|
15 | 13 | <property name="windowTitle"> |
|
16 | 14 | <string>Form</string> |
|
17 | 15 | </property> |
|
16 | <layout class="QVBoxLayout" name="verticalLayout_2"> | |
|
17 | <item> | |
|
18 | <widget class="QFrame" name="visualizationZoneFrame"> | |
|
19 | <property name="frameShape"> | |
|
20 | <enum>QFrame::StyledPanel</enum> | |
|
21 | </property> | |
|
22 | <property name="frameShadow"> | |
|
23 | <enum>QFrame::Raised</enum> | |
|
24 | </property> | |
|
25 | <layout class="QVBoxLayout" name="verticalLayout"/> | |
|
26 | </widget> | |
|
27 | </item> | |
|
28 | </layout> | |
|
18 | 29 | </widget> |
|
19 | <pixmapfunction/> | |
|
30 | <resources/> | |
|
20 | 31 | <connections/> |
|
21 | 32 | </ui> |
General Comments 0
You need to be logged in to leave comments.
Login now