##// END OF EJS Templates
Add the visualization gui classes
perrinel -
r118:58d173e4af62
parent child
Show More
@@ -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() = 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 #ifndef SCIQLOP_VISUALIZATIONGRAPHWIDGET_H
1 #ifndef SCIQLOP_VISUALIZATIONGRAPHWIDGET_H
2 #define SCIQLOP_VISUALIZATIONGRAPHWIDGET_H
2 #define SCIQLOP_VISUALIZATIONGRAPHWIDGET_H
3
3
4 #include "Visualization/IVisualizationWidget.h"
5
4 #include <QWidget>
6 #include <QWidget>
5
7
8 #include <memory>
9
10 #include <Common/spimpl.h>
11
12 class Variable;
13
6 namespace Ui {
14 namespace Ui {
7 class VisualizationGraphWidget;
15 class VisualizationGraphWidget;
8 } // namespace Ui
16 } // namespace Ui
9
17
10 class VisualizationGraphWidget : public QWidget {
18 class VisualizationGraphWidget : public QWidget, public IVisualizationWidget {
11 Q_OBJECT
19 Q_OBJECT
12
20
13 public:
21 public:
14 explicit VisualizationGraphWidget(QWidget *parent = 0);
22 explicit VisualizationGraphWidget(QWidget *parent = 0);
15 virtual ~VisualizationGraphWidget();
23 virtual ~VisualizationGraphWidget();
16
24
25 void addVariable(std::shared_ptr<Variable> variable);
26
27 // IVisualizationWidget interface
28 void accept(IVisualizationWidget *visitor);
29 void close();
30 QString name();
31
17 private:
32 private:
18 Ui::VisualizationGraphWidget *ui;
33 Ui::VisualizationGraphWidget *ui;
34
35 class VisualizationGraphWidgetPrivate;
36 spimpl::unique_impl_ptr<VisualizationGraphWidgetPrivate> impl;
19 };
37 };
20
38
21 #endif // SCIQLOP_VISUALIZATIONGRAPHWIDGET_H
39 #endif // SCIQLOP_VISUALIZATIONGRAPHWIDGET_H
@@ -1,19 +1,37
1 #ifndef SCIQLOP_VISUALIZATIONTABWIDGET_H
1 #ifndef SCIQLOP_VISUALIZATIONTABWIDGET_H
2 #define SCIQLOP_VISUALIZATIONTABWIDGET_H
2 #define SCIQLOP_VISUALIZATIONTABWIDGET_H
3
3
4 #include "Visualization/IVisualizationWidget.h"
5
4 #include <QWidget>
6 #include <QWidget>
5
7
8 class VisualizationZoneWidget;
9
6 namespace Ui {
10 namespace Ui {
7 class VisualizationTabWidget;
11 class VisualizationTabWidget;
8 } // namespace Ui
12 } // namespace Ui
9
13
10 class VisualizationTabWidget : public QWidget {
14 class VisualizationTabWidget : public QWidget, public IVisualizationWidget {
11 Q_OBJECT
15 Q_OBJECT
12
16
13 public:
17 public:
14 explicit VisualizationTabWidget(QWidget *parent = 0);
18 explicit VisualizationTabWidget(QWidget *parent = 0);
15 virtual ~VisualizationTabWidget();
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);
32 void close();
33 QString name();
34
17 private:
35 private:
18 Ui::VisualizationTabWidget *ui;
36 Ui::VisualizationTabWidget *ui;
19 };
37 };
@@ -1,22 +1,40
1 #ifndef SCIQLOP_VISUALIZATIONWIDGET_H
1 #ifndef SCIQLOP_VISUALIZATIONWIDGET_H
2 #define SCIQLOP_VISUALIZATIONWIDGET_H
2 #define SCIQLOP_VISUALIZATIONWIDGET_H
3
3
4 #include "Visualization/IVisualizationWidget.h"
5
4 #include <QLoggingCategory>
6 #include <QLoggingCategory>
5 #include <QWidget>
7 #include <QWidget>
6
8
9 class VisualizationTabWidget;
10
7 Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationWidget)
11 Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationWidget)
8
12
9 namespace Ui {
13 namespace Ui {
10 class VisualizationWidget;
14 class VisualizationWidget;
11 } // namespace Ui
15 } // namespace Ui
12
16
13 class VisualizationWidget : public QWidget {
17 class VisualizationWidget : public QWidget, public IVisualizationWidget {
14 Q_OBJECT
18 Q_OBJECT
15
19
16 public:
20 public:
17 explicit VisualizationWidget(QWidget *parent = 0);
21 explicit VisualizationWidget(QWidget *parent = 0);
18 virtual ~VisualizationWidget();
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);
35 void close();
36 QString name();
37
20 private:
38 private:
21 Ui::VisualizationWidget *ui;
39 Ui::VisualizationWidget *ui;
22 };
40 };
@@ -1,19 +1,37
1 #ifndef SCIQLOP_VISUALIZATIONZONEWIDGET_H
1 #ifndef SCIQLOP_VISUALIZATIONZONEWIDGET_H
2 #define SCIQLOP_VISUALIZATIONZONEWIDGET_H
2 #define SCIQLOP_VISUALIZATIONZONEWIDGET_H
3
3
4 #include "Visualization/IVisualizationWidget.h"
5
6 class VisualizationGraphWidget;
7
4 #include <QWidget>
8 #include <QWidget>
5
9
6 namespace Ui {
10 namespace Ui {
7 class VisualizationZoneWidget;
11 class VisualizationZoneWidget;
8 } // Ui
12 } // Ui
9
13
10 class VisualizationZoneWidget : public QWidget {
14 class VisualizationZoneWidget : public QWidget, public IVisualizationWidget {
11 Q_OBJECT
15 Q_OBJECT
12
16
13 public:
17 public:
14 explicit VisualizationZoneWidget(QWidget *parent = 0);
18 explicit VisualizationZoneWidget(QWidget *parent = 0);
15 virtual ~VisualizationZoneWidget();
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);
32 void close();
33 QString name();
34
17 private:
35 private:
18 Ui::VisualizationZoneWidget *ui;
36 Ui::VisualizationZoneWidget *ui;
19 };
37 };
@@ -1,8 +1,21
1 #include "Visualization/VisualizationGraphWidget.h"
1 #include "Visualization/VisualizationGraphWidget.h"
2 #include "ui_VisualizationGraphWidget.h"
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 VisualizationGraphWidget::VisualizationGraphWidget(QWidget *parent)
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 ui->setupUi(this);
20 ui->setupUi(this);
8 }
21 }
@@ -11,3 +24,24 VisualizationGraphWidget::~VisualizationGraphWidget()
11 {
24 {
12 delete ui;
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()
45 {
46 return QStringLiteral("MainView");
47 }
@@ -1,13 +1,50
1 #include "Visualization/VisualizationTabWidget.h"
1 #include "Visualization/VisualizationTabWidget.h"
2 #include "ui_VisualizationTabWidget.h"
2 #include "ui_VisualizationTabWidget.h"
3
3
4 #include "Visualization/VisualizationZoneWidget.h"
5
6
4 VisualizationTabWidget::VisualizationTabWidget(QWidget *parent)
7 VisualizationTabWidget::VisualizationTabWidget(QWidget *parent)
5 : QWidget{parent}, ui{new Ui::VisualizationTabWidget}
8 : QWidget{parent}, ui{new Ui::VisualizationTabWidget}
6 {
9 {
7 ui->setupUi(this);
10 ui->setupUi(this);
11
8 }
12 }
9
13
10 VisualizationTabWidget::~VisualizationTabWidget()
14 VisualizationTabWidget::~VisualizationTabWidget()
11 {
15 {
12 delete ui;
16 delete ui;
13 }
17 }
18
19 void VisualizationTabWidget::addZone(VisualizationZoneWidget *zoneWidget)
20 {
21 this->layout()->addWidget(zoneWidget);
22 }
23
24 VisualizationZoneWidget *VisualizationTabWidget::createZone()
25 {
26 auto zoneWidget = new VisualizationZoneWidget(this);
27 this->addZone(zoneWidget);
28
29 return zoneWidget;
30 }
31
32 void VisualizationTabWidget::removeZone(VisualizationZoneWidget *zone)
33 {
34 }
35
36 void VisualizationTabWidget::accept(IVisualizationWidget *visitor)
37 {
38 // TODO: manage the visitor
39 }
40
41 void VisualizationTabWidget::close()
42 {
43 // The main view cannot be directly closed.
44 return;
45 }
46
47 QString VisualizationTabWidget::name()
48 {
49 return QStringLiteral("MainView");
50 }
@@ -1,12 +1,11
1 #include "Visualization/VisualizationWidget.h"
1 #include "Visualization/VisualizationWidget.h"
2 #include "Visualization/VisualizationTabWidget.h"
2 #include "Visualization/VisualizationTabWidget.h"
3 #include "Visualization/qcustomplot.h"
4
3 #include "ui_VisualizationWidget.h"
5 #include "ui_VisualizationWidget.h"
4
6
5 #include <QDebug>
6 #include <QToolButton>
7 #include <QToolButton>
7
8
8 #include "iostream"
9
10 Q_LOGGING_CATEGORY(LOG_VisualizationWidget, "VisualizationWidget")
9 Q_LOGGING_CATEGORY(LOG_VisualizationWidget, "VisualizationWidget")
11
10
12 VisualizationWidget::VisualizationWidget(QWidget *parent)
11 VisualizationWidget::VisualizationWidget(QWidget *parent)
@@ -41,3 +40,35 VisualizationWidget::~VisualizationWidget()
41 {
40 {
42 delete ui;
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()
72 {
73 return QStringLiteral("MainView");
74 }
@@ -1,6 +1,8
1 #include "Visualization/VisualizationZoneWidget.h"
1 #include "Visualization/VisualizationZoneWidget.h"
2 #include "ui_VisualizationZoneWidget.h"
2 #include "ui_VisualizationZoneWidget.h"
3
3
4 #include "Visualization/VisualizationGraphWidget.h"
5
4 VisualizationZoneWidget::VisualizationZoneWidget(QWidget *parent)
6 VisualizationZoneWidget::VisualizationZoneWidget(QWidget *parent)
5 : QWidget{parent}, ui{new Ui::VisualizationZoneWidget}
7 : QWidget{parent}, ui{new Ui::VisualizationZoneWidget}
6 {
8 {
@@ -11,3 +13,36 VisualizationZoneWidget::~VisualizationZoneWidget()
11 {
13 {
12 delete ui;
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()
46 {
47 return QStringLiteral("MainView");
48 }
1 NO CONTENT: file renamed from gui/ui/sidepane/SqpSidePane.ui to gui/ui/Sidepane/SqpSidePane.ui
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 <ui version="4.0">
2 <ui version="4.0">
2 <author/>
3 <comment/>
4 <exportmacro/>
5 <class>VisualizationGraphWidget</class>
3 <class>VisualizationGraphWidget</class>
6 <widget name="VisualizationGraphWidget" class="QWidget">
4 <widget class="QWidget" name="VisualizationGraphWidget">
7 <property name="geometry">
5 <property name="geometry">
8 <rect>
6 <rect>
9 <x>0</x>
7 <x>0</x>
@@ -15,7 +13,20
15 <property name="windowTitle">
13 <property name="windowTitle">
16 <string>Form</string>
14 <string>Form</string>
17 </property>
15 </property>
16 <layout class="QVBoxLayout" name="verticalLayout">
17 <item>
18 <widget class="QCustomPlot" name="widget" native="true"/>
19 </item>
20 </layout>
18 </widget>
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 <connections/>
31 <connections/>
21 </ui>
32 </ui>
@@ -1,9 +1,7
1 <?xml version="1.0" encoding="UTF-8"?>
1 <ui version="4.0">
2 <ui version="4.0">
2 <author/>
3 <comment/>
4 <exportmacro/>
5 <class>VisualizationTabWidget</class>
3 <class>VisualizationTabWidget</class>
6 <widget name="VisualizationTabWidget" class="QWidget">
4 <widget class="QWidget" name="VisualizationTabWidget">
7 <property name="geometry">
5 <property name="geometry">
8 <rect>
6 <rect>
9 <x>0</x>
7 <x>0</x>
@@ -15,7 +13,8
15 <property name="windowTitle">
13 <property name="windowTitle">
16 <string>Form</string>
14 <string>Form</string>
17 </property>
15 </property>
16 <layout class="QVBoxLayout" name="verticalLayout"/>
18 </widget>
17 </widget>
19 <pixmapfunction/>
18 <resources/>
20 <connections/>
19 <connections/>
21 </ui>
20 </ui>
1 NO CONTENT: file renamed from gui/ui/visualization/VisualizationWidget.ui to gui/ui/Visualization/VisualizationWidget.ui
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 <ui version="4.0">
2 <ui version="4.0">
2 <author/>
3 <comment/>
4 <exportmacro/>
5 <class>VisualizationZoneWidget</class>
3 <class>VisualizationZoneWidget</class>
6 <widget name="VisualizationZoneWidget" class="QWidget">
4 <widget class="QWidget" name="VisualizationZoneWidget">
7 <property name="geometry">
5 <property name="geometry">
8 <rect>
6 <rect>
9 <x>0</x>
7 <x>0</x>
@@ -15,7 +13,20
15 <property name="windowTitle">
13 <property name="windowTitle">
16 <string>Form</string>
14 <string>Form</string>
17 </property>
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 </widget>
29 </widget>
19 <pixmapfunction/>
30 <resources/>
20 <connections/>
31 <connections/>
21 </ui>
32 </ui>
General Comments 0
You need to be logged in to leave comments. Login now