Auto status change to "Under Review"
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
@@ -1,254 +1,353 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the SciQLop Software |
|
3 | 3 | -- Copyright (C) 2017, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "MainWindow.h" |
|
23 | 23 | #include "ui_MainWindow.h" |
|
24 | 24 | |
|
25 | 25 | #include <DataSource/DataSourceController.h> |
|
26 | 26 | #include <DataSource/DataSourceWidget.h> |
|
27 | 27 | #include <Settings/SqpSettingsDialog.h> |
|
28 | 28 | #include <Settings/SqpSettingsGeneralWidget.h> |
|
29 | 29 | #include <SidePane/SqpSidePane.h> |
|
30 | 30 | #include <SqpApplication.h> |
|
31 | 31 | #include <Time/TimeController.h> |
|
32 | 32 | #include <TimeWidget/TimeWidget.h> |
|
33 | 33 | #include <Variable/Variable.h> |
|
34 | 34 | #include <Variable/VariableController.h> |
|
35 | 35 | #include <Visualization/VisualizationController.h> |
|
36 | 36 | |
|
37 | 37 | #include <QAction> |
|
38 | 38 | #include <QDate> |
|
39 | 39 | #include <QDir> |
|
40 | 40 | #include <QFileDialog> |
|
41 | 41 | #include <QToolBar> |
|
42 | 42 | #include <QToolButton> |
|
43 | 43 | #include <memory.h> |
|
44 | 44 | |
|
45 | 45 | #include "iostream" |
|
46 | 46 | |
|
47 | 47 | Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow") |
|
48 | 48 | |
|
49 | 49 | namespace { |
|
50 | 50 | const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0; |
|
51 | 51 | const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1; |
|
52 | 52 | const auto VIEWPLITTERINDEX = 2; |
|
53 | 53 | const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3; |
|
54 | 54 | const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4; |
|
55 | 55 | } |
|
56 | 56 | |
|
57 | 57 | class MainWindow::MainWindowPrivate { |
|
58 | 58 | public: |
|
59 | 59 | explicit MainWindowPrivate(MainWindow *mainWindow) |
|
60 | 60 | : m_LastOpenLeftInspectorSize{}, |
|
61 | 61 | m_LastOpenRightInspectorSize{}, |
|
62 | 62 | m_GeneralSettingsWidget{new SqpSettingsGeneralWidget{mainWindow}}, |
|
63 | 63 | m_SettingsDialog{new SqpSettingsDialog{mainWindow}} |
|
64 | 64 | { |
|
65 | 65 | } |
|
66 | 66 | |
|
67 | 67 | QSize m_LastOpenLeftInspectorSize; |
|
68 | 68 | QSize m_LastOpenRightInspectorSize; |
|
69 | 69 | /// General settings widget. MainWindow has the ownership |
|
70 | 70 | SqpSettingsGeneralWidget *m_GeneralSettingsWidget; |
|
71 | 71 | /// Settings dialog. MainWindow has the ownership |
|
72 | 72 | SqpSettingsDialog *m_SettingsDialog; |
|
73 | 73 | }; |
|
74 | 74 | |
|
75 | 75 | MainWindow::MainWindow(QWidget *parent) |
|
76 | 76 | : QMainWindow{parent}, |
|
77 | 77 | m_Ui{new Ui::MainWindow}, |
|
78 | 78 | impl{spimpl::make_unique_impl<MainWindowPrivate>(this)} |
|
79 | 79 | { |
|
80 | 80 | m_Ui->setupUi(this); |
|
81 | 81 | |
|
82 | 82 | m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false); |
|
83 | 83 | m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false); |
|
84 | 84 | |
|
85 | 85 | |
|
86 | 86 | auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane(); |
|
87 | 87 | auto openLeftInspectorAction = new QAction{QIcon{ |
|
88 | 88 | ":/icones/previous.png", |
|
89 | 89 | }, |
|
90 | 90 | tr("Show/hide the left inspector"), this}; |
|
91 | 91 | |
|
92 | 92 | |
|
93 | 93 | auto spacerLeftTop = new QWidget{}; |
|
94 | 94 | spacerLeftTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
95 | 95 | |
|
96 | 96 | auto spacerLeftBottom = new QWidget{}; |
|
97 | 97 | spacerLeftBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
98 | 98 | |
|
99 | 99 | leftSidePane->addWidget(spacerLeftTop); |
|
100 | 100 | leftSidePane->addAction(openLeftInspectorAction); |
|
101 | 101 | leftSidePane->addWidget(spacerLeftBottom); |
|
102 | 102 | |
|
103 | 103 | |
|
104 | 104 | auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane(); |
|
105 | 105 | auto openRightInspectorAction = new QAction{QIcon{ |
|
106 | 106 | ":/icones/next.png", |
|
107 | 107 | }, |
|
108 | 108 | tr("Show/hide the right inspector"), this}; |
|
109 | 109 | |
|
110 | 110 | auto spacerRightTop = new QWidget{}; |
|
111 | 111 | spacerRightTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
112 | 112 | |
|
113 | 113 | auto spacerRightBottom = new QWidget{}; |
|
114 | 114 | spacerRightBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
115 | 115 | |
|
116 | 116 | rightSidePane->addWidget(spacerRightTop); |
|
117 | 117 | rightSidePane->addAction(openRightInspectorAction); |
|
118 | 118 | rightSidePane->addWidget(spacerRightBottom); |
|
119 | 119 | |
|
120 | 120 | openLeftInspectorAction->setCheckable(true); |
|
121 | 121 | openRightInspectorAction->setCheckable(true); |
|
122 | 122 | |
|
123 | 123 | auto openInspector = [this](bool checked, bool right, auto action) { |
|
124 | 124 | |
|
125 | 125 | action->setIcon(QIcon{(checked xor right) ? ":/icones/next.png" : ":/icones/previous.png"}); |
|
126 | 126 | |
|
127 | 127 | auto &lastInspectorSize |
|
128 | 128 | = right ? impl->m_LastOpenRightInspectorSize : impl->m_LastOpenLeftInspectorSize; |
|
129 | 129 | |
|
130 | 130 | auto nextInspectorSize = right ? m_Ui->rightMainInspectorWidget->size() |
|
131 | 131 | : m_Ui->leftMainInspectorWidget->size(); |
|
132 | 132 | |
|
133 | 133 | // Update of the last opened geometry |
|
134 | 134 | if (checked) { |
|
135 | 135 | lastInspectorSize = nextInspectorSize; |
|
136 | 136 | } |
|
137 | 137 | |
|
138 | 138 | auto startSize = lastInspectorSize; |
|
139 | 139 | auto endSize = startSize; |
|
140 | 140 | endSize.setWidth(0); |
|
141 | 141 | |
|
142 | 142 | auto splitterInspectorIndex |
|
143 | 143 | = right ? RIGHTMAININSPECTORWIDGETSPLITTERINDEX : LEFTMAININSPECTORWIDGETSPLITTERINDEX; |
|
144 | 144 | |
|
145 | 145 | auto currentSizes = m_Ui->splitter->sizes(); |
|
146 | 146 | if (checked) { |
|
147 | 147 | // adjust sizes individually here, e.g. |
|
148 | 148 | currentSizes[splitterInspectorIndex] -= lastInspectorSize.width(); |
|
149 | 149 | currentSizes[VIEWPLITTERINDEX] += lastInspectorSize.width(); |
|
150 | 150 | m_Ui->splitter->setSizes(currentSizes); |
|
151 | 151 | } |
|
152 | 152 | else { |
|
153 | 153 | // adjust sizes individually here, e.g. |
|
154 | 154 | currentSizes[splitterInspectorIndex] += lastInspectorSize.width(); |
|
155 | 155 | currentSizes[VIEWPLITTERINDEX] -= lastInspectorSize.width(); |
|
156 | 156 | m_Ui->splitter->setSizes(currentSizes); |
|
157 | 157 | } |
|
158 | 158 | |
|
159 | 159 | }; |
|
160 | 160 | |
|
161 | 161 | |
|
162 | 162 | connect(openLeftInspectorAction, &QAction::triggered, |
|
163 | 163 | [openInspector, openLeftInspectorAction](bool checked) { |
|
164 | 164 | openInspector(checked, false, openLeftInspectorAction); |
|
165 | 165 | }); |
|
166 | 166 | connect(openRightInspectorAction, &QAction::triggered, |
|
167 | 167 | [openInspector, openRightInspectorAction](bool checked) { |
|
168 | 168 | openInspector(checked, true, openRightInspectorAction); |
|
169 | 169 | }); |
|
170 | 170 | |
|
171 | // //// // | |
|
172 | // Menu // | |
|
173 | // //// // | |
|
171 | // //////////////// // | |
|
172 | // Menu and Toolbar // | |
|
173 | // //////////////// // | |
|
174 | 174 | this->menuBar()->addAction(tr("File")); |
|
175 | 175 | auto toolsMenu = this->menuBar()->addMenu(tr("Tools")); |
|
176 | 176 | toolsMenu->addAction(tr("Settings..."), [this]() { |
|
177 | 177 | // Loads settings |
|
178 | 178 | impl->m_SettingsDialog->loadSettings(); |
|
179 | 179 | |
|
180 | 180 | // Open settings dialog and save settings if the dialog is accepted |
|
181 | 181 | if (impl->m_SettingsDialog->exec() == QDialog::Accepted) { |
|
182 | 182 | impl->m_SettingsDialog->saveSettings(); |
|
183 | 183 | } |
|
184 | 184 | |
|
185 | 185 | }); |
|
186 | 186 | |
|
187 | 187 | auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar")); |
|
188 | 188 | |
|
189 | 189 | auto timeWidget = new TimeWidget{}; |
|
190 | 190 | mainToolBar->addWidget(timeWidget); |
|
191 | 191 | |
|
192 | auto actionPointerMode = new QAction{QIcon(":/icones/pointer.png"), "Pointer", this}; | |
|
193 | actionPointerMode->setCheckable(true); | |
|
194 | actionPointerMode->setChecked(sqpApp->plotsInteractionMode() | |
|
195 | == SqpApplication::PlotsInteractionMode::None); | |
|
196 | connect(actionPointerMode, &QAction::triggered, | |
|
197 | []() { sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::None); }); | |
|
198 | ||
|
199 | auto actionZoomMode = new QAction{QIcon(":/icones/zoom.png"), "Zoom", this}; | |
|
200 | actionZoomMode->setCheckable(true); | |
|
201 | actionZoomMode->setChecked(sqpApp->plotsInteractionMode() | |
|
202 | == SqpApplication::PlotsInteractionMode::ZoomBox); | |
|
203 | connect(actionZoomMode, &QAction::triggered, []() { | |
|
204 | sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::ZoomBox); | |
|
205 | }); | |
|
206 | ||
|
207 | auto actionOrganisationMode = new QAction{QIcon(":/icones/drag.png"), "Organize", this}; | |
|
208 | actionOrganisationMode->setCheckable(true); | |
|
209 | actionOrganisationMode->setChecked(sqpApp->plotsInteractionMode() | |
|
210 | == SqpApplication::PlotsInteractionMode::DragAndDrop); | |
|
211 | connect(actionOrganisationMode, &QAction::triggered, []() { | |
|
212 | sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::DragAndDrop); | |
|
213 | }); | |
|
214 | ||
|
215 | auto actionZonesMode = new QAction{QIcon(":/icones/rectangle.png"), "Zones", this}; | |
|
216 | actionZonesMode->setCheckable(true); | |
|
217 | actionZonesMode->setChecked(sqpApp->plotsInteractionMode() | |
|
218 | == SqpApplication::PlotsInteractionMode::SelectionZones); | |
|
219 | connect(actionZonesMode, &QAction::triggered, []() { | |
|
220 | sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::SelectionZones); | |
|
221 | }); | |
|
222 | ||
|
223 | auto modeActionGroup = new QActionGroup{this}; | |
|
224 | modeActionGroup->addAction(actionZoomMode); | |
|
225 | modeActionGroup->addAction(actionZonesMode); | |
|
226 | modeActionGroup->addAction(actionOrganisationMode); | |
|
227 | modeActionGroup->addAction(actionPointerMode); | |
|
228 | modeActionGroup->setExclusive(true); | |
|
229 | ||
|
230 | mainToolBar->addSeparator(); | |
|
231 | mainToolBar->addAction(actionPointerMode); | |
|
232 | mainToolBar->addAction(actionZoomMode); | |
|
233 | mainToolBar->addAction(actionOrganisationMode); | |
|
234 | mainToolBar->addAction(actionZonesMode); | |
|
235 | mainToolBar->addSeparator(); | |
|
236 | ||
|
237 | auto btnCursor = new QToolButton{this}; | |
|
238 | btnCursor->setIcon(QIcon(":/icones/cursor.png")); | |
|
239 | btnCursor->setText("Cursor"); | |
|
240 | btnCursor->setToolTip("Cursor"); | |
|
241 | btnCursor->setPopupMode(QToolButton::InstantPopup); | |
|
242 | auto cursorMenu = new QMenu("CursorMenu", this); | |
|
243 | btnCursor->setMenu(cursorMenu); | |
|
244 | ||
|
245 | auto noCursorAction = cursorMenu->addAction("No Cursor"); | |
|
246 | noCursorAction->setCheckable(true); | |
|
247 | noCursorAction->setChecked(sqpApp->plotsCursorMode() | |
|
248 | == SqpApplication::PlotsCursorMode::NoCursor); | |
|
249 | connect(noCursorAction, &QAction::triggered, | |
|
250 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::NoCursor); }); | |
|
251 | ||
|
252 | cursorMenu->addSeparator(); | |
|
253 | auto verticalCursorAction = cursorMenu->addAction("Vertical Cursor"); | |
|
254 | verticalCursorAction->setCheckable(true); | |
|
255 | verticalCursorAction->setChecked(sqpApp->plotsCursorMode() | |
|
256 | == SqpApplication::PlotsCursorMode::Vertical); | |
|
257 | connect(verticalCursorAction, &QAction::triggered, | |
|
258 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Vertical); }); | |
|
259 | ||
|
260 | auto temporalCursorAction = cursorMenu->addAction("Temporal Cursor"); | |
|
261 | temporalCursorAction->setCheckable(true); | |
|
262 | temporalCursorAction->setChecked(sqpApp->plotsCursorMode() | |
|
263 | == SqpApplication::PlotsCursorMode::Temporal); | |
|
264 | connect(temporalCursorAction, &QAction::triggered, | |
|
265 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Temporal); }); | |
|
266 | ||
|
267 | auto horizontalCursorAction = cursorMenu->addAction("Horizontal Cursor"); | |
|
268 | horizontalCursorAction->setCheckable(true); | |
|
269 | horizontalCursorAction->setChecked(sqpApp->plotsCursorMode() | |
|
270 | == SqpApplication::PlotsCursorMode::Horizontal); | |
|
271 | connect(horizontalCursorAction, &QAction::triggered, | |
|
272 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Horizontal); }); | |
|
273 | ||
|
274 | auto crossCursorAction = cursorMenu->addAction("Cross Cursor"); | |
|
275 | crossCursorAction->setCheckable(true); | |
|
276 | crossCursorAction->setChecked(sqpApp->plotsCursorMode() | |
|
277 | == SqpApplication::PlotsCursorMode::Cross); | |
|
278 | connect(crossCursorAction, &QAction::triggered, | |
|
279 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Cross); }); | |
|
280 | ||
|
281 | mainToolBar->addWidget(btnCursor); | |
|
282 | ||
|
283 | auto cursorModeActionGroup = new QActionGroup{this}; | |
|
284 | cursorModeActionGroup->setExclusive(true); | |
|
285 | cursorModeActionGroup->addAction(noCursorAction); | |
|
286 | cursorModeActionGroup->addAction(verticalCursorAction); | |
|
287 | cursorModeActionGroup->addAction(temporalCursorAction); | |
|
288 | cursorModeActionGroup->addAction(horizontalCursorAction); | |
|
289 | cursorModeActionGroup->addAction(crossCursorAction); | |
|
290 | ||
|
192 | 291 | // //////// // |
|
193 | 292 | // Settings // |
|
194 | 293 | // //////// // |
|
195 | 294 | |
|
196 | 295 | // Registers "general settings" widget to the settings dialog |
|
197 | 296 | impl->m_SettingsDialog->registerWidget(QStringLiteral("General"), |
|
198 | 297 | impl->m_GeneralSettingsWidget); |
|
199 | 298 | |
|
200 | 299 | // /////////// // |
|
201 | 300 | // Connections // |
|
202 | 301 | // /////////// // |
|
203 | 302 | |
|
204 | 303 | // Controllers / controllers connections |
|
205 | 304 | connect(&sqpApp->timeController(), SIGNAL(timeUpdated(SqpRange)), &sqpApp->variableController(), |
|
206 | 305 | SLOT(onDateTimeOnSelection(SqpRange))); |
|
207 | 306 | |
|
208 | 307 | // Widgets / controllers connections |
|
209 | 308 | |
|
210 | 309 | // DataSource |
|
211 | 310 | connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)), |
|
212 | 311 | m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *))); |
|
213 | 312 | |
|
214 | 313 | // Time |
|
215 | 314 | connect(timeWidget, SIGNAL(timeUpdated(SqpRange)), &sqpApp->timeController(), |
|
216 | 315 | SLOT(onTimeToUpdate(SqpRange))); |
|
217 | 316 | |
|
218 | 317 | // Visualization |
|
219 | 318 | connect(&sqpApp->visualizationController(), |
|
220 | 319 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), m_Ui->view, |
|
221 | 320 | SLOT(onVariableAboutToBeDeleted(std::shared_ptr<Variable>))); |
|
222 | 321 | |
|
223 | 322 | connect(&sqpApp->visualizationController(), |
|
224 | 323 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &)), m_Ui->view, |
|
225 | 324 | SLOT(onRangeChanged(std::shared_ptr<Variable>, const SqpRange &))); |
|
226 | 325 | |
|
227 | 326 | // Widgets / widgets connections |
|
228 | 327 | |
|
229 | 328 | // For the following connections, we use DirectConnection to allow each widget that can |
|
230 | 329 | // potentially attach a menu to the variable's menu to do so before this menu is displayed. |
|
231 | 330 | // The order of connections is also important, since it determines the order in which each |
|
232 | 331 | // widget will attach its menu |
|
233 | 332 | connect( |
|
234 | 333 | m_Ui->variableInspectorWidget, |
|
235 | 334 | SIGNAL(tableMenuAboutToBeDisplayed(QMenu *, const QVector<std::shared_ptr<Variable> > &)), |
|
236 | 335 | m_Ui->view, SLOT(attachVariableMenu(QMenu *, const QVector<std::shared_ptr<Variable> > &)), |
|
237 | 336 | Qt::DirectConnection); |
|
238 | 337 | } |
|
239 | 338 | |
|
240 | 339 | MainWindow::~MainWindow() |
|
241 | 340 | { |
|
242 | 341 | } |
|
243 | 342 | |
|
244 | 343 | void MainWindow::changeEvent(QEvent *e) |
|
245 | 344 | { |
|
246 | 345 | QMainWindow::changeEvent(e); |
|
247 | 346 | switch (e->type()) { |
|
248 | 347 | case QEvent::LanguageChange: |
|
249 | 348 | m_Ui->retranslateUi(this); |
|
250 | 349 | break; |
|
251 | 350 | default: |
|
252 | 351 | break; |
|
253 | 352 | } |
|
254 | 353 | } |
@@ -1,57 +1,67 | |||
|
1 | 1 | #ifndef SCIQLOP_SQPAPPLICATION_H |
|
2 | 2 | #define SCIQLOP_SQPAPPLICATION_H |
|
3 | 3 | |
|
4 | 4 | #include "SqpApplication.h" |
|
5 | 5 | |
|
6 | 6 | #include <QApplication> |
|
7 | 7 | #include <QLoggingCategory> |
|
8 | 8 | |
|
9 | 9 | #include <Common/spimpl.h> |
|
10 | 10 | |
|
11 | 11 | Q_DECLARE_LOGGING_CATEGORY(LOG_SqpApplication) |
|
12 | 12 | |
|
13 | 13 | #if defined(sqpApp) |
|
14 | 14 | #undef sqpApp |
|
15 | 15 | #endif |
|
16 | 16 | #define sqpApp (static_cast<SqpApplication *>(QCoreApplication::instance())) |
|
17 | 17 | |
|
18 | 18 | class DataSourceController; |
|
19 | 19 | class NetworkController; |
|
20 | 20 | class TimeController; |
|
21 | 21 | class VariableController; |
|
22 | 22 | class VisualizationController; |
|
23 | 23 | class DragDropHelper; |
|
24 | 24 | |
|
25 | 25 | /** |
|
26 | 26 | * @brief The SqpApplication class aims to make the link between SciQlop |
|
27 | 27 | * and its plugins. This is the intermediate class that SciQlop has to use |
|
28 | 28 | * in the way to connect a data source. Please first use load method to initialize |
|
29 | 29 | * a plugin specified by its metadata name (JSON plugin source) then others specifics |
|
30 | 30 | * method will be able to access it. |
|
31 | 31 | * You can load a data source driver plugin then create a data source. |
|
32 | 32 | */ |
|
33 | 33 | |
|
34 | 34 | class SqpApplication : public QApplication { |
|
35 | 35 | Q_OBJECT |
|
36 | 36 | public: |
|
37 | 37 | explicit SqpApplication(int &argc, char **argv); |
|
38 | 38 | virtual ~SqpApplication(); |
|
39 | 39 | void initialize(); |
|
40 | 40 | |
|
41 | 41 | /// Accessors for the differents sciqlop controllers |
|
42 | 42 | DataSourceController &dataSourceController() noexcept; |
|
43 | 43 | NetworkController &networkController() noexcept; |
|
44 | 44 | TimeController &timeController() noexcept; |
|
45 | 45 | VariableController &variableController() noexcept; |
|
46 | 46 | VisualizationController &visualizationController() noexcept; |
|
47 | 47 | |
|
48 | 48 | /// Accessors for the differents sciqlop helpers, these helpers classes are like controllers but |
|
49 | 49 | /// doesn't live in a thread and access gui |
|
50 | 50 | DragDropHelper &dragDropHelper() noexcept; |
|
51 | 51 | |
|
52 | enum class PlotsInteractionMode { None, ZoomBox, DragAndDrop, SelectionZones }; | |
|
53 | ||
|
54 | enum class PlotsCursorMode { NoCursor, Vertical, Temporal, Horizontal, Cross }; | |
|
55 | ||
|
56 | PlotsInteractionMode plotsInteractionMode() const; | |
|
57 | void setPlotsInteractionMode(PlotsInteractionMode mode); | |
|
58 | ||
|
59 | PlotsCursorMode plotsCursorMode() const; | |
|
60 | void setPlotsCursorMode(PlotsCursorMode mode); | |
|
61 | ||
|
52 | 62 | private: |
|
53 | 63 | class SqpApplicationPrivate; |
|
54 | 64 | spimpl::unique_impl_ptr<SqpApplicationPrivate> impl; |
|
55 | 65 | }; |
|
56 | 66 | |
|
57 | 67 | #endif // SCIQLOP_SQPAPPLICATION_H |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -1,17 +1,22 | |||
|
1 | 1 | <RCC> |
|
2 | 2 | <qresource prefix="/"> |
|
3 | 3 | <file>icones/dataSourceComponent.png</file> |
|
4 | 4 | <file>icones/dataSourceNode.png</file> |
|
5 | 5 | <file>icones/dataSourceProduct.png</file> |
|
6 | 6 | <file>icones/dataSourceRoot.png</file> |
|
7 | 7 | <file>icones/delete.png</file> |
|
8 | 8 | <file>icones/down.png</file> |
|
9 | 9 | <file>icones/openInspector.png</file> |
|
10 | 10 | <file>icones/next.png</file> |
|
11 | 11 | <file>icones/plot.png</file> |
|
12 | 12 | <file>icones/previous.png</file> |
|
13 | 13 | <file>icones/unplot.png</file> |
|
14 | 14 | <file>icones/up.png</file> |
|
15 | 15 | <file>icones/time.png</file> |
|
16 | <file>icones/zoom.png</file> | |
|
17 | <file>icones/rectangle.png</file> | |
|
18 | <file>icones/drag.png</file> | |
|
19 | <file>icones/cursor.png</file> | |
|
20 | <file>icones/pointer.png</file> | |
|
16 | 21 | </qresource> |
|
17 | 22 | </RCC> |
@@ -1,163 +1,188 | |||
|
1 | 1 | #include "SqpApplication.h" |
|
2 | 2 | |
|
3 | 3 | #include <Data/IDataProvider.h> |
|
4 | 4 | #include <DataSource/DataSourceController.h> |
|
5 | 5 | #include <DragAndDrop/DragDropHelper.h> |
|
6 | 6 | #include <Network/NetworkController.h> |
|
7 | 7 | #include <QThread> |
|
8 | 8 | #include <Time/TimeController.h> |
|
9 | 9 | #include <Variable/Variable.h> |
|
10 | 10 | #include <Variable/VariableController.h> |
|
11 | 11 | #include <Variable/VariableModel.h> |
|
12 | 12 | #include <Visualization/VisualizationController.h> |
|
13 | 13 | |
|
14 | 14 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") |
|
15 | 15 | |
|
16 | 16 | class SqpApplication::SqpApplicationPrivate { |
|
17 | 17 | public: |
|
18 | 18 | SqpApplicationPrivate() |
|
19 | 19 | : m_DataSourceController{std::make_unique<DataSourceController>()}, |
|
20 | 20 | m_NetworkController{std::make_unique<NetworkController>()}, |
|
21 | 21 | m_TimeController{std::make_unique<TimeController>()}, |
|
22 | 22 | m_VariableController{std::make_unique<VariableController>()}, |
|
23 | 23 | m_VisualizationController{std::make_unique<VisualizationController>()}, |
|
24 | m_DragDropHelper{std::make_unique<DragDropHelper>()} | |
|
24 | m_DragDropHelper{std::make_unique<DragDropHelper>()}, | |
|
25 | m_PlotInterractionMode(SqpApplication::PlotsInteractionMode::None), | |
|
26 | m_PlotCursorMode(SqpApplication::PlotsCursorMode::NoCursor) | |
|
25 | 27 | { |
|
26 | 28 | // /////////////////////////////// // |
|
27 | 29 | // Connections between controllers // |
|
28 | 30 | // /////////////////////////////// // |
|
29 | 31 | |
|
30 | 32 | // VariableController <-> DataSourceController |
|
31 | 33 | connect(m_DataSourceController.get(), |
|
32 | 34 | SIGNAL(variableCreationRequested(const QString &, const QVariantHash &, |
|
33 | 35 | std::shared_ptr<IDataProvider>)), |
|
34 | 36 | m_VariableController.get(), |
|
35 | 37 | SLOT(createVariable(const QString &, const QVariantHash &, |
|
36 | 38 | std::shared_ptr<IDataProvider>))); |
|
37 | 39 | |
|
38 | 40 | connect(m_VariableController->variableModel(), &VariableModel::requestVariable, |
|
39 | 41 | m_DataSourceController.get(), &DataSourceController::requestVariable); |
|
40 | 42 | |
|
41 | 43 | // VariableController <-> VisualizationController |
|
42 | 44 | connect(m_VariableController.get(), |
|
43 | 45 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), |
|
44 | 46 | m_VisualizationController.get(), |
|
45 | 47 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), Qt::DirectConnection); |
|
46 | 48 | |
|
47 | 49 | connect(m_VariableController.get(), |
|
48 | 50 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &)), |
|
49 | 51 | m_VisualizationController.get(), |
|
50 | 52 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &))); |
|
51 | 53 | |
|
52 | 54 | |
|
53 | 55 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); |
|
54 | 56 | m_DataSourceControllerThread.setObjectName("DataSourceControllerThread"); |
|
55 | 57 | m_NetworkController->moveToThread(&m_NetworkControllerThread); |
|
56 | 58 | m_NetworkControllerThread.setObjectName("NetworkControllerThread"); |
|
57 | 59 | m_VariableController->moveToThread(&m_VariableControllerThread); |
|
58 | 60 | m_VariableControllerThread.setObjectName("VariableControllerThread"); |
|
59 | 61 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); |
|
60 | 62 | m_VisualizationControllerThread.setObjectName("VsualizationControllerThread"); |
|
61 | 63 | |
|
62 | 64 | |
|
63 | 65 | // Additionnal init |
|
64 | 66 | m_VariableController->setTimeController(m_TimeController.get()); |
|
65 | 67 | } |
|
66 | 68 | |
|
67 | 69 | virtual ~SqpApplicationPrivate() |
|
68 | 70 | { |
|
69 | 71 | m_DataSourceControllerThread.quit(); |
|
70 | 72 | m_DataSourceControllerThread.wait(); |
|
71 | 73 | |
|
72 | 74 | m_NetworkControllerThread.quit(); |
|
73 | 75 | m_NetworkControllerThread.wait(); |
|
74 | 76 | |
|
75 | 77 | m_VariableControllerThread.quit(); |
|
76 | 78 | m_VariableControllerThread.wait(); |
|
77 | 79 | |
|
78 | 80 | m_VisualizationControllerThread.quit(); |
|
79 | 81 | m_VisualizationControllerThread.wait(); |
|
80 | 82 | } |
|
81 | 83 | |
|
82 | 84 | std::unique_ptr<DataSourceController> m_DataSourceController; |
|
83 | 85 | std::unique_ptr<VariableController> m_VariableController; |
|
84 | 86 | std::unique_ptr<TimeController> m_TimeController; |
|
85 | 87 | std::unique_ptr<NetworkController> m_NetworkController; |
|
86 | 88 | std::unique_ptr<VisualizationController> m_VisualizationController; |
|
87 | 89 | QThread m_DataSourceControllerThread; |
|
88 | 90 | QThread m_NetworkControllerThread; |
|
89 | 91 | QThread m_VariableControllerThread; |
|
90 | 92 | QThread m_VisualizationControllerThread; |
|
91 | 93 | |
|
92 | 94 | std::unique_ptr<DragDropHelper> m_DragDropHelper; |
|
95 | ||
|
96 | SqpApplication::PlotsInteractionMode m_PlotInterractionMode; | |
|
97 | SqpApplication::PlotsCursorMode m_PlotCursorMode; | |
|
93 | 98 | }; |
|
94 | 99 | |
|
95 | 100 | |
|
96 | 101 | SqpApplication::SqpApplication(int &argc, char **argv) |
|
97 | 102 | : QApplication{argc, argv}, impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} |
|
98 | 103 | { |
|
99 | 104 | qCDebug(LOG_SqpApplication()) << tr("SqpApplication construction") << QThread::currentThread(); |
|
100 | 105 | |
|
101 | 106 | connect(&impl->m_DataSourceControllerThread, &QThread::started, |
|
102 | 107 | impl->m_DataSourceController.get(), &DataSourceController::initialize); |
|
103 | 108 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, |
|
104 | 109 | impl->m_DataSourceController.get(), &DataSourceController::finalize); |
|
105 | 110 | |
|
106 | 111 | connect(&impl->m_NetworkControllerThread, &QThread::started, impl->m_NetworkController.get(), |
|
107 | 112 | &NetworkController::initialize); |
|
108 | 113 | connect(&impl->m_NetworkControllerThread, &QThread::finished, impl->m_NetworkController.get(), |
|
109 | 114 | &NetworkController::finalize); |
|
110 | 115 | |
|
111 | 116 | connect(&impl->m_VariableControllerThread, &QThread::started, impl->m_VariableController.get(), |
|
112 | 117 | &VariableController::initialize); |
|
113 | 118 | connect(&impl->m_VariableControllerThread, &QThread::finished, impl->m_VariableController.get(), |
|
114 | 119 | &VariableController::finalize); |
|
115 | 120 | |
|
116 | 121 | connect(&impl->m_VisualizationControllerThread, &QThread::started, |
|
117 | 122 | impl->m_VisualizationController.get(), &VisualizationController::initialize); |
|
118 | 123 | connect(&impl->m_VisualizationControllerThread, &QThread::finished, |
|
119 | 124 | impl->m_VisualizationController.get(), &VisualizationController::finalize); |
|
120 | 125 | |
|
121 | 126 | impl->m_DataSourceControllerThread.start(); |
|
122 | 127 | impl->m_NetworkControllerThread.start(); |
|
123 | 128 | impl->m_VariableControllerThread.start(); |
|
124 | 129 | impl->m_VisualizationControllerThread.start(); |
|
125 | 130 | } |
|
126 | 131 | |
|
127 | 132 | SqpApplication::~SqpApplication() |
|
128 | 133 | { |
|
129 | 134 | } |
|
130 | 135 | |
|
131 | 136 | void SqpApplication::initialize() |
|
132 | 137 | { |
|
133 | 138 | } |
|
134 | 139 | |
|
135 | 140 | DataSourceController &SqpApplication::dataSourceController() noexcept |
|
136 | 141 | { |
|
137 | 142 | return *impl->m_DataSourceController; |
|
138 | 143 | } |
|
139 | 144 | |
|
140 | 145 | NetworkController &SqpApplication::networkController() noexcept |
|
141 | 146 | { |
|
142 | 147 | return *impl->m_NetworkController; |
|
143 | 148 | } |
|
144 | 149 | |
|
145 | 150 | TimeController &SqpApplication::timeController() noexcept |
|
146 | 151 | { |
|
147 | 152 | return *impl->m_TimeController; |
|
148 | 153 | } |
|
149 | 154 | |
|
150 | 155 | VariableController &SqpApplication::variableController() noexcept |
|
151 | 156 | { |
|
152 | 157 | return *impl->m_VariableController; |
|
153 | 158 | } |
|
154 | 159 | |
|
155 | 160 | VisualizationController &SqpApplication::visualizationController() noexcept |
|
156 | 161 | { |
|
157 | 162 | return *impl->m_VisualizationController; |
|
158 | 163 | } |
|
159 | 164 | |
|
160 | 165 | DragDropHelper &SqpApplication::dragDropHelper() noexcept |
|
161 | 166 | { |
|
162 | 167 | return *impl->m_DragDropHelper; |
|
163 | 168 | } |
|
169 | ||
|
170 | SqpApplication::PlotsInteractionMode SqpApplication::plotsInteractionMode() const | |
|
171 | { | |
|
172 | return impl->m_PlotInterractionMode; | |
|
173 | } | |
|
174 | ||
|
175 | void SqpApplication::setPlotsInteractionMode(SqpApplication::PlotsInteractionMode mode) | |
|
176 | { | |
|
177 | impl->m_PlotInterractionMode = mode; | |
|
178 | } | |
|
179 | ||
|
180 | SqpApplication::PlotsCursorMode SqpApplication::plotsCursorMode() const | |
|
181 | { | |
|
182 | return impl->m_PlotCursorMode; | |
|
183 | } | |
|
184 | ||
|
185 | void SqpApplication::setPlotsCursorMode(SqpApplication::PlotsCursorMode mode) | |
|
186 | { | |
|
187 | impl->m_PlotCursorMode = mode; | |
|
188 | } |
General Comments 1
You need to be logged in to leave comments.
Login now