##// END OF EJS Templates
Merge pull request 148 from SCIQLOP-Initialisation develop...
leroux -
r121:c6da4aa56140 merge
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() 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 #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) override;
29 void close() override;
30 QString name() const;
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,21 +1,39
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) override;
32 void close() override;
33 QString name() const override;
34
17 private:
35 private:
18 Ui::VisualizationTabWidget *ui;
36 Ui::VisualizationTabWidget *ui;
19 };
37 };
20
38
21 #endif // SCIQLOP_VISUALIZATIONTABWIDGET_H
39 #endif // SCIQLOP_VISUALIZATIONTABWIDGET_H
@@ -1,24 +1,42
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) override;
35 void close() override;
36 QString name() const;
37
20 private:
38 private:
21 Ui::VisualizationWidget *ui;
39 Ui::VisualizationWidget *ui;
22 };
40 };
23
41
24 #endif // VISUALIZATIONWIDGET_H
42 #endif // VISUALIZATIONWIDGET_H
@@ -1,21 +1,39
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) override;
32 void close() override;
33 QString name() const override;
34
17 private:
35 private:
18 Ui::VisualizationZoneWidget *ui;
36 Ui::VisualizationZoneWidget *ui;
19 };
37 };
20
38
21 #endif // SCIQLOP_VISUALIZATIONZONEWIDGET_H
39 #endif // SCIQLOP_VISUALIZATIONZONEWIDGET_H
@@ -1,13 +1,47
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 }
9
22
10 VisualizationGraphWidget::~VisualizationGraphWidget()
23 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() const
45 {
46 return QStringLiteral("MainView");
47 }
@@ -1,13 +1,49
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);
8 }
11 }
9
12
10 VisualizationTabWidget::~VisualizationTabWidget()
13 VisualizationTabWidget::~VisualizationTabWidget()
11 {
14 {
12 delete ui;
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,43 +1,74
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)
13 : QWidget{parent}, ui{new Ui::VisualizationWidget}
12 : QWidget{parent}, ui{new Ui::VisualizationWidget}
14 {
13 {
15 ui->setupUi(this);
14 ui->setupUi(this);
16
15
17 auto addTabViewButton = new QToolButton{ui->tabWidget};
16 auto addTabViewButton = new QToolButton{ui->tabWidget};
18 addTabViewButton->setText(tr("Add View"));
17 addTabViewButton->setText(tr("Add View"));
19 addTabViewButton->setCursor(Qt::ArrowCursor);
18 addTabViewButton->setCursor(Qt::ArrowCursor);
20 addTabViewButton->setAutoRaise(true);
19 addTabViewButton->setAutoRaise(true);
21 ui->tabWidget->setCornerWidget(addTabViewButton, Qt::TopRightCorner);
20 ui->tabWidget->setCornerWidget(addTabViewButton, Qt::TopRightCorner);
22
21
23 auto addTabView = [&]() {
22 auto addTabView = [&]() {
24 auto index = ui->tabWidget->addTab(new VisualizationTabWidget(ui->tabWidget),
23 auto index = ui->tabWidget->addTab(new VisualizationTabWidget(ui->tabWidget),
25 QString("View %1").arg(ui->tabWidget->count() + 1));
24 QString("View %1").arg(ui->tabWidget->count() + 1));
26 qCInfo(LOG_VisualizationWidget()) << tr("add the tab of index %1").arg(index);
25 qCInfo(LOG_VisualizationWidget()) << tr("add the tab of index %1").arg(index);
27 };
26 };
28
27
29 auto removeTabView = [&](int index) {
28 auto removeTabView = [&](int index) {
30 ui->tabWidget->removeTab(index);
29 ui->tabWidget->removeTab(index);
31 qCInfo(LOG_VisualizationWidget()) << tr("remove the tab of index %1").arg(index);
30 qCInfo(LOG_VisualizationWidget()) << tr("remove the tab of index %1").arg(index);
32 };
31 };
33
32
34 ui->tabWidget->setTabsClosable(true);
33 ui->tabWidget->setTabsClosable(true);
35
34
36 connect(addTabViewButton, &QToolButton::clicked, addTabView);
35 connect(addTabViewButton, &QToolButton::clicked, addTabView);
37 connect(ui->tabWidget, &QTabWidget::tabCloseRequested, removeTabView);
36 connect(ui->tabWidget, &QTabWidget::tabCloseRequested, removeTabView);
38 }
37 }
39
38
40 VisualizationWidget::~VisualizationWidget()
39 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() const
72 {
73 return QStringLiteral("MainView");
74 }
@@ -1,13 +1,48
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 {
7 ui->setupUi(this);
9 ui->setupUi(this);
8 }
10 }
9
11
10 VisualizationZoneWidget::~VisualizationZoneWidget()
12 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() const
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,21 +1,32
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>
10 <y>0</y>
8 <y>0</y>
11 <width>400</width>
9 <width>400</width>
12 <height>300</height>
10 <height>300</height>
13 </rect>
11 </rect>
14 </property>
12 </property>
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,21 +1,20
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>
10 <y>0</y>
8 <y>0</y>
11 <width>400</width>
9 <width>400</width>
12 <height>300</height>
10 <height>300</height>
13 </rect>
11 </rect>
14 </property>
12 </property>
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,21 +1,32
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>
10 <y>0</y>
8 <y>0</y>
11 <width>400</width>
9 <width>400</width>
12 <height>300</height>
10 <height>300</height>
13 </rect>
11 </rect>
14 </property>
12 </property>
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