@@ -1,24 +1,24 | |||||
1 | #ifndef SCIQLOP_IVISUALIZATIONWIDGET_H |
|
1 | #ifndef SCIQLOP_IVISUALIZATIONWIDGET_H | |
2 | #define SCIQLOP_IVISUALIZATIONWIDGET_H |
|
2 | #define SCIQLOP_IVISUALIZATIONWIDGET_H | |
3 |
|
3 | |||
4 | #include "Visualization/IVisualizationWidgetVisitor.h" |
|
4 | #include "Visualization/IVisualizationWidgetVisitor.h" | |
5 |
|
5 | |||
6 | #include <QString> |
|
6 | #include <QString> | |
7 | #include <memory> |
|
7 | #include <memory> | |
8 |
|
8 | |||
9 | /** |
|
9 | /** | |
10 | * @brief The IVisualizationWidget handles the visualization widget. |
|
10 | * @brief The IVisualizationWidget handles the visualization widget. | |
11 | */ |
|
11 | */ | |
12 | class IVisualizationWidget { |
|
12 | class IVisualizationWidget { | |
13 |
|
13 | |||
14 | public: |
|
14 | public: | |
15 | virtual ~IVisualizationWidget() = default; |
|
15 | virtual ~IVisualizationWidget() = default; | |
16 |
|
16 | |||
17 | /// Initializes the plugin |
|
17 | /// Initializes the plugin | |
18 | virtual void accept(IVisualizationWidget *visitor) = 0; |
|
18 | virtual void accept(IVisualizationWidget *visitor) = 0; | |
19 | virtual void close() = 0; |
|
19 | virtual void close() = 0; | |
20 | virtual QString name() = 0; |
|
20 | virtual QString name() const = 0; | |
21 | }; |
|
21 | }; | |
22 |
|
22 | |||
23 |
|
23 | |||
24 | #endif // SCIQLOP_IVISUALIZATIONWIDGET_H |
|
24 | #endif // SCIQLOP_IVISUALIZATIONWIDGET_H |
@@ -1,39 +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" |
|
4 | #include "Visualization/IVisualizationWidget.h" | |
5 |
|
5 | |||
6 | #include <QWidget> |
|
6 | #include <QWidget> | |
7 |
|
7 | |||
8 | #include <memory> |
|
8 | #include <memory> | |
9 |
|
9 | |||
10 | #include <Common/spimpl.h> |
|
10 | #include <Common/spimpl.h> | |
11 |
|
11 | |||
12 | class Variable; |
|
12 | class Variable; | |
13 |
|
13 | |||
14 | namespace Ui { |
|
14 | namespace Ui { | |
15 | class VisualizationGraphWidget; |
|
15 | class VisualizationGraphWidget; | |
16 | } // namespace Ui |
|
16 | } // namespace Ui | |
17 |
|
17 | |||
18 | class VisualizationGraphWidget : public QWidget, public IVisualizationWidget { |
|
18 | class VisualizationGraphWidget : public QWidget, public IVisualizationWidget { | |
19 | Q_OBJECT |
|
19 | Q_OBJECT | |
20 |
|
20 | |||
21 | public: |
|
21 | public: | |
22 | explicit VisualizationGraphWidget(QWidget *parent = 0); |
|
22 | explicit VisualizationGraphWidget(QWidget *parent = 0); | |
23 | virtual ~VisualizationGraphWidget(); |
|
23 | virtual ~VisualizationGraphWidget(); | |
24 |
|
24 | |||
25 | void addVariable(std::shared_ptr<Variable> variable); |
|
25 | void addVariable(std::shared_ptr<Variable> variable); | |
26 |
|
26 | |||
27 | // IVisualizationWidget interface |
|
27 | // IVisualizationWidget interface | |
28 | void accept(IVisualizationWidget *visitor); |
|
28 | void accept(IVisualizationWidget *visitor) override; | |
29 | void close(); |
|
29 | void close() override; | |
30 | QString name(); |
|
30 | QString name() const; | |
31 |
|
31 | |||
32 | private: |
|
32 | private: | |
33 | Ui::VisualizationGraphWidget *ui; |
|
33 | Ui::VisualizationGraphWidget *ui; | |
34 |
|
34 | |||
35 | class VisualizationGraphWidgetPrivate; |
|
35 | class VisualizationGraphWidgetPrivate; | |
36 | spimpl::unique_impl_ptr<VisualizationGraphWidgetPrivate> impl; |
|
36 | spimpl::unique_impl_ptr<VisualizationGraphWidgetPrivate> impl; | |
37 | }; |
|
37 | }; | |
38 |
|
38 | |||
39 | #endif // SCIQLOP_VISUALIZATIONGRAPHWIDGET_H |
|
39 | #endif // SCIQLOP_VISUALIZATIONGRAPHWIDGET_H |
@@ -1,39 +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" |
|
4 | #include "Visualization/IVisualizationWidget.h" | |
5 |
|
5 | |||
6 | #include <QWidget> |
|
6 | #include <QWidget> | |
7 |
|
7 | |||
8 | class VisualizationZoneWidget; |
|
8 | class VisualizationZoneWidget; | |
9 |
|
9 | |||
10 | namespace Ui { |
|
10 | namespace Ui { | |
11 | class VisualizationTabWidget; |
|
11 | class VisualizationTabWidget; | |
12 | } // namespace Ui |
|
12 | } // namespace Ui | |
13 |
|
13 | |||
14 | class VisualizationTabWidget : public QWidget, public IVisualizationWidget { |
|
14 | class VisualizationTabWidget : public QWidget, public IVisualizationWidget { | |
15 | Q_OBJECT |
|
15 | Q_OBJECT | |
16 |
|
16 | |||
17 | public: |
|
17 | public: | |
18 | explicit VisualizationTabWidget(QWidget *parent = 0); |
|
18 | explicit VisualizationTabWidget(QWidget *parent = 0); | |
19 | virtual ~VisualizationTabWidget(); |
|
19 | virtual ~VisualizationTabWidget(); | |
20 |
|
20 | |||
21 | /// Add a zone widget |
|
21 | /// Add a zone widget | |
22 | void addZone(VisualizationZoneWidget *zoneWidget); |
|
22 | void addZone(VisualizationZoneWidget *zoneWidget); | |
23 |
|
23 | |||
24 | /// Create a zone using a Variable |
|
24 | /// Create a zone using a Variable | |
25 | VisualizationZoneWidget *createZone(); |
|
25 | VisualizationZoneWidget *createZone(); | |
26 |
|
26 | |||
27 | /// Remove a zone |
|
27 | /// Remove a zone | |
28 | void removeZone(VisualizationZoneWidget *zone); |
|
28 | void removeZone(VisualizationZoneWidget *zone); | |
29 |
|
29 | |||
30 | // IVisualizationWidget interface |
|
30 | // IVisualizationWidget interface | |
31 | void accept(IVisualizationWidget *visitor); |
|
31 | void accept(IVisualizationWidget *visitor) override; | |
32 | void close(); |
|
32 | void close() override; | |
33 | QString name(); |
|
33 | QString name() const override; | |
34 |
|
34 | |||
35 | private: |
|
35 | private: | |
36 | Ui::VisualizationTabWidget *ui; |
|
36 | Ui::VisualizationTabWidget *ui; | |
37 | }; |
|
37 | }; | |
38 |
|
38 | |||
39 | #endif // SCIQLOP_VISUALIZATIONTABWIDGET_H |
|
39 | #endif // SCIQLOP_VISUALIZATIONTABWIDGET_H |
@@ -1,42 +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" |
|
4 | #include "Visualization/IVisualizationWidget.h" | |
5 |
|
5 | |||
6 | #include <QLoggingCategory> |
|
6 | #include <QLoggingCategory> | |
7 | #include <QWidget> |
|
7 | #include <QWidget> | |
8 |
|
8 | |||
9 | class VisualizationTabWidget; |
|
9 | class VisualizationTabWidget; | |
10 |
|
10 | |||
11 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationWidget) |
|
11 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationWidget) | |
12 |
|
12 | |||
13 | namespace Ui { |
|
13 | namespace Ui { | |
14 | class VisualizationWidget; |
|
14 | class VisualizationWidget; | |
15 | } // namespace Ui |
|
15 | } // namespace Ui | |
16 |
|
16 | |||
17 | class VisualizationWidget : public QWidget, public IVisualizationWidget { |
|
17 | class VisualizationWidget : public QWidget, public IVisualizationWidget { | |
18 | Q_OBJECT |
|
18 | Q_OBJECT | |
19 |
|
19 | |||
20 | public: |
|
20 | public: | |
21 | explicit VisualizationWidget(QWidget *parent = 0); |
|
21 | explicit VisualizationWidget(QWidget *parent = 0); | |
22 | virtual ~VisualizationWidget(); |
|
22 | virtual ~VisualizationWidget(); | |
23 |
|
23 | |||
24 | /// Add a zone widget |
|
24 | /// Add a zone widget | |
25 | virtual void addTab(VisualizationTabWidget *tabWidget); |
|
25 | virtual void addTab(VisualizationTabWidget *tabWidget); | |
26 |
|
26 | |||
27 | /// Create a tab using a Variable |
|
27 | /// Create a tab using a Variable | |
28 | VisualizationTabWidget *createTab(); |
|
28 | VisualizationTabWidget *createTab(); | |
29 |
|
29 | |||
30 | /// Remove a tab |
|
30 | /// Remove a tab | |
31 | void removeTab(VisualizationTabWidget *tab); |
|
31 | void removeTab(VisualizationTabWidget *tab); | |
32 |
|
32 | |||
33 | // IVisualizationWidget interface |
|
33 | // IVisualizationWidget interface | |
34 | void accept(IVisualizationWidget *visitor); |
|
34 | void accept(IVisualizationWidget *visitor) override; | |
35 | void close(); |
|
35 | void close() override; | |
36 | QString name(); |
|
36 | QString name() const; | |
37 |
|
37 | |||
38 | private: |
|
38 | private: | |
39 | Ui::VisualizationWidget *ui; |
|
39 | Ui::VisualizationWidget *ui; | |
40 | }; |
|
40 | }; | |
41 |
|
41 | |||
42 | #endif // VISUALIZATIONWIDGET_H |
|
42 | #endif // VISUALIZATIONWIDGET_H |
@@ -1,39 +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" |
|
4 | #include "Visualization/IVisualizationWidget.h" | |
5 |
|
5 | |||
6 | class VisualizationGraphWidget; |
|
6 | class VisualizationGraphWidget; | |
7 |
|
7 | |||
8 | #include <QWidget> |
|
8 | #include <QWidget> | |
9 |
|
9 | |||
10 | namespace Ui { |
|
10 | namespace Ui { | |
11 | class VisualizationZoneWidget; |
|
11 | class VisualizationZoneWidget; | |
12 | } // Ui |
|
12 | } // Ui | |
13 |
|
13 | |||
14 | class VisualizationZoneWidget : public QWidget, public IVisualizationWidget { |
|
14 | class VisualizationZoneWidget : public QWidget, public IVisualizationWidget { | |
15 | Q_OBJECT |
|
15 | Q_OBJECT | |
16 |
|
16 | |||
17 | public: |
|
17 | public: | |
18 | explicit VisualizationZoneWidget(QWidget *parent = 0); |
|
18 | explicit VisualizationZoneWidget(QWidget *parent = 0); | |
19 | virtual ~VisualizationZoneWidget(); |
|
19 | virtual ~VisualizationZoneWidget(); | |
20 |
|
20 | |||
21 | /// Add a graph widget |
|
21 | /// Add a graph widget | |
22 | void addGraph(VisualizationGraphWidget *graphWidget); |
|
22 | void addGraph(VisualizationGraphWidget *graphWidget); | |
23 |
|
23 | |||
24 | /// Create a graph using a Variable |
|
24 | /// Create a graph using a Variable | |
25 | VisualizationGraphWidget *createGraph(); |
|
25 | VisualizationGraphWidget *createGraph(); | |
26 |
|
26 | |||
27 | /// Remove a graph |
|
27 | /// Remove a graph | |
28 | void removeGraph(VisualizationGraphWidget *graph); |
|
28 | void removeGraph(VisualizationGraphWidget *graph); | |
29 |
|
29 | |||
30 | // IVisualizationWidget interface |
|
30 | // IVisualizationWidget interface | |
31 | void accept(IVisualizationWidget *visitor); |
|
31 | void accept(IVisualizationWidget *visitor) override; | |
32 | void close(); |
|
32 | void close() override; | |
33 | QString name(); |
|
33 | QString name() const override; | |
34 |
|
34 | |||
35 | private: |
|
35 | private: | |
36 | Ui::VisualizationZoneWidget *ui; |
|
36 | Ui::VisualizationZoneWidget *ui; | |
37 | }; |
|
37 | }; | |
38 |
|
38 | |||
39 | #endif // SCIQLOP_VISUALIZATIONZONEWIDGET_H |
|
39 | #endif // SCIQLOP_VISUALIZATIONZONEWIDGET_H |
@@ -1,47 +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> |
|
4 | #include <Variable/Variable.h> | |
5 |
|
5 | |||
6 | #include <unordered_map> |
|
6 | #include <unordered_map> | |
7 |
|
7 | |||
8 | struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate { |
|
8 | struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate { | |
9 |
|
9 | |||
10 | // 1 variable -> n qcpplot |
|
10 | // 1 variable -> n qcpplot | |
11 | std::unordered_map<std::shared_ptr<Variable>, std::unique_ptr<QCPAbstractPlottable> > |
|
11 | std::unordered_map<std::shared_ptr<Variable>, std::unique_ptr<QCPAbstractPlottable> > | |
12 | m_VariableToPlotMap; |
|
12 | m_VariableToPlotMap; | |
13 | }; |
|
13 | }; | |
14 |
|
14 | |||
15 | VisualizationGraphWidget::VisualizationGraphWidget(QWidget *parent) |
|
15 | VisualizationGraphWidget::VisualizationGraphWidget(QWidget *parent) | |
16 | : QWidget(parent), |
|
16 | : QWidget(parent), | |
17 | ui(new Ui::VisualizationGraphWidget), |
|
17 | ui(new Ui::VisualizationGraphWidget), | |
18 | impl{spimpl::make_unique_impl<VisualizationGraphWidgetPrivate>()} |
|
18 | impl{spimpl::make_unique_impl<VisualizationGraphWidgetPrivate>()} | |
19 | { |
|
19 | { | |
20 | ui->setupUi(this); |
|
20 | ui->setupUi(this); | |
21 | } |
|
21 | } | |
22 |
|
22 | |||
23 | VisualizationGraphWidget::~VisualizationGraphWidget() |
|
23 | VisualizationGraphWidget::~VisualizationGraphWidget() | |
24 | { |
|
24 | { | |
25 | delete ui; |
|
25 | delete ui; | |
26 | } |
|
26 | } | |
27 |
|
27 | |||
28 | void VisualizationGraphWidget::addVariable(std::shared_ptr<Variable> variable) |
|
28 | void VisualizationGraphWidget::addVariable(std::shared_ptr<Variable> variable) | |
29 | { |
|
29 | { | |
30 | // todo: first check is variable contains data then check how many plot have to be created |
|
30 | // todo: first check is variable contains data then check how many plot have to be created | |
31 | } |
|
31 | } | |
32 |
|
32 | |||
33 | void VisualizationGraphWidget::accept(IVisualizationWidget *visitor) |
|
33 | void VisualizationGraphWidget::accept(IVisualizationWidget *visitor) | |
34 | { |
|
34 | { | |
35 | // TODO: manage the visitor |
|
35 | // TODO: manage the visitor | |
36 | } |
|
36 | } | |
37 |
|
37 | |||
38 | void VisualizationGraphWidget::close() |
|
38 | void VisualizationGraphWidget::close() | |
39 | { |
|
39 | { | |
40 | // The main view cannot be directly closed. |
|
40 | // The main view cannot be directly closed. | |
41 | return; |
|
41 | return; | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | QString VisualizationGraphWidget::name() |
|
44 | QString VisualizationGraphWidget::name() const | |
45 | { |
|
45 | { | |
46 | return QStringLiteral("MainView"); |
|
46 | return QStringLiteral("MainView"); | |
47 | } |
|
47 | } |
@@ -1,50 +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" |
|
4 | #include "Visualization/VisualizationZoneWidget.h" | |
5 |
|
5 | |||
6 |
|
6 | |||
7 | VisualizationTabWidget::VisualizationTabWidget(QWidget *parent) |
|
7 | VisualizationTabWidget::VisualizationTabWidget(QWidget *parent) | |
8 | : QWidget{parent}, ui{new Ui::VisualizationTabWidget} |
|
8 | : QWidget{parent}, ui{new Ui::VisualizationTabWidget} | |
9 | { |
|
9 | { | |
10 | ui->setupUi(this); |
|
10 | ui->setupUi(this); | |
11 |
|
||||
12 | } |
|
11 | } | |
13 |
|
12 | |||
14 | VisualizationTabWidget::~VisualizationTabWidget() |
|
13 | VisualizationTabWidget::~VisualizationTabWidget() | |
15 | { |
|
14 | { | |
16 | delete ui; |
|
15 | delete ui; | |
17 | } |
|
16 | } | |
18 |
|
17 | |||
19 | void VisualizationTabWidget::addZone(VisualizationZoneWidget *zoneWidget) |
|
18 | void VisualizationTabWidget::addZone(VisualizationZoneWidget *zoneWidget) | |
20 | { |
|
19 | { | |
21 | this->layout()->addWidget(zoneWidget); |
|
20 | this->layout()->addWidget(zoneWidget); | |
22 | } |
|
21 | } | |
23 |
|
22 | |||
24 | VisualizationZoneWidget *VisualizationTabWidget::createZone() |
|
23 | VisualizationZoneWidget *VisualizationTabWidget::createZone() | |
25 | { |
|
24 | { | |
26 | auto zoneWidget = new VisualizationZoneWidget(this); |
|
25 | auto zoneWidget = new VisualizationZoneWidget(this); | |
27 | this->addZone(zoneWidget); |
|
26 | this->addZone(zoneWidget); | |
28 |
|
27 | |||
29 | return zoneWidget; |
|
28 | return zoneWidget; | |
30 | } |
|
29 | } | |
31 |
|
30 | |||
32 | void VisualizationTabWidget::removeZone(VisualizationZoneWidget *zone) |
|
31 | void VisualizationTabWidget::removeZone(VisualizationZoneWidget *zone) | |
33 | { |
|
32 | { | |
34 | } |
|
33 | } | |
35 |
|
34 | |||
36 | void VisualizationTabWidget::accept(IVisualizationWidget *visitor) |
|
35 | void VisualizationTabWidget::accept(IVisualizationWidget *visitor) | |
37 | { |
|
36 | { | |
38 | // TODO: manage the visitor |
|
37 | // TODO: manage the visitor | |
39 | } |
|
38 | } | |
40 |
|
39 | |||
41 | void VisualizationTabWidget::close() |
|
40 | void VisualizationTabWidget::close() | |
42 | { |
|
41 | { | |
43 | // The main view cannot be directly closed. |
|
42 | // The main view cannot be directly closed. | |
44 | return; |
|
43 | return; | |
45 | } |
|
44 | } | |
46 |
|
45 | |||
47 | QString VisualizationTabWidget::name() |
|
46 | QString VisualizationTabWidget::name() const | |
48 | { |
|
47 | { | |
49 | return QStringLiteral("MainView"); |
|
48 | return QStringLiteral("MainView"); | |
50 | } |
|
49 | } |
@@ -1,74 +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" |
|
3 | #include "Visualization/qcustomplot.h" | |
4 |
|
4 | |||
5 | #include "ui_VisualizationWidget.h" |
|
5 | #include "ui_VisualizationWidget.h" | |
6 |
|
6 | |||
7 | #include <QToolButton> |
|
7 | #include <QToolButton> | |
8 |
|
8 | |||
9 | Q_LOGGING_CATEGORY(LOG_VisualizationWidget, "VisualizationWidget") |
|
9 | Q_LOGGING_CATEGORY(LOG_VisualizationWidget, "VisualizationWidget") | |
10 |
|
10 | |||
11 | VisualizationWidget::VisualizationWidget(QWidget *parent) |
|
11 | VisualizationWidget::VisualizationWidget(QWidget *parent) | |
12 | : QWidget{parent}, ui{new Ui::VisualizationWidget} |
|
12 | : QWidget{parent}, ui{new Ui::VisualizationWidget} | |
13 | { |
|
13 | { | |
14 | ui->setupUi(this); |
|
14 | ui->setupUi(this); | |
15 |
|
15 | |||
16 | auto addTabViewButton = new QToolButton{ui->tabWidget}; |
|
16 | auto addTabViewButton = new QToolButton{ui->tabWidget}; | |
17 | addTabViewButton->setText(tr("Add View")); |
|
17 | addTabViewButton->setText(tr("Add View")); | |
18 | addTabViewButton->setCursor(Qt::ArrowCursor); |
|
18 | addTabViewButton->setCursor(Qt::ArrowCursor); | |
19 | addTabViewButton->setAutoRaise(true); |
|
19 | addTabViewButton->setAutoRaise(true); | |
20 | ui->tabWidget->setCornerWidget(addTabViewButton, Qt::TopRightCorner); |
|
20 | ui->tabWidget->setCornerWidget(addTabViewButton, Qt::TopRightCorner); | |
21 |
|
21 | |||
22 | auto addTabView = [&]() { |
|
22 | auto addTabView = [&]() { | |
23 | auto index = ui->tabWidget->addTab(new VisualizationTabWidget(ui->tabWidget), |
|
23 | auto index = ui->tabWidget->addTab(new VisualizationTabWidget(ui->tabWidget), | |
24 | QString("View %1").arg(ui->tabWidget->count() + 1)); |
|
24 | QString("View %1").arg(ui->tabWidget->count() + 1)); | |
25 | 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); | |
26 | }; |
|
26 | }; | |
27 |
|
27 | |||
28 | auto removeTabView = [&](int index) { |
|
28 | auto removeTabView = [&](int index) { | |
29 | ui->tabWidget->removeTab(index); |
|
29 | ui->tabWidget->removeTab(index); | |
30 | 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); | |
31 | }; |
|
31 | }; | |
32 |
|
32 | |||
33 | ui->tabWidget->setTabsClosable(true); |
|
33 | ui->tabWidget->setTabsClosable(true); | |
34 |
|
34 | |||
35 | connect(addTabViewButton, &QToolButton::clicked, addTabView); |
|
35 | connect(addTabViewButton, &QToolButton::clicked, addTabView); | |
36 | connect(ui->tabWidget, &QTabWidget::tabCloseRequested, removeTabView); |
|
36 | connect(ui->tabWidget, &QTabWidget::tabCloseRequested, removeTabView); | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | VisualizationWidget::~VisualizationWidget() |
|
39 | VisualizationWidget::~VisualizationWidget() | |
40 | { |
|
40 | { | |
41 | delete ui; |
|
41 | delete ui; | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | void VisualizationWidget::addTab(VisualizationTabWidget *tabWidget) |
|
44 | void VisualizationWidget::addTab(VisualizationTabWidget *tabWidget) | |
45 | { |
|
45 | { | |
46 | // NOTE: check is this method has to be deleted because of its dupplicated version visible as |
|
46 | // NOTE: check is this method has to be deleted because of its dupplicated version visible as | |
47 | // lambda function (in the constructor) |
|
47 | // lambda function (in the constructor) | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | VisualizationTabWidget *VisualizationWidget::createTab() |
|
50 | VisualizationTabWidget *VisualizationWidget::createTab() | |
51 | { |
|
51 | { | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | void VisualizationWidget::removeTab(VisualizationTabWidget *tab) |
|
54 | void VisualizationWidget::removeTab(VisualizationTabWidget *tab) | |
55 | { |
|
55 | { | |
56 | // NOTE: check is this method has to be deleted because of its dupplicated version visible as |
|
56 | // NOTE: check is this method has to be deleted because of its dupplicated version visible as | |
57 | // lambda function (in the constructor) |
|
57 | // lambda function (in the constructor) | |
58 | } |
|
58 | } | |
59 |
|
59 | |||
60 | void VisualizationWidget::accept(IVisualizationWidget *visitor) |
|
60 | void VisualizationWidget::accept(IVisualizationWidget *visitor) | |
61 | { |
|
61 | { | |
62 | // TODO: manage the visitor |
|
62 | // TODO: manage the visitor | |
63 | } |
|
63 | } | |
64 |
|
64 | |||
65 | void VisualizationWidget::close() |
|
65 | void VisualizationWidget::close() | |
66 | { |
|
66 | { | |
67 | // The main view cannot be directly closed. |
|
67 | // The main view cannot be directly closed. | |
68 | return; |
|
68 | return; | |
69 | } |
|
69 | } | |
70 |
|
70 | |||
71 | QString VisualizationWidget::name() |
|
71 | QString VisualizationWidget::name() const | |
72 | { |
|
72 | { | |
73 | return QStringLiteral("MainView"); |
|
73 | return QStringLiteral("MainView"); | |
74 | } |
|
74 | } |
@@ -1,48 +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" |
|
4 | #include "Visualization/VisualizationGraphWidget.h" | |
5 |
|
5 | |||
6 | VisualizationZoneWidget::VisualizationZoneWidget(QWidget *parent) |
|
6 | VisualizationZoneWidget::VisualizationZoneWidget(QWidget *parent) | |
7 | : QWidget{parent}, ui{new Ui::VisualizationZoneWidget} |
|
7 | : QWidget{parent}, ui{new Ui::VisualizationZoneWidget} | |
8 | { |
|
8 | { | |
9 | ui->setupUi(this); |
|
9 | ui->setupUi(this); | |
10 | } |
|
10 | } | |
11 |
|
11 | |||
12 | VisualizationZoneWidget::~VisualizationZoneWidget() |
|
12 | VisualizationZoneWidget::~VisualizationZoneWidget() | |
13 | { |
|
13 | { | |
14 | delete ui; |
|
14 | delete ui; | |
15 | } |
|
15 | } | |
16 |
|
16 | |||
17 | void VisualizationZoneWidget::addGraph(VisualizationGraphWidget *graphWidget) |
|
17 | void VisualizationZoneWidget::addGraph(VisualizationGraphWidget *graphWidget) | |
18 | { |
|
18 | { | |
19 | ui->visualizationZoneFrame->layout()->addWidget(graphWidget); |
|
19 | ui->visualizationZoneFrame->layout()->addWidget(graphWidget); | |
20 | } |
|
20 | } | |
21 |
|
21 | |||
22 | VisualizationGraphWidget *VisualizationZoneWidget::createGraph() |
|
22 | VisualizationGraphWidget *VisualizationZoneWidget::createGraph() | |
23 | { |
|
23 | { | |
24 | auto graphWidget = new VisualizationGraphWidget(this); |
|
24 | auto graphWidget = new VisualizationGraphWidget(this); | |
25 | this->addGraph(graphWidget); |
|
25 | this->addGraph(graphWidget); | |
26 |
|
26 | |||
27 | return graphWidget; |
|
27 | return graphWidget; | |
28 | } |
|
28 | } | |
29 |
|
29 | |||
30 | void VisualizationZoneWidget::removeGraph(VisualizationGraphWidget *graph) |
|
30 | void VisualizationZoneWidget::removeGraph(VisualizationGraphWidget *graph) | |
31 | { |
|
31 | { | |
32 | } |
|
32 | } | |
33 |
|
33 | |||
34 | void VisualizationZoneWidget::accept(IVisualizationWidget *visitor) |
|
34 | void VisualizationZoneWidget::accept(IVisualizationWidget *visitor) | |
35 | { |
|
35 | { | |
36 | // TODO: manage the visitor |
|
36 | // TODO: manage the visitor | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | void VisualizationZoneWidget::close() |
|
39 | void VisualizationZoneWidget::close() | |
40 | { |
|
40 | { | |
41 | // The main view cannot be directly closed. |
|
41 | // The main view cannot be directly closed. | |
42 | return; |
|
42 | return; | |
43 | } |
|
43 | } | |
44 |
|
44 | |||
45 | QString VisualizationZoneWidget::name() |
|
45 | QString VisualizationZoneWidget::name() const | |
46 | { |
|
46 | { | |
47 | return QStringLiteral("MainView"); |
|
47 | return QStringLiteral("MainView"); | |
48 | } |
|
48 | } |
General Comments 0
You need to be logged in to leave comments.
Login now