@@ -0,0 +1,56 | |||
|
1 | #ifndef SCIQLOP_ARRAYDATA_H | |
|
2 | #define SCIQLOP_ARRAYDATA_H | |
|
3 | ||
|
4 | #include <QVector> | |
|
5 | ||
|
6 | /** | |
|
7 | * @brief The ArrayData class represents a dataset for a data series. | |
|
8 | * | |
|
9 | * A dataset can be unidimensional or two-dimensional. This property is determined by the Dim | |
|
10 | * template-parameter. | |
|
11 | * | |
|
12 | * @tparam Dim the dimension of the ArrayData (one or two) | |
|
13 | * @sa IDataSeries | |
|
14 | */ | |
|
15 | template <int Dim> | |
|
16 | class ArrayData { | |
|
17 | public: | |
|
18 | /** | |
|
19 | * Ctor for a unidimensional ArrayData | |
|
20 | * @param nbColumns the number of values the ArrayData will hold | |
|
21 | */ | |
|
22 | template <int D = Dim, typename = std::enable_if_t<D == 1> > | |
|
23 | explicit ArrayData(int nbColumns) : m_Data{1, QVector<double>{}} | |
|
24 | { | |
|
25 | m_Data[0].resize(nbColumns); | |
|
26 | } | |
|
27 | ||
|
28 | /** | |
|
29 | * Sets a data at a specified index. The index has to be valid to be effective | |
|
30 | * @param index the index to which the data will be set | |
|
31 | * @param data the data to set | |
|
32 | * @remarks this method is only available for a unidimensional ArrayData | |
|
33 | */ | |
|
34 | template <int D = Dim, typename = std::enable_if_t<D == 1> > | |
|
35 | void setData(int index, double data) noexcept | |
|
36 | { | |
|
37 | if (index >= 0 && index < m_Data.at(0).size()) { | |
|
38 | m_Data[0].replace(index, data); | |
|
39 | } | |
|
40 | } | |
|
41 | ||
|
42 | /** | |
|
43 | * @return the data as a vector | |
|
44 | * @remarks this method is only available for a unidimensional ArrayData | |
|
45 | */ | |
|
46 | template <int D = Dim, typename = std::enable_if_t<D == 1> > | |
|
47 | QVector<double> data() const noexcept | |
|
48 | { | |
|
49 | return m_Data.at(0); | |
|
50 | } | |
|
51 | ||
|
52 | private: | |
|
53 | QVector<QVector<double> > m_Data; | |
|
54 | }; | |
|
55 | ||
|
56 | #endif // SCIQLOP_ARRAYDATA_H |
@@ -0,0 +1,16 | |||
|
1 | #ifndef SCIQLOP_DATAPROVIDERPARAMETERS_H | |
|
2 | #define SCIQLOP_DATAPROVIDERPARAMETERS_H | |
|
3 | ||
|
4 | /** | |
|
5 | * @brief The DataProviderParameters struct holds the information needed to retrieve data from a | |
|
6 | * data provider | |
|
7 | * @sa IDataProvider | |
|
8 | */ | |
|
9 | struct DataProviderParameters { | |
|
10 | /// Start time | |
|
11 | double m_TStart; | |
|
12 | /// End time | |
|
13 | double m_TEnd; | |
|
14 | }; | |
|
15 | ||
|
16 | #endif // SCIQLOP_DATAPROVIDERPARAMETERS_H |
@@ -0,0 +1,50 | |||
|
1 | #ifndef SCIQLOP_DATASERIES_H | |
|
2 | #define SCIQLOP_DATASERIES_H | |
|
3 | ||
|
4 | #include <Data/ArrayData.h> | |
|
5 | #include <Data/IDataSeries.h> | |
|
6 | ||
|
7 | #include <memory> | |
|
8 | ||
|
9 | /** | |
|
10 | * @brief The DataSeries class is the base (abstract) implementation of IDataSeries. | |
|
11 | * | |
|
12 | * It proposes to set a dimension for the values ββdata | |
|
13 | * | |
|
14 | * @tparam Dim The dimension of the values data | |
|
15 | * | |
|
16 | */ | |
|
17 | template <int Dim> | |
|
18 | class DataSeries : public IDataSeries { | |
|
19 | public: | |
|
20 | /// @sa IDataSeries::xAxisData() | |
|
21 | std::shared_ptr<ArrayData<1> > xAxisData() override { return m_XAxisData; } | |
|
22 | ||
|
23 | /// @sa IDataSeries::xAxisUnit() | |
|
24 | QString xAxisUnit() const override { return m_XAxisUnit; } | |
|
25 | ||
|
26 | /// @return the values dataset | |
|
27 | std::shared_ptr<ArrayData<Dim> > valuesData() const { return m_ValuesData; } | |
|
28 | ||
|
29 | /// @sa IDataSeries::valuesUnit() | |
|
30 | QString valuesUnit() const override { return m_ValuesUnit; } | |
|
31 | ||
|
32 | protected: | |
|
33 | /// Protected ctor (DataSeries is abstract) | |
|
34 | explicit DataSeries(std::shared_ptr<ArrayData<1> > xAxisData, const QString &xAxisUnit, | |
|
35 | std::shared_ptr<ArrayData<Dim> > valuesData, const QString &valuesUnit) | |
|
36 | : m_XAxisData{xAxisData}, | |
|
37 | m_XAxisUnit{xAxisUnit}, | |
|
38 | m_ValuesData{valuesData}, | |
|
39 | m_ValuesUnit{valuesUnit} | |
|
40 | { | |
|
41 | } | |
|
42 | ||
|
43 | private: | |
|
44 | std::shared_ptr<ArrayData<1> > m_XAxisData; | |
|
45 | QString m_XAxisUnit; | |
|
46 | std::shared_ptr<ArrayData<Dim> > m_ValuesData; | |
|
47 | QString m_ValuesUnit; | |
|
48 | }; | |
|
49 | ||
|
50 | #endif // SCIQLOP_DATASERIES_H |
@@ -0,0 +1,25 | |||
|
1 | #ifndef SCIQLOP_IDATAPROVIDER_H | |
|
2 | #define SCIQLOP_IDATAPROVIDER_H | |
|
3 | ||
|
4 | #include <memory> | |
|
5 | ||
|
6 | class DataProviderParameters; | |
|
7 | class IDataSeries; | |
|
8 | ||
|
9 | /** | |
|
10 | * @brief The IDataProvider interface aims to declare a data provider. | |
|
11 | * | |
|
12 | * A data provider is an entity that generates data and returns it according to various parameters | |
|
13 | * (time interval, product to retrieve the data, etc.) | |
|
14 | * | |
|
15 | * @sa IDataSeries | |
|
16 | */ | |
|
17 | class IDataProvider { | |
|
18 | public: | |
|
19 | virtual ~IDataProvider() noexcept = default; | |
|
20 | ||
|
21 | virtual std::unique_ptr<IDataSeries> | |
|
22 | retrieveData(const DataProviderParameters ¶meters) const = 0; | |
|
23 | }; | |
|
24 | ||
|
25 | #endif // SCIQLOP_IDATAPROVIDER_H |
@@ -0,0 +1,37 | |||
|
1 | #ifndef SCIQLOP_IDATASERIES_H | |
|
2 | #define SCIQLOP_IDATASERIES_H | |
|
3 | ||
|
4 | #include <QString> | |
|
5 | ||
|
6 | #include <memory> | |
|
7 | ||
|
8 | template <int Dim> | |
|
9 | class ArrayData; | |
|
10 | ||
|
11 | /** | |
|
12 | * @brief The IDataSeries aims to declare a data series. | |
|
13 | * | |
|
14 | * A data series is an entity that contains at least : | |
|
15 | * - one dataset representing the x-axis | |
|
16 | * - one dataset representing the values | |
|
17 | * | |
|
18 | * Each dataset is represented by an ArrayData, and is associated with a unit. | |
|
19 | * | |
|
20 | * An ArrayData can be unidimensional or two-dimensional, depending on the implementation of the | |
|
21 | * IDataSeries. The x-axis dataset is always unidimensional. | |
|
22 | * | |
|
23 | * @sa ArrayData | |
|
24 | */ | |
|
25 | class IDataSeries { | |
|
26 | public: | |
|
27 | virtual ~IDataSeries() noexcept = default; | |
|
28 | ||
|
29 | /// Returns the x-axis dataset | |
|
30 | virtual std::shared_ptr<ArrayData<1> > xAxisData() = 0; | |
|
31 | ||
|
32 | virtual QString xAxisUnit() const = 0; | |
|
33 | ||
|
34 | virtual QString valuesUnit() const = 0; | |
|
35 | }; | |
|
36 | ||
|
37 | #endif // SCIQLOP_IDATASERIES_H |
@@ -0,0 +1,28 | |||
|
1 | #ifndef SCIQLOP_SCALARSERIES_H | |
|
2 | #define SCIQLOP_SCALARSERIES_H | |
|
3 | ||
|
4 | #include <Data/DataSeries.h> | |
|
5 | ||
|
6 | /** | |
|
7 | * @brief The ScalarSeries class is the implementation for a data series representing a scalar. | |
|
8 | */ | |
|
9 | class ScalarSeries : public DataSeries<1> { | |
|
10 | public: | |
|
11 | /** | |
|
12 | * Ctor | |
|
13 | * @param size the number of data the series will hold | |
|
14 | * @param xAxisUnit x-axis unit | |
|
15 | * @param valuesUnit values unit | |
|
16 | */ | |
|
17 | explicit ScalarSeries(int size, const QString &xAxisUnit, const QString &valuesUnit); | |
|
18 | ||
|
19 | /** | |
|
20 | * Sets data for a specific index. The index has to be valid to be effective | |
|
21 | * @param index the index to which the data will be set | |
|
22 | * @param x the x-axis data | |
|
23 | * @param value the value data | |
|
24 | */ | |
|
25 | void setData(int index, double x, double value) noexcept; | |
|
26 | }; | |
|
27 | ||
|
28 | #endif // SCIQLOP_SCALARSERIES_H |
@@ -0,0 +1,13 | |||
|
1 | #include <Data/ScalarSeries.h> | |
|
2 | ||
|
3 | ScalarSeries::ScalarSeries(int size, const QString &xAxisUnit, const QString &valuesUnit) | |
|
4 | : DataSeries{std::make_shared<ArrayData<1> >(size), xAxisUnit, | |
|
5 | std::make_shared<ArrayData<1> >(size), valuesUnit} | |
|
6 | { | |
|
7 | } | |
|
8 | ||
|
9 | void ScalarSeries::setData(int index, double x, double value) noexcept | |
|
10 | { | |
|
11 | xAxisData()->setData(index, x); | |
|
12 | valuesData()->setData(index, value); | |
|
13 | } |
@@ -0,0 +1,21 | |||
|
1 | #ifndef SCIQLOP_TIMEWIDGET_H | |
|
2 | #define SCIQLOP_TIMEWIDGET_H | |
|
3 | ||
|
4 | #include <QWidget> | |
|
5 | ||
|
6 | namespace Ui { | |
|
7 | class TimeWidget; | |
|
8 | } // Ui | |
|
9 | ||
|
10 | class TimeWidget : public QWidget { | |
|
11 | Q_OBJECT | |
|
12 | ||
|
13 | public: | |
|
14 | explicit TimeWidget(QWidget *parent = 0); | |
|
15 | virtual ~TimeWidget(); | |
|
16 | ||
|
17 | private: | |
|
18 | Ui::TimeWidget *ui; | |
|
19 | }; | |
|
20 | ||
|
21 | #endif // SCIQLOP_ SQPSIDEPANE_H |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
@@ -0,0 +1,12 | |||
|
1 | #include "TimeWidget/TimeWidget.h" | |
|
2 | #include "ui_TimeWidget.h" | |
|
3 | ||
|
4 | TimeWidget::TimeWidget(QWidget *parent) : QWidget{parent}, ui{new Ui::TimeWidget} | |
|
5 | { | |
|
6 | ui->setupUi(this); | |
|
7 | } | |
|
8 | ||
|
9 | TimeWidget::~TimeWidget() | |
|
10 | { | |
|
11 | delete ui; | |
|
12 | } |
@@ -0,0 +1,85 | |||
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
|
2 | <ui version="4.0"> | |
|
3 | <class>TimeWidget</class> | |
|
4 | <widget class="QWidget" name="TimeWidget"> | |
|
5 | <property name="geometry"> | |
|
6 | <rect> | |
|
7 | <x>0</x> | |
|
8 | <y>0</y> | |
|
9 | <width>716</width> | |
|
10 | <height>48</height> | |
|
11 | </rect> | |
|
12 | </property> | |
|
13 | <property name="sizePolicy"> | |
|
14 | <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> | |
|
15 | <horstretch>0</horstretch> | |
|
16 | <verstretch>0</verstretch> | |
|
17 | </sizepolicy> | |
|
18 | </property> | |
|
19 | <property name="windowTitle"> | |
|
20 | <string>Form</string> | |
|
21 | </property> | |
|
22 | <layout class="QHBoxLayout" name="horizontalLayout_2"> | |
|
23 | <item> | |
|
24 | <widget class="QLabel" name="label"> | |
|
25 | <property name="sizePolicy"> | |
|
26 | <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> | |
|
27 | <horstretch>0</horstretch> | |
|
28 | <verstretch>0</verstretch> | |
|
29 | </sizepolicy> | |
|
30 | </property> | |
|
31 | <property name="text"> | |
|
32 | <string>TStart :</string> | |
|
33 | </property> | |
|
34 | </widget> | |
|
35 | </item> | |
|
36 | <item> | |
|
37 | <widget class="QDateTimeEdit" name="startDateTimeEdit"> | |
|
38 | <property name="sizePolicy"> | |
|
39 | <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | |
|
40 | <horstretch>0</horstretch> | |
|
41 | <verstretch>0</verstretch> | |
|
42 | </sizepolicy> | |
|
43 | </property> | |
|
44 | <property name="displayFormat"> | |
|
45 | <string>dd/MM/yyyy HH:mm:ss:zzz</string> | |
|
46 | </property> | |
|
47 | <property name="calendarPopup"> | |
|
48 | <bool>true</bool> | |
|
49 | </property> | |
|
50 | </widget> | |
|
51 | </item> | |
|
52 | <item> | |
|
53 | <widget class="QLabel" name="label_2"> | |
|
54 | <property name="sizePolicy"> | |
|
55 | <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> | |
|
56 | <horstretch>0</horstretch> | |
|
57 | <verstretch>0</verstretch> | |
|
58 | </sizepolicy> | |
|
59 | </property> | |
|
60 | <property name="text"> | |
|
61 | <string>TEnd :</string> | |
|
62 | </property> | |
|
63 | </widget> | |
|
64 | </item> | |
|
65 | <item> | |
|
66 | <widget class="QDateTimeEdit" name="endDateTimeEdit"> | |
|
67 | <property name="sizePolicy"> | |
|
68 | <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | |
|
69 | <horstretch>0</horstretch> | |
|
70 | <verstretch>0</verstretch> | |
|
71 | </sizepolicy> | |
|
72 | </property> | |
|
73 | <property name="displayFormat"> | |
|
74 | <string>dd/MM/yyyy HH:mm:ss:zzz</string> | |
|
75 | </property> | |
|
76 | <property name="calendarPopup"> | |
|
77 | <bool>true</bool> | |
|
78 | </property> | |
|
79 | </widget> | |
|
80 | </item> | |
|
81 | </layout> | |
|
82 | </widget> | |
|
83 | <resources/> | |
|
84 | <connections/> | |
|
85 | </ui> |
@@ -0,0 +1,16 | |||
|
1 | #ifndef SCIQLOP_COSINUSPROVIDER_H | |
|
2 | #define SCIQLOP_COSINUSPROVIDER_H | |
|
3 | ||
|
4 | #include <Data/IDataProvider.h> | |
|
5 | ||
|
6 | /** | |
|
7 | * @brief The CosinusProvider class is an example of how a data provider can generate data | |
|
8 | */ | |
|
9 | class CosinusProvider : public IDataProvider { | |
|
10 | public: | |
|
11 | /// @sa IDataProvider::retrieveData() | |
|
12 | std::unique_ptr<IDataSeries> | |
|
13 | retrieveData(const DataProviderParameters ¶meters) const override; | |
|
14 | }; | |
|
15 | ||
|
16 | #endif // SCIQLOP_COSINUSPROVIDER_H |
@@ -0,0 +1,30 | |||
|
1 | #include "CosinusProvider.h" | |
|
2 | ||
|
3 | #include <Data/DataProviderParameters.h> | |
|
4 | #include <Data/ScalarSeries.h> | |
|
5 | ||
|
6 | #include <cmath> | |
|
7 | ||
|
8 | std::unique_ptr<IDataSeries> | |
|
9 | CosinusProvider::retrieveData(const DataProviderParameters ¶meters) const | |
|
10 | { | |
|
11 | // Gets the timerange from the parameters | |
|
12 | auto start = parameters.m_TStart; | |
|
13 | auto end = parameters.m_TEnd; | |
|
14 | ||
|
15 | // We assure that timerange is valid | |
|
16 | if (end < start) { | |
|
17 | std::swap(start, end); | |
|
18 | } | |
|
19 | ||
|
20 | // Generates scalar series containing cosinus values (one value per second) | |
|
21 | auto scalarSeries | |
|
22 | = std::make_unique<ScalarSeries>(end - start, QStringLiteral("t"), QStringLiteral("")); | |
|
23 | ||
|
24 | auto dataIndex = 0; | |
|
25 | for (auto time = start; time < end; ++time, ++dataIndex) { | |
|
26 | scalarSeries->setData(dataIndex, time, std::cos(time)); | |
|
27 | } | |
|
28 | ||
|
29 | return scalarSeries; | |
|
30 | } |
@@ -26,6 +26,7 | |||
|
26 | 26 | #include <DataSource/DataSourceWidget.h> |
|
27 | 27 | #include <SidePane/SqpSidePane.h> |
|
28 | 28 | #include <SqpApplication.h> |
|
29 | #include <TimeWidget/TimeWidget.h> | |
|
29 | 30 | |
|
30 | 31 | #include <QAction> |
|
31 | 32 | #include <QDate> |
@@ -33,6 +34,7 | |||
|
33 | 34 | #include <QDir> |
|
34 | 35 | #include <QFileDialog> |
|
35 | 36 | #include <QToolBar> |
|
37 | #include <QToolButton> | |
|
36 | 38 | #include <memory.h> |
|
37 | 39 | |
|
38 | 40 | //#include <omp.h> |
@@ -75,89 +77,96 MainWindow::MainWindow(QWidget *parent) | |||
|
75 | 77 | m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false); |
|
76 | 78 | m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false); |
|
77 | 79 | |
|
78 | // NOTE: These lambda could be factorized. Be careful of theirs parameters | |
|
79 | // Lambda that defines what's happened when clicking on the leftSidePaneInspector open button | |
|
80 | auto openLeftInspector = [this](bool checked) { | |
|
81 | 80 | |
|
82 | // Update of the last opened geometry | |
|
83 | if (checked) { | |
|
84 | impl->m_LastOpenLeftInspectorSize = m_Ui->leftMainInspectorWidget->size(); | |
|
85 | } | |
|
81 | auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane(); | |
|
82 | auto openLeftInspectorAction = new QAction{QIcon{ | |
|
83 | ":/icones/previous.png", | |
|
84 | }, | |
|
85 | tr("Show/hide the left inspector"), this}; | |
|
86 | 86 | |
|
87 | auto startSize = impl->m_LastOpenLeftInspectorSize; | |
|
88 | auto endSize = startSize; | |
|
89 | endSize.setWidth(0); | |
|
90 | 87 | |
|
91 | auto currentSizes = m_Ui->splitter->sizes(); | |
|
92 | if (checked) { | |
|
93 | // adjust sizes individually here, e.g. | |
|
94 | currentSizes[LEFTMAININSPECTORWIDGETSPLITTERINDEX] | |
|
95 | -= impl->m_LastOpenLeftInspectorSize.width(); | |
|
96 | currentSizes[VIEWPLITTERINDEX] += impl->m_LastOpenLeftInspectorSize.width(); | |
|
97 | m_Ui->splitter->setSizes(currentSizes); | |
|
98 | } | |
|
99 | else { | |
|
100 | // adjust sizes individually here, e.g. | |
|
101 | currentSizes[LEFTMAININSPECTORWIDGETSPLITTERINDEX] | |
|
102 | += impl->m_LastOpenLeftInspectorSize.width(); | |
|
103 | currentSizes[VIEWPLITTERINDEX] -= impl->m_LastOpenLeftInspectorSize.width(); | |
|
104 | m_Ui->splitter->setSizes(currentSizes); | |
|
105 | } | |
|
88 | auto spacerLeftTop = new QWidget{}; | |
|
89 | spacerLeftTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
|
106 | 90 | |
|
107 | }; | |
|
91 | auto spacerLeftBottom = new QWidget{}; | |
|
92 | spacerLeftBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
|
93 | ||
|
94 | leftSidePane->addWidget(spacerLeftTop); | |
|
95 | leftSidePane->addAction(openLeftInspectorAction); | |
|
96 | leftSidePane->addWidget(spacerLeftBottom); | |
|
97 | ||
|
98 | ||
|
99 | auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane(); | |
|
100 | auto openRightInspectorAction = new QAction{QIcon{ | |
|
101 | ":/icones/next.png", | |
|
102 | }, | |
|
103 | tr("Show/hide the right inspector"), this}; | |
|
104 | ||
|
105 | auto spacerRightTop = new QWidget{}; | |
|
106 | spacerRightTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
|
107 | ||
|
108 | auto spacerRightBottom = new QWidget{}; | |
|
109 | spacerRightBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
|
110 | ||
|
111 | rightSidePane->addWidget(spacerRightTop); | |
|
112 | rightSidePane->addAction(openRightInspectorAction); | |
|
113 | rightSidePane->addWidget(spacerRightBottom); | |
|
114 | ||
|
115 | openLeftInspectorAction->setCheckable(true); | |
|
116 | openRightInspectorAction->setCheckable(true); | |
|
117 | ||
|
118 | auto openInspector = [this](bool checked, bool right, auto action) { | |
|
119 | ||
|
120 | action->setIcon(QIcon{(checked xor right) ? ":/icones/next.png" : ":/icones/previous.png"}); | |
|
121 | ||
|
122 | auto &lastInspectorSize | |
|
123 | = right ? impl->m_LastOpenRightInspectorSize : impl->m_LastOpenLeftInspectorSize; | |
|
108 | 124 | |
|
109 | // Lambda that defines what's happened when clicking on the SidePaneInspector open button | |
|
110 | auto openRightInspector = [this](bool checked) { | |
|
125 | auto nextInspectorSize = right ? m_Ui->rightMainInspectorWidget->size() | |
|
126 | : m_Ui->leftMainInspectorWidget->size(); | |
|
111 | 127 | |
|
112 | 128 | // Update of the last opened geometry |
|
113 | 129 | if (checked) { |
|
114 |
|
|
|
130 | lastInspectorSize = nextInspectorSize; | |
|
115 | 131 | } |
|
116 | 132 | |
|
117 |
auto startSize = |
|
|
133 | auto startSize = lastInspectorSize; | |
|
118 | 134 | auto endSize = startSize; |
|
119 | 135 | endSize.setWidth(0); |
|
120 | 136 | |
|
137 | auto splitterInspectorIndex | |
|
138 | = right ? RIGHTMAININSPECTORWIDGETSPLITTERINDEX : LEFTMAININSPECTORWIDGETSPLITTERINDEX; | |
|
139 | ||
|
121 | 140 | auto currentSizes = m_Ui->splitter->sizes(); |
|
122 | 141 | if (checked) { |
|
123 | 142 | // adjust sizes individually here, e.g. |
|
124 | currentSizes[RIGHTMAININSPECTORWIDGETSPLITTERINDEX] | |
|
125 |
|
|
|
126 | currentSizes[VIEWPLITTERINDEX] += impl->m_LastOpenRightInspectorSize.width(); | |
|
143 | currentSizes[splitterInspectorIndex] -= lastInspectorSize.width(); | |
|
144 | currentSizes[VIEWPLITTERINDEX] += lastInspectorSize.width(); | |
|
127 | 145 | m_Ui->splitter->setSizes(currentSizes); |
|
128 | 146 | } |
|
129 | 147 | else { |
|
130 | 148 | // adjust sizes individually here, e.g. |
|
131 | currentSizes[RIGHTMAININSPECTORWIDGETSPLITTERINDEX] | |
|
132 |
|
|
|
133 | currentSizes[VIEWPLITTERINDEX] -= impl->m_LastOpenRightInspectorSize.width(); | |
|
149 | currentSizes[splitterInspectorIndex] += lastInspectorSize.width(); | |
|
150 | currentSizes[VIEWPLITTERINDEX] -= lastInspectorSize.width(); | |
|
134 | 151 | m_Ui->splitter->setSizes(currentSizes); |
|
135 | 152 | } |
|
136 | 153 | |
|
137 | 154 | }; |
|
138 | 155 | |
|
139 | 156 | |
|
140 | QToolBar *leftSidePane = m_Ui->leftInspectorSidePane->sidePane(); | |
|
141 | auto openLeftInspectorAction = leftSidePane->addAction( | |
|
142 | QIcon{ | |
|
143 | ":/icones/openInspector.png", | |
|
144 | }, | |
|
145 | tr("Show/hide the left inspector"), openLeftInspector); | |
|
146 | ||
|
147 | openLeftInspectorAction->setCheckable(true); | |
|
148 | ||
|
149 | auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane(); | |
|
150 | auto openRightInspectorAction = rightSidePane->addAction( | |
|
151 | QIcon{ | |
|
152 | ":/icones/openInspector.png", | |
|
153 | }, | |
|
154 | tr("Show/hide the right inspector"), openRightInspector); | |
|
155 | ||
|
156 | openRightInspectorAction->setCheckable(true); | |
|
157 | connect(openLeftInspectorAction, &QAction::triggered, | |
|
158 | [openInspector, openLeftInspectorAction](bool checked) { | |
|
159 | openInspector(checked, false, openLeftInspectorAction); | |
|
160 | }); | |
|
161 | connect(openRightInspectorAction, &QAction::triggered, | |
|
162 | [openInspector, openRightInspectorAction](bool checked) { | |
|
163 | openInspector(checked, true, openRightInspectorAction); | |
|
164 | }); | |
|
157 | 165 | |
|
158 | 166 | this->menuBar()->addAction(tr("File")); |
|
159 | 167 | auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar")); |
|
160 | mainToolBar->addAction(QStringLiteral("A1")); | |
|
168 | ||
|
169 | mainToolBar->addWidget(new TimeWidget{}); | |
|
161 | 170 | |
|
162 | 171 | // Widgets / controllers connections |
|
163 | 172 | connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)), |
@@ -10,6 +10,7 | |||
|
10 | 10 | Q_DECLARE_LOGGING_CATEGORY(LOG_DataSourceController) |
|
11 | 11 | |
|
12 | 12 | class DataSourceItem; |
|
13 | class IDataProvider; | |
|
13 | 14 | |
|
14 | 15 | /** |
|
15 | 16 | * @brief The DataSourceController class aims to make the link between SciQlop and its plugins. This |
@@ -42,6 +43,17 public: | |||
|
42 | 43 | void setDataSourceItem(const QUuid &dataSourceUid, |
|
43 | 44 | std::unique_ptr<DataSourceItem> dataSourceItem) noexcept; |
|
44 | 45 | |
|
46 | /** | |
|
47 | * Sets the data provider used to retrieve data from of a data source. The controller takes | |
|
48 | * ownership of the provider. | |
|
49 | * @param dataSourceUid the unique id with which the data source has been registered into the | |
|
50 | * controller. If it is invalid, the method has no effect. | |
|
51 | * @param dataProvider the provider of the data source | |
|
52 | * @sa registerDataSource() | |
|
53 | */ | |
|
54 | void setDataProvider(const QUuid &dataSourceUid, | |
|
55 | std::unique_ptr<IDataProvider> dataProvider) noexcept; | |
|
56 | ||
|
45 | 57 | public slots: |
|
46 | 58 | /// Manage init/end of the controller |
|
47 | 59 | void initialize(); |
@@ -1,6 +1,8 | |||
|
1 | 1 | #include <DataSource/DataSourceController.h> |
|
2 | 2 | #include <DataSource/DataSourceItem.h> |
|
3 | 3 | |
|
4 | #include <Data/IDataProvider.h> | |
|
5 | ||
|
4 | 6 | #include <QMutex> |
|
5 | 7 | #include <QThread> |
|
6 | 8 | |
@@ -16,6 +18,8 public: | |||
|
16 | 18 | QHash<QUuid, QString> m_DataSources; |
|
17 | 19 | /// Data sources structures |
|
18 | 20 | std::map<QUuid, std::unique_ptr<DataSourceItem> > m_DataSourceItems; |
|
21 | /// Data providers registered | |
|
22 | std::map<QUuid, std::unique_ptr<IDataProvider> > m_DataProviders; | |
|
19 | 23 | }; |
|
20 | 24 | |
|
21 | 25 | DataSourceController::DataSourceController(QObject *parent) |
@@ -59,6 +63,19 void DataSourceController::setDataSourceItem( | |||
|
59 | 63 | } |
|
60 | 64 | } |
|
61 | 65 | |
|
66 | void DataSourceController::setDataProvider(const QUuid &dataSourceUid, | |
|
67 | std::unique_ptr<IDataProvider> dataProvider) noexcept | |
|
68 | { | |
|
69 | if (impl->m_DataSources.contains(dataSourceUid)) { | |
|
70 | impl->m_DataProviders.insert(std::make_pair(dataSourceUid, std::move(dataProvider))); | |
|
71 | } | |
|
72 | else { | |
|
73 | qCWarning(LOG_DataSourceController()) << tr("Can't set data provider for uid %1 : no data " | |
|
74 | "source has been registered with the uid") | |
|
75 | .arg(dataSourceUid.toString()); | |
|
76 | } | |
|
77 | } | |
|
78 | ||
|
62 | 79 | void DataSourceController::initialize() |
|
63 | 80 | { |
|
64 | 81 | qCDebug(LOG_DataSourceController()) << tr("DataSourceController init") |
@@ -19,14 +19,14 struct VariableController::VariableControllerPrivate { | |||
|
19 | 19 | VariableController::VariableController(QObject *parent) |
|
20 | 20 | : QObject{parent}, impl{spimpl::make_unique_impl<VariableControllerPrivate>()} |
|
21 | 21 | { |
|
22 | qCDebug(LOG_VariableController()) | |
|
23 | << tr("VariableController construction") << QThread::currentThread(); | |
|
22 | qCDebug(LOG_VariableController()) << tr("VariableController construction") | |
|
23 | << QThread::currentThread(); | |
|
24 | 24 | } |
|
25 | 25 | |
|
26 | 26 | VariableController::~VariableController() |
|
27 | 27 | { |
|
28 | qCDebug(LOG_VariableController()) | |
|
29 | << tr("VariableController destruction") << QThread::currentThread(); | |
|
28 | qCDebug(LOG_VariableController()) << tr("VariableController destruction") | |
|
29 | << QThread::currentThread(); | |
|
30 | 30 | this->waitForFinish(); |
|
31 | 31 | } |
|
32 | 32 |
@@ -4,3 +4,7 Common/spimpl\.h:\d+:.* | |||
|
4 | 4 | # Ignore false positive relative to two class definitions in a same file |
|
5 | 5 | DataSourceItem\.h:\d+:.*IPSIS_S01.* |
|
6 | 6 | |
|
7 | # Ignore false positive relative to a template class | |
|
8 | ArrayData\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (D) | |
|
9 | ArrayData\.h:\d+:.*IPSIS_S06.*found: (D) | |
|
10 | ArrayData\.h:\d+:.*IPSIS_S06.*found: (Dim) |
@@ -1,5 +1,7 | |||
|
1 | 1 | <RCC> |
|
2 | 2 | <qresource prefix="/"> |
|
3 | 3 | <file>icones/openInspector.png</file> |
|
4 | <file>icones/next.png</file> | |
|
5 | <file>icones/previous.png</file> | |
|
4 | 6 | </qresource> |
|
5 | 7 | </RCC> |
@@ -34,13 +34,6 SqpSidePane::SqpSidePane(QWidget *parent) : QWidget{parent}, ui{new Ui::SqpSideP | |||
|
34 | 34 | this->layout()->addWidget(m_SidePaneToolbar); |
|
35 | 35 | |
|
36 | 36 | m_SidePaneToolbar->setStyleSheet(SQPSIDEPANESTYLESHEET); |
|
37 | ||
|
38 | this->setStyleSheet( | |
|
39 | " QWidget {" | |
|
40 | "background: red;" | |
|
41 | ||
|
42 | "border: 1px;" | |
|
43 | " }"); | |
|
44 | 37 | } |
|
45 | 38 | |
|
46 | 39 | SqpSidePane::~SqpSidePane() |
|
1 | NO CONTENT: file renamed from gui/ui/Sidepane/SqpSidePane.ui to gui/ui/SidePane/SqpSidePane.ui |
@@ -18,10 +18,6 class MockPlugin : public QObject, public IPlugin { | |||
|
18 | 18 | public: |
|
19 | 19 | /// @sa IPlugin::initialize() |
|
20 | 20 | void initialize() override; |
|
21 | ||
|
22 | private: | |
|
23 | /// Creates the data source item relative to the plugin | |
|
24 | std::unique_ptr<DataSourceItem> createDataSourceItem() const noexcept; | |
|
25 | 21 | }; |
|
26 | 22 | |
|
27 | 23 | #endif // SCIQLOP_MOCKPLUGIN_H |
@@ -1,4 +1,5 | |||
|
1 |
#include |
|
|
1 | #include "MockPlugin.h" | |
|
2 | #include "CosinusProvider.h" | |
|
2 | 3 | |
|
3 | 4 | #include <DataSource/DataSourceController.h> |
|
4 | 5 | #include <DataSource/DataSourceItem.h> |
@@ -12,23 +13,14 namespace { | |||
|
12 | 13 | /// Name of the data source |
|
13 | 14 | const auto DATA_SOURCE_NAME = QStringLiteral("MMS"); |
|
14 | 15 | |
|
15 | } // namespace | |
|
16 | ||
|
17 | void MockPlugin::initialize() | |
|
16 | /// Creates the data provider relative to the plugin | |
|
17 | std::unique_ptr<IDataProvider> createDataProvider() noexcept | |
|
18 | 18 | { |
|
19 | if (auto app = sqpApp) { | |
|
20 | // Registers to the data source controller | |
|
21 | auto &dataSourceController = app->dataSourceController(); | |
|
22 | auto dataSourceUid = dataSourceController.registerDataSource(DATA_SOURCE_NAME); | |
|
23 | ||
|
24 | dataSourceController.setDataSourceItem(dataSourceUid, createDataSourceItem()); | |
|
25 | } | |
|
26 | else { | |
|
27 | qCWarning(LOG_MockPlugin()) << tr("Can't access to SciQlop application"); | |
|
28 | } | |
|
19 | return std::make_unique<CosinusProvider>(); | |
|
29 | 20 | } |
|
30 | 21 | |
|
31 | std::unique_ptr<DataSourceItem> MockPlugin::createDataSourceItem() const noexcept | |
|
22 | /// Creates the data source item relative to the plugin | |
|
23 | std::unique_ptr<DataSourceItem> createDataSourceItem() noexcept | |
|
32 | 24 | { |
|
33 | 25 | // Magnetic field products |
|
34 | 26 | auto fgmProduct = std::make_unique<DataSourceItem>(DataSourceItemType::PRODUCT, |
@@ -51,5 +43,25 std::unique_ptr<DataSourceItem> MockPlugin::createDataSourceItem() const noexcep | |||
|
51 | 43 | root->appendChild(std::move(magneticFieldFolder)); |
|
52 | 44 | root->appendChild(std::move(electricFieldFolder)); |
|
53 | 45 | |
|
54 |
return |
|
|
46 | return root; | |
|
47 | } | |
|
48 | ||
|
49 | } // namespace | |
|
50 | ||
|
51 | void MockPlugin::initialize() | |
|
52 | { | |
|
53 | if (auto app = sqpApp) { | |
|
54 | // Registers to the data source controller | |
|
55 | auto &dataSourceController = app->dataSourceController(); | |
|
56 | auto dataSourceUid = dataSourceController.registerDataSource(DATA_SOURCE_NAME); | |
|
57 | ||
|
58 | // Sets data source tree | |
|
59 | dataSourceController.setDataSourceItem(dataSourceUid, createDataSourceItem()); | |
|
60 | ||
|
61 | // Sets data provider | |
|
62 | dataSourceController.setDataProvider(dataSourceUid, createDataProvider()); | |
|
63 | } | |
|
64 | else { | |
|
65 | qCWarning(LOG_MockPlugin()) << tr("Can't access to SciQlop application"); | |
|
66 | } | |
|
55 | 67 | } |
General Comments 0
You need to be logged in to leave comments.
Login now