Auto status change to "Under Review"
@@ -1,198 +1,212 | |||||
1 | #include "SqpApplication.h" |
|
1 | #include "SqpApplication.h" | |
2 |
|
2 | |||
3 | #include <Actions/ActionsGuiController.h> |
|
3 | #include <Actions/ActionsGuiController.h> | |
|
4 | #include <Catalogue/CatalogueController.h> | |||
4 | #include <Data/IDataProvider.h> |
|
5 | #include <Data/IDataProvider.h> | |
5 | #include <DataSource/DataSourceController.h> |
|
6 | #include <DataSource/DataSourceController.h> | |
6 | #include <DragAndDrop/DragDropGuiController.h> |
|
7 | #include <DragAndDrop/DragDropGuiController.h> | |
7 | #include <Network/NetworkController.h> |
|
8 | #include <Network/NetworkController.h> | |
8 | #include <QThread> |
|
9 | #include <QThread> | |
9 | #include <Time/TimeController.h> |
|
10 | #include <Time/TimeController.h> | |
10 | #include <Variable/Variable.h> |
|
11 | #include <Variable/Variable.h> | |
11 | #include <Variable/VariableController.h> |
|
12 | #include <Variable/VariableController.h> | |
12 | #include <Variable/VariableModel.h> |
|
13 | #include <Variable/VariableModel.h> | |
13 | #include <Visualization/VisualizationController.h> |
|
14 | #include <Visualization/VisualizationController.h> | |
14 |
|
15 | |||
15 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") |
|
16 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") | |
16 |
|
17 | |||
17 | class SqpApplication::SqpApplicationPrivate { |
|
18 | class SqpApplication::SqpApplicationPrivate { | |
18 | public: |
|
19 | public: | |
19 | SqpApplicationPrivate() |
|
20 | SqpApplicationPrivate() | |
20 | : m_DataSourceController{std::make_unique<DataSourceController>()}, |
|
21 | : m_DataSourceController{std::make_unique<DataSourceController>()}, | |
21 | m_VariableController{std::make_unique<VariableController>()}, |
|
22 | m_VariableController{std::make_unique<VariableController>()}, | |
22 | m_TimeController{std::make_unique<TimeController>()}, |
|
23 | m_TimeController{std::make_unique<TimeController>()}, | |
23 | m_NetworkController{std::make_unique<NetworkController>()}, |
|
24 | m_NetworkController{std::make_unique<NetworkController>()}, | |
24 | m_VisualizationController{std::make_unique<VisualizationController>()}, |
|
25 | m_VisualizationController{std::make_unique<VisualizationController>()}, | |
25 | m_DragDropGuiController{std::make_unique<DragDropGuiController>()}, |
|
26 | m_DragDropGuiController{std::make_unique<DragDropGuiController>()}, | |
26 | m_CatalogueController{std::make_unique<CatalogueController>()}, |
|
27 | m_CatalogueController{std::make_unique<CatalogueController>()}, | |
27 | m_ActionsGuiController{std::make_unique<ActionsGuiController>()}, |
|
28 | m_ActionsGuiController{std::make_unique<ActionsGuiController>()}, | |
28 | m_PlotInterractionMode(SqpApplication::PlotsInteractionMode::None), |
|
29 | m_PlotInterractionMode(SqpApplication::PlotsInteractionMode::None), | |
29 | m_PlotCursorMode(SqpApplication::PlotsCursorMode::NoCursor) |
|
30 | m_PlotCursorMode(SqpApplication::PlotsCursorMode::NoCursor) | |
30 | { |
|
31 | { | |
31 | // /////////////////////////////// // |
|
32 | // /////////////////////////////// // | |
32 | // Connections between controllers // |
|
33 | // Connections between controllers // | |
33 | // /////////////////////////////// // |
|
34 | // /////////////////////////////// // | |
34 |
|
35 | |||
35 | // VariableController <-> DataSourceController |
|
36 | // VariableController <-> DataSourceController | |
36 | connect(m_DataSourceController.get(), |
|
37 | connect(m_DataSourceController.get(), | |
37 | SIGNAL(variableCreationRequested(const QString &, const QVariantHash &, |
|
38 | SIGNAL(variableCreationRequested(const QString &, const QVariantHash &, | |
38 | std::shared_ptr<IDataProvider>)), |
|
39 | std::shared_ptr<IDataProvider>)), | |
39 | m_VariableController.get(), |
|
40 | m_VariableController.get(), | |
40 | SLOT(createVariable(const QString &, const QVariantHash &, |
|
41 | SLOT(createVariable(const QString &, const QVariantHash &, | |
41 | std::shared_ptr<IDataProvider>))); |
|
42 | std::shared_ptr<IDataProvider>))); | |
42 |
|
43 | |||
43 | connect(m_VariableController->variableModel(), &VariableModel::requestVariable, |
|
44 | connect(m_VariableController->variableModel(), &VariableModel::requestVariable, | |
44 | m_DataSourceController.get(), &DataSourceController::requestVariable); |
|
45 | m_DataSourceController.get(), &DataSourceController::requestVariable); | |
45 |
|
46 | |||
46 | // VariableController <-> VisualizationController |
|
47 | // VariableController <-> VisualizationController | |
47 | connect(m_VariableController.get(), |
|
48 | connect(m_VariableController.get(), | |
48 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), |
|
49 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), | |
49 | m_VisualizationController.get(), |
|
50 | m_VisualizationController.get(), | |
50 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), Qt::DirectConnection); |
|
51 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), Qt::DirectConnection); | |
51 |
|
52 | |||
52 | connect(m_VariableController.get(), |
|
53 | connect(m_VariableController.get(), | |
53 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &)), |
|
54 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &)), | |
54 | m_VisualizationController.get(), |
|
55 | m_VisualizationController.get(), | |
55 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &))); |
|
56 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &))); | |
56 |
|
57 | |||
57 |
|
58 | |||
58 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); |
|
59 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); | |
59 | m_DataSourceControllerThread.setObjectName("DataSourceControllerThread"); |
|
60 | m_DataSourceControllerThread.setObjectName("DataSourceControllerThread"); | |
60 | m_NetworkController->moveToThread(&m_NetworkControllerThread); |
|
61 | m_NetworkController->moveToThread(&m_NetworkControllerThread); | |
61 | m_NetworkControllerThread.setObjectName("NetworkControllerThread"); |
|
62 | m_NetworkControllerThread.setObjectName("NetworkControllerThread"); | |
62 | m_VariableController->moveToThread(&m_VariableControllerThread); |
|
63 | m_VariableController->moveToThread(&m_VariableControllerThread); | |
63 | m_VariableControllerThread.setObjectName("VariableControllerThread"); |
|
64 | m_VariableControllerThread.setObjectName("VariableControllerThread"); | |
64 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); |
|
65 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); | |
65 | m_VisualizationControllerThread.setObjectName("VsualizationControllerThread"); |
|
66 | m_VisualizationControllerThread.setObjectName("VsualizationControllerThread"); | |
|
67 | m_CatalogueController->moveToThread(&m_CatalogueControllerThread); | |||
|
68 | m_CatalogueControllerThread.setObjectName("CatalogueControllerThread"); | |||
66 |
|
69 | |||
67 |
|
70 | |||
68 | // Additionnal init |
|
71 | // Additionnal init | |
69 | m_VariableController->setTimeController(m_TimeController.get()); |
|
72 | m_VariableController->setTimeController(m_TimeController.get()); | |
70 | } |
|
73 | } | |
71 |
|
74 | |||
72 | virtual ~SqpApplicationPrivate() |
|
75 | virtual ~SqpApplicationPrivate() | |
73 | { |
|
76 | { | |
74 | m_DataSourceControllerThread.quit(); |
|
77 | m_DataSourceControllerThread.quit(); | |
75 | m_DataSourceControllerThread.wait(); |
|
78 | m_DataSourceControllerThread.wait(); | |
76 |
|
79 | |||
77 | m_NetworkControllerThread.quit(); |
|
80 | m_NetworkControllerThread.quit(); | |
78 | m_NetworkControllerThread.wait(); |
|
81 | m_NetworkControllerThread.wait(); | |
79 |
|
82 | |||
80 | m_VariableControllerThread.quit(); |
|
83 | m_VariableControllerThread.quit(); | |
81 | m_VariableControllerThread.wait(); |
|
84 | m_VariableControllerThread.wait(); | |
82 |
|
85 | |||
83 | m_VisualizationControllerThread.quit(); |
|
86 | m_VisualizationControllerThread.quit(); | |
84 | m_VisualizationControllerThread.wait(); |
|
87 | m_VisualizationControllerThread.wait(); | |
|
88 | ||||
|
89 | m_CatalogueControllerThread.quit(); | |||
|
90 | m_CatalogueControllerThread.wait(); | |||
85 | } |
|
91 | } | |
86 |
|
92 | |||
87 | std::unique_ptr<DataSourceController> m_DataSourceController; |
|
93 | std::unique_ptr<DataSourceController> m_DataSourceController; | |
88 | std::unique_ptr<VariableController> m_VariableController; |
|
94 | std::unique_ptr<VariableController> m_VariableController; | |
89 | std::unique_ptr<TimeController> m_TimeController; |
|
95 | std::unique_ptr<TimeController> m_TimeController; | |
90 | std::unique_ptr<NetworkController> m_NetworkController; |
|
96 | std::unique_ptr<NetworkController> m_NetworkController; | |
91 | std::unique_ptr<VisualizationController> m_VisualizationController; |
|
97 | std::unique_ptr<VisualizationController> m_VisualizationController; | |
|
98 | std::unique_ptr<CatalogueController> m_CatalogueController; | |||
92 |
|
99 | |||
93 | QThread m_DataSourceControllerThread; |
|
100 | QThread m_DataSourceControllerThread; | |
94 | QThread m_NetworkControllerThread; |
|
101 | QThread m_NetworkControllerThread; | |
95 | QThread m_VariableControllerThread; |
|
102 | QThread m_VariableControllerThread; | |
96 | QThread m_VisualizationControllerThread; |
|
103 | QThread m_VisualizationControllerThread; | |
|
104 | QThread m_CatalogueControllerThread; | |||
97 |
|
105 | |||
98 | std::unique_ptr<DragDropGuiController> m_DragDropGuiController; |
|
106 | std::unique_ptr<DragDropGuiController> m_DragDropGuiController; | |
99 | std::unique_ptr<ActionsGuiController> m_ActionsGuiController; |
|
107 | std::unique_ptr<ActionsGuiController> m_ActionsGuiController; | |
100 |
|
108 | |||
101 | SqpApplication::PlotsInteractionMode m_PlotInterractionMode; |
|
109 | SqpApplication::PlotsInteractionMode m_PlotInterractionMode; | |
102 | SqpApplication::PlotsCursorMode m_PlotCursorMode; |
|
110 | SqpApplication::PlotsCursorMode m_PlotCursorMode; | |
103 | }; |
|
111 | }; | |
104 |
|
112 | |||
105 |
|
113 | |||
106 | SqpApplication::SqpApplication(int &argc, char **argv) |
|
114 | SqpApplication::SqpApplication(int &argc, char **argv) | |
107 | : QApplication{argc, argv}, impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} |
|
115 | : QApplication{argc, argv}, impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} | |
108 | { |
|
116 | { | |
109 | qCDebug(LOG_SqpApplication()) << tr("SqpApplication construction") << QThread::currentThread(); |
|
117 | qCDebug(LOG_SqpApplication()) << tr("SqpApplication construction") << QThread::currentThread(); | |
110 |
|
118 | |||
111 | connect(&impl->m_DataSourceControllerThread, &QThread::started, |
|
119 | connect(&impl->m_DataSourceControllerThread, &QThread::started, | |
112 | impl->m_DataSourceController.get(), &DataSourceController::initialize); |
|
120 | impl->m_DataSourceController.get(), &DataSourceController::initialize); | |
113 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, |
|
121 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, | |
114 | impl->m_DataSourceController.get(), &DataSourceController::finalize); |
|
122 | impl->m_DataSourceController.get(), &DataSourceController::finalize); | |
115 |
|
123 | |||
116 | connect(&impl->m_NetworkControllerThread, &QThread::started, impl->m_NetworkController.get(), |
|
124 | connect(&impl->m_NetworkControllerThread, &QThread::started, impl->m_NetworkController.get(), | |
117 | &NetworkController::initialize); |
|
125 | &NetworkController::initialize); | |
118 | connect(&impl->m_NetworkControllerThread, &QThread::finished, impl->m_NetworkController.get(), |
|
126 | connect(&impl->m_NetworkControllerThread, &QThread::finished, impl->m_NetworkController.get(), | |
119 | &NetworkController::finalize); |
|
127 | &NetworkController::finalize); | |
120 |
|
128 | |||
121 | connect(&impl->m_VariableControllerThread, &QThread::started, impl->m_VariableController.get(), |
|
129 | connect(&impl->m_VariableControllerThread, &QThread::started, impl->m_VariableController.get(), | |
122 | &VariableController::initialize); |
|
130 | &VariableController::initialize); | |
123 | connect(&impl->m_VariableControllerThread, &QThread::finished, impl->m_VariableController.get(), |
|
131 | connect(&impl->m_VariableControllerThread, &QThread::finished, impl->m_VariableController.get(), | |
124 | &VariableController::finalize); |
|
132 | &VariableController::finalize); | |
125 |
|
133 | |||
126 | connect(&impl->m_VisualizationControllerThread, &QThread::started, |
|
134 | connect(&impl->m_VisualizationControllerThread, &QThread::started, | |
127 | impl->m_VisualizationController.get(), &VisualizationController::initialize); |
|
135 | impl->m_VisualizationController.get(), &VisualizationController::initialize); | |
128 | connect(&impl->m_VisualizationControllerThread, &QThread::finished, |
|
136 | connect(&impl->m_VisualizationControllerThread, &QThread::finished, | |
129 | impl->m_VisualizationController.get(), &VisualizationController::finalize); |
|
137 | impl->m_VisualizationController.get(), &VisualizationController::finalize); | |
130 |
|
138 | |||
|
139 | connect(&impl->m_CatalogueControllerThread, &QThread::started, | |||
|
140 | impl->m_CatalogueController.get(), &CatalogueController::initialize); | |||
|
141 | connect(&impl->m_CatalogueControllerThread, &QThread::finished, | |||
|
142 | impl->m_CatalogueController.get(), &CatalogueController::finalize); | |||
|
143 | ||||
131 | impl->m_DataSourceControllerThread.start(); |
|
144 | impl->m_DataSourceControllerThread.start(); | |
132 | impl->m_NetworkControllerThread.start(); |
|
145 | impl->m_NetworkControllerThread.start(); | |
133 | impl->m_VariableControllerThread.start(); |
|
146 | impl->m_VariableControllerThread.start(); | |
134 | impl->m_VisualizationControllerThread.start(); |
|
147 | impl->m_VisualizationControllerThread.start(); | |
|
148 | impl->m_CatalogueControllerThread.start(); | |||
135 | } |
|
149 | } | |
136 |
|
150 | |||
137 | SqpApplication::~SqpApplication() |
|
151 | SqpApplication::~SqpApplication() | |
138 | { |
|
152 | { | |
139 | } |
|
153 | } | |
140 |
|
154 | |||
141 | void SqpApplication::initialize() |
|
155 | void SqpApplication::initialize() | |
142 | { |
|
156 | { | |
143 | } |
|
157 | } | |
144 |
|
158 | |||
145 | DataSourceController &SqpApplication::dataSourceController() noexcept |
|
159 | DataSourceController &SqpApplication::dataSourceController() noexcept | |
146 | { |
|
160 | { | |
147 | return *impl->m_DataSourceController; |
|
161 | return *impl->m_DataSourceController; | |
148 | } |
|
162 | } | |
149 |
|
163 | |||
150 | NetworkController &SqpApplication::networkController() noexcept |
|
164 | NetworkController &SqpApplication::networkController() noexcept | |
151 | { |
|
165 | { | |
152 | return *impl->m_NetworkController; |
|
166 | return *impl->m_NetworkController; | |
153 | } |
|
167 | } | |
154 |
|
168 | |||
155 | TimeController &SqpApplication::timeController() noexcept |
|
169 | TimeController &SqpApplication::timeController() noexcept | |
156 | { |
|
170 | { | |
157 | return *impl->m_TimeController; |
|
171 | return *impl->m_TimeController; | |
158 | } |
|
172 | } | |
159 |
|
173 | |||
160 | VariableController &SqpApplication::variableController() noexcept |
|
174 | VariableController &SqpApplication::variableController() noexcept | |
161 | { |
|
175 | { | |
162 | return *impl->m_VariableController; |
|
176 | return *impl->m_VariableController; | |
163 | } |
|
177 | } | |
164 |
|
178 | |||
165 | VisualizationController &SqpApplication::visualizationController() noexcept |
|
179 | VisualizationController &SqpApplication::visualizationController() noexcept | |
166 | { |
|
180 | { | |
167 | return *impl->m_VisualizationController; |
|
181 | return *impl->m_VisualizationController; | |
168 | } |
|
182 | } | |
169 |
|
183 | |||
170 | DragDropGuiController &SqpApplication::dragDropGuiController() noexcept |
|
184 | DragDropGuiController &SqpApplication::dragDropGuiController() noexcept | |
171 | { |
|
185 | { | |
172 | return *impl->m_DragDropGuiController; |
|
186 | return *impl->m_DragDropGuiController; | |
173 | } |
|
187 | } | |
174 |
|
188 | |||
175 | ActionsGuiController &SqpApplication::actionsGuiController() noexcept |
|
189 | ActionsGuiController &SqpApplication::actionsGuiController() noexcept | |
176 | { |
|
190 | { | |
177 | return *impl->m_ActionsGuiController; |
|
191 | return *impl->m_ActionsGuiController; | |
178 | } |
|
192 | } | |
179 |
|
193 | |||
180 | SqpApplication::PlotsInteractionMode SqpApplication::plotsInteractionMode() const |
|
194 | SqpApplication::PlotsInteractionMode SqpApplication::plotsInteractionMode() const | |
181 | { |
|
195 | { | |
182 | return impl->m_PlotInterractionMode; |
|
196 | return impl->m_PlotInterractionMode; | |
183 | } |
|
197 | } | |
184 |
|
198 | |||
185 | void SqpApplication::setPlotsInteractionMode(SqpApplication::PlotsInteractionMode mode) |
|
199 | void SqpApplication::setPlotsInteractionMode(SqpApplication::PlotsInteractionMode mode) | |
186 | { |
|
200 | { | |
187 | impl->m_PlotInterractionMode = mode; |
|
201 | impl->m_PlotInterractionMode = mode; | |
188 | } |
|
202 | } | |
189 |
|
203 | |||
190 | SqpApplication::PlotsCursorMode SqpApplication::plotsCursorMode() const |
|
204 | SqpApplication::PlotsCursorMode SqpApplication::plotsCursorMode() const | |
191 | { |
|
205 | { | |
192 | return impl->m_PlotCursorMode; |
|
206 | return impl->m_PlotCursorMode; | |
193 | } |
|
207 | } | |
194 |
|
208 | |||
195 | void SqpApplication::setPlotsCursorMode(SqpApplication::PlotsCursorMode mode) |
|
209 | void SqpApplication::setPlotsCursorMode(SqpApplication::PlotsCursorMode mode) | |
196 | { |
|
210 | { | |
197 | impl->m_PlotCursorMode = mode; |
|
211 | impl->m_PlotCursorMode = mode; | |
198 | } |
|
212 | } |
General Comments 4
Status change > Approved
Status change > Approved
You need to be logged in to leave comments.
Login now