@@ -1,265 +1,269 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SciQLop Software |
|
2 | -- This file is a part of the SciQLop Software | |
3 | -- Copyright (C) 2017, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2017, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "MainWindow.h" |
|
22 | #include "MainWindow.h" | |
23 | #include "ui_MainWindow.h" |
|
23 | #include "ui_MainWindow.h" | |
24 |
|
24 | |||
25 | #include <DataSource/DataSourceController.h> |
|
25 | #include <DataSource/DataSourceController.h> | |
26 | #include <DataSource/DataSourceWidget.h> |
|
26 | #include <DataSource/DataSourceWidget.h> | |
27 | #include <SidePane/SqpSidePane.h> |
|
27 | #include <SidePane/SqpSidePane.h> | |
28 | #include <SqpApplication.h> |
|
28 | #include <SqpApplication.h> | |
29 | #include <Time/TimeController.h> |
|
29 | #include <Time/TimeController.h> | |
30 | #include <TimeWidget/TimeWidget.h> |
|
30 | #include <TimeWidget/TimeWidget.h> | |
31 | #include <Variable/Variable.h> |
|
31 | #include <Variable/Variable.h> | |
32 | #include <Variable/VariableController.h> |
|
32 | #include <Variable/VariableController.h> | |
33 | #include <Visualization/VisualizationController.h> |
|
33 | #include <Visualization/VisualizationController.h> | |
34 |
|
34 | |||
35 | #include <QAction> |
|
35 | #include <QAction> | |
36 | #include <QDate> |
|
36 | #include <QDate> | |
37 | #include <QDateTime> |
|
37 | #include <QDateTime> | |
38 | #include <QDir> |
|
38 | #include <QDir> | |
39 | #include <QFileDialog> |
|
39 | #include <QFileDialog> | |
40 | #include <QToolBar> |
|
40 | #include <QToolBar> | |
41 | #include <QToolButton> |
|
41 | #include <QToolButton> | |
42 | #include <memory.h> |
|
42 | #include <memory.h> | |
43 |
|
43 | |||
44 | //#include <omp.h> |
|
44 | //#include <omp.h> | |
45 | //#include <network/filedownloader.h> |
|
45 | //#include <network/filedownloader.h> | |
46 | //#include <qlopdatabase.h> |
|
46 | //#include <qlopdatabase.h> | |
47 | //#include <qlopsettings.h> |
|
47 | //#include <qlopsettings.h> | |
48 | //#include <qlopgui.h> |
|
48 | //#include <qlopgui.h> | |
49 | //#include <spacedata.h> |
|
49 | //#include <spacedata.h> | |
50 | //#include "qlopcore.h" |
|
50 | //#include "qlopcore.h" | |
51 | //#include "qlopcodecmanager.h" |
|
51 | //#include "qlopcodecmanager.h" | |
52 | //#include "cdfcodec.h" |
|
52 | //#include "cdfcodec.h" | |
53 | //#include "amdatxtcodec.h" |
|
53 | //#include "amdatxtcodec.h" | |
54 | //#include <qlopplotmanager.h> |
|
54 | //#include <qlopplotmanager.h> | |
55 |
|
55 | |||
56 | #include "iostream" |
|
56 | #include "iostream" | |
57 |
|
57 | |||
58 | Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow") |
|
58 | Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow") | |
59 |
|
59 | |||
60 | namespace { |
|
60 | namespace { | |
61 | const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0; |
|
61 | const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0; | |
62 | const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1; |
|
62 | const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1; | |
63 | const auto VIEWPLITTERINDEX = 2; |
|
63 | const auto VIEWPLITTERINDEX = 2; | |
64 | const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3; |
|
64 | const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3; | |
65 | const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4; |
|
65 | const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4; | |
66 | } |
|
66 | } | |
67 |
|
67 | |||
68 | class MainWindow::MainWindowPrivate { |
|
68 | class MainWindow::MainWindowPrivate { | |
69 | public: |
|
69 | public: | |
70 | QSize m_LastOpenLeftInspectorSize; |
|
70 | QSize m_LastOpenLeftInspectorSize; | |
71 | QSize m_LastOpenRightInspectorSize; |
|
71 | QSize m_LastOpenRightInspectorSize; | |
72 | }; |
|
72 | }; | |
73 |
|
73 | |||
74 | MainWindow::MainWindow(QWidget *parent) |
|
74 | MainWindow::MainWindow(QWidget *parent) | |
75 | : QMainWindow{parent}, |
|
75 | : QMainWindow{parent}, | |
76 | m_Ui{new Ui::MainWindow}, |
|
76 | m_Ui{new Ui::MainWindow}, | |
77 | impl{spimpl::make_unique_impl<MainWindowPrivate>()} |
|
77 | impl{spimpl::make_unique_impl<MainWindowPrivate>()} | |
78 | { |
|
78 | { | |
79 | m_Ui->setupUi(this); |
|
79 | m_Ui->setupUi(this); | |
80 |
|
80 | |||
81 | m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false); |
|
81 | m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false); | |
82 | m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false); |
|
82 | m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false); | |
83 |
|
83 | |||
84 |
|
84 | |||
85 | auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane(); |
|
85 | auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane(); | |
86 | auto openLeftInspectorAction = new QAction{QIcon{ |
|
86 | auto openLeftInspectorAction = new QAction{QIcon{ | |
87 | ":/icones/previous.png", |
|
87 | ":/icones/previous.png", | |
88 | }, |
|
88 | }, | |
89 | tr("Show/hide the left inspector"), this}; |
|
89 | tr("Show/hide the left inspector"), this}; | |
90 |
|
90 | |||
91 |
|
91 | |||
92 | auto spacerLeftTop = new QWidget{}; |
|
92 | auto spacerLeftTop = new QWidget{}; | |
93 | spacerLeftTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
93 | spacerLeftTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
94 |
|
94 | |||
95 | auto spacerLeftBottom = new QWidget{}; |
|
95 | auto spacerLeftBottom = new QWidget{}; | |
96 | spacerLeftBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
96 | spacerLeftBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
97 |
|
97 | |||
98 | leftSidePane->addWidget(spacerLeftTop); |
|
98 | leftSidePane->addWidget(spacerLeftTop); | |
99 | leftSidePane->addAction(openLeftInspectorAction); |
|
99 | leftSidePane->addAction(openLeftInspectorAction); | |
100 | leftSidePane->addWidget(spacerLeftBottom); |
|
100 | leftSidePane->addWidget(spacerLeftBottom); | |
101 |
|
101 | |||
102 |
|
102 | |||
103 | auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane(); |
|
103 | auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane(); | |
104 | auto openRightInspectorAction = new QAction{QIcon{ |
|
104 | auto openRightInspectorAction = new QAction{QIcon{ | |
105 | ":/icones/next.png", |
|
105 | ":/icones/next.png", | |
106 | }, |
|
106 | }, | |
107 | tr("Show/hide the right inspector"), this}; |
|
107 | tr("Show/hide the right inspector"), this}; | |
108 |
|
108 | |||
109 | auto spacerRightTop = new QWidget{}; |
|
109 | auto spacerRightTop = new QWidget{}; | |
110 | spacerRightTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
110 | spacerRightTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
111 |
|
111 | |||
112 | auto spacerRightBottom = new QWidget{}; |
|
112 | auto spacerRightBottom = new QWidget{}; | |
113 | spacerRightBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
113 | spacerRightBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
114 |
|
114 | |||
115 | rightSidePane->addWidget(spacerRightTop); |
|
115 | rightSidePane->addWidget(spacerRightTop); | |
116 | rightSidePane->addAction(openRightInspectorAction); |
|
116 | rightSidePane->addAction(openRightInspectorAction); | |
117 | rightSidePane->addWidget(spacerRightBottom); |
|
117 | rightSidePane->addWidget(spacerRightBottom); | |
118 |
|
118 | |||
119 | openLeftInspectorAction->setCheckable(true); |
|
119 | openLeftInspectorAction->setCheckable(true); | |
120 | openRightInspectorAction->setCheckable(true); |
|
120 | openRightInspectorAction->setCheckable(true); | |
121 |
|
121 | |||
122 | auto openInspector = [this](bool checked, bool right, auto action) { |
|
122 | auto openInspector = [this](bool checked, bool right, auto action) { | |
123 |
|
123 | |||
124 | action->setIcon(QIcon{(checked xor right) ? ":/icones/next.png" : ":/icones/previous.png"}); |
|
124 | action->setIcon(QIcon{(checked xor right) ? ":/icones/next.png" : ":/icones/previous.png"}); | |
125 |
|
125 | |||
126 | auto &lastInspectorSize |
|
126 | auto &lastInspectorSize | |
127 | = right ? impl->m_LastOpenRightInspectorSize : impl->m_LastOpenLeftInspectorSize; |
|
127 | = right ? impl->m_LastOpenRightInspectorSize : impl->m_LastOpenLeftInspectorSize; | |
128 |
|
128 | |||
129 | auto nextInspectorSize = right ? m_Ui->rightMainInspectorWidget->size() |
|
129 | auto nextInspectorSize = right ? m_Ui->rightMainInspectorWidget->size() | |
130 | : m_Ui->leftMainInspectorWidget->size(); |
|
130 | : m_Ui->leftMainInspectorWidget->size(); | |
131 |
|
131 | |||
132 | // Update of the last opened geometry |
|
132 | // Update of the last opened geometry | |
133 | if (checked) { |
|
133 | if (checked) { | |
134 | lastInspectorSize = nextInspectorSize; |
|
134 | lastInspectorSize = nextInspectorSize; | |
135 | } |
|
135 | } | |
136 |
|
136 | |||
137 | auto startSize = lastInspectorSize; |
|
137 | auto startSize = lastInspectorSize; | |
138 | auto endSize = startSize; |
|
138 | auto endSize = startSize; | |
139 | endSize.setWidth(0); |
|
139 | endSize.setWidth(0); | |
140 |
|
140 | |||
141 | auto splitterInspectorIndex |
|
141 | auto splitterInspectorIndex | |
142 | = right ? RIGHTMAININSPECTORWIDGETSPLITTERINDEX : LEFTMAININSPECTORWIDGETSPLITTERINDEX; |
|
142 | = right ? RIGHTMAININSPECTORWIDGETSPLITTERINDEX : LEFTMAININSPECTORWIDGETSPLITTERINDEX; | |
143 |
|
143 | |||
144 | auto currentSizes = m_Ui->splitter->sizes(); |
|
144 | auto currentSizes = m_Ui->splitter->sizes(); | |
145 | if (checked) { |
|
145 | if (checked) { | |
146 | // adjust sizes individually here, e.g. |
|
146 | // adjust sizes individually here, e.g. | |
147 | currentSizes[splitterInspectorIndex] -= lastInspectorSize.width(); |
|
147 | currentSizes[splitterInspectorIndex] -= lastInspectorSize.width(); | |
148 | currentSizes[VIEWPLITTERINDEX] += lastInspectorSize.width(); |
|
148 | currentSizes[VIEWPLITTERINDEX] += lastInspectorSize.width(); | |
149 | m_Ui->splitter->setSizes(currentSizes); |
|
149 | m_Ui->splitter->setSizes(currentSizes); | |
150 | } |
|
150 | } | |
151 | else { |
|
151 | else { | |
152 | // adjust sizes individually here, e.g. |
|
152 | // adjust sizes individually here, e.g. | |
153 | currentSizes[splitterInspectorIndex] += lastInspectorSize.width(); |
|
153 | currentSizes[splitterInspectorIndex] += lastInspectorSize.width(); | |
154 | currentSizes[VIEWPLITTERINDEX] -= lastInspectorSize.width(); |
|
154 | currentSizes[VIEWPLITTERINDEX] -= lastInspectorSize.width(); | |
155 | m_Ui->splitter->setSizes(currentSizes); |
|
155 | m_Ui->splitter->setSizes(currentSizes); | |
156 | } |
|
156 | } | |
157 |
|
157 | |||
158 | }; |
|
158 | }; | |
159 |
|
159 | |||
160 |
|
160 | |||
161 | connect(openLeftInspectorAction, &QAction::triggered, |
|
161 | connect(openLeftInspectorAction, &QAction::triggered, | |
162 | [openInspector, openLeftInspectorAction](bool checked) { |
|
162 | [openInspector, openLeftInspectorAction](bool checked) { | |
163 | openInspector(checked, false, openLeftInspectorAction); |
|
163 | openInspector(checked, false, openLeftInspectorAction); | |
164 | }); |
|
164 | }); | |
165 | connect(openRightInspectorAction, &QAction::triggered, |
|
165 | connect(openRightInspectorAction, &QAction::triggered, | |
166 | [openInspector, openRightInspectorAction](bool checked) { |
|
166 | [openInspector, openRightInspectorAction](bool checked) { | |
167 | openInspector(checked, true, openRightInspectorAction); |
|
167 | openInspector(checked, true, openRightInspectorAction); | |
168 | }); |
|
168 | }); | |
169 |
|
169 | |||
170 | this->menuBar()->addAction(tr("File")); |
|
170 | this->menuBar()->addAction(tr("File")); | |
171 | auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar")); |
|
171 | auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar")); | |
172 |
|
172 | |||
173 | auto timeWidget = new TimeWidget{}; |
|
173 | auto timeWidget = new TimeWidget{}; | |
174 | mainToolBar->addWidget(timeWidget); |
|
174 | mainToolBar->addWidget(timeWidget); | |
175 |
|
175 | |||
176 | // Controllers / controllers connections |
|
176 | // Controllers / controllers connections | |
177 | connect(&sqpApp->timeController(), SIGNAL(timeUpdated(SqpDateTime)), |
|
177 | connect(&sqpApp->timeController(), SIGNAL(timeUpdated(SqpDateTime)), | |
178 | &sqpApp->variableController(), SLOT(onDateTimeOnSelection(SqpDateTime))); |
|
178 | &sqpApp->variableController(), SLOT(onDateTimeOnSelection(SqpDateTime))); | |
179 |
|
179 | |||
180 | // Widgets / controllers connections |
|
180 | // Widgets / controllers connections | |
181 |
|
181 | |||
182 | // DataSource |
|
182 | // DataSource | |
183 | connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)), |
|
183 | connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)), | |
184 | m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *))); |
|
184 | m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *))); | |
185 |
|
185 | |||
186 | // Time |
|
186 | // Time | |
187 | connect(timeWidget, SIGNAL(timeUpdated(SqpDateTime)), &sqpApp->timeController(), |
|
187 | connect(timeWidget, SIGNAL(timeUpdated(SqpDateTime)), &sqpApp->timeController(), | |
188 | SLOT(onTimeToUpdate(SqpDateTime))); |
|
188 | SLOT(onTimeToUpdate(SqpDateTime))); | |
189 |
|
189 | |||
190 | // Visualization |
|
190 | // Visualization | |
191 | connect(&sqpApp->visualizationController(), |
|
191 | connect(&sqpApp->visualizationController(), | |
192 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), m_Ui->view, |
|
192 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), m_Ui->view, | |
193 | SLOT(onVariableAboutToBeDeleted(std::shared_ptr<Variable>))); |
|
193 | SLOT(onVariableAboutToBeDeleted(std::shared_ptr<Variable>))); | |
194 |
|
194 | |||
|
195 | connect(&sqpApp->visualizationController(), | |||
|
196 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpDateTime &)), m_Ui->view, | |||
|
197 | SLOT(onRangeChanged(std::shared_ptr<Variable>, const SqpDateTime &))); | |||
|
198 | ||||
195 | // Widgets / widgets connections |
|
199 | // Widgets / widgets connections | |
196 |
|
200 | |||
197 | // For the following connections, we use DirectConnection to allow each widget that can |
|
201 | // For the following connections, we use DirectConnection to allow each widget that can | |
198 | // potentially attach a menu to the variable's menu to do so before this menu is displayed. |
|
202 | // potentially attach a menu to the variable's menu to do so before this menu is displayed. | |
199 | // The order of connections is also important, since it determines the order in which each |
|
203 | // The order of connections is also important, since it determines the order in which each | |
200 | // widget will attach its menu |
|
204 | // widget will attach its menu | |
201 | connect( |
|
205 | connect( | |
202 | m_Ui->variableInspectorWidget, |
|
206 | m_Ui->variableInspectorWidget, | |
203 | SIGNAL(tableMenuAboutToBeDisplayed(QMenu *, const QVector<std::shared_ptr<Variable> > &)), |
|
207 | SIGNAL(tableMenuAboutToBeDisplayed(QMenu *, const QVector<std::shared_ptr<Variable> > &)), | |
204 | m_Ui->view, SLOT(attachVariableMenu(QMenu *, const QVector<std::shared_ptr<Variable> > &)), |
|
208 | m_Ui->view, SLOT(attachVariableMenu(QMenu *, const QVector<std::shared_ptr<Variable> > &)), | |
205 | Qt::DirectConnection); |
|
209 | Qt::DirectConnection); | |
206 |
|
210 | |||
207 | /* QLopGUI::registerMenuBar(menuBar()); |
|
211 | /* QLopGUI::registerMenuBar(menuBar()); | |
208 | this->setWindowIcon(QIcon(":/sciqlopLOGO.svg")); |
|
212 | this->setWindowIcon(QIcon(":/sciqlopLOGO.svg")); | |
209 | this->m_progressWidget = new QWidget(); |
|
213 | this->m_progressWidget = new QWidget(); | |
210 | this->m_progressLayout = new QVBoxLayout(this->m_progressWidget); |
|
214 | this->m_progressLayout = new QVBoxLayout(this->m_progressWidget); | |
211 | this->m_progressWidget->setLayout(this->m_progressLayout); |
|
215 | this->m_progressWidget->setLayout(this->m_progressLayout); | |
212 | this->m_progressWidget->setWindowModality(Qt::WindowModal); |
|
216 | this->m_progressWidget->setWindowModality(Qt::WindowModal); | |
213 | m_progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int)); |
|
217 | m_progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int)); | |
214 | for(int i=0;i<OMP_THREADS;i++) |
|
218 | for(int i=0;i<OMP_THREADS;i++) | |
215 | { |
|
219 | { | |
216 | this->m_progress.append(new QProgressBar(this->m_progressWidget)); |
|
220 | this->m_progress.append(new QProgressBar(this->m_progressWidget)); | |
217 | this->m_progress.last()->setMinimum(0); |
|
221 | this->m_progress.last()->setMinimum(0); | |
218 | this->m_progress.last()->setMaximum(100); |
|
222 | this->m_progress.last()->setMaximum(100); | |
219 | this->m_progressLayout->addWidget(this->m_progress.last()); |
|
223 | this->m_progressLayout->addWidget(this->m_progress.last()); | |
220 | this->m_progressWidget->hide(); |
|
224 | this->m_progressWidget->hide(); | |
221 | this->m_progressThreadIds[i] = -1; |
|
225 | this->m_progressThreadIds[i] = -1; | |
222 | } |
|
226 | } | |
223 | this->m_progressWidget->setWindowTitle("Loading File"); |
|
227 | this->m_progressWidget->setWindowTitle("Loading File"); | |
224 | const QList<QLopService*>ServicesToLoad=QList<QLopService*>() |
|
228 | const QList<QLopService*>ServicesToLoad=QList<QLopService*>() | |
225 | << QLopCore::self() |
|
229 | << QLopCore::self() | |
226 | << QLopPlotManager::self() |
|
230 | << QLopPlotManager::self() | |
227 | << QLopCodecManager::self() |
|
231 | << QLopCodecManager::self() | |
228 | << FileDownloader::self() |
|
232 | << FileDownloader::self() | |
229 | << QLopDataBase::self() |
|
233 | << QLopDataBase::self() | |
230 | << SpaceData::self(); |
|
234 | << SpaceData::self(); | |
231 |
|
235 | |||
232 | CDFCodec::registerToManager(); |
|
236 | CDFCodec::registerToManager(); | |
233 | AMDATXTCodec::registerToManager(); |
|
237 | AMDATXTCodec::registerToManager(); | |
234 |
|
238 | |||
235 |
|
239 | |||
236 | for(int i=0;i<ServicesToLoad.count();i++) |
|
240 | for(int i=0;i<ServicesToLoad.count();i++) | |
237 | { |
|
241 | { | |
238 | qDebug()<<ServicesToLoad.at(i)->serviceName(); |
|
242 | qDebug()<<ServicesToLoad.at(i)->serviceName(); | |
239 | ServicesToLoad.at(i)->initialize(); //must be called before getGUI |
|
243 | ServicesToLoad.at(i)->initialize(); //must be called before getGUI | |
240 | QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI(); |
|
244 | QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI(); | |
241 | if(wdgt) |
|
245 | if(wdgt) | |
242 | { |
|
246 | { | |
243 | wdgt->setAllowedAreas(Qt::AllDockWidgetAreas); |
|
247 | wdgt->setAllowedAreas(Qt::AllDockWidgetAreas); | |
244 | this->addDockWidget(Qt::TopDockWidgetArea,wdgt); |
|
248 | this->addDockWidget(Qt::TopDockWidgetArea,wdgt); | |
245 | } |
|
249 | } | |
246 | PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i)); |
|
250 | PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i)); | |
247 | }*/ |
|
251 | }*/ | |
248 | } |
|
252 | } | |
249 |
|
253 | |||
250 | MainWindow::~MainWindow() |
|
254 | MainWindow::~MainWindow() | |
251 | { |
|
255 | { | |
252 | } |
|
256 | } | |
253 |
|
257 | |||
254 |
|
258 | |||
255 | void MainWindow::changeEvent(QEvent *e) |
|
259 | void MainWindow::changeEvent(QEvent *e) | |
256 | { |
|
260 | { | |
257 | QMainWindow::changeEvent(e); |
|
261 | QMainWindow::changeEvent(e); | |
258 | switch (e->type()) { |
|
262 | switch (e->type()) { | |
259 | case QEvent::LanguageChange: |
|
263 | case QEvent::LanguageChange: | |
260 | m_Ui->retranslateUi(this); |
|
264 | m_Ui->retranslateUi(this); | |
261 | break; |
|
265 | break; | |
262 | default: |
|
266 | default: | |
263 | break; |
|
267 | break; | |
264 | } |
|
268 | } | |
265 | } |
|
269 | } |
@@ -1,92 +1,95 | |||||
1 | #ifndef SCIQLOP_VARIABLECONTROLLER_H |
|
1 | #ifndef SCIQLOP_VARIABLECONTROLLER_H | |
2 | #define SCIQLOP_VARIABLECONTROLLER_H |
|
2 | #define SCIQLOP_VARIABLECONTROLLER_H | |
3 |
|
3 | |||
4 | #include <Data/SqpDateTime.h> |
|
4 | #include <Data/SqpDateTime.h> | |
5 |
|
5 | |||
6 | #include <QLoggingCategory> |
|
6 | #include <QLoggingCategory> | |
7 | #include <QObject> |
|
7 | #include <QObject> | |
8 |
|
8 | |||
9 | #include <Common/spimpl.h> |
|
9 | #include <Common/spimpl.h> | |
10 |
|
10 | |||
11 | class IDataProvider; |
|
11 | class IDataProvider; | |
12 | class QItemSelectionModel; |
|
12 | class QItemSelectionModel; | |
13 | class TimeController; |
|
13 | class TimeController; | |
14 | class Variable; |
|
14 | class Variable; | |
15 | class VariableModel; |
|
15 | class VariableModel; | |
16 |
|
16 | |||
17 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableController) |
|
17 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableController) | |
18 |
|
18 | |||
19 | /** |
|
19 | /** | |
20 | * @brief The VariableController class aims to handle the variables in SciQlop. |
|
20 | * @brief The VariableController class aims to handle the variables in SciQlop. | |
21 | */ |
|
21 | */ | |
22 | class VariableController : public QObject { |
|
22 | class VariableController : public QObject { | |
23 | Q_OBJECT |
|
23 | Q_OBJECT | |
24 | public: |
|
24 | public: | |
25 | explicit VariableController(QObject *parent = 0); |
|
25 | explicit VariableController(QObject *parent = 0); | |
26 | virtual ~VariableController(); |
|
26 | virtual ~VariableController(); | |
27 |
|
27 | |||
28 | VariableModel *variableModel() noexcept; |
|
28 | VariableModel *variableModel() noexcept; | |
29 | QItemSelectionModel *variableSelectionModel() noexcept; |
|
29 | QItemSelectionModel *variableSelectionModel() noexcept; | |
30 |
|
30 | |||
31 | void setTimeController(TimeController *timeController) noexcept; |
|
31 | void setTimeController(TimeController *timeController) noexcept; | |
32 |
|
32 | |||
33 | /** |
|
33 | /** | |
34 | * Deletes from the controller the variable passed in parameter. |
|
34 | * Deletes from the controller the variable passed in parameter. | |
35 | * |
|
35 | * | |
36 | * Delete a variable includes: |
|
36 | * Delete a variable includes: | |
37 | * - the deletion of the various references to the variable in SciQlop |
|
37 | * - the deletion of the various references to the variable in SciQlop | |
38 | * - the deletion of the model variable |
|
38 | * - the deletion of the model variable | |
39 | * - the deletion of the provider associated with the variable |
|
39 | * - the deletion of the provider associated with the variable | |
40 | * - removing the cache associated with the variable |
|
40 | * - removing the cache associated with the variable | |
41 | * |
|
41 | * | |
42 | * @param variable the variable to delete from the controller. |
|
42 | * @param variable the variable to delete from the controller. | |
43 | */ |
|
43 | */ | |
44 | void deleteVariable(std::shared_ptr<Variable> variable) noexcept; |
|
44 | void deleteVariable(std::shared_ptr<Variable> variable) noexcept; | |
45 |
|
45 | |||
46 | /** |
|
46 | /** | |
47 | * Deletes from the controller the variables passed in parameter. |
|
47 | * Deletes from the controller the variables passed in parameter. | |
48 | * @param variables the variables to delete from the controller. |
|
48 | * @param variables the variables to delete from the controller. | |
49 | * @sa deleteVariable() |
|
49 | * @sa deleteVariable() | |
50 | */ |
|
50 | */ | |
51 | void deleteVariables(const QVector<std::shared_ptr<Variable> > &variables) noexcept; |
|
51 | void deleteVariables(const QVector<std::shared_ptr<Variable> > &variables) noexcept; | |
52 |
|
52 | |||
53 | /** |
|
53 | /** | |
54 | * @brief abort the variable retrieve data progression |
|
54 | * @brief abort the variable retrieve data progression | |
55 | */ |
|
55 | */ | |
56 | void abortProgress(std::shared_ptr<Variable> variable); |
|
56 | void abortProgress(std::shared_ptr<Variable> variable); | |
57 |
|
57 | |||
58 | signals: |
|
58 | signals: | |
59 | /// Signal emitted when a variable is about to be deleted from the controller |
|
59 | /// Signal emitted when a variable is about to be deleted from the controller | |
60 | void variableAboutToBeDeleted(std::shared_ptr<Variable> variable); |
|
60 | void variableAboutToBeDeleted(std::shared_ptr<Variable> variable); | |
61 |
|
61 | |||
|
62 | /// Signal emitted when a data acquisition is requested on a range for a variable | |||
|
63 | void rangeChanged(std::shared_ptr<Variable> variable, const SqpDateTime &range); | |||
|
64 | ||||
62 | public slots: |
|
65 | public slots: | |
63 | /// Request the data loading of the variable whithin dateTime |
|
66 | /// Request the data loading of the variable whithin dateTime | |
64 | void onRequestDataLoading(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime); |
|
67 | void onRequestDataLoading(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime); | |
65 | /** |
|
68 | /** | |
66 | * Creates a new variable and adds it to the model |
|
69 | * Creates a new variable and adds it to the model | |
67 | * @param name the name of the new variable |
|
70 | * @param name the name of the new variable | |
68 | * @param metadata the metadata of the new variable |
|
71 | * @param metadata the metadata of the new variable | |
69 | * @param provider the data provider for the new variable |
|
72 | * @param provider the data provider for the new variable | |
70 | */ |
|
73 | */ | |
71 | void createVariable(const QString &name, const QVariantHash &metadata, |
|
74 | void createVariable(const QString &name, const QVariantHash &metadata, | |
72 | std::shared_ptr<IDataProvider> provider) noexcept; |
|
75 | std::shared_ptr<IDataProvider> provider) noexcept; | |
73 |
|
76 | |||
74 | /// Update the temporal parameters of every selected variable to dateTime |
|
77 | /// Update the temporal parameters of every selected variable to dateTime | |
75 | void onDateTimeOnSelection(const SqpDateTime &dateTime); |
|
78 | void onDateTimeOnSelection(const SqpDateTime &dateTime); | |
76 |
|
79 | |||
77 |
|
80 | |||
78 | void onVariableRetrieveDataInProgress(QUuid identifier, double progress); |
|
81 | void onVariableRetrieveDataInProgress(QUuid identifier, double progress); | |
79 |
|
82 | |||
80 | void onAbortProgressRequested(std::shared_ptr<Variable> variable); |
|
83 | void onAbortProgressRequested(std::shared_ptr<Variable> variable); | |
81 |
|
84 | |||
82 | void initialize(); |
|
85 | void initialize(); | |
83 | void finalize(); |
|
86 | void finalize(); | |
84 |
|
87 | |||
85 | private: |
|
88 | private: | |
86 | void waitForFinish(); |
|
89 | void waitForFinish(); | |
87 |
|
90 | |||
88 | class VariableControllerPrivate; |
|
91 | class VariableControllerPrivate; | |
89 | spimpl::unique_impl_ptr<VariableControllerPrivate> impl; |
|
92 | spimpl::unique_impl_ptr<VariableControllerPrivate> impl; | |
90 | }; |
|
93 | }; | |
91 |
|
94 | |||
92 | #endif // SCIQLOP_VARIABLECONTROLLER_H |
|
95 | #endif // SCIQLOP_VARIABLECONTROLLER_H |
@@ -1,44 +1,49 | |||||
1 | #ifndef SCIQLOP_VISUALIZATIONCONTROLLER_H |
|
1 | #ifndef SCIQLOP_VISUALIZATIONCONTROLLER_H | |
2 | #define SCIQLOP_VISUALIZATIONCONTROLLER_H |
|
2 | #define SCIQLOP_VISUALIZATIONCONTROLLER_H | |
3 |
|
3 | |||
|
4 | #include <Data/SqpDateTime.h> | |||
|
5 | ||||
4 | #include <QLoggingCategory> |
|
6 | #include <QLoggingCategory> | |
5 | #include <QObject> |
|
7 | #include <QObject> | |
6 | #include <QUuid> |
|
8 | #include <QUuid> | |
7 |
|
9 | |||
8 | #include <Common/spimpl.h> |
|
10 | #include <Common/spimpl.h> | |
9 |
|
11 | |||
10 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationController) |
|
12 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationController) | |
11 |
|
13 | |||
12 | class DataSourceItem; |
|
14 | class DataSourceItem; | |
13 | class Variable; |
|
15 | class Variable; | |
14 |
|
16 | |||
15 | /** |
|
17 | /** | |
16 | * @brief The VisualizationController class aims to make the link between SciQlop and its plugins. |
|
18 | * @brief The VisualizationController class aims to make the link between SciQlop and its plugins. | |
17 | * This is the intermediate class that SciQlop has to use in the way to connect a data source. |
|
19 | * This is the intermediate class that SciQlop has to use in the way to connect a data source. | |
18 | * Please first use register method to initialize a plugin specified by its metadata name (JSON |
|
20 | * Please first use register method to initialize a plugin specified by its metadata name (JSON | |
19 | * plugin source) then others specifics method will be able to access it. You can load a data source |
|
21 | * plugin source) then others specifics method will be able to access it. You can load a data source | |
20 | * driver plugin then create a data source. |
|
22 | * driver plugin then create a data source. | |
21 | */ |
|
23 | */ | |
22 | class VisualizationController : public QObject { |
|
24 | class VisualizationController : public QObject { | |
23 | Q_OBJECT |
|
25 | Q_OBJECT | |
24 | public: |
|
26 | public: | |
25 | explicit VisualizationController(QObject *parent = 0); |
|
27 | explicit VisualizationController(QObject *parent = 0); | |
26 | virtual ~VisualizationController(); |
|
28 | virtual ~VisualizationController(); | |
27 |
|
29 | |||
28 | signals: |
|
30 | signals: | |
29 | /// Signal emitted when a variable is about to be deleted from SciQlop |
|
31 | /// Signal emitted when a variable is about to be deleted from SciQlop | |
30 | void variableAboutToBeDeleted(std::shared_ptr<Variable> variable); |
|
32 | void variableAboutToBeDeleted(std::shared_ptr<Variable> variable); | |
31 |
|
33 | |||
|
34 | /// Signal emitted when a data acquisition is requested on a range for a variable | |||
|
35 | void rangeChanged(std::shared_ptr<Variable> variable, const SqpDateTime &range); | |||
|
36 | ||||
32 | public slots: |
|
37 | public slots: | |
33 | /// Manage init/end of the controller |
|
38 | /// Manage init/end of the controller | |
34 | void initialize(); |
|
39 | void initialize(); | |
35 | void finalize(); |
|
40 | void finalize(); | |
36 |
|
41 | |||
37 | private: |
|
42 | private: | |
38 | void waitForFinish(); |
|
43 | void waitForFinish(); | |
39 |
|
44 | |||
40 | class VisualizationControllerPrivate; |
|
45 | class VisualizationControllerPrivate; | |
41 | spimpl::unique_impl_ptr<VisualizationControllerPrivate> impl; |
|
46 | spimpl::unique_impl_ptr<VisualizationControllerPrivate> impl; | |
42 | }; |
|
47 | }; | |
43 |
|
48 | |||
44 | #endif // SCIQLOP_VISUALIZATIONCONTROLLER_H |
|
49 | #endif // SCIQLOP_VISUALIZATIONCONTROLLER_H |
@@ -1,241 +1,242 | |||||
1 | #include <Variable/Variable.h> |
|
1 | #include <Variable/Variable.h> | |
2 | #include <Variable/VariableCacheController.h> |
|
2 | #include <Variable/VariableCacheController.h> | |
3 | #include <Variable/VariableController.h> |
|
3 | #include <Variable/VariableController.h> | |
4 | #include <Variable/VariableModel.h> |
|
4 | #include <Variable/VariableModel.h> | |
5 |
|
5 | |||
6 | #include <Data/DataProviderParameters.h> |
|
6 | #include <Data/DataProviderParameters.h> | |
7 | #include <Data/IDataProvider.h> |
|
7 | #include <Data/IDataProvider.h> | |
8 | #include <Data/IDataSeries.h> |
|
8 | #include <Data/IDataSeries.h> | |
9 | #include <Time/TimeController.h> |
|
9 | #include <Time/TimeController.h> | |
10 |
|
10 | |||
11 | #include <QDateTime> |
|
11 | #include <QDateTime> | |
12 | #include <QMutex> |
|
12 | #include <QMutex> | |
13 | #include <QThread> |
|
13 | #include <QThread> | |
14 | #include <QUuid> |
|
14 | #include <QUuid> | |
15 | #include <QtCore/QItemSelectionModel> |
|
15 | #include <QtCore/QItemSelectionModel> | |
16 |
|
16 | |||
17 | #include <unordered_map> |
|
17 | #include <unordered_map> | |
18 |
|
18 | |||
19 | Q_LOGGING_CATEGORY(LOG_VariableController, "VariableController") |
|
19 | Q_LOGGING_CATEGORY(LOG_VariableController, "VariableController") | |
20 |
|
20 | |||
21 | struct VariableController::VariableControllerPrivate { |
|
21 | struct VariableController::VariableControllerPrivate { | |
22 | explicit VariableControllerPrivate(VariableController *parent) |
|
22 | explicit VariableControllerPrivate(VariableController *parent) | |
23 | : m_WorkingMutex{}, |
|
23 | : m_WorkingMutex{}, | |
24 | m_VariableModel{new VariableModel{parent}}, |
|
24 | m_VariableModel{new VariableModel{parent}}, | |
25 | m_VariableSelectionModel{new QItemSelectionModel{m_VariableModel, parent}}, |
|
25 | m_VariableSelectionModel{new QItemSelectionModel{m_VariableModel, parent}}, | |
26 | m_VariableCacheController{std::make_unique<VariableCacheController>()} |
|
26 | m_VariableCacheController{std::make_unique<VariableCacheController>()} | |
27 | { |
|
27 | { | |
28 | } |
|
28 | } | |
29 |
|
29 | |||
30 | QMutex m_WorkingMutex; |
|
30 | QMutex m_WorkingMutex; | |
31 | /// Variable model. The VariableController has the ownership |
|
31 | /// Variable model. The VariableController has the ownership | |
32 | VariableModel *m_VariableModel; |
|
32 | VariableModel *m_VariableModel; | |
33 | QItemSelectionModel *m_VariableSelectionModel; |
|
33 | QItemSelectionModel *m_VariableSelectionModel; | |
34 |
|
34 | |||
35 |
|
35 | |||
36 | TimeController *m_TimeController{nullptr}; |
|
36 | TimeController *m_TimeController{nullptr}; | |
37 | std::unique_ptr<VariableCacheController> m_VariableCacheController; |
|
37 | std::unique_ptr<VariableCacheController> m_VariableCacheController; | |
38 |
|
38 | |||
39 | std::unordered_map<std::shared_ptr<Variable>, std::shared_ptr<IDataProvider> > |
|
39 | std::unordered_map<std::shared_ptr<Variable>, std::shared_ptr<IDataProvider> > | |
40 | m_VariableToProviderMap; |
|
40 | m_VariableToProviderMap; | |
41 | std::unordered_map<std::shared_ptr<Variable>, QUuid> m_VariableToIdentifierMap; |
|
41 | std::unordered_map<std::shared_ptr<Variable>, QUuid> m_VariableToIdentifierMap; | |
42 | }; |
|
42 | }; | |
43 |
|
43 | |||
44 | VariableController::VariableController(QObject *parent) |
|
44 | VariableController::VariableController(QObject *parent) | |
45 | : QObject{parent}, impl{spimpl::make_unique_impl<VariableControllerPrivate>(this)} |
|
45 | : QObject{parent}, impl{spimpl::make_unique_impl<VariableControllerPrivate>(this)} | |
46 | { |
|
46 | { | |
47 | qCDebug(LOG_VariableController()) << tr("VariableController construction") |
|
47 | qCDebug(LOG_VariableController()) << tr("VariableController construction") | |
48 | << QThread::currentThread(); |
|
48 | << QThread::currentThread(); | |
49 |
|
49 | |||
50 | connect(impl->m_VariableModel, &VariableModel::abortProgessRequested, this, |
|
50 | connect(impl->m_VariableModel, &VariableModel::abortProgessRequested, this, | |
51 | &VariableController::onAbortProgressRequested); |
|
51 | &VariableController::onAbortProgressRequested); | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | VariableController::~VariableController() |
|
54 | VariableController::~VariableController() | |
55 | { |
|
55 | { | |
56 | qCDebug(LOG_VariableController()) << tr("VariableController destruction") |
|
56 | qCDebug(LOG_VariableController()) << tr("VariableController destruction") | |
57 | << QThread::currentThread(); |
|
57 | << QThread::currentThread(); | |
58 | this->waitForFinish(); |
|
58 | this->waitForFinish(); | |
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 | VariableModel *VariableController::variableModel() noexcept |
|
61 | VariableModel *VariableController::variableModel() noexcept | |
62 | { |
|
62 | { | |
63 | return impl->m_VariableModel; |
|
63 | return impl->m_VariableModel; | |
64 | } |
|
64 | } | |
65 |
|
65 | |||
66 | QItemSelectionModel *VariableController::variableSelectionModel() noexcept |
|
66 | QItemSelectionModel *VariableController::variableSelectionModel() noexcept | |
67 | { |
|
67 | { | |
68 | return impl->m_VariableSelectionModel; |
|
68 | return impl->m_VariableSelectionModel; | |
69 | } |
|
69 | } | |
70 |
|
70 | |||
71 | void VariableController::setTimeController(TimeController *timeController) noexcept |
|
71 | void VariableController::setTimeController(TimeController *timeController) noexcept | |
72 | { |
|
72 | { | |
73 | impl->m_TimeController = timeController; |
|
73 | impl->m_TimeController = timeController; | |
74 | } |
|
74 | } | |
75 |
|
75 | |||
76 | void VariableController::deleteVariable(std::shared_ptr<Variable> variable) noexcept |
|
76 | void VariableController::deleteVariable(std::shared_ptr<Variable> variable) noexcept | |
77 | { |
|
77 | { | |
78 | if (!variable) { |
|
78 | if (!variable) { | |
79 | qCCritical(LOG_VariableController()) << "Can't delete variable: variable is null"; |
|
79 | qCCritical(LOG_VariableController()) << "Can't delete variable: variable is null"; | |
80 | return; |
|
80 | return; | |
81 | } |
|
81 | } | |
82 |
|
82 | |||
83 | // Spreads in SciQlop that the variable will be deleted, so that potential receivers can |
|
83 | // Spreads in SciQlop that the variable will be deleted, so that potential receivers can | |
84 | // make some treatments before the deletion |
|
84 | // make some treatments before the deletion | |
85 | emit variableAboutToBeDeleted(variable); |
|
85 | emit variableAboutToBeDeleted(variable); | |
86 |
|
86 | |||
87 | // Deletes identifier |
|
87 | // Deletes identifier | |
88 | impl->m_VariableToIdentifierMap.erase(variable); |
|
88 | impl->m_VariableToIdentifierMap.erase(variable); | |
89 |
|
89 | |||
90 | // Deletes provider |
|
90 | // Deletes provider | |
91 | auto nbProvidersDeleted = impl->m_VariableToProviderMap.erase(variable); |
|
91 | auto nbProvidersDeleted = impl->m_VariableToProviderMap.erase(variable); | |
92 | qCDebug(LOG_VariableController()) |
|
92 | qCDebug(LOG_VariableController()) | |
93 | << tr("Number of providers deleted for variable %1: %2") |
|
93 | << tr("Number of providers deleted for variable %1: %2") | |
94 | .arg(variable->name(), QString::number(nbProvidersDeleted)); |
|
94 | .arg(variable->name(), QString::number(nbProvidersDeleted)); | |
95 |
|
95 | |||
96 | // Clears cache |
|
96 | // Clears cache | |
97 | impl->m_VariableCacheController->clear(variable); |
|
97 | impl->m_VariableCacheController->clear(variable); | |
98 |
|
98 | |||
99 | // Deletes from model |
|
99 | // Deletes from model | |
100 | impl->m_VariableModel->deleteVariable(variable); |
|
100 | impl->m_VariableModel->deleteVariable(variable); | |
101 | } |
|
101 | } | |
102 |
|
102 | |||
103 | void VariableController::deleteVariables( |
|
103 | void VariableController::deleteVariables( | |
104 | const QVector<std::shared_ptr<Variable> > &variables) noexcept |
|
104 | const QVector<std::shared_ptr<Variable> > &variables) noexcept | |
105 | { |
|
105 | { | |
106 | for (auto variable : qAsConst(variables)) { |
|
106 | for (auto variable : qAsConst(variables)) { | |
107 | deleteVariable(variable); |
|
107 | deleteVariable(variable); | |
108 | } |
|
108 | } | |
109 | } |
|
109 | } | |
110 |
|
110 | |||
111 | void VariableController::abortProgress(std::shared_ptr<Variable> variable) |
|
111 | void VariableController::abortProgress(std::shared_ptr<Variable> variable) | |
112 | { |
|
112 | { | |
113 | } |
|
113 | } | |
114 |
|
114 | |||
115 | void VariableController::createVariable(const QString &name, const QVariantHash &metadata, |
|
115 | void VariableController::createVariable(const QString &name, const QVariantHash &metadata, | |
116 | std::shared_ptr<IDataProvider> provider) noexcept |
|
116 | std::shared_ptr<IDataProvider> provider) noexcept | |
117 | { |
|
117 | { | |
118 |
|
118 | |||
119 | if (!impl->m_TimeController) { |
|
119 | if (!impl->m_TimeController) { | |
120 | qCCritical(LOG_VariableController()) |
|
120 | qCCritical(LOG_VariableController()) | |
121 | << tr("Impossible to create variable: The time controller is null"); |
|
121 | << tr("Impossible to create variable: The time controller is null"); | |
122 | return; |
|
122 | return; | |
123 | } |
|
123 | } | |
124 |
|
124 | |||
125 | auto dateTime = impl->m_TimeController->dateTime(); |
|
125 | auto dateTime = impl->m_TimeController->dateTime(); | |
126 |
|
126 | |||
127 | if (auto newVariable = impl->m_VariableModel->createVariable(name, dateTime, metadata)) { |
|
127 | if (auto newVariable = impl->m_VariableModel->createVariable(name, dateTime, metadata)) { | |
128 | auto identifier = QUuid::createUuid(); |
|
128 | auto identifier = QUuid::createUuid(); | |
129 |
|
129 | |||
130 | // store the provider |
|
130 | // store the provider | |
131 | impl->m_VariableToProviderMap[newVariable] = provider; |
|
131 | impl->m_VariableToProviderMap[newVariable] = provider; | |
132 | impl->m_VariableToIdentifierMap[newVariable] = identifier; |
|
132 | impl->m_VariableToIdentifierMap[newVariable] = identifier; | |
133 |
|
133 | |||
134 | auto addDateTimeAcquired = [ this, varW = std::weak_ptr<Variable>{newVariable} ]( |
|
134 | auto addDateTimeAcquired = [ this, varW = std::weak_ptr<Variable>{newVariable} ]( | |
135 | QUuid identifier, auto dataSeriesAcquired, auto dateTimeToPutInCache) |
|
135 | QUuid identifier, auto dataSeriesAcquired, auto dateTimeToPutInCache) | |
136 | { |
|
136 | { | |
137 | if (auto variable = varW.lock()) { |
|
137 | if (auto variable = varW.lock()) { | |
138 | auto varIdentifier = impl->m_VariableToIdentifierMap.at(variable); |
|
138 | auto varIdentifier = impl->m_VariableToIdentifierMap.at(variable); | |
139 | if (varIdentifier == identifier) { |
|
139 | if (varIdentifier == identifier) { | |
140 | impl->m_VariableCacheController->addDateTime(variable, dateTimeToPutInCache); |
|
140 | impl->m_VariableCacheController->addDateTime(variable, dateTimeToPutInCache); | |
141 | variable->setDataSeries(dataSeriesAcquired); |
|
141 | variable->setDataSeries(dataSeriesAcquired); | |
142 | emit variable->updated(); |
|
142 | emit variable->updated(); | |
143 | } |
|
143 | } | |
144 | } |
|
144 | } | |
145 | }; |
|
145 | }; | |
146 |
|
146 | |||
147 | connect(provider.get(), &IDataProvider::dataProvided, addDateTimeAcquired); |
|
147 | connect(provider.get(), &IDataProvider::dataProvided, addDateTimeAcquired); | |
148 | connect(provider.get(), &IDataProvider::dataProvidedProgress, this, |
|
148 | connect(provider.get(), &IDataProvider::dataProvidedProgress, this, | |
149 | &VariableController::onVariableRetrieveDataInProgress); |
|
149 | &VariableController::onVariableRetrieveDataInProgress); | |
150 | this->onRequestDataLoading(newVariable, dateTime); |
|
150 | this->onRequestDataLoading(newVariable, dateTime); | |
151 | } |
|
151 | } | |
152 | } |
|
152 | } | |
153 |
|
153 | |||
154 | void VariableController::onDateTimeOnSelection(const SqpDateTime &dateTime) |
|
154 | void VariableController::onDateTimeOnSelection(const SqpDateTime &dateTime) | |
155 | { |
|
155 | { | |
156 | qCDebug(LOG_VariableController()) << "VariableController::onDateTimeOnSelection" |
|
156 | qCDebug(LOG_VariableController()) << "VariableController::onDateTimeOnSelection" | |
157 | << QThread::currentThread()->objectName(); |
|
157 | << QThread::currentThread()->objectName(); | |
158 | auto selectedRows = impl->m_VariableSelectionModel->selectedRows(); |
|
158 | auto selectedRows = impl->m_VariableSelectionModel->selectedRows(); | |
159 |
|
159 | |||
160 | for (const auto &selectedRow : qAsConst(selectedRows)) { |
|
160 | for (const auto &selectedRow : qAsConst(selectedRows)) { | |
161 | if (auto selectedVariable = impl->m_VariableModel->variable(selectedRow.row())) { |
|
161 | if (auto selectedVariable = impl->m_VariableModel->variable(selectedRow.row())) { | |
162 | selectedVariable->setDateTime(dateTime); |
|
162 | selectedVariable->setDateTime(dateTime); | |
163 | this->onRequestDataLoading(selectedVariable, dateTime); |
|
163 | this->onRequestDataLoading(selectedVariable, dateTime); | |
|
164 | emit rangeChanged(selectedVariable, dateTime); | |||
164 | } |
|
165 | } | |
165 | } |
|
166 | } | |
166 | } |
|
167 | } | |
167 |
|
168 | |||
168 | void VariableController::onVariableRetrieveDataInProgress(QUuid identifier, double progress) |
|
169 | void VariableController::onVariableRetrieveDataInProgress(QUuid identifier, double progress) | |
169 | { |
|
170 | { | |
170 | auto findReply = [identifier](const auto &entry) { return identifier == entry.second; }; |
|
171 | auto findReply = [identifier](const auto &entry) { return identifier == entry.second; }; | |
171 |
|
172 | |||
172 | auto end = impl->m_VariableToIdentifierMap.cend(); |
|
173 | auto end = impl->m_VariableToIdentifierMap.cend(); | |
173 | auto it = std::find_if(impl->m_VariableToIdentifierMap.cbegin(), end, findReply); |
|
174 | auto it = std::find_if(impl->m_VariableToIdentifierMap.cbegin(), end, findReply); | |
174 | if (it != end) { |
|
175 | if (it != end) { | |
175 | impl->m_VariableModel->setDataProgress(it->first, progress); |
|
176 | impl->m_VariableModel->setDataProgress(it->first, progress); | |
176 | } |
|
177 | } | |
177 | } |
|
178 | } | |
178 |
|
179 | |||
179 | void VariableController::onAbortProgressRequested(std::shared_ptr<Variable> variable) |
|
180 | void VariableController::onAbortProgressRequested(std::shared_ptr<Variable> variable) | |
180 | { |
|
181 | { | |
181 | qCDebug(LOG_VariableController()) << "TORM: VariableController::onAbortProgressRequested" |
|
182 | qCDebug(LOG_VariableController()) << "TORM: VariableController::onAbortProgressRequested" | |
182 | << QThread::currentThread()->objectName(); |
|
183 | << QThread::currentThread()->objectName(); | |
183 |
|
184 | |||
184 | auto it = impl->m_VariableToIdentifierMap.find(variable); |
|
185 | auto it = impl->m_VariableToIdentifierMap.find(variable); | |
185 | if (it != impl->m_VariableToIdentifierMap.cend()) { |
|
186 | if (it != impl->m_VariableToIdentifierMap.cend()) { | |
186 | impl->m_VariableToProviderMap.at(variable)->requestDataAborting(it->second); |
|
187 | impl->m_VariableToProviderMap.at(variable)->requestDataAborting(it->second); | |
187 | } |
|
188 | } | |
188 | else { |
|
189 | else { | |
189 | qCWarning(LOG_VariableController()) |
|
190 | qCWarning(LOG_VariableController()) | |
190 | << tr("Aborting progression of inexistant variable detected !!!") |
|
191 | << tr("Aborting progression of inexistant variable detected !!!") | |
191 | << QThread::currentThread()->objectName(); |
|
192 | << QThread::currentThread()->objectName(); | |
192 | } |
|
193 | } | |
193 | } |
|
194 | } | |
194 |
|
195 | |||
195 |
|
196 | |||
196 | void VariableController::onRequestDataLoading(std::shared_ptr<Variable> variable, |
|
197 | void VariableController::onRequestDataLoading(std::shared_ptr<Variable> variable, | |
197 | const SqpDateTime &dateTime) |
|
198 | const SqpDateTime &dateTime) | |
198 | { |
|
199 | { | |
199 | qCDebug(LOG_VariableController()) << "VariableController::onRequestDataLoading" |
|
200 | qCDebug(LOG_VariableController()) << "VariableController::onRequestDataLoading" | |
200 | << QThread::currentThread()->objectName(); |
|
201 | << QThread::currentThread()->objectName(); | |
201 | // we want to load data of the variable for the dateTime. |
|
202 | // we want to load data of the variable for the dateTime. | |
202 | // First we check if the cache contains some of them. |
|
203 | // First we check if the cache contains some of them. | |
203 | // For the other, we ask the provider to give them. |
|
204 | // For the other, we ask the provider to give them. | |
204 | if (variable) { |
|
205 | if (variable) { | |
205 |
|
206 | |||
206 | auto dateTimeListNotInCache |
|
207 | auto dateTimeListNotInCache | |
207 | = impl->m_VariableCacheController->provideNotInCacheDateTimeList(variable, dateTime); |
|
208 | = impl->m_VariableCacheController->provideNotInCacheDateTimeList(variable, dateTime); | |
208 |
|
209 | |||
209 | if (!dateTimeListNotInCache.empty()) { |
|
210 | if (!dateTimeListNotInCache.empty()) { | |
210 | // Ask the provider for each data on the dateTimeListNotInCache |
|
211 | // Ask the provider for each data on the dateTimeListNotInCache | |
211 | auto identifier = impl->m_VariableToIdentifierMap.at(variable); |
|
212 | auto identifier = impl->m_VariableToIdentifierMap.at(variable); | |
212 | impl->m_VariableToProviderMap.at(variable)->requestDataLoading( |
|
213 | impl->m_VariableToProviderMap.at(variable)->requestDataLoading( | |
213 | identifier, |
|
214 | identifier, | |
214 | DataProviderParameters{std::move(dateTimeListNotInCache), variable->metadata()}); |
|
215 | DataProviderParameters{std::move(dateTimeListNotInCache), variable->metadata()}); | |
215 | } |
|
216 | } | |
216 | else { |
|
217 | else { | |
217 | emit variable->updated(); |
|
218 | emit variable->updated(); | |
218 | } |
|
219 | } | |
219 | } |
|
220 | } | |
220 | else { |
|
221 | else { | |
221 | qCCritical(LOG_VariableController()) << tr("Impossible to load data of a variable null"); |
|
222 | qCCritical(LOG_VariableController()) << tr("Impossible to load data of a variable null"); | |
222 | } |
|
223 | } | |
223 | } |
|
224 | } | |
224 |
|
225 | |||
225 |
|
226 | |||
226 | void VariableController::initialize() |
|
227 | void VariableController::initialize() | |
227 | { |
|
228 | { | |
228 | qCDebug(LOG_VariableController()) << tr("VariableController init") << QThread::currentThread(); |
|
229 | qCDebug(LOG_VariableController()) << tr("VariableController init") << QThread::currentThread(); | |
229 | impl->m_WorkingMutex.lock(); |
|
230 | impl->m_WorkingMutex.lock(); | |
230 | qCDebug(LOG_VariableController()) << tr("VariableController init END"); |
|
231 | qCDebug(LOG_VariableController()) << tr("VariableController init END"); | |
231 | } |
|
232 | } | |
232 |
|
233 | |||
233 | void VariableController::finalize() |
|
234 | void VariableController::finalize() | |
234 | { |
|
235 | { | |
235 | impl->m_WorkingMutex.unlock(); |
|
236 | impl->m_WorkingMutex.unlock(); | |
236 | } |
|
237 | } | |
237 |
|
238 | |||
238 | void VariableController::waitForFinish() |
|
239 | void VariableController::waitForFinish() | |
239 | { |
|
240 | { | |
240 | QMutexLocker locker{&impl->m_WorkingMutex}; |
|
241 | QMutexLocker locker{&impl->m_WorkingMutex}; | |
241 | } |
|
242 | } |
@@ -1,65 +1,66 | |||||
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 <QLoggingCategory> |
|
6 | #include <QLoggingCategory> | |
7 | #include <QWidget> |
|
7 | #include <QWidget> | |
8 |
|
8 | |||
9 | #include <memory> |
|
9 | #include <memory> | |
10 |
|
10 | |||
11 | #include <Common/spimpl.h> |
|
11 | #include <Common/spimpl.h> | |
12 |
|
12 | |||
13 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationGraphWidget) |
|
13 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationGraphWidget) | |
14 |
|
14 | |||
15 | class QCPRange; |
|
15 | class QCPRange; | |
16 | class SqpDateTime; |
|
16 | class SqpDateTime; | |
17 | class Variable; |
|
17 | class Variable; | |
18 |
|
18 | |||
19 | namespace Ui { |
|
19 | namespace Ui { | |
20 | class VisualizationGraphWidget; |
|
20 | class VisualizationGraphWidget; | |
21 | } // namespace Ui |
|
21 | } // namespace Ui | |
22 |
|
22 | |||
23 | class VisualizationGraphWidget : public QWidget, public IVisualizationWidget { |
|
23 | class VisualizationGraphWidget : public QWidget, public IVisualizationWidget { | |
24 | Q_OBJECT |
|
24 | Q_OBJECT | |
25 |
|
25 | |||
26 | public: |
|
26 | public: | |
27 | explicit VisualizationGraphWidget(const QString &name = {}, QWidget *parent = 0); |
|
27 | explicit VisualizationGraphWidget(const QString &name = {}, QWidget *parent = 0); | |
28 | virtual ~VisualizationGraphWidget(); |
|
28 | virtual ~VisualizationGraphWidget(); | |
29 |
|
29 | |||
30 | void addVariable(std::shared_ptr<Variable> variable); |
|
30 | void addVariable(std::shared_ptr<Variable> variable); | |
31 | void addVariableUsingGraph(std::shared_ptr<Variable> variable); |
|
31 | void addVariableUsingGraph(std::shared_ptr<Variable> variable); | |
32 | /// Removes a variable from the graph |
|
32 | /// Removes a variable from the graph | |
33 | void removeVariable(std::shared_ptr<Variable> variable) noexcept; |
|
33 | void removeVariable(std::shared_ptr<Variable> variable) noexcept; | |
34 |
|
34 | |||
|
35 | /// Rescale the X axe to range parameter | |||
|
36 | void setRange(std::shared_ptr<Variable> variable, const SqpDateTime &range); | |||
|
37 | ||||
35 | // IVisualizationWidget interface |
|
38 | // IVisualizationWidget interface | |
36 | void accept(IVisualizationWidgetVisitor *visitor) override; |
|
39 | void accept(IVisualizationWidgetVisitor *visitor) override; | |
37 | bool canDrop(const Variable &variable) const override; |
|
40 | bool canDrop(const Variable &variable) const override; | |
38 | bool contains(const Variable &variable) const override; |
|
41 | bool contains(const Variable &variable) const override; | |
39 | QString name() const override; |
|
42 | QString name() const override; | |
40 |
|
43 | |||
41 | void updateDisplay(std::shared_ptr<Variable> variable); |
|
|||
42 |
|
||||
43 | signals: |
|
44 | signals: | |
44 | void requestDataLoading(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime); |
|
45 | void requestDataLoading(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime); | |
45 |
|
46 | |||
46 |
|
47 | |||
47 | private: |
|
48 | private: | |
48 | Ui::VisualizationGraphWidget *ui; |
|
49 | Ui::VisualizationGraphWidget *ui; | |
49 |
|
50 | |||
50 | class VisualizationGraphWidgetPrivate; |
|
51 | class VisualizationGraphWidgetPrivate; | |
51 | spimpl::unique_impl_ptr<VisualizationGraphWidgetPrivate> impl; |
|
52 | spimpl::unique_impl_ptr<VisualizationGraphWidgetPrivate> impl; | |
52 |
|
53 | |||
53 | private slots: |
|
54 | private slots: | |
54 | /// Slot called when right clicking on the graph (displays a menu) |
|
55 | /// Slot called when right clicking on the graph (displays a menu) | |
55 | void onGraphMenuRequested(const QPoint &pos) noexcept; |
|
56 | void onGraphMenuRequested(const QPoint &pos) noexcept; | |
56 |
|
57 | |||
57 | void onRangeChanged(const QCPRange &t1); |
|
58 | void onRangeChanged(const QCPRange &t1); | |
58 |
|
59 | |||
59 | /// Slot called when a mouse wheel was made, to perform some processing before the zoom is done |
|
60 | /// Slot called when a mouse wheel was made, to perform some processing before the zoom is done | |
60 | void onMouseWheel(QWheelEvent *event) noexcept; |
|
61 | void onMouseWheel(QWheelEvent *event) noexcept; | |
61 |
|
62 | |||
62 | void onDataCacheVariableUpdated(); |
|
63 | void onDataCacheVariableUpdated(); | |
63 | }; |
|
64 | }; | |
64 |
|
65 | |||
65 | #endif // SCIQLOP_VISUALIZATIONGRAPHWIDGET_H |
|
66 | #endif // SCIQLOP_VISUALIZATIONGRAPHWIDGET_H |
@@ -1,48 +1,51 | |||||
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 | #include <Data/SqpDateTime.h> | |||
5 |
|
6 | |||
6 | #include <QLoggingCategory> |
|
7 | #include <QLoggingCategory> | |
7 | #include <QWidget> |
|
8 | #include <QWidget> | |
8 |
|
9 | |||
9 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationWidget) |
|
10 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationWidget) | |
10 |
|
11 | |||
11 | class QMenu; |
|
12 | class QMenu; | |
12 | class Variable; |
|
13 | class Variable; | |
13 | class VisualizationTabWidget; |
|
14 | class VisualizationTabWidget; | |
14 |
|
15 | |||
15 | namespace Ui { |
|
16 | namespace Ui { | |
16 | class VisualizationWidget; |
|
17 | class VisualizationWidget; | |
17 | } // namespace Ui |
|
18 | } // namespace Ui | |
18 |
|
19 | |||
19 | class VisualizationWidget : public QWidget, public IVisualizationWidget { |
|
20 | class VisualizationWidget : public QWidget, public IVisualizationWidget { | |
20 | Q_OBJECT |
|
21 | Q_OBJECT | |
21 |
|
22 | |||
22 | public: |
|
23 | public: | |
23 | explicit VisualizationWidget(QWidget *parent = 0); |
|
24 | explicit VisualizationWidget(QWidget *parent = 0); | |
24 | virtual ~VisualizationWidget(); |
|
25 | virtual ~VisualizationWidget(); | |
25 |
|
26 | |||
26 | // IVisualizationWidget interface |
|
27 | // IVisualizationWidget interface | |
27 | void accept(IVisualizationWidgetVisitor *visitor) override; |
|
28 | void accept(IVisualizationWidgetVisitor *visitor) override; | |
28 | bool canDrop(const Variable &variable) const override; |
|
29 | bool canDrop(const Variable &variable) const override; | |
29 | bool contains(const Variable &variable) const override; |
|
30 | bool contains(const Variable &variable) const override; | |
30 | QString name() const override; |
|
31 | QString name() const override; | |
31 |
|
32 | |||
32 | public slots: |
|
33 | public slots: | |
33 | /** |
|
34 | /** | |
34 | * Attaches to a menu the menu relative to the visualization of variables |
|
35 | * Attaches to a menu the menu relative to the visualization of variables | |
35 | * @param menu the parent menu of the generated menu |
|
36 | * @param menu the parent menu of the generated menu | |
36 | * @param variables the variables for which to generate the menu |
|
37 | * @param variables the variables for which to generate the menu | |
37 | */ |
|
38 | */ | |
38 | void attachVariableMenu(QMenu *menu, |
|
39 | void attachVariableMenu(QMenu *menu, | |
39 | const QVector<std::shared_ptr<Variable> > &variables) noexcept; |
|
40 | const QVector<std::shared_ptr<Variable> > &variables) noexcept; | |
40 |
|
41 | |||
41 | /// Slot called when a variable is about to be deleted from SciQlop |
|
42 | /// Slot called when a variable is about to be deleted from SciQlop | |
42 | void onVariableAboutToBeDeleted(std::shared_ptr<Variable> variable) noexcept; |
|
43 | void onVariableAboutToBeDeleted(std::shared_ptr<Variable> variable) noexcept; | |
43 |
|
44 | |||
|
45 | void onRangeChanged(std::shared_ptr<Variable> variable, const SqpDateTime &range) noexcept; | |||
|
46 | ||||
44 | private: |
|
47 | private: | |
45 | Ui::VisualizationWidget *ui; |
|
48 | Ui::VisualizationWidget *ui; | |
46 | }; |
|
49 | }; | |
47 |
|
50 | |||
48 | #endif // VISUALIZATIONWIDGET_H |
|
51 | #endif // VISUALIZATIONWIDGET_H |
@@ -1,146 +1,151 | |||||
1 | #include "SqpApplication.h" |
|
1 | #include "SqpApplication.h" | |
2 |
|
2 | |||
3 | #include <Data/IDataProvider.h> |
|
3 | #include <Data/IDataProvider.h> | |
4 | #include <DataSource/DataSourceController.h> |
|
4 | #include <DataSource/DataSourceController.h> | |
5 | #include <Network/NetworkController.h> |
|
5 | #include <Network/NetworkController.h> | |
6 | #include <QThread> |
|
6 | #include <QThread> | |
7 | #include <Time/TimeController.h> |
|
7 | #include <Time/TimeController.h> | |
8 | #include <Variable/Variable.h> |
|
8 | #include <Variable/Variable.h> | |
9 | #include <Variable/VariableController.h> |
|
9 | #include <Variable/VariableController.h> | |
10 | #include <Visualization/VisualizationController.h> |
|
10 | #include <Visualization/VisualizationController.h> | |
11 |
|
11 | |||
12 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") |
|
12 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") | |
13 |
|
13 | |||
14 | class SqpApplication::SqpApplicationPrivate { |
|
14 | class SqpApplication::SqpApplicationPrivate { | |
15 | public: |
|
15 | public: | |
16 | SqpApplicationPrivate() |
|
16 | SqpApplicationPrivate() | |
17 | : m_DataSourceController{std::make_unique<DataSourceController>()}, |
|
17 | : m_DataSourceController{std::make_unique<DataSourceController>()}, | |
18 | m_NetworkController{std::make_unique<NetworkController>()}, |
|
18 | m_NetworkController{std::make_unique<NetworkController>()}, | |
19 | m_TimeController{std::make_unique<TimeController>()}, |
|
19 | m_TimeController{std::make_unique<TimeController>()}, | |
20 | m_VariableController{std::make_unique<VariableController>()}, |
|
20 | m_VariableController{std::make_unique<VariableController>()}, | |
21 | m_VisualizationController{std::make_unique<VisualizationController>()} |
|
21 | m_VisualizationController{std::make_unique<VisualizationController>()} | |
22 | { |
|
22 | { | |
23 | // /////////////////////////////// // |
|
23 | // /////////////////////////////// // | |
24 | // Connections between controllers // |
|
24 | // Connections between controllers // | |
25 | // /////////////////////////////// // |
|
25 | // /////////////////////////////// // | |
26 |
|
26 | |||
27 | // VariableController <-> DataSourceController |
|
27 | // VariableController <-> DataSourceController | |
28 | connect(m_DataSourceController.get(), |
|
28 | connect(m_DataSourceController.get(), | |
29 | SIGNAL(variableCreationRequested(const QString &, const QVariantHash &, |
|
29 | SIGNAL(variableCreationRequested(const QString &, const QVariantHash &, | |
30 | std::shared_ptr<IDataProvider>)), |
|
30 | std::shared_ptr<IDataProvider>)), | |
31 | m_VariableController.get(), |
|
31 | m_VariableController.get(), | |
32 | SLOT(createVariable(const QString &, const QVariantHash &, |
|
32 | SLOT(createVariable(const QString &, const QVariantHash &, | |
33 | std::shared_ptr<IDataProvider>))); |
|
33 | std::shared_ptr<IDataProvider>))); | |
34 |
|
34 | |||
35 | // VariableController <-> VisualizationController |
|
35 | // VariableController <-> VisualizationController | |
36 | connect(m_VariableController.get(), |
|
36 | connect(m_VariableController.get(), | |
37 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), |
|
37 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), | |
38 | m_VisualizationController.get(), |
|
38 | m_VisualizationController.get(), | |
39 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), Qt::DirectConnection); |
|
39 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), Qt::DirectConnection); | |
40 |
|
40 | |||
|
41 | connect(m_VariableController.get(), | |||
|
42 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpDateTime &)), | |||
|
43 | m_VisualizationController.get(), | |||
|
44 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpDateTime &))); | |||
|
45 | ||||
41 |
|
46 | |||
42 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); |
|
47 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); | |
43 | m_DataSourceControllerThread.setObjectName("DataSourceControllerThread"); |
|
48 | m_DataSourceControllerThread.setObjectName("DataSourceControllerThread"); | |
44 | m_NetworkController->moveToThread(&m_NetworkControllerThread); |
|
49 | m_NetworkController->moveToThread(&m_NetworkControllerThread); | |
45 | m_NetworkControllerThread.setObjectName("NetworkControllerThread"); |
|
50 | m_NetworkControllerThread.setObjectName("NetworkControllerThread"); | |
46 | m_VariableController->moveToThread(&m_VariableControllerThread); |
|
51 | m_VariableController->moveToThread(&m_VariableControllerThread); | |
47 | m_VariableControllerThread.setObjectName("VariableControllerThread"); |
|
52 | m_VariableControllerThread.setObjectName("VariableControllerThread"); | |
48 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); |
|
53 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); | |
49 | m_VisualizationControllerThread.setObjectName("VsualizationControllerThread"); |
|
54 | m_VisualizationControllerThread.setObjectName("VsualizationControllerThread"); | |
50 |
|
55 | |||
51 |
|
56 | |||
52 | // Additionnal init |
|
57 | // Additionnal init | |
53 | m_VariableController->setTimeController(m_TimeController.get()); |
|
58 | m_VariableController->setTimeController(m_TimeController.get()); | |
54 | } |
|
59 | } | |
55 |
|
60 | |||
56 | virtual ~SqpApplicationPrivate() |
|
61 | virtual ~SqpApplicationPrivate() | |
57 | { |
|
62 | { | |
58 | qCInfo(LOG_SqpApplication()) << tr("SqpApplicationPrivate destruction"); |
|
63 | qCInfo(LOG_SqpApplication()) << tr("SqpApplicationPrivate destruction"); | |
59 | m_DataSourceControllerThread.quit(); |
|
64 | m_DataSourceControllerThread.quit(); | |
60 | m_DataSourceControllerThread.wait(); |
|
65 | m_DataSourceControllerThread.wait(); | |
61 |
|
66 | |||
62 | m_NetworkControllerThread.quit(); |
|
67 | m_NetworkControllerThread.quit(); | |
63 | m_NetworkControllerThread.wait(); |
|
68 | m_NetworkControllerThread.wait(); | |
64 |
|
69 | |||
65 | m_VariableControllerThread.quit(); |
|
70 | m_VariableControllerThread.quit(); | |
66 | m_VariableControllerThread.wait(); |
|
71 | m_VariableControllerThread.wait(); | |
67 |
|
72 | |||
68 | m_VisualizationControllerThread.quit(); |
|
73 | m_VisualizationControllerThread.quit(); | |
69 | m_VisualizationControllerThread.wait(); |
|
74 | m_VisualizationControllerThread.wait(); | |
70 | } |
|
75 | } | |
71 |
|
76 | |||
72 | std::unique_ptr<DataSourceController> m_DataSourceController; |
|
77 | std::unique_ptr<DataSourceController> m_DataSourceController; | |
73 | std::unique_ptr<VariableController> m_VariableController; |
|
78 | std::unique_ptr<VariableController> m_VariableController; | |
74 | std::unique_ptr<TimeController> m_TimeController; |
|
79 | std::unique_ptr<TimeController> m_TimeController; | |
75 | std::unique_ptr<NetworkController> m_NetworkController; |
|
80 | std::unique_ptr<NetworkController> m_NetworkController; | |
76 | std::unique_ptr<VisualizationController> m_VisualizationController; |
|
81 | std::unique_ptr<VisualizationController> m_VisualizationController; | |
77 | QThread m_DataSourceControllerThread; |
|
82 | QThread m_DataSourceControllerThread; | |
78 | QThread m_NetworkControllerThread; |
|
83 | QThread m_NetworkControllerThread; | |
79 | QThread m_VariableControllerThread; |
|
84 | QThread m_VariableControllerThread; | |
80 | QThread m_VisualizationControllerThread; |
|
85 | QThread m_VisualizationControllerThread; | |
81 | }; |
|
86 | }; | |
82 |
|
87 | |||
83 |
|
88 | |||
84 | SqpApplication::SqpApplication(int &argc, char **argv) |
|
89 | SqpApplication::SqpApplication(int &argc, char **argv) | |
85 | : QApplication{argc, argv}, impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} |
|
90 | : QApplication{argc, argv}, impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} | |
86 | { |
|
91 | { | |
87 | qCDebug(LOG_SqpApplication()) << tr("SqpApplication construction") << QThread::currentThread(); |
|
92 | qCDebug(LOG_SqpApplication()) << tr("SqpApplication construction") << QThread::currentThread(); | |
88 |
|
93 | |||
89 | connect(&impl->m_DataSourceControllerThread, &QThread::started, |
|
94 | connect(&impl->m_DataSourceControllerThread, &QThread::started, | |
90 | impl->m_DataSourceController.get(), &DataSourceController::initialize); |
|
95 | impl->m_DataSourceController.get(), &DataSourceController::initialize); | |
91 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, |
|
96 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, | |
92 | impl->m_DataSourceController.get(), &DataSourceController::finalize); |
|
97 | impl->m_DataSourceController.get(), &DataSourceController::finalize); | |
93 |
|
98 | |||
94 | connect(&impl->m_NetworkControllerThread, &QThread::started, impl->m_NetworkController.get(), |
|
99 | connect(&impl->m_NetworkControllerThread, &QThread::started, impl->m_NetworkController.get(), | |
95 | &NetworkController::initialize); |
|
100 | &NetworkController::initialize); | |
96 | connect(&impl->m_NetworkControllerThread, &QThread::finished, impl->m_NetworkController.get(), |
|
101 | connect(&impl->m_NetworkControllerThread, &QThread::finished, impl->m_NetworkController.get(), | |
97 | &NetworkController::finalize); |
|
102 | &NetworkController::finalize); | |
98 |
|
103 | |||
99 | connect(&impl->m_VariableControllerThread, &QThread::started, impl->m_VariableController.get(), |
|
104 | connect(&impl->m_VariableControllerThread, &QThread::started, impl->m_VariableController.get(), | |
100 | &VariableController::initialize); |
|
105 | &VariableController::initialize); | |
101 | connect(&impl->m_VariableControllerThread, &QThread::finished, impl->m_VariableController.get(), |
|
106 | connect(&impl->m_VariableControllerThread, &QThread::finished, impl->m_VariableController.get(), | |
102 | &VariableController::finalize); |
|
107 | &VariableController::finalize); | |
103 |
|
108 | |||
104 | connect(&impl->m_VisualizationControllerThread, &QThread::started, |
|
109 | connect(&impl->m_VisualizationControllerThread, &QThread::started, | |
105 | impl->m_VisualizationController.get(), &VisualizationController::initialize); |
|
110 | impl->m_VisualizationController.get(), &VisualizationController::initialize); | |
106 | connect(&impl->m_VisualizationControllerThread, &QThread::finished, |
|
111 | connect(&impl->m_VisualizationControllerThread, &QThread::finished, | |
107 | impl->m_VisualizationController.get(), &VisualizationController::finalize); |
|
112 | impl->m_VisualizationController.get(), &VisualizationController::finalize); | |
108 |
|
113 | |||
109 | impl->m_DataSourceControllerThread.start(); |
|
114 | impl->m_DataSourceControllerThread.start(); | |
110 | impl->m_NetworkControllerThread.start(); |
|
115 | impl->m_NetworkControllerThread.start(); | |
111 | impl->m_VariableControllerThread.start(); |
|
116 | impl->m_VariableControllerThread.start(); | |
112 | impl->m_VisualizationControllerThread.start(); |
|
117 | impl->m_VisualizationControllerThread.start(); | |
113 | } |
|
118 | } | |
114 |
|
119 | |||
115 | SqpApplication::~SqpApplication() |
|
120 | SqpApplication::~SqpApplication() | |
116 | { |
|
121 | { | |
117 | } |
|
122 | } | |
118 |
|
123 | |||
119 | void SqpApplication::initialize() |
|
124 | void SqpApplication::initialize() | |
120 | { |
|
125 | { | |
121 | } |
|
126 | } | |
122 |
|
127 | |||
123 | DataSourceController &SqpApplication::dataSourceController() noexcept |
|
128 | DataSourceController &SqpApplication::dataSourceController() noexcept | |
124 | { |
|
129 | { | |
125 | return *impl->m_DataSourceController; |
|
130 | return *impl->m_DataSourceController; | |
126 | } |
|
131 | } | |
127 |
|
132 | |||
128 | NetworkController &SqpApplication::networkController() noexcept |
|
133 | NetworkController &SqpApplication::networkController() noexcept | |
129 | { |
|
134 | { | |
130 | return *impl->m_NetworkController; |
|
135 | return *impl->m_NetworkController; | |
131 | } |
|
136 | } | |
132 |
|
137 | |||
133 | TimeController &SqpApplication::timeController() noexcept |
|
138 | TimeController &SqpApplication::timeController() noexcept | |
134 | { |
|
139 | { | |
135 | return *impl->m_TimeController; |
|
140 | return *impl->m_TimeController; | |
136 | } |
|
141 | } | |
137 |
|
142 | |||
138 | VariableController &SqpApplication::variableController() noexcept |
|
143 | VariableController &SqpApplication::variableController() noexcept | |
139 | { |
|
144 | { | |
140 | return *impl->m_VariableController; |
|
145 | return *impl->m_VariableController; | |
141 | } |
|
146 | } | |
142 |
|
147 | |||
143 | VisualizationController &SqpApplication::visualizationController() noexcept |
|
148 | VisualizationController &SqpApplication::visualizationController() noexcept | |
144 | { |
|
149 | { | |
145 | return *impl->m_VisualizationController; |
|
150 | return *impl->m_VisualizationController; | |
146 | } |
|
151 | } |
@@ -1,143 +1,152 | |||||
1 | #include "Visualization/VisualizationWidget.h" |
|
1 | #include "Visualization/VisualizationWidget.h" | |
2 | #include "Visualization/IVisualizationWidgetVisitor.h" |
|
2 | #include "Visualization/IVisualizationWidgetVisitor.h" | |
3 | #include "Visualization/VisualizationGraphWidget.h" |
|
3 | #include "Visualization/VisualizationGraphWidget.h" | |
4 | #include "Visualization/VisualizationTabWidget.h" |
|
4 | #include "Visualization/VisualizationTabWidget.h" | |
5 | #include "Visualization/VisualizationZoneWidget.h" |
|
5 | #include "Visualization/VisualizationZoneWidget.h" | |
6 | #include "Visualization/operations/GenerateVariableMenuOperation.h" |
|
6 | #include "Visualization/operations/GenerateVariableMenuOperation.h" | |
7 | #include "Visualization/operations/RemoveVariableOperation.h" |
|
7 | #include "Visualization/operations/RemoveVariableOperation.h" | |
|
8 | #include "Visualization/operations/RescaleAxeOperation.h" | |||
8 | #include "Visualization/qcustomplot.h" |
|
9 | #include "Visualization/qcustomplot.h" | |
9 |
|
10 | |||
10 | #include "ui_VisualizationWidget.h" |
|
11 | #include "ui_VisualizationWidget.h" | |
11 |
|
12 | |||
12 | #include <QToolButton> |
|
13 | #include <QToolButton> | |
13 |
|
14 | |||
14 | Q_LOGGING_CATEGORY(LOG_VisualizationWidget, "VisualizationWidget") |
|
15 | Q_LOGGING_CATEGORY(LOG_VisualizationWidget, "VisualizationWidget") | |
15 |
|
16 | |||
16 | VisualizationWidget::VisualizationWidget(QWidget *parent) |
|
17 | VisualizationWidget::VisualizationWidget(QWidget *parent) | |
17 | : QWidget{parent}, ui{new Ui::VisualizationWidget} |
|
18 | : QWidget{parent}, ui{new Ui::VisualizationWidget} | |
18 | { |
|
19 | { | |
19 | ui->setupUi(this); |
|
20 | ui->setupUi(this); | |
20 |
|
21 | |||
21 | auto addTabViewButton = new QToolButton{ui->tabWidget}; |
|
22 | auto addTabViewButton = new QToolButton{ui->tabWidget}; | |
22 | addTabViewButton->setText(tr("Add View")); |
|
23 | addTabViewButton->setText(tr("Add View")); | |
23 | addTabViewButton->setCursor(Qt::ArrowCursor); |
|
24 | addTabViewButton->setCursor(Qt::ArrowCursor); | |
24 | ui->tabWidget->setCornerWidget(addTabViewButton, Qt::TopRightCorner); |
|
25 | ui->tabWidget->setCornerWidget(addTabViewButton, Qt::TopRightCorner); | |
25 |
|
26 | |||
26 | auto enableMinimumCornerWidgetSize = [this](bool enable) { |
|
27 | auto enableMinimumCornerWidgetSize = [this](bool enable) { | |
27 |
|
28 | |||
28 | auto tabViewCornerWidget = ui->tabWidget->cornerWidget(); |
|
29 | auto tabViewCornerWidget = ui->tabWidget->cornerWidget(); | |
29 | auto width = enable ? tabViewCornerWidget->width() : 0; |
|
30 | auto width = enable ? tabViewCornerWidget->width() : 0; | |
30 | auto height = enable ? tabViewCornerWidget->height() : 0; |
|
31 | auto height = enable ? tabViewCornerWidget->height() : 0; | |
31 | tabViewCornerWidget->setMinimumHeight(height); |
|
32 | tabViewCornerWidget->setMinimumHeight(height); | |
32 | tabViewCornerWidget->setMinimumWidth(width); |
|
33 | tabViewCornerWidget->setMinimumWidth(width); | |
33 | ui->tabWidget->setMinimumHeight(height); |
|
34 | ui->tabWidget->setMinimumHeight(height); | |
34 | ui->tabWidget->setMinimumWidth(width); |
|
35 | ui->tabWidget->setMinimumWidth(width); | |
35 | }; |
|
36 | }; | |
36 |
|
37 | |||
37 | auto addTabView = [this, enableMinimumCornerWidgetSize]() { |
|
38 | auto addTabView = [this, enableMinimumCornerWidgetSize]() { | |
38 | auto widget = new VisualizationTabWidget{QString{"View %1"}.arg(ui->tabWidget->count() + 1), |
|
39 | auto widget = new VisualizationTabWidget{QString{"View %1"}.arg(ui->tabWidget->count() + 1), | |
39 | ui->tabWidget}; |
|
40 | ui->tabWidget}; | |
40 | auto index = ui->tabWidget->addTab(widget, widget->name()); |
|
41 | auto index = ui->tabWidget->addTab(widget, widget->name()); | |
41 | if (ui->tabWidget->count() > 0) { |
|
42 | if (ui->tabWidget->count() > 0) { | |
42 | enableMinimumCornerWidgetSize(false); |
|
43 | enableMinimumCornerWidgetSize(false); | |
43 | } |
|
44 | } | |
44 | qCInfo(LOG_VisualizationWidget()) << tr("add the tab of index %1").arg(index); |
|
45 | qCInfo(LOG_VisualizationWidget()) << tr("add the tab of index %1").arg(index); | |
45 | }; |
|
46 | }; | |
46 |
|
47 | |||
47 | auto removeTabView = [this, enableMinimumCornerWidgetSize](int index) { |
|
48 | auto removeTabView = [this, enableMinimumCornerWidgetSize](int index) { | |
48 | if (ui->tabWidget->count() == 1) { |
|
49 | if (ui->tabWidget->count() == 1) { | |
49 | enableMinimumCornerWidgetSize(true); |
|
50 | enableMinimumCornerWidgetSize(true); | |
50 | } |
|
51 | } | |
51 |
|
52 | |||
52 | // Removes widget from tab and closes it |
|
53 | // Removes widget from tab and closes it | |
53 | auto widget = ui->tabWidget->widget(index); |
|
54 | auto widget = ui->tabWidget->widget(index); | |
54 | ui->tabWidget->removeTab(index); |
|
55 | ui->tabWidget->removeTab(index); | |
55 | if (widget) { |
|
56 | if (widget) { | |
56 | widget->close(); |
|
57 | widget->close(); | |
57 | } |
|
58 | } | |
58 |
|
59 | |||
59 | qCInfo(LOG_VisualizationWidget()) << tr("remove the tab of index %1").arg(index); |
|
60 | qCInfo(LOG_VisualizationWidget()) << tr("remove the tab of index %1").arg(index); | |
60 |
|
61 | |||
61 | }; |
|
62 | }; | |
62 |
|
63 | |||
63 | ui->tabWidget->setTabsClosable(true); |
|
64 | ui->tabWidget->setTabsClosable(true); | |
64 |
|
65 | |||
65 | connect(addTabViewButton, &QToolButton::clicked, addTabView); |
|
66 | connect(addTabViewButton, &QToolButton::clicked, addTabView); | |
66 | connect(ui->tabWidget, &QTabWidget::tabCloseRequested, removeTabView); |
|
67 | connect(ui->tabWidget, &QTabWidget::tabCloseRequested, removeTabView); | |
67 |
|
68 | |||
68 | // Adds default tab |
|
69 | // Adds default tab | |
69 | addTabView(); |
|
70 | addTabView(); | |
70 | } |
|
71 | } | |
71 |
|
72 | |||
72 | VisualizationWidget::~VisualizationWidget() |
|
73 | VisualizationWidget::~VisualizationWidget() | |
73 | { |
|
74 | { | |
74 | delete ui; |
|
75 | delete ui; | |
75 | } |
|
76 | } | |
76 |
|
77 | |||
77 | void VisualizationWidget::accept(IVisualizationWidgetVisitor *visitor) |
|
78 | void VisualizationWidget::accept(IVisualizationWidgetVisitor *visitor) | |
78 | { |
|
79 | { | |
79 | if (visitor) { |
|
80 | if (visitor) { | |
80 | visitor->visitEnter(this); |
|
81 | visitor->visitEnter(this); | |
81 |
|
82 | |||
82 | // Apply visitor for tab children |
|
83 | // Apply visitor for tab children | |
83 | for (auto i = 0; i < ui->tabWidget->count(); ++i) { |
|
84 | for (auto i = 0; i < ui->tabWidget->count(); ++i) { | |
84 | // Widgets different from tabs are not visited (no action) |
|
85 | // Widgets different from tabs are not visited (no action) | |
85 | if (auto visualizationTabWidget |
|
86 | if (auto visualizationTabWidget | |
86 | = dynamic_cast<VisualizationTabWidget *>(ui->tabWidget->widget(i))) { |
|
87 | = dynamic_cast<VisualizationTabWidget *>(ui->tabWidget->widget(i))) { | |
87 | visualizationTabWidget->accept(visitor); |
|
88 | visualizationTabWidget->accept(visitor); | |
88 | } |
|
89 | } | |
89 | } |
|
90 | } | |
90 |
|
91 | |||
91 | visitor->visitLeave(this); |
|
92 | visitor->visitLeave(this); | |
92 | } |
|
93 | } | |
93 | else { |
|
94 | else { | |
94 | qCCritical(LOG_VisualizationWidget()) << tr("Can't visit widget : the visitor is null"); |
|
95 | qCCritical(LOG_VisualizationWidget()) << tr("Can't visit widget : the visitor is null"); | |
95 | } |
|
96 | } | |
96 | } |
|
97 | } | |
97 |
|
98 | |||
98 | bool VisualizationWidget::canDrop(const Variable &variable) const |
|
99 | bool VisualizationWidget::canDrop(const Variable &variable) const | |
99 | { |
|
100 | { | |
100 | // The main widget can never accomodate a variable |
|
101 | // The main widget can never accomodate a variable | |
101 | Q_UNUSED(variable); |
|
102 | Q_UNUSED(variable); | |
102 | return false; |
|
103 | return false; | |
103 | } |
|
104 | } | |
104 |
|
105 | |||
105 | bool VisualizationWidget::contains(const Variable &variable) const |
|
106 | bool VisualizationWidget::contains(const Variable &variable) const | |
106 | { |
|
107 | { | |
107 | Q_UNUSED(variable); |
|
108 | Q_UNUSED(variable); | |
108 | return false; |
|
109 | return false; | |
109 | } |
|
110 | } | |
110 |
|
111 | |||
111 | QString VisualizationWidget::name() const |
|
112 | QString VisualizationWidget::name() const | |
112 | { |
|
113 | { | |
113 | return QStringLiteral("MainView"); |
|
114 | return QStringLiteral("MainView"); | |
114 | } |
|
115 | } | |
115 |
|
116 | |||
116 | void VisualizationWidget::attachVariableMenu( |
|
117 | void VisualizationWidget::attachVariableMenu( | |
117 | QMenu *menu, const QVector<std::shared_ptr<Variable> > &variables) noexcept |
|
118 | QMenu *menu, const QVector<std::shared_ptr<Variable> > &variables) noexcept | |
118 | { |
|
119 | { | |
119 | // Menu is generated only if there is a single variable |
|
120 | // Menu is generated only if there is a single variable | |
120 | if (variables.size() == 1) { |
|
121 | if (variables.size() == 1) { | |
121 | if (auto variable = variables.first()) { |
|
122 | if (auto variable = variables.first()) { | |
122 | // Generates the actions that make it possible to visualize the variable |
|
123 | // Generates the actions that make it possible to visualize the variable | |
123 | auto generateVariableMenuOperation = GenerateVariableMenuOperation{menu, variable}; |
|
124 | auto generateVariableMenuOperation = GenerateVariableMenuOperation{menu, variable}; | |
124 | accept(&generateVariableMenuOperation); |
|
125 | accept(&generateVariableMenuOperation); | |
125 | } |
|
126 | } | |
126 | else { |
|
127 | else { | |
127 | qCCritical(LOG_VisualizationWidget()) << tr( |
|
128 | qCCritical(LOG_VisualizationWidget()) << tr( | |
128 | "Can't generate the menu relative to the visualization: the variable is null"); |
|
129 | "Can't generate the menu relative to the visualization: the variable is null"); | |
129 | } |
|
130 | } | |
130 | } |
|
131 | } | |
131 | else { |
|
132 | else { | |
132 | qCDebug(LOG_VisualizationWidget()) |
|
133 | qCDebug(LOG_VisualizationWidget()) | |
133 | << tr("No generation of the menu related to the visualization: several variables are " |
|
134 | << tr("No generation of the menu related to the visualization: several variables are " | |
134 | "selected"); |
|
135 | "selected"); | |
135 | } |
|
136 | } | |
136 | } |
|
137 | } | |
137 |
|
138 | |||
138 | void VisualizationWidget::onVariableAboutToBeDeleted(std::shared_ptr<Variable> variable) noexcept |
|
139 | void VisualizationWidget::onVariableAboutToBeDeleted(std::shared_ptr<Variable> variable) noexcept | |
139 | { |
|
140 | { | |
140 | // Calls the operation of removing all references to the variable in the visualization |
|
141 | // Calls the operation of removing all references to the variable in the visualization | |
141 | auto removeVariableOperation = RemoveVariableOperation{variable}; |
|
142 | auto removeVariableOperation = RemoveVariableOperation{variable}; | |
142 | accept(&removeVariableOperation); |
|
143 | accept(&removeVariableOperation); | |
143 | } |
|
144 | } | |
|
145 | ||||
|
146 | void VisualizationWidget::onRangeChanged(std::shared_ptr<Variable> variable, | |||
|
147 | const SqpDateTime &range) noexcept | |||
|
148 | { | |||
|
149 | // Calls the operation of removing all references to the variable in the visualization | |||
|
150 | auto rescaleVariableOperation = RescaleAxeOperation{variable, range}; | |||
|
151 | accept(&rescaleVariableOperation); | |||
|
152 | } |
General Comments 0
You need to be logged in to leave comments.
Login now