##// END OF EJS Templates
All the codebase is modified to build with new Variable Controller...
jeandet -
r1348:ea7d1a66f4ab
parent child
Show More
@@ -47,7 +47,13 ENDIF(IWYU)
47
47
48 enable_testing()
48 enable_testing()
49
49
50 add_subdirectory(core)
50 find_package(core CONFIG QUIET)
51 if (NOT sciqlopcore_FOUND)
52 execute_process(COMMAND git submodule init core WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
53 execute_process(COMMAND git submodule update core WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
54 add_subdirectory(core)
55 endif()
56
51 add_subdirectory(gui)
57 add_subdirectory(gui)
52 add_subdirectory(app)
58 add_subdirectory(app)
53 add_subdirectory(plugins)
59 add_subdirectory(plugins)
@@ -319,8 +319,8 MainWindow::MainWindow(QWidget *parent)
319 // /////////// //
319 // /////////// //
320
320
321 // Controllers / controllers connections
321 // Controllers / controllers connections
322 connect(&sqpApp->timeController(), SIGNAL(timeUpdated(DateTimeRange)), &sqpApp->variableController(),
322 // connect(&sqpApp->timeController(), SIGNAL(timeUpdated(DateTimeRange)), &sqpApp->variableController(),
323 SLOT(onDateTimeOnSelection(DateTimeRange)));
323 // SLOT(onDateTimeOnSelection(DateTimeRange)));
324
324
325 // Widgets / controllers connections
325 // Widgets / controllers connections
326
326
@@ -1,1 +1,1
1 Subproject commit 5a50815a763fb421298a06a6d0380b8f5364e7cd
1 Subproject commit 5f4f9560990ba00394322fa1d06d4a30feaf7075
@@ -19,6 +19,8 class DataSourceController;
19 class NetworkController;
19 class NetworkController;
20 class TimeController;
20 class TimeController;
21 class VariableController;
21 class VariableController;
22 class VariableController2;
23 class VariableModel2;
22 class VisualizationController;
24 class VisualizationController;
23 class DragDropGuiController;
25 class DragDropGuiController;
24 class ActionsGuiController;
26 class ActionsGuiController;
@@ -37,14 +39,17 class SqpApplication : public QApplication {
37 Q_OBJECT
39 Q_OBJECT
38 public:
40 public:
39 explicit SqpApplication(int &argc, char **argv);
41 explicit SqpApplication(int &argc, char **argv);
40 virtual ~SqpApplication();
42 ~SqpApplication() override;
41 void initialize();
43 void initialize();
42
44
43 /// Accessors for the differents sciqlop controllers
45 /// Accessors for the differents sciqlop controllers
44 DataSourceController &dataSourceController() noexcept;
46 DataSourceController &dataSourceController() noexcept;
45 NetworkController &networkController() noexcept;
47 NetworkController &networkController() noexcept;
46 TimeController &timeController() noexcept;
48 TimeController &timeController() noexcept;
47 VariableController &variableController() noexcept;
49 VariableController2 &variableController() noexcept;
50 std::shared_ptr<VariableController2> variableControllerOwner() noexcept;
51 //@TODO there should not be any global model it's just GUI impl detail
52 // VariableModel2 &variableModel() noexcept;
48 VisualizationController &visualizationController() noexcept;
53 VisualizationController &visualizationController() noexcept;
49 CatalogueController &catalogueController() noexcept;
54 CatalogueController &catalogueController() noexcept;
50
55
@@ -7,6 +7,8
7
7
8 #include <memory>
8 #include <memory>
9
9
10 #include <Variable/VariableModel2.h>
11
10 Q_DECLARE_LOGGING_CATEGORY(LOG_VariableInspectorWidget)
12 Q_DECLARE_LOGGING_CATEGORY(LOG_VariableInspectorWidget)
11
13
12 class Variable;
14 class Variable;
@@ -45,6 +47,7 private:
45 Ui::VariableInspectorWidget *ui;
47 Ui::VariableInspectorWidget *ui;
46
48
47 QProgressBarItemDelegate *m_ProgressBarItemDelegate;
49 QProgressBarItemDelegate *m_ProgressBarItemDelegate;
50 VariableModel2* m_model;
48
51
49 private slots:
52 private slots:
50 /// Slot called when right clicking on an variable in the table (displays a menu)
53 /// Slot called when right clicking on an variable in the table (displays a menu)
@@ -64,7 +64,7 public:
64 void removeVariable(std::shared_ptr<Variable> variable) noexcept;
64 void removeVariable(std::shared_ptr<Variable> variable) noexcept;
65
65
66 /// Returns the list of all variables used in the graph
66 /// Returns the list of all variables used in the graph
67 QList<std::shared_ptr<Variable> > variables() const;
67 std::vector<std::shared_ptr<Variable> > variables() const;
68
68
69 /// Sets the y-axis range based on the data of a variable
69 /// Sets the y-axis range based on the data of a variable
70 void setYRange(std::shared_ptr<Variable> variable);
70 void setYRange(std::shared_ptr<Variable> variable);
@@ -53,7 +53,7 public:
53 * @param index The index where the zone should be inserted in the layout
53 * @param index The index where the zone should be inserted in the layout
54 * @return the pointer to the created zone
54 * @return the pointer to the created zone
55 */
55 */
56 VisualizationZoneWidget *createZone(const QList<std::shared_ptr<Variable> > &variables,
56 VisualizationZoneWidget *createZone(const std::vector<std::shared_ptr<Variable> > &variables,
57 int index);
57 int index);
58
58
59 /**
59 /**
@@ -62,7 +62,7 public:
62 * @param index The index where the graph should be inserted in the layout
62 * @param index The index where the graph should be inserted in the layout
63 * @return the pointer to the created graph
63 * @return the pointer to the created graph
64 */
64 */
65 VisualizationGraphWidget *createGraph(const QList<std::shared_ptr<Variable> > variables,
65 VisualizationGraphWidget *createGraph( std::vector<std::shared_ptr<Variable> > variables,
66 int index);
66 int index);
67
67
68 /// Returns the first graph in the zone or nullptr if there is no graph inside
68 /// Returns the first graph in the zone or nullptr if there is no graph inside
@@ -12,6 +12,7
12 #include <SqpApplication.h>
12 #include <SqpApplication.h>
13 #include <Variable/Variable.h>
13 #include <Variable/Variable.h>
14 #include <Variable/VariableController.h>
14 #include <Variable/VariableController.h>
15 #include <Variable/VariableController2.h>
15 #include <Visualization/VisualizationGraphWidget.h>
16 #include <Visualization/VisualizationGraphWidget.h>
16 #include <Visualization/VisualizationTabWidget.h>
17 #include <Visualization/VisualizationTabWidget.h>
17 #include <Visualization/VisualizationWidget.h>
18 #include <Visualization/VisualizationWidget.h>
@@ -240,11 +241,9 struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate {
240 // Closes the previous graph and delete the asociated variables
241 // Closes the previous graph and delete the asociated variables
241 for (auto graph : m_CustomGraphs) {
242 for (auto graph : m_CustomGraphs) {
242 graph->close();
243 graph->close();
243 auto variables = graph->variables().toVector();
244 auto variables = graph->variables();
244
245 for(const auto& variable:variables)
245 QMetaObject::invokeMethod(&sqpApp->variableController(), "deleteVariables",
246 sqpApp->variableController().deleteVariable(variable);
246 Qt::QueuedConnection,
247 Q_ARG(QVector<std::shared_ptr<Variable> >, variables));
248 }
247 }
249 m_CustomGraphs.clear();
248 m_CustomGraphs.clear();
250
249
@@ -276,7 +275,7 struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate {
276
275
277 auto context = new QObject{catalogueEventWidget};
276 auto context = new QObject{catalogueEventWidget};
278 QObject::connect(
277 QObject::connect(
279 &sqpApp->variableController(), &VariableController::variableAdded, context,
278 &sqpApp->variableController(), &VariableController2::variableAdded, context,
280 [this, catalogueEventWidget, zone, context, event, range, productRange,
279 [this, catalogueEventWidget, zone, context, event, range, productRange,
281 productId](auto variable) {
280 productId](auto variable) {
282
281
@@ -9,7 +9,7
9
9
10 #include "DataSource/DataSourceController.h"
10 #include "DataSource/DataSourceController.h"
11 #include "Variable/Variable.h"
11 #include "Variable/Variable.h"
12 #include "Variable/VariableController.h"
12 #include "Variable/VariableController2.h"
13
13
14 #include "Common/MimeTypesDef.h"
14 #include "Common/MimeTypesDef.h"
15 #include "Common/VisualizationDef.h"
15 #include "Common/VisualizationDef.h"
@@ -244,12 +244,12 bool DragDropGuiController::checkMimeDataForVisualization(
244 auto result = false;
244 auto result = false;
245
245
246 if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) {
246 if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) {
247 auto variables = sqpApp->variableController().variablesForMimeData(
247 auto variables = sqpApp->variableController().variables(
248 mimeData->data(MIME_TYPE_VARIABLE_LIST));
248 mimeData->data(MIME_TYPE_VARIABLE_LIST));
249
249
250 if (variables.count() == 1) {
250 if (variables.size() == 1) {
251
251
252 auto variable = variables.first();
252 auto variable = variables[0];
253 if (variable->dataSeries() != nullptr) {
253 if (variable->dataSeries() != nullptr) {
254
254
255 // Check that the variable is not already in a graph
255 // Check that the variable is not already in a graph
@@ -10,6 +10,8
10 #include <Time/TimeController.h>
10 #include <Time/TimeController.h>
11 #include <Variable/Variable.h>
11 #include <Variable/Variable.h>
12 #include <Variable/VariableController.h>
12 #include <Variable/VariableController.h>
13 #include <Variable/VariableController2.h>
14 #include <Variable/VariableModel2.h>
13 #include <Variable/VariableModel.h>
15 #include <Variable/VariableModel.h>
14 #include <Visualization/VisualizationController.h>
16 #include <Visualization/VisualizationController.h>
15
17
@@ -18,14 +20,8 Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication")
18 class SqpApplication::SqpApplicationPrivate {
20 class SqpApplication::SqpApplicationPrivate {
19 public:
21 public:
20 SqpApplicationPrivate()
22 SqpApplicationPrivate()
21 : m_DataSourceController{std::make_unique<DataSourceController>()},
23 : m_VariableController{std::make_shared<VariableController2>()},
22 m_VariableController{std::make_unique<VariableController>()},
24 m_VariableModel{m_VariableController},
23 m_TimeController{std::make_unique<TimeController>()},
24 m_NetworkController{std::make_unique<NetworkController>()},
25 m_VisualizationController{std::make_unique<VisualizationController>()},
26 m_DragDropGuiController{std::make_unique<DragDropGuiController>()},
27 m_CatalogueController{std::make_unique<CatalogueController>()},
28 m_ActionsGuiController{std::make_unique<ActionsGuiController>()},
29 m_PlotInterractionMode(SqpApplication::PlotsInteractionMode::None),
25 m_PlotInterractionMode(SqpApplication::PlotsInteractionMode::None),
30 m_PlotCursorMode(SqpApplication::PlotsCursorMode::NoCursor)
26 m_PlotCursorMode(SqpApplication::PlotsCursorMode::NoCursor)
31 {
27 {
@@ -34,35 +30,33 public:
34 // /////////////////////////////// //
30 // /////////////////////////////// //
35
31
36 // VariableController <-> DataSourceController
32 // VariableController <-> DataSourceController
37 connect(m_DataSourceController.get(),
33 connect(&m_DataSourceController,
38 SIGNAL(variableCreationRequested(const QString &, const QVariantHash &,
34 SIGNAL(variableCreationRequested(const QString &, const QVariantHash &,
39 std::shared_ptr<IDataProvider>)),
35 std::shared_ptr<IDataProvider>)),
40 m_VariableController.get(),
36 m_VariableController.get(),
41 SLOT(createVariable(const QString &, const QVariantHash &,
37 SLOT(createVariable(const QString &, const QVariantHash &,
42 std::shared_ptr<IDataProvider>)));
38 std::shared_ptr<IDataProvider>)));
43
39
44 connect(m_VariableController->variableModel(), &VariableModel::requestVariable,
40 // connect(m_VariableController->variableModel(), &VariableModel::requestVariable,
45 m_DataSourceController.get(), &DataSourceController::requestVariable);
41 // m_DataSourceController.get(), &DataSourceController::requestVariable);
46
42
47 // VariableController <-> VisualizationController
43 // VariableController <-> VisualizationController
48 connect(m_VariableController.get(),
44 // connect(m_VariableController.get(),
49 SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)),
45 // SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)),
50 m_VisualizationController.get(),
46 // m_VisualizationController.get(),
51 SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), Qt::DirectConnection);
47 // SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), Qt::DirectConnection);
52
48
53 connect(m_VariableController.get(),
49 // connect(m_VariableController.get(),
54 SIGNAL(rangeChanged(std::shared_ptr<Variable>, const DateTimeRange &)),
50 // SIGNAL(rangeChanged(std::shared_ptr<Variable>, const DateTimeRange &)),
55 m_VisualizationController.get(),
51 // m_VisualizationController.get(),
56 SIGNAL(rangeChanged(std::shared_ptr<Variable>, const DateTimeRange &)));
52 // SIGNAL(rangeChanged(std::shared_ptr<Variable>, const DateTimeRange &)));
57
53
58
54
59 m_DataSourceController->moveToThread(&m_DataSourceControllerThread);
55 m_DataSourceController.moveToThread(&m_DataSourceControllerThread);
60 m_DataSourceControllerThread.setObjectName("DataSourceControllerThread");
56 m_DataSourceControllerThread.setObjectName("DataSourceControllerThread");
61 m_NetworkController->moveToThread(&m_NetworkControllerThread);
57 m_NetworkController.moveToThread(&m_NetworkControllerThread);
62 m_NetworkControllerThread.setObjectName("NetworkControllerThread");
58 m_NetworkControllerThread.setObjectName("NetworkControllerThread");
63 m_VariableController->moveToThread(&m_VariableControllerThread);
59 m_VisualizationController.moveToThread(&m_VisualizationControllerThread);
64 m_VariableControllerThread.setObjectName("VariableControllerThread");
65 m_VisualizationController->moveToThread(&m_VisualizationControllerThread);
66 m_VisualizationControllerThread.setObjectName("VsualizationControllerThread");
60 m_VisualizationControllerThread.setObjectName("VsualizationControllerThread");
67
61
68 // Additionnal init
62 // Additionnal init
@@ -77,27 +71,24 public:
77 m_NetworkControllerThread.quit();
71 m_NetworkControllerThread.quit();
78 m_NetworkControllerThread.wait();
72 m_NetworkControllerThread.wait();
79
73
80 m_VariableControllerThread.quit();
81 m_VariableControllerThread.wait();
82
83 m_VisualizationControllerThread.quit();
74 m_VisualizationControllerThread.quit();
84 m_VisualizationControllerThread.wait();
75 m_VisualizationControllerThread.wait();
85 }
76 }
86
77
87 std::unique_ptr<DataSourceController> m_DataSourceController;
78 DataSourceController m_DataSourceController;
88 std::unique_ptr<VariableController> m_VariableController;
79 std::shared_ptr<VariableController2> m_VariableController;
89 std::unique_ptr<TimeController> m_TimeController;
80 TimeController m_TimeController;
90 std::unique_ptr<NetworkController> m_NetworkController;
81 NetworkController m_NetworkController;
91 std::unique_ptr<VisualizationController> m_VisualizationController;
82 VisualizationController m_VisualizationController;
92 std::unique_ptr<CatalogueController> m_CatalogueController;
83 CatalogueController m_CatalogueController;
84 VariableModel2 m_VariableModel;
93
85
94 QThread m_DataSourceControllerThread;
86 QThread m_DataSourceControllerThread;
95 QThread m_NetworkControllerThread;
87 QThread m_NetworkControllerThread;
96 QThread m_VariableControllerThread;
97 QThread m_VisualizationControllerThread;
88 QThread m_VisualizationControllerThread;
98
89
99 std::unique_ptr<DragDropGuiController> m_DragDropGuiController;
90 DragDropGuiController m_DragDropGuiController;
100 std::unique_ptr<ActionsGuiController> m_ActionsGuiController;
91 ActionsGuiController m_ActionsGuiController;
101
92
102 SqpApplication::PlotsInteractionMode m_PlotInterractionMode;
93 SqpApplication::PlotsInteractionMode m_PlotInterractionMode;
103 SqpApplication::PlotsCursorMode m_PlotCursorMode;
94 SqpApplication::PlotsCursorMode m_PlotCursorMode;
@@ -112,30 +103,24 SqpApplication::SqpApplication(int &argc, char **argv)
112 QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
103 QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
113
104
114 connect(&impl->m_DataSourceControllerThread, &QThread::started,
105 connect(&impl->m_DataSourceControllerThread, &QThread::started,
115 impl->m_DataSourceController.get(), &DataSourceController::initialize);
106 &impl->m_DataSourceController, &DataSourceController::initialize);
116 connect(&impl->m_DataSourceControllerThread, &QThread::finished,
107 connect(&impl->m_DataSourceControllerThread, &QThread::finished,
117 impl->m_DataSourceController.get(), &DataSourceController::finalize);
108 &impl->m_DataSourceController, &DataSourceController::finalize);
118
109
119 connect(&impl->m_NetworkControllerThread, &QThread::started, impl->m_NetworkController.get(),
110 connect(&impl->m_NetworkControllerThread, &QThread::started, &impl->m_NetworkController,
120 &NetworkController::initialize);
111 &NetworkController::initialize);
121 connect(&impl->m_NetworkControllerThread, &QThread::finished, impl->m_NetworkController.get(),
112 connect(&impl->m_NetworkControllerThread, &QThread::finished, &impl->m_NetworkController,
122 &NetworkController::finalize);
113 &NetworkController::finalize);
123
114
124 connect(&impl->m_VariableControllerThread, &QThread::started, impl->m_VariableController.get(),
125 &VariableController::initialize);
126 connect(&impl->m_VariableControllerThread, &QThread::finished, impl->m_VariableController.get(),
127 &VariableController::finalize);
128
129 connect(&impl->m_VisualizationControllerThread, &QThread::started,
115 connect(&impl->m_VisualizationControllerThread, &QThread::started,
130 impl->m_VisualizationController.get(), &VisualizationController::initialize);
116 &impl->m_VisualizationController, &VisualizationController::initialize);
131 connect(&impl->m_VisualizationControllerThread, &QThread::finished,
117 connect(&impl->m_VisualizationControllerThread, &QThread::finished,
132 impl->m_VisualizationController.get(), &VisualizationController::finalize);
118 &impl->m_VisualizationController, &VisualizationController::finalize);
133
119
134 impl->m_DataSourceControllerThread.start();
120 impl->m_DataSourceControllerThread.start();
135 impl->m_NetworkControllerThread.start();
121 impl->m_NetworkControllerThread.start();
136 impl->m_VariableControllerThread.start();
137 impl->m_VisualizationControllerThread.start();
122 impl->m_VisualizationControllerThread.start();
138 impl->m_CatalogueController->initialize();
123 impl->m_CatalogueController.initialize();
139 }
124 }
140
125
141 SqpApplication::~SqpApplication()
126 SqpApplication::~SqpApplication()
@@ -148,42 +133,52 void SqpApplication::initialize()
148
133
149 DataSourceController &SqpApplication::dataSourceController() noexcept
134 DataSourceController &SqpApplication::dataSourceController() noexcept
150 {
135 {
151 return *impl->m_DataSourceController;
136 return impl->m_DataSourceController;
152 }
137 }
153
138
154 NetworkController &SqpApplication::networkController() noexcept
139 NetworkController &SqpApplication::networkController() noexcept
155 {
140 {
156 return *impl->m_NetworkController;
141 return impl->m_NetworkController;
157 }
142 }
158
143
159 TimeController &SqpApplication::timeController() noexcept
144 TimeController &SqpApplication::timeController() noexcept
160 {
145 {
161 return *impl->m_TimeController;
146 return impl->m_TimeController;
162 }
147 }
163
148
164 VariableController &SqpApplication::variableController() noexcept
149 VariableController2 &SqpApplication::variableController() noexcept
165 {
150 {
166 return *impl->m_VariableController;
151 return *impl->m_VariableController;
167 }
152 }
168
153
154 std::shared_ptr<VariableController2> SqpApplication::variableControllerOwner() noexcept
155 {
156 return impl->m_VariableController;
157 }
158
159 //VariableModel2 &SqpApplication::variableModel() noexcept
160 //{
161 // return impl->m_VariableModel;
162 //}
163
169 VisualizationController &SqpApplication::visualizationController() noexcept
164 VisualizationController &SqpApplication::visualizationController() noexcept
170 {
165 {
171 return *impl->m_VisualizationController;
166 return impl->m_VisualizationController;
172 }
167 }
173
168
174 CatalogueController &SqpApplication::catalogueController() noexcept
169 CatalogueController &SqpApplication::catalogueController() noexcept
175 {
170 {
176 return *impl->m_CatalogueController;
171 return impl->m_CatalogueController;
177 }
172 }
178
173
179 DragDropGuiController &SqpApplication::dragDropGuiController() noexcept
174 DragDropGuiController &SqpApplication::dragDropGuiController() noexcept
180 {
175 {
181 return *impl->m_DragDropGuiController;
176 return impl->m_DragDropGuiController;
182 }
177 }
183
178
184 ActionsGuiController &SqpApplication::actionsGuiController() noexcept
179 ActionsGuiController &SqpApplication::actionsGuiController() noexcept
185 {
180 {
186 return *impl->m_ActionsGuiController;
181 return impl->m_ActionsGuiController;
187 }
182 }
188
183
189 SqpApplication::PlotsInteractionMode SqpApplication::plotsInteractionMode() const
184 SqpApplication::PlotsInteractionMode SqpApplication::plotsInteractionMode() const
@@ -1,9 +1,9
1 #include <Variable/RenameVariableDialog.h>
1 #include <Variable/RenameVariableDialog.h>
2 #include <Variable/Variable.h>
2 #include <Variable/Variable.h>
3 #include <Variable/VariableController.h>
3 #include <Variable/VariableController2.h>
4 #include <Variable/VariableInspectorWidget.h>
4 #include <Variable/VariableInspectorWidget.h>
5 #include <Variable/VariableMenuHeaderWidget.h>
5 #include <Variable/VariableMenuHeaderWidget.h>
6 #include <Variable/VariableModel.h>
6 #include <Variable/VariableModel2.h>
7
7
8 #include <ui_VariableInspectorWidget.h>
8 #include <ui_VariableInspectorWidget.h>
9
9
@@ -92,8 +92,8 public:
92
92
93 if (clickX > x && clickX < x + w) {
93 if (clickX > x && clickX < x + w) {
94 if (clickY > y && clickY < y + h) {
94 if (clickY > y && clickY < y + h) {
95 auto variableModel = sqpApp->variableController().variableModel();
95 //auto& variableModel = sqpApp->variableModel();
96 variableModel->abortProgress(index);
96 //variableModel->abortProgress(index);
97 }
97 }
98 return true;
98 return true;
99 }
99 }
@@ -125,15 +125,15 VariableInspectorWidget::VariableInspectorWidget(QWidget *parent)
125 // auto sortFilterModel = new QSortFilterProxyModel{this};
125 // auto sortFilterModel = new QSortFilterProxyModel{this};
126 // sortFilterModel->setSourceModel(sqpApp->variableController().variableModel());
126 // sortFilterModel->setSourceModel(sqpApp->variableController().variableModel());
127
127
128 auto variableModel = sqpApp->variableController().variableModel();
128 m_model = new VariableModel2(sqpApp->variableControllerOwner());
129 ui->tableView->setModel(variableModel);
129 ui->tableView->setModel(m_model);
130
130
131 // Adds extra signal/slot between view and model, so the view can be updated instantly when
131 // Adds extra signal/slot between view and model, so the view can be updated instantly when
132 // there is a change of data in the model
132 // there is a change of data in the model
133 connect(variableModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), this,
133 connect(m_model, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), this,
134 SLOT(refresh()));
134 SLOT(refresh()));
135
135
136 ui->tableView->setSelectionModel(sqpApp->variableController().variableSelectionModel());
136 //ui->tableView->setSelectionModel(sqpApp->variableController().variableSelectionModel());
137 ui->tableView->setItemDelegateForColumn(0, m_ProgressBarItemDelegate);
137 ui->tableView->setItemDelegateForColumn(0, m_ProgressBarItemDelegate);
138
138
139 // Fixes column sizes
139 // Fixes column sizes
@@ -164,10 +164,10 void VariableInspectorWidget::onTableMenuRequested(const QPoint &pos) noexcept
164 auto selectedRows = ui->tableView->selectionModel()->selectedRows();
164 auto selectedRows = ui->tableView->selectionModel()->selectedRows();
165
165
166 // Gets the model to retrieve the underlying selected variables
166 // Gets the model to retrieve the underlying selected variables
167 auto model = sqpApp->variableController().variableModel();
167 auto& vc = sqpApp->variableController();
168 auto selectedVariables = QVector<std::shared_ptr<Variable> >{};
168 auto selectedVariables = QVector<std::shared_ptr<Variable> >{};
169 for (const auto &selectedRow : qAsConst(selectedRows)) {
169 for (const auto &selectedRow : qAsConst(selectedRows)) {
170 if (auto selectedVariable = model->variable(selectedRow.row())) {
170 if (auto selectedVariable = vc[selectedRow.row()]) {
171 selectedVariables.push_back(selectedVariable);
171 selectedVariables.push_back(selectedVariable);
172 }
172 }
173 }
173 }
@@ -194,11 +194,11 void VariableInspectorWidget::onTableMenuRequested(const QPoint &pos) noexcept
194
194
195 tableMenu.addAction(tr("Duplicate"), duplicateFun);
195 tableMenu.addAction(tr("Duplicate"), duplicateFun);
196
196
197 auto renameFun = [ varW = std::weak_ptr<Variable>(selectedVariable), &model, this ]()
197 auto renameFun = [ varW = std::weak_ptr<Variable>(selectedVariable), this ]()
198 {
198 {
199 if (auto var = varW.lock()) {
199 if (auto var = varW.lock()) {
200 // Generates forbidden names (names associated to existing variables)
200 // Generates forbidden names (names associated to existing variables)
201 auto allVariables = model->variables();
201 auto allVariables = sqpApp->variableController().variables();
202 auto forbiddenNames = QVector<QString>(allVariables.size());
202 auto forbiddenNames = QVector<QString>(allVariables.size());
203 std::transform(allVariables.cbegin(), allVariables.cend(),
203 std::transform(allVariables.cbegin(), allVariables.cend(),
204 forbiddenNames.begin(),
204 forbiddenNames.begin(),
@@ -216,7 +216,8 void VariableInspectorWidget::onTableMenuRequested(const QPoint &pos) noexcept
216
216
217 // 'Delete' action
217 // 'Delete' action
218 auto deleteFun = [&selectedVariables]() {
218 auto deleteFun = [&selectedVariables]() {
219 sqpApp->variableController().deleteVariables(selectedVariables);
219 for(const auto& var:selectedVariables)
220 sqpApp->variableController().deleteVariable(var);
220 };
221 };
221
222
222 tableMenu.addAction(QIcon{":/icones/delete.png"}, tr("Delete"), deleteFun);
223 tableMenu.addAction(QIcon{":/icones/delete.png"}, tr("Delete"), deleteFun);
@@ -253,11 +253,12 VisualizationGraphWidget::VisualizationGraphWidget(const QString &name, QWidget
253 connect(ui->widget, &QCustomPlot::customContextMenuRequested, this,
253 connect(ui->widget, &QCustomPlot::customContextMenuRequested, this,
254 &VisualizationGraphWidget::onGraphMenuRequested);
254 &VisualizationGraphWidget::onGraphMenuRequested);
255
255
256 connect(this, &VisualizationGraphWidget::requestDataLoading, &sqpApp->variableController(),
256 //@TODO implement this :)
257 &VariableController::onRequestDataLoading);
257 // connect(this, &VisualizationGraphWidget::requestDataLoading, &sqpApp->variableController(),
258 // &VariableController::onRequestDataLoading);
258
259
259 connect(&sqpApp->variableController(), &VariableController::updateVarDisplaying, this,
260 // connect(&sqpApp->variableController(), &VariableController2::updateVarDisplaying, this,
260 &VisualizationGraphWidget::onUpdateVarDisplaying);
261 // &VisualizationGraphWidget::onUpdateVarDisplaying);
261
262
262 // Necessary for all platform since Qt::AA_EnableHighDpiScaling is enable.
263 // Necessary for all platform since Qt::AA_EnableHighDpiScaling is enable.
263 plot().setPlottingHint(QCP::phFastPolylines, true);
264 plot().setPlottingHint(QCP::phFastPolylines, true);
@@ -365,12 +366,12 void VisualizationGraphWidget::removeVariable(std::shared_ptr<Variable> variable
365 ui->widget->replot();
366 ui->widget->replot();
366 }
367 }
367
368
368 QList<std::shared_ptr<Variable> > VisualizationGraphWidget::variables() const
369 std::vector<std::shared_ptr<Variable> > VisualizationGraphWidget::variables() const
369 {
370 {
370 auto variables = QList<std::shared_ptr<Variable> >{};
371 auto variables = std::vector<std::shared_ptr<Variable> >{};
371 for (auto it = std::cbegin(impl->m_VariableToPlotMultiMap);
372 for (auto it = std::cbegin(impl->m_VariableToPlotMultiMap);
372 it != std::cend(impl->m_VariableToPlotMultiMap); ++it) {
373 it != std::cend(impl->m_VariableToPlotMultiMap); ++it) {
373 variables << it->first;
374 variables.push_back (it->first);
374 }
375 }
375
376
376 return variables;
377 return variables;
@@ -8,7 +8,7
8 #include "Visualization/MacScrollBarStyle.h"
8 #include "Visualization/MacScrollBarStyle.h"
9
9
10 #include "DataSource/DataSourceController.h"
10 #include "DataSource/DataSourceController.h"
11 #include "Variable/VariableController.h"
11 #include "Variable/VariableController2.h"
12
12
13 #include "Common/MimeTypesDef.h"
13 #include "Common/MimeTypesDef.h"
14
14
@@ -68,7 +68,7 struct VisualizationTabWidget::VisualizationTabWidgetPrivate {
68
68
69 void dropGraph(int index, VisualizationTabWidget *tabWidget);
69 void dropGraph(int index, VisualizationTabWidget *tabWidget);
70 void dropZone(int index, VisualizationTabWidget *tabWidget);
70 void dropZone(int index, VisualizationTabWidget *tabWidget);
71 void dropVariables(const QList<std::shared_ptr<Variable> > &variables, int index,
71 void dropVariables(const std::vector<std::shared_ptr<Variable> > &variables, int index,
72 VisualizationTabWidget *tabWidget);
72 VisualizationTabWidget *tabWidget);
73 void dropProducts(const QVariantList &productsMetaData, int index,
73 void dropProducts(const QVariantList &productsMetaData, int index,
74 VisualizationTabWidget *tabWidget);
74 VisualizationTabWidget *tabWidget);
@@ -154,7 +154,7 VisualizationZoneWidget *VisualizationTabWidget::createZone(std::shared_ptr<Vari
154 }
154 }
155
155
156 VisualizationZoneWidget *
156 VisualizationZoneWidget *
157 VisualizationTabWidget::createZone(const QList<std::shared_ptr<Variable> > &variables, int index)
157 VisualizationTabWidget::createZone(const std::vector<std::shared_ptr<Variable> > &variables, int index)
158 {
158 {
159 auto zoneWidget = createEmptyZone(index);
159 auto zoneWidget = createEmptyZone(index);
160
160
@@ -230,7 +230,7 void VisualizationTabWidget::dropMimeData(int index, const QMimeData *mimeData)
230 impl->dropZone(index, this);
230 impl->dropZone(index, this);
231 }
231 }
232 else if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) {
232 else if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) {
233 auto variables = sqpApp->variableController().variablesForMimeData(
233 auto variables = sqpApp->variableController().variables(
234 mimeData->data(MIME_TYPE_VARIABLE_LIST));
234 mimeData->data(MIME_TYPE_VARIABLE_LIST));
235 impl->dropVariables(variables, index, this);
235 impl->dropVariables(variables, index, this);
236 }
236 }
@@ -273,7 +273,7 void VisualizationTabWidget::VisualizationTabWidgetPrivate::dropGraph(
273
273
274 const auto &variables = graphWidget->variables();
274 const auto &variables = graphWidget->variables();
275
275
276 if (!variables.isEmpty()) {
276 if (!variables.empty()) {
277 // Abort the requests for the variables (if any)
277 // Abort the requests for the variables (if any)
278 // Commented, because it's not sure if it's needed or not
278 // Commented, because it's not sure if it's needed or not
279 // for (const auto& var : variables)
279 // for (const auto& var : variables)
@@ -348,12 +348,12 void VisualizationTabWidget::VisualizationTabWidgetPrivate::dropZone(
348 }
348 }
349
349
350 void VisualizationTabWidget::VisualizationTabWidgetPrivate::dropVariables(
350 void VisualizationTabWidget::VisualizationTabWidgetPrivate::dropVariables(
351 const QList<std::shared_ptr<Variable> > &variables, int index,
351 const std::vector<std::shared_ptr<Variable> > &variables, int index,
352 VisualizationTabWidget *tabWidget)
352 VisualizationTabWidget *tabWidget)
353 {
353 {
354 // Note: the AcceptMimeDataFunction (set on the drop container) ensure there is a single and
354 // Note: the AcceptMimeDataFunction (set on the drop container) ensure there is a single and
355 // compatible variable here
355 // compatible variable here
356 if (variables.count() > 1) {
356 if (variables.size() > 1) {
357 qCWarning(LOG_VisualizationZoneWidget())
357 qCWarning(LOG_VisualizationZoneWidget())
358 << tr("VisualizationTabWidget::dropVariables, dropping multiple variables, operation "
358 << tr("VisualizationTabWidget::dropVariables, dropping multiple variables, operation "
359 "aborted.");
359 "aborted.");
@@ -376,7 +376,7 void VisualizationTabWidget::VisualizationTabWidgetPrivate::dropProducts(
376 }
376 }
377
377
378 auto context = new QObject{tabWidget};
378 auto context = new QObject{tabWidget};
379 connect(&sqpApp->variableController(), &VariableController::variableAdded, context,
379 connect(&sqpApp->variableController(), &VariableController2::variableAdded, context,
380 [this, index, tabWidget, context](auto variable) {
380 [this, index, tabWidget, context](auto variable) {
381 tabWidget->createZone({variable}, index);
381 tabWidget->createZone({variable}, index);
382 delete context; // removes the connection
382 delete context; // removes the connection
@@ -10,10 +10,11
10 #include "Common/VisualizationDef.h"
10 #include "Common/VisualizationDef.h"
11
11
12 #include <Data/DateTimeRange.h>
12 #include <Data/DateTimeRange.h>
13 #include <Data/DateTimeRangeHelper.h>
13 #include <DataSource/DataSourceController.h>
14 #include <DataSource/DataSourceController.h>
14 #include <Time/TimeController.h>
15 #include <Time/TimeController.h>
15 #include <Variable/Variable.h>
16 #include <Variable/Variable.h>
16 #include <Variable/VariableController.h>
17 #include <Variable/VariableController2.h>
17
18
18 #include <Visualization/operations/FindVariableOperation.h>
19 #include <Visualization/operations/FindVariableOperation.h>
19
20
@@ -78,7 +79,7 struct VisualizationZoneWidget::VisualizationZoneWidgetPrivate {
78 std::unique_ptr<IGraphSynchronizer> m_Synchronizer;
79 std::unique_ptr<IGraphSynchronizer> m_Synchronizer;
79
80
80 void dropGraph(int index, VisualizationZoneWidget *zoneWidget);
81 void dropGraph(int index, VisualizationZoneWidget *zoneWidget);
81 void dropVariables(const QList<std::shared_ptr<Variable> > &variables, int index,
82 void dropVariables(const std::vector<std::shared_ptr<Variable> > &variables, int index,
82 VisualizationZoneWidget *zoneWidget);
83 VisualizationZoneWidget *zoneWidget);
83 void dropProducts(const QVariantList &productsData, int index,
84 void dropProducts(const QVariantList &productsData, int index,
84 VisualizationZoneWidget *zoneWidget);
85 VisualizationZoneWidget *zoneWidget);
@@ -117,13 +118,13 VisualizationZoneWidget::VisualizationZoneWidget(const QString &name, QWidget *p
117 }
118 }
118
119
119 if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) {
120 if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) {
120 auto variables = sqpApp->variableController().variablesForMimeData(
121 auto variables = sqpApp->variableController().variables(
121 mimeData->data(MIME_TYPE_VARIABLE_LIST));
122 mimeData->data(MIME_TYPE_VARIABLE_LIST));
122
123
123 if (variables.count() != 1) {
124 if (variables.size() != 1) {
124 return false;
125 return false;
125 }
126 }
126 auto variable = variables.first();
127 auto variable = variables.front();
127
128
128 if (auto graphWidget = dynamic_cast<const VisualizationGraphWidget *>(dragWidget)) {
129 if (auto graphWidget = dynamic_cast<const VisualizationGraphWidget *>(dragWidget)) {
129 return graphWidget->canDrop(*variable);
130 return graphWidget->canDrop(*variable);
@@ -202,7 +203,7 VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<V
202 auto synchronizeZoneWidget = [this, graphWidget](const DateTimeRange &graphRange,
203 auto synchronizeZoneWidget = [this, graphWidget](const DateTimeRange &graphRange,
203 const DateTimeRange &oldGraphRange) {
204 const DateTimeRange &oldGraphRange) {
204
205
205 auto zoomType = VariableController::getZoomType(graphRange, oldGraphRange);
206 auto zoomType = DateTimeRangeHelper::getTransformationType(oldGraphRange, graphRange);
206 auto frameLayout = ui->dragDropContainer->layout();
207 auto frameLayout = ui->dragDropContainer->layout();
207 for (auto i = 0; i < frameLayout->count(); ++i) {
208 for (auto i = 0; i < frameLayout->count(); ++i) {
208 auto graphChild
209 auto graphChild
@@ -211,57 +212,36 VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<V
211
212
212 auto graphChildRange = graphChild->graphRange();
213 auto graphChildRange = graphChild->graphRange();
213 switch (zoomType) {
214 switch (zoomType) {
214 case AcquisitionZoomType::ZoomIn: {
215 case TransformationType::ZoomIn: {
215 auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart;
216 auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart;
216 auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd;
217 auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd;
217 graphChildRange.m_TStart += deltaLeft;
218 graphChildRange.m_TStart += deltaLeft;
218 graphChildRange.m_TEnd -= deltaRight;
219 graphChildRange.m_TEnd -= deltaRight;
219 qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: ZoomIn");
220 qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: deltaLeft")
221 << deltaLeft;
222 qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: deltaRight")
223 << deltaRight;
224 qCDebug(LOG_VisualizationZoneWidget())
225 << tr("TORM: dt") << graphRange.m_TEnd - graphRange.m_TStart;
226
227 break;
220 break;
228 }
221 }
229
222
230 case AcquisitionZoomType::ZoomOut: {
223 case TransformationType::ZoomOut: {
231 qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: ZoomOut");
232 auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart;
224 auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart;
233 auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd;
225 auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd;
234 qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: deltaLeft")
235 << deltaLeft;
236 qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: deltaRight")
237 << deltaRight;
238 qCDebug(LOG_VisualizationZoneWidget())
239 << tr("TORM: dt") << graphRange.m_TEnd - graphRange.m_TStart;
240 graphChildRange.m_TStart -= deltaLeft;
226 graphChildRange.m_TStart -= deltaLeft;
241 graphChildRange.m_TEnd += deltaRight;
227 graphChildRange.m_TEnd += deltaRight;
242 break;
228 break;
243 }
229 }
244 case AcquisitionZoomType::PanRight: {
230 case TransformationType::PanRight: {
245 qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: PanRight");
246 auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart;
231 auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart;
247 auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd;
232 auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd;
248 graphChildRange.m_TStart += deltaLeft;
233 graphChildRange.m_TStart += deltaLeft;
249 graphChildRange.m_TEnd += deltaRight;
234 graphChildRange.m_TEnd += deltaRight;
250 qCDebug(LOG_VisualizationZoneWidget())
251 << tr("TORM: dt") << graphRange.m_TEnd - graphRange.m_TStart;
252 break;
235 break;
253 }
236 }
254 case AcquisitionZoomType::PanLeft: {
237 case TransformationType::PanLeft: {
255 qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: PanLeft");
256 auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart;
238 auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart;
257 auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd;
239 auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd;
258 graphChildRange.m_TStart -= deltaLeft;
240 graphChildRange.m_TStart -= deltaLeft;
259 graphChildRange.m_TEnd -= deltaRight;
241 graphChildRange.m_TEnd -= deltaRight;
260 break;
242 break;
261 }
243 }
262 case AcquisitionZoomType::Unknown: {
244 case TransformationType::Unknown: {
263 qCDebug(LOG_VisualizationZoneWidget())
264 << tr("Impossible to synchronize: zoom type unknown");
265 break;
245 break;
266 }
246 }
267 default:
247 default:
@@ -271,12 +251,6 VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<V
271 break;
251 break;
272 }
252 }
273 graphChild->setFlags(GraphFlag::DisableAll);
253 graphChild->setFlags(GraphFlag::DisableAll);
274 qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: Range before: ")
275 << graphChild->graphRange();
276 qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: Range after : ")
277 << graphChildRange;
278 qCDebug(LOG_VisualizationZoneWidget())
279 << tr("TORM: child dt") << graphChildRange.m_TEnd - graphChildRange.m_TStart;
280 graphChild->setGraphRange(graphChildRange);
254 graphChild->setGraphRange(graphChildRange);
281 graphChild->setFlags(GraphFlag::EnableAll);
255 graphChild->setFlags(GraphFlag::EnableAll);
282 }
256 }
@@ -309,13 +283,13 VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<V
309 }
283 }
310
284
311 VisualizationGraphWidget *
285 VisualizationGraphWidget *
312 VisualizationZoneWidget::createGraph(const QList<std::shared_ptr<Variable> > variables, int index)
286 VisualizationZoneWidget::createGraph(const std::vector<std::shared_ptr<Variable> > variables, int index)
313 {
287 {
314 if (variables.isEmpty()) {
288 if (variables.empty()) {
315 return nullptr;
289 return nullptr;
316 }
290 }
317
291
318 auto graphWidget = createGraph(variables.first(), index);
292 auto graphWidget = createGraph(variables.front(), index);
319 for (auto variableIt = variables.cbegin() + 1; variableIt != variables.cend(); ++variableIt) {
293 for (auto variableIt = variables.cbegin() + 1; variableIt != variables.cend(); ++variableIt) {
320 graphWidget->addVariable(*variableIt, graphWidget->graphRange());
294 graphWidget->addVariable(*variableIt, graphWidget->graphRange());
321 }
295 }
@@ -485,7 +459,7 void VisualizationZoneWidget::dropMimeData(int index, const QMimeData *mimeData)
485 impl->dropGraph(index, this);
459 impl->dropGraph(index, this);
486 }
460 }
487 else if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) {
461 else if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) {
488 auto variables = sqpApp->variableController().variablesForMimeData(
462 auto variables = sqpApp->variableController().variables(
489 mimeData->data(MIME_TYPE_VARIABLE_LIST));
463 mimeData->data(MIME_TYPE_VARIABLE_LIST));
490 impl->dropVariables(variables, index, this);
464 impl->dropVariables(variables, index, this);
491 }
465 }
@@ -513,7 +487,7 void VisualizationZoneWidget::dropMimeDataOnGraph(VisualizationDragWidget *dragW
513 }
487 }
514
488
515 if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) {
489 if (mimeData->hasFormat(MIME_TYPE_VARIABLE_LIST)) {
516 auto variables = sqpApp->variableController().variablesForMimeData(
490 auto variables = sqpApp->variableController().variables(
517 mimeData->data(MIME_TYPE_VARIABLE_LIST));
491 mimeData->data(MIME_TYPE_VARIABLE_LIST));
518 for (const auto &var : variables) {
492 for (const auto &var : variables) {
519 graphWidget->addVariable(var, graphWidget->graphRange());
493 graphWidget->addVariable(var, graphWidget->graphRange());
@@ -524,7 +498,7 void VisualizationZoneWidget::dropMimeDataOnGraph(VisualizationDragWidget *dragW
524 mimeData->data(MIME_TYPE_PRODUCT_LIST));
498 mimeData->data(MIME_TYPE_PRODUCT_LIST));
525
499
526 auto context = new QObject{this};
500 auto context = new QObject{this};
527 connect(&sqpApp->variableController(), &VariableController::variableAdded, context,
501 connect(&sqpApp->variableController(), &VariableController2::variableAdded, context,
528 [this, graphWidget, context](auto variable) {
502 [this, graphWidget, context](auto variable) {
529 graphWidget->addVariable(variable, graphWidget->graphRange());
503 graphWidget->addVariable(variable, graphWidget->graphRange());
530 delete context; // removes the connection
504 delete context; // removes the connection
@@ -571,7 +545,7 void VisualizationZoneWidget::VisualizationZoneWidgetPrivate::dropGraph(
571
545
572 const auto &variables = graphWidget->variables();
546 const auto &variables = graphWidget->variables();
573
547
574 if (parentDragDropContainer != zoneWidget->ui->dragDropContainer && !variables.isEmpty()) {
548 if (parentDragDropContainer != zoneWidget->ui->dragDropContainer && !variables.empty()) {
575 // The drop didn't occur in the same zone
549 // The drop didn't occur in the same zone
576
550
577 // Abort the requests for the variables (if any)
551 // Abort the requests for the variables (if any)
@@ -601,7 +575,7 void VisualizationZoneWidget::VisualizationZoneWidgetPrivate::dropGraph(
601 // Simple move of the graph, no variable operation associated
575 // Simple move of the graph, no variable operation associated
602 parentDragDropContainer->layout()->removeWidget(graphWidget);
576 parentDragDropContainer->layout()->removeWidget(graphWidget);
603
577
604 if (variables.isEmpty() && parentDragDropContainer != zoneWidget->ui->dragDropContainer) {
578 if (variables.empty() && parentDragDropContainer != zoneWidget->ui->dragDropContainer) {
605 // The graph is empty and dropped in a different zone.
579 // The graph is empty and dropped in a different zone.
606 // Take the range of the first graph in the zone (if existing).
580 // Take the range of the first graph in the zone (if existing).
607 auto layout = zoneWidget->ui->dragDropContainer->layout();
581 auto layout = zoneWidget->ui->dragDropContainer->layout();
@@ -618,18 +592,14 void VisualizationZoneWidget::VisualizationZoneWidgetPrivate::dropGraph(
618 }
592 }
619
593
620 void VisualizationZoneWidget::VisualizationZoneWidgetPrivate::dropVariables(
594 void VisualizationZoneWidget::VisualizationZoneWidgetPrivate::dropVariables(
621 const QList<std::shared_ptr<Variable> > &variables, int index,
595 const std::vector<std::shared_ptr<Variable> > &variables, int index,
622 VisualizationZoneWidget *zoneWidget)
596 VisualizationZoneWidget *zoneWidget)
623 {
597 {
624 // Note: the AcceptMimeDataFunction (set on the drop container) ensure there is a single and
598 // Note: the AcceptMimeDataFunction (set on the drop container) ensure there is a single and
625 // compatible variable here
599 // compatible variable here
626 if (variables.count() > 1) {
600 if (variables.size() > 1) {
627 qCWarning(LOG_VisualizationZoneWidget())
628 << tr("VisualizationZoneWidget::dropVariables, dropping multiple variables, operation "
629 "aborted.");
630 return;
601 return;
631 }
602 }
632
633 zoneWidget->createGraph(variables, index);
603 zoneWidget->createGraph(variables, index);
634 }
604 }
635
605
@@ -646,7 +616,7 void VisualizationZoneWidget::VisualizationZoneWidgetPrivate::dropProducts(
646 }
616 }
647
617
648 auto context = new QObject{zoneWidget};
618 auto context = new QObject{zoneWidget};
649 connect(&sqpApp->variableController(), &VariableController::variableAdded, context,
619 connect(&sqpApp->variableController(), &VariableController2::variableAdded, context,
650 [this, index, zoneWidget, context](auto variable) {
620 [this, index, zoneWidget, context](auto variable) {
651 zoneWidget->createGraph(variable, index);
621 zoneWidget->createGraph(variable, index);
652 delete context; // removes the connection
622 delete context; // removes the connection
@@ -30,7 +30,7
30 #include <pybind11/chrono.h>
30 #include <pybind11/chrono.h>
31
31
32 #include <SqpApplication.h>
32 #include <SqpApplication.h>
33 #include <Variable/VariableController.h>
33 #include <Variable/VariableController2.h>
34 #include <Time/TimeController.h>
34 #include <Time/TimeController.h>
35 #include <Data/DateTimeRange.h>
35 #include <Data/DateTimeRange.h>
36 #include <Data/DataSeriesType.h>
36 #include <Data/DataSeriesType.h>
@@ -73,38 +73,38 PYBIND11_MODULE(pytestamda, m){
73
73
74 m.doc() = "hello";
74 m.doc() = "hello";
75
75
76 py::class_<VariableController>(m, "VariableController")
76 // py::class_<VariableController>(m, "VariableController")
77 .def_static("createVariable",[](const QString &name,
77 // .def_static("createVariable",[](const QString &name,
78 std::shared_ptr<IDataProvider> provider, const DateTimeRange& range){
78 // std::shared_ptr<IDataProvider> provider, const DateTimeRange& range){
79 return sqpApp->variableController().createVariable(name, {{"dataType", "vector"}, {"xml:id", "c1_b"}}, provider, range);
79 // return sqpApp->variableController().createVariable(name, {{"dataType", "vector"}, {"xml:id", "c1_b"}}, provider, range);
80 })
80 // })
81 .def_static("hasPendingDownloads",
81 // .def_static("hasPendingDownloads",
82 [](){return sqpApp->variableController().hasPendingDownloads();}
82 // [](){return sqpApp->variableController().hasPendingDownloads();}
83 )
83 // )
84 .def_static("addSynchronizationGroup",
84 // .def_static("addSynchronizationGroup",
85 [](QUuid uuid){sqpApp->variableController().onAddSynchronizationGroupId(uuid);}
85 // [](QUuid uuid){sqpApp->variableController().onAddSynchronizationGroupId(uuid);}
86 )
86 // )
87 .def_static("removeSynchronizationGroup",
87 // .def_static("removeSynchronizationGroup",
88 [](QUuid uuid){sqpApp->variableController().onRemoveSynchronizationGroupId(uuid);}
88 // [](QUuid uuid){sqpApp->variableController().onRemoveSynchronizationGroupId(uuid);}
89 )
89 // )
90 .def_static("synchronizeVar",
90 // .def_static("synchronizeVar",
91 [](std::shared_ptr<Variable> variable, QUuid uuid){sqpApp->variableController().onAddSynchronized(variable, uuid);}
91 // [](std::shared_ptr<Variable> variable, QUuid uuid){sqpApp->variableController().onAddSynchronized(variable, uuid);}
92 )
92 // )
93 .def_static("deSynchronizeVar",
93 // .def_static("deSynchronizeVar",
94 [](std::shared_ptr<Variable> variable, QUuid uuid){sqpApp->variableController().desynchronize(variable, uuid);}
94 // [](std::shared_ptr<Variable> variable, QUuid uuid){sqpApp->variableController().desynchronize(variable, uuid);}
95 )
95 // )
96 .def_static("deleteVariable",
96 // .def_static("deleteVariable",
97 [](std::shared_ptr<Variable> variable){
97 // [](std::shared_ptr<Variable> variable){
98 sqpApp->variableController().deleteVariable(variable);}
98 // sqpApp->variableController().deleteVariable(variable);}
99 )
99 // )
100 .def_static("update_range",[](std::shared_ptr<Variable> variable, const DateTimeRange &range, bool synchronise){
100 // .def_static("update_range",[](std::shared_ptr<Variable> variable, const DateTimeRange &range, bool synchronise){
101 sqpApp->variableController().onRequestDataLoading({variable}, range, synchronise);
101 // sqpApp->variableController().onRequestDataLoading({variable}, range, synchronise);
102 })
102 // })
103 .def_static("wait_for_downloads",[](){
103 // .def_static("wait_for_downloads",[](){
104 while (sqpApp->variableController().hasPendingDownloads()) {
104 // while (sqpApp->variableController().hasPendingDownloads()) {
105 usleep(100);
105 // usleep(100);
106 }
106 // }
107 });
107 // });
108
108
109 py::class_<TimeController>(m,"TimeController")
109 py::class_<TimeController>(m,"TimeController")
110 .def_static("setTime", [](DateTimeRange range){sqpApp->timeController().setDateTimeRange(range);});
110 .def_static("setTime", [](DateTimeRange range){sqpApp->timeController().setDateTimeRange(range);});
@@ -7,7 +7,7
7 #include <Data/ScalarSeries.h>
7 #include <Data/ScalarSeries.h>
8 #include <Time/TimeController.h>
8 #include <Time/TimeController.h>
9 #include <Variable/Variable.h>
9 #include <Variable/Variable.h>
10 #include <Variable/VariableController.h>
10 #include <Variable/VariableController2.h>
11
11
12 #include <QObject>
12 #include <QObject>
13 #include <QtTest>
13 #include <QtTest>
@@ -143,7 +143,7 void TestAmdaAcquisition::testAcquisition()
143 QFETCH(std::vector<DateTimeRange>, operations);
143 QFETCH(std::vector<DateTimeRange>, operations);
144 for (const auto &operation : operations) {
144 for (const auto &operation : operations) {
145 // Asks request on the variable and waits during its execution
145 // Asks request on the variable and waits during its execution
146 sqpApp->variableController().onRequestDataLoading({variable}, operation, false);
146 sqpApp->variableController().changeRange({variable}, operation);
147
147
148 QTest::qWait(OPERATION_DELAY);
148 QTest::qWait(OPERATION_DELAY);
149 validateVariable(variable, operation);
149 validateVariable(variable, operation);
@@ -11,7 +11,7
11 #include <SqpApplication.h>
11 #include <SqpApplication.h>
12 #include <Time/TimeController.h>
12 #include <Time/TimeController.h>
13 #include <Variable/Variable.h>
13 #include <Variable/Variable.h>
14 #include <Variable/VariableController.h>
14 #include <Variable/VariableController2.h>
15
15
16 #include <QLoggingCategory>
16 #include <QLoggingCategory>
17 #include <QObject>
17 #include <QObject>
@@ -173,7 +173,7 void validate(const VariablesPool &variablesPool, const Validators &validators)
173 */
173 */
174 class FuzzingTest {
174 class FuzzingTest {
175 public:
175 public:
176 explicit FuzzingTest(VariableController &variableController, Properties properties)
176 explicit FuzzingTest(VariableController2 &variableController, Properties properties)
177 : m_VariableController{variableController},
177 : m_VariableController{variableController},
178 m_Properties{std::move(properties)},
178 m_Properties{std::move(properties)},
179 m_FuzzingState{}
179 m_FuzzingState{}
@@ -186,7 +186,7 public:
186 // Inits sync groups and registers them into the variable controller
186 // Inits sync groups and registers them into the variable controller
187 for (auto i = 0; i < nbMaxSyncGroups(); ++i) {
187 for (auto i = 0; i < nbMaxSyncGroups(); ++i) {
188 auto syncGroupId = SyncGroupId::createUuid();
188 auto syncGroupId = SyncGroupId::createUuid();
189 variableController.onAddSynchronizationGroupId(syncGroupId);
189 //variableController.onAddSynchronizationGroupId(syncGroupId);
190 m_FuzzingState.m_SyncGroupsPool[syncGroupId] = SyncGroup{};
190 m_FuzzingState.m_SyncGroupsPool[syncGroupId] = SyncGroup{};
191 }
191 }
192 }
192 }
@@ -229,8 +229,8 public:
229 auto waitAcquisition = nextValidationCounter == 0
229 auto waitAcquisition = nextValidationCounter == 0
230 || operationsPool().at(fuzzingOperation).m_WaitAcquisition;
230 || operationsPool().at(fuzzingOperation).m_WaitAcquisition;
231
231
232 fuzzingOperation->execute(variableId, m_FuzzingState, m_VariableController,
232 // fuzzingOperation->execute(variableId, m_FuzzingState, m_VariableController,
233 m_Properties);
233 // m_Properties);
234
234
235 if (waitAcquisition) {
235 if (waitAcquisition) {
236 qCDebug(LOG_TestAmdaFuzzing()) << "Waiting for acquisition to finish...";
236 qCDebug(LOG_TestAmdaFuzzing()) << "Waiting for acquisition to finish...";
@@ -285,7 +285,7 private:
285 DECLARE_PROPERTY_GETTER(validationFrequencies, VALIDATION_FREQUENCY_BOUNDS, IntPair)
285 DECLARE_PROPERTY_GETTER(validationFrequencies, VALIDATION_FREQUENCY_BOUNDS, IntPair)
286 DECLARE_PROPERTY_GETTER(acquisitionTimeout, ACQUISITION_TIMEOUT, int)
286 DECLARE_PROPERTY_GETTER(acquisitionTimeout, ACQUISITION_TIMEOUT, int)
287
287
288 VariableController &m_VariableController;
288 VariableController2 &m_VariableController;
289 Properties m_Properties;
289 Properties m_Properties;
290 FuzzingState m_FuzzingState;
290 FuzzingState m_FuzzingState;
291 };
291 };
@@ -6,7 +6,7
6 #include <SqpApplication.h>
6 #include <SqpApplication.h>
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/VariableController2.h>
10
10
11 #include <QObject>
11 #include <QObject>
12 #include <QtTest>
12 #include <QtTest>
@@ -168,7 +168,7 void TestCosinusAcquisition::testAcquisition()
168 QFETCH(std::vector<DateTimeRange>, operations);
168 QFETCH(std::vector<DateTimeRange>, operations);
169 for (const auto &operation : operations) {
169 for (const auto &operation : operations) {
170 // Asks request on the variable and waits during its execution
170 // Asks request on the variable and waits during its execution
171 sqpApp->variableController().onRequestDataLoading({variable}, operation, false);
171 sqpApp->variableController().changeRange(variable, operation);
172
172
173 QTest::qWait(operationDelay);
173 QTest::qWait(operationDelay);
174 validateVariable(variable, operation);
174 validateVariable(variable, operation);
@@ -177,7 +177,7 void TestCosinusAcquisition::testAcquisition()
177
177
178 for (const auto &operation : operations) {
178 for (const auto &operation : operations) {
179 // Asks request on the variable and waits during its execution
179 // Asks request on the variable and waits during its execution
180 sqpApp->variableController().onRequestDataLoading({variable}, operation, false);
180 sqpApp->variableController().changeRange(variable, operation);
181 }
181 }
182 QTest::qWait(operationDelay);
182 QTest::qWait(operationDelay);
183 validateVariable(variable, operations.back());
183 validateVariable(variable, operations.back());
General Comments 0
You need to be logged in to leave comments. Login now