@@ -1,404 +1,375 | |||
|
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 <Catalogue/CatalogueController.h> |
|
26 | 26 | #include <Catalogue/CatalogueExplorer.h> |
|
27 | 27 | #include <DataSource/DataSourceController.h> |
|
28 | 28 | #include <DataSource/DataSourceWidget.h> |
|
29 | 29 | #include <Settings/SqpSettingsDialog.h> |
|
30 | 30 | #include <Settings/SqpSettingsGeneralWidget.h> |
|
31 | 31 | #include <SidePane/SqpSidePane.h> |
|
32 | 32 | #include <SqpApplication.h> |
|
33 | 33 | #include <Time/TimeController.h> |
|
34 | 34 | #include <TimeWidget/TimeWidget.h> |
|
35 | 35 | #include <Variable/Variable.h> |
|
36 | 36 | #include <Visualization/VisualizationController.h> |
|
37 | 37 | |
|
38 | 38 | #include <QAction> |
|
39 | 39 | #include <QCloseEvent> |
|
40 | 40 | #include <QDate> |
|
41 | 41 | #include <QDir> |
|
42 | 42 | #include <QFileDialog> |
|
43 | 43 | #include <QMessageBox> |
|
44 | 44 | #include <QToolBar> |
|
45 | 45 | #include <QToolButton> |
|
46 | 46 | #include <memory.h> |
|
47 | 47 | |
|
48 | 48 | #include "iostream" |
|
49 | 49 | |
|
50 | 50 | Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow") |
|
51 | 51 | |
|
52 | 52 | namespace { |
|
53 | 53 | const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0; |
|
54 | 54 | const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1; |
|
55 | 55 | const auto VIEWPLITTERINDEX = 2; |
|
56 | 56 | const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3; |
|
57 | 57 | const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4; |
|
58 | 58 | } |
|
59 | 59 | |
|
60 | 60 | class MainWindow::MainWindowPrivate { |
|
61 | 61 | public: |
|
62 | 62 | explicit MainWindowPrivate(MainWindow *mainWindow) |
|
63 | 63 | : m_LastOpenLeftInspectorSize{}, |
|
64 | 64 | m_LastOpenRightInspectorSize{}, |
|
65 | 65 | m_GeneralSettingsWidget{new SqpSettingsGeneralWidget{mainWindow}}, |
|
66 | 66 | m_SettingsDialog{new SqpSettingsDialog{mainWindow}}, |
|
67 | 67 | m_CatalogExplorer{new CatalogueExplorer{mainWindow}} |
|
68 | 68 | { |
|
69 | 69 | } |
|
70 | 70 | |
|
71 | 71 | QSize m_LastOpenLeftInspectorSize; |
|
72 | 72 | QSize m_LastOpenRightInspectorSize; |
|
73 | 73 | /// General settings widget. MainWindow has the ownership |
|
74 | 74 | SqpSettingsGeneralWidget *m_GeneralSettingsWidget; |
|
75 | 75 | /// Settings dialog. MainWindow has the ownership |
|
76 | 76 | SqpSettingsDialog *m_SettingsDialog; |
|
77 | 77 | /// Catalogue dialog. MainWindow has the ownership |
|
78 | 78 | CatalogueExplorer *m_CatalogExplorer; |
|
79 | 79 | |
|
80 | 80 | bool checkDataToSave(QWidget *parentWidget); |
|
81 | 81 | }; |
|
82 | 82 | |
|
83 | 83 | MainWindow::MainWindow(QWidget *parent) |
|
84 | 84 | : QMainWindow{parent}, |
|
85 | 85 | m_Ui{new Ui::MainWindow}, |
|
86 | 86 | impl{spimpl::make_unique_impl<MainWindowPrivate>(this)} |
|
87 | 87 | { |
|
88 | 88 | m_Ui->setupUi(this); |
|
89 | 89 | |
|
90 | 90 | m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false); |
|
91 | 91 | m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false); |
|
92 | 92 | |
|
93 | 93 | impl->m_CatalogExplorer->setVisualizationWidget(m_Ui->view); |
|
94 | 94 | |
|
95 | 95 | |
|
96 | auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane(); | |
|
97 | auto openLeftInspectorAction = new QAction{QIcon{ | |
|
98 | ":/icones/previous.png", | |
|
99 | }, | |
|
100 | tr("Show/hide the left inspector"), this}; | |
|
96 | ||
|
101 | 97 | |
|
102 | 98 | |
|
103 | 99 | auto spacerLeftTop = new QWidget{}; |
|
104 | 100 | spacerLeftTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
105 | 101 | |
|
106 | 102 | auto spacerLeftBottom = new QWidget{}; |
|
107 | 103 | spacerLeftBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
108 | 104 | |
|
109 | leftSidePane->addWidget(spacerLeftTop); | |
|
110 | leftSidePane->addAction(openLeftInspectorAction); | |
|
111 | leftSidePane->addWidget(spacerLeftBottom); | |
|
112 | ||
|
113 | ||
|
114 | auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane(); | |
|
115 | auto openRightInspectorAction = new QAction{QIcon{ | |
|
116 | ":/icones/next.png", | |
|
117 | }, | |
|
118 | tr("Show/hide the right inspector"), this}; | |
|
119 | 105 | |
|
120 | 106 | auto spacerRightTop = new QWidget{}; |
|
121 | 107 | spacerRightTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
122 | 108 | |
|
123 | 109 | auto spacerRightBottom = new QWidget{}; |
|
124 | 110 | spacerRightBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
125 | 111 | |
|
126 | rightSidePane->addWidget(spacerRightTop); | |
|
127 | rightSidePane->addAction(openRightInspectorAction); | |
|
128 | rightSidePane->addWidget(spacerRightBottom); | |
|
129 | ||
|
130 | openLeftInspectorAction->setCheckable(true); | |
|
131 | openRightInspectorAction->setCheckable(true); | |
|
132 | 112 | |
|
133 | 113 | auto openInspector = [this](bool checked, bool right, auto action) { |
|
134 | 114 | |
|
135 | 115 | action->setIcon(QIcon{(checked ^ right) ? ":/icones/next.png" : ":/icones/previous.png"}); |
|
136 | 116 | |
|
137 | 117 | auto &lastInspectorSize |
|
138 | 118 | = right ? impl->m_LastOpenRightInspectorSize : impl->m_LastOpenLeftInspectorSize; |
|
139 | 119 | |
|
140 | 120 | auto nextInspectorSize = right ? m_Ui->rightMainInspectorWidget->size() |
|
141 | 121 | : m_Ui->leftMainInspectorWidget->size(); |
|
142 | 122 | |
|
143 | 123 | // Update of the last opened geometry |
|
144 | 124 | if (checked) { |
|
145 | 125 | lastInspectorSize = nextInspectorSize; |
|
146 | 126 | } |
|
147 | 127 | |
|
148 | 128 | auto startSize = lastInspectorSize; |
|
149 | 129 | auto endSize = startSize; |
|
150 | 130 | endSize.setWidth(0); |
|
151 | 131 | |
|
152 | 132 | auto splitterInspectorIndex |
|
153 | 133 | = right ? RIGHTMAININSPECTORWIDGETSPLITTERINDEX : LEFTMAININSPECTORWIDGETSPLITTERINDEX; |
|
154 | 134 | |
|
155 | 135 | auto currentSizes = m_Ui->splitter->sizes(); |
|
156 | 136 | if (checked) { |
|
157 | 137 | // adjust sizes individually here, e.g. |
|
158 | 138 | currentSizes[splitterInspectorIndex] -= lastInspectorSize.width(); |
|
159 | 139 | currentSizes[VIEWPLITTERINDEX] += lastInspectorSize.width(); |
|
160 | 140 | m_Ui->splitter->setSizes(currentSizes); |
|
161 | 141 | } |
|
162 | 142 | else { |
|
163 | 143 | // adjust sizes individually here, e.g. |
|
164 | 144 | currentSizes[splitterInspectorIndex] += lastInspectorSize.width(); |
|
165 | 145 | currentSizes[VIEWPLITTERINDEX] -= lastInspectorSize.width(); |
|
166 | 146 | m_Ui->splitter->setSizes(currentSizes); |
|
167 | 147 | } |
|
168 | 148 | |
|
169 | 149 | }; |
|
170 | 150 | |
|
171 | 151 | |
|
172 | connect(openLeftInspectorAction, &QAction::triggered, | |
|
173 | [openInspector, openLeftInspectorAction](bool checked) { | |
|
174 | openInspector(checked, false, openLeftInspectorAction); | |
|
175 | }); | |
|
176 | connect(openRightInspectorAction, &QAction::triggered, | |
|
177 | [openInspector, openRightInspectorAction](bool checked) { | |
|
178 | openInspector(checked, true, openRightInspectorAction); | |
|
179 | }); | |
|
180 | ||
|
181 | 152 | // //////////////// // |
|
182 | 153 | // Menu and Toolbar // |
|
183 | 154 | // //////////////// // |
|
184 | 155 | this->menuBar()->addAction(tr("File")); |
|
185 | 156 | auto toolsMenu = this->menuBar()->addMenu(tr("Tools")); |
|
186 | 157 | toolsMenu->addAction(tr("Settings..."), [this]() { |
|
187 | 158 | // Loads settings |
|
188 | 159 | impl->m_SettingsDialog->loadSettings(); |
|
189 | 160 | |
|
190 | 161 | // Open settings dialog and save settings if the dialog is accepted |
|
191 | 162 | if (impl->m_SettingsDialog->exec() == QDialog::Accepted) { |
|
192 | 163 | impl->m_SettingsDialog->saveSettings(); |
|
193 | 164 | } |
|
194 | 165 | |
|
195 | 166 | }); |
|
196 | 167 | |
|
197 | 168 | auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar")); |
|
198 | 169 | |
|
199 | 170 | auto timeWidget = new TimeWidget{}; |
|
200 | 171 | mainToolBar->addWidget(timeWidget); |
|
201 | 172 | |
|
202 | 173 | // Interaction modes |
|
203 | 174 | auto actionPointerMode = new QAction{QIcon(":/icones/pointer.png"), "Move", this}; |
|
204 | 175 | actionPointerMode->setCheckable(true); |
|
205 | 176 | actionPointerMode->setChecked(sqpApp->plotsInteractionMode() |
|
206 | 177 | == SqpApplication::PlotsInteractionMode::None); |
|
207 | 178 | connect(actionPointerMode, &QAction::triggered, |
|
208 | 179 | []() { sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::None); }); |
|
209 | 180 | |
|
210 | 181 | auto actionZoomMode = new QAction{QIcon(":/icones/zoom.png"), "Zoom", this}; |
|
211 | 182 | actionZoomMode->setCheckable(true); |
|
212 | 183 | actionZoomMode->setChecked(sqpApp->plotsInteractionMode() |
|
213 | 184 | == SqpApplication::PlotsInteractionMode::ZoomBox); |
|
214 | 185 | connect(actionZoomMode, &QAction::triggered, []() { |
|
215 | 186 | sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::ZoomBox); |
|
216 | 187 | }); |
|
217 | 188 | |
|
218 | 189 | auto actionOrganisationMode = new QAction{QIcon(":/icones/drag.png"), "Organize", this}; |
|
219 | 190 | actionOrganisationMode->setCheckable(true); |
|
220 | 191 | actionOrganisationMode->setChecked(sqpApp->plotsInteractionMode() |
|
221 | 192 | == SqpApplication::PlotsInteractionMode::DragAndDrop); |
|
222 | 193 | connect(actionOrganisationMode, &QAction::triggered, []() { |
|
223 | 194 | sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::DragAndDrop); |
|
224 | 195 | }); |
|
225 | 196 | |
|
226 | 197 | auto actionZonesMode = new QAction{QIcon(":/icones/rectangle.png"), "Zones", this}; |
|
227 | 198 | actionZonesMode->setCheckable(true); |
|
228 | 199 | actionZonesMode->setChecked(sqpApp->plotsInteractionMode() |
|
229 | 200 | == SqpApplication::PlotsInteractionMode::SelectionZones); |
|
230 | 201 | connect(actionZonesMode, &QAction::triggered, []() { |
|
231 | 202 | sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::SelectionZones); |
|
232 | 203 | }); |
|
233 | 204 | |
|
234 | 205 | auto modeActionGroup = new QActionGroup{this}; |
|
235 | 206 | modeActionGroup->addAction(actionZoomMode); |
|
236 | 207 | modeActionGroup->addAction(actionZonesMode); |
|
237 | 208 | modeActionGroup->addAction(actionOrganisationMode); |
|
238 | 209 | modeActionGroup->addAction(actionPointerMode); |
|
239 | 210 | modeActionGroup->setExclusive(true); |
|
240 | 211 | |
|
241 | 212 | mainToolBar->addSeparator(); |
|
242 | 213 | mainToolBar->addAction(actionPointerMode); |
|
243 | 214 | mainToolBar->addAction(actionZoomMode); |
|
244 | 215 | mainToolBar->addAction(actionOrganisationMode); |
|
245 | 216 | mainToolBar->addAction(actionZonesMode); |
|
246 | 217 | mainToolBar->addSeparator(); |
|
247 | 218 | |
|
248 | 219 | // Cursors |
|
249 | 220 | auto btnCursor = new QToolButton{this}; |
|
250 | 221 | btnCursor->setIcon(QIcon(":/icones/cursor.png")); |
|
251 | 222 | btnCursor->setText("Cursor"); |
|
252 | 223 | btnCursor->setToolTip("Cursor"); |
|
253 | 224 | btnCursor->setPopupMode(QToolButton::InstantPopup); |
|
254 | 225 | auto cursorMenu = new QMenu("CursorMenu", this); |
|
255 | 226 | btnCursor->setMenu(cursorMenu); |
|
256 | 227 | |
|
257 | 228 | auto noCursorAction = cursorMenu->addAction("No Cursor"); |
|
258 | 229 | noCursorAction->setCheckable(true); |
|
259 | 230 | noCursorAction->setChecked(sqpApp->plotsCursorMode() |
|
260 | 231 | == SqpApplication::PlotsCursorMode::NoCursor); |
|
261 | 232 | connect(noCursorAction, &QAction::triggered, |
|
262 | 233 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::NoCursor); }); |
|
263 | 234 | |
|
264 | 235 | cursorMenu->addSeparator(); |
|
265 | 236 | auto verticalCursorAction = cursorMenu->addAction("Vertical Cursor"); |
|
266 | 237 | verticalCursorAction->setCheckable(true); |
|
267 | 238 | verticalCursorAction->setChecked(sqpApp->plotsCursorMode() |
|
268 | 239 | == SqpApplication::PlotsCursorMode::Vertical); |
|
269 | 240 | connect(verticalCursorAction, &QAction::triggered, |
|
270 | 241 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Vertical); }); |
|
271 | 242 | |
|
272 | 243 | auto temporalCursorAction = cursorMenu->addAction("Temporal Cursor"); |
|
273 | 244 | temporalCursorAction->setCheckable(true); |
|
274 | 245 | temporalCursorAction->setChecked(sqpApp->plotsCursorMode() |
|
275 | 246 | == SqpApplication::PlotsCursorMode::Temporal); |
|
276 | 247 | connect(temporalCursorAction, &QAction::triggered, |
|
277 | 248 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Temporal); }); |
|
278 | 249 | |
|
279 | 250 | auto horizontalCursorAction = cursorMenu->addAction("Horizontal Cursor"); |
|
280 | 251 | horizontalCursorAction->setCheckable(true); |
|
281 | 252 | horizontalCursorAction->setChecked(sqpApp->plotsCursorMode() |
|
282 | 253 | == SqpApplication::PlotsCursorMode::Horizontal); |
|
283 | 254 | connect(horizontalCursorAction, &QAction::triggered, |
|
284 | 255 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Horizontal); }); |
|
285 | 256 | |
|
286 | 257 | auto crossCursorAction = cursorMenu->addAction("Cross Cursor"); |
|
287 | 258 | crossCursorAction->setCheckable(true); |
|
288 | 259 | crossCursorAction->setChecked(sqpApp->plotsCursorMode() |
|
289 | 260 | == SqpApplication::PlotsCursorMode::Cross); |
|
290 | 261 | connect(crossCursorAction, &QAction::triggered, |
|
291 | 262 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Cross); }); |
|
292 | 263 | |
|
293 | 264 | mainToolBar->addWidget(btnCursor); |
|
294 | 265 | |
|
295 | 266 | auto cursorModeActionGroup = new QActionGroup{this}; |
|
296 | 267 | cursorModeActionGroup->setExclusive(true); |
|
297 | 268 | cursorModeActionGroup->addAction(noCursorAction); |
|
298 | 269 | cursorModeActionGroup->addAction(verticalCursorAction); |
|
299 | 270 | cursorModeActionGroup->addAction(temporalCursorAction); |
|
300 | 271 | cursorModeActionGroup->addAction(horizontalCursorAction); |
|
301 | 272 | cursorModeActionGroup->addAction(crossCursorAction); |
|
302 | 273 | |
|
303 | 274 | // Catalog |
|
304 | 275 | mainToolBar->addSeparator(); |
|
305 | 276 | mainToolBar->addAction(QIcon(":/icones/catalogue.png"), "Catalogues", |
|
306 | 277 | [this]() { impl->m_CatalogExplorer->show(); }); |
|
307 | 278 | |
|
308 | 279 | // //////// // |
|
309 | 280 | // Settings // |
|
310 | 281 | // //////// // |
|
311 | 282 | |
|
312 | 283 | // Registers "general settings" widget to the settings dialog |
|
313 | 284 | impl->m_SettingsDialog->registerWidget(QStringLiteral("General"), |
|
314 | 285 | impl->m_GeneralSettingsWidget); |
|
315 | 286 | |
|
316 | 287 | // /////////// // |
|
317 | 288 | // Connections // |
|
318 | 289 | // /////////// // |
|
319 | 290 | |
|
320 | 291 | // Controllers / controllers connections |
|
321 | 292 | // connect(&sqpApp->timeController(), SIGNAL(timeUpdated(DateTimeRange)), &sqpApp->variableController(), |
|
322 | 293 | // SLOT(onDateTimeOnSelection(DateTimeRange))); |
|
323 | 294 | |
|
324 | 295 | // Widgets / controllers connections |
|
325 | 296 | |
|
326 | 297 | // DataSource |
|
327 | 298 | connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)), |
|
328 | 299 | m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *))); |
|
329 | 300 | |
|
330 | 301 | // Time |
|
331 | 302 | connect(timeWidget, SIGNAL(timeUpdated(DateTimeRange)), &sqpApp->timeController(), |
|
332 | 303 | SLOT(onTimeToUpdate(DateTimeRange))); |
|
333 | 304 | |
|
334 | 305 | // Visualization |
|
335 | 306 | connect(&sqpApp->visualizationController(), |
|
336 | 307 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), m_Ui->view, |
|
337 | 308 | SLOT(onVariableAboutToBeDeleted(std::shared_ptr<Variable>))); |
|
338 | 309 | |
|
339 | 310 | connect(&sqpApp->visualizationController(), |
|
340 | 311 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const DateTimeRange &)), m_Ui->view, |
|
341 | 312 | SLOT(onRangeChanged(std::shared_ptr<Variable>, const DateTimeRange &))); |
|
342 | 313 | |
|
343 | 314 | // Widgets / widgets connections |
|
344 | 315 | |
|
345 | 316 | // For the following connections, we use DirectConnection to allow each widget that can |
|
346 | 317 | // potentially attach a menu to the variable's menu to do so before this menu is displayed. |
|
347 | 318 | // The order of connections is also important, since it determines the order in which each |
|
348 | 319 | // widget will attach its menu |
|
349 | 320 | connect( |
|
350 | 321 | m_Ui->variableInspectorWidget, |
|
351 | 322 | SIGNAL(tableMenuAboutToBeDisplayed(QMenu *, const QVector<std::shared_ptr<Variable> > &)), |
|
352 | 323 | m_Ui->view, SLOT(attachVariableMenu(QMenu *, const QVector<std::shared_ptr<Variable> > &)), |
|
353 | 324 | Qt::DirectConnection); |
|
354 | 325 | } |
|
355 | 326 | |
|
356 | 327 | MainWindow::~MainWindow() |
|
357 | 328 | { |
|
358 | 329 | } |
|
359 | 330 | |
|
360 | 331 | void MainWindow::changeEvent(QEvent *e) |
|
361 | 332 | { |
|
362 | 333 | QMainWindow::changeEvent(e); |
|
363 | 334 | switch (e->type()) { |
|
364 | 335 | case QEvent::LanguageChange: |
|
365 | 336 | m_Ui->retranslateUi(this); |
|
366 | 337 | break; |
|
367 | 338 | default: |
|
368 | 339 | break; |
|
369 | 340 | } |
|
370 | 341 | } |
|
371 | 342 | |
|
372 | 343 | void MainWindow::closeEvent(QCloseEvent *event) |
|
373 | 344 | { |
|
374 | 345 | if (!impl->checkDataToSave(this)) { |
|
375 | 346 | event->ignore(); |
|
376 | 347 | } |
|
377 | 348 | else { |
|
378 | 349 | event->accept(); |
|
379 | 350 | } |
|
380 | 351 | } |
|
381 | 352 | |
|
382 | 353 | bool MainWindow::MainWindowPrivate::checkDataToSave(QWidget *parentWidget) |
|
383 | 354 | { |
|
384 | 355 | auto hasChanges = sqpApp->catalogueController().hasChanges(); |
|
385 | 356 | if (hasChanges) { |
|
386 | 357 | // There are some unsaved changes |
|
387 | 358 | switch (QMessageBox::question( |
|
388 | 359 | parentWidget, tr("Save changes"), |
|
389 | 360 | tr("The catalogue controller has unsaved changes.\nDo you want to save them ?"), |
|
390 | 361 | QMessageBox::SaveAll | QMessageBox::Discard | QMessageBox::Cancel, |
|
391 | 362 | QMessageBox::SaveAll)) { |
|
392 | 363 | case QMessageBox::SaveAll: |
|
393 | 364 | sqpApp->catalogueController().saveAll(); |
|
394 | 365 | break; |
|
395 | 366 | case QMessageBox::Discard: |
|
396 | 367 | break; |
|
397 | 368 | case QMessageBox::Cancel: |
|
398 | 369 | default: |
|
399 | 370 | return false; |
|
400 | 371 | } |
|
401 | 372 | } |
|
402 | 373 | |
|
403 | 374 | return true; |
|
404 | 375 | } |
@@ -1,170 +1,162 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
|
2 | 2 | <ui version="4.0"> |
|
3 | 3 | <class>MainWindow</class> |
|
4 | 4 | <widget class="QMainWindow" name="MainWindow"> |
|
5 | 5 | <property name="geometry"> |
|
6 | 6 | <rect> |
|
7 | 7 | <x>0</x> |
|
8 | 8 | <y>0</y> |
|
9 | 9 | <width>800</width> |
|
10 | 10 | <height>600</height> |
|
11 | 11 | </rect> |
|
12 | 12 | </property> |
|
13 | 13 | <property name="windowTitle"> |
|
14 | 14 | <string>SciQlop v0.0.1</string> |
|
15 | 15 | </property> |
|
16 | 16 | <property name="dockNestingEnabled"> |
|
17 | 17 | <bool>true</bool> |
|
18 | 18 | </property> |
|
19 | 19 | <widget class="QWidget" name="centralWidget"> |
|
20 | 20 | <property name="enabled"> |
|
21 | 21 | <bool>true</bool> |
|
22 | 22 | </property> |
|
23 | 23 | <property name="sizePolicy"> |
|
24 | 24 | <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> |
|
25 | 25 | <horstretch>0</horstretch> |
|
26 | 26 | <verstretch>0</verstretch> |
|
27 | 27 | </sizepolicy> |
|
28 | 28 | </property> |
|
29 | 29 | <property name="maximumSize"> |
|
30 | 30 | <size> |
|
31 | 31 | <width>16777215</width> |
|
32 | 32 | <height>16777215</height> |
|
33 | 33 | </size> |
|
34 | 34 | </property> |
|
35 | 35 | <layout class="QHBoxLayout" name="horizontalLayout"> |
|
36 | 36 | <property name="spacing"> |
|
37 | 37 | <number>0</number> |
|
38 | 38 | </property> |
|
39 | 39 | <property name="leftMargin"> |
|
40 | 40 | <number>0</number> |
|
41 | 41 | </property> |
|
42 | 42 | <property name="topMargin"> |
|
43 | 43 | <number>0</number> |
|
44 | 44 | </property> |
|
45 | 45 | <property name="rightMargin"> |
|
46 | 46 | <number>0</number> |
|
47 | 47 | </property> |
|
48 | 48 | <property name="bottomMargin"> |
|
49 | 49 | <number>0</number> |
|
50 | 50 | </property> |
|
51 | 51 | <item> |
|
52 | 52 | <widget class="QSplitter" name="splitter"> |
|
53 | 53 | <property name="orientation"> |
|
54 | 54 | <enum>Qt::Horizontal</enum> |
|
55 | 55 | </property> |
|
56 | 56 | <widget class="QWidget" name="leftMainInspectorWidget" native="true"> |
|
57 | 57 | <layout class="QVBoxLayout" name="verticalLayout"> |
|
58 | 58 | <property name="spacing"> |
|
59 | 59 | <number>0</number> |
|
60 | 60 | </property> |
|
61 | 61 | <property name="leftMargin"> |
|
62 | 62 | <number>0</number> |
|
63 | 63 | </property> |
|
64 | 64 | <property name="topMargin"> |
|
65 | 65 | <number>0</number> |
|
66 | 66 | </property> |
|
67 | 67 | <property name="rightMargin"> |
|
68 | 68 | <number>0</number> |
|
69 | 69 | </property> |
|
70 | 70 | <property name="bottomMargin"> |
|
71 | 71 | <number>0</number> |
|
72 | 72 | </property> |
|
73 | 73 | <item> |
|
74 | 74 | <widget class="DataSourceWidget" name="dataSourceWidget" native="true"/> |
|
75 | 75 | </item> |
|
76 | 76 | <item> |
|
77 | 77 | <widget class="QWidget" name="dateTimeWidget" native="true"/> |
|
78 | 78 | </item> |
|
79 | 79 | <item> |
|
80 | 80 | <widget class="VariableInspectorWidget" name="variableInspectorWidget" native="true"/> |
|
81 | 81 | </item> |
|
82 | 82 | </layout> |
|
83 | 83 | </widget> |
|
84 | <widget class="SqpSidePane" name="leftInspectorSidePane" native="true"/> | |
|
85 | 84 | <widget class="VisualizationWidget" name="view" native="true"> |
|
86 | 85 | <property name="sizePolicy"> |
|
87 | 86 | <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> |
|
88 | 87 | <horstretch>0</horstretch> |
|
89 | 88 | <verstretch>0</verstretch> |
|
90 | 89 | </sizepolicy> |
|
91 | 90 | </property> |
|
92 | 91 | </widget> |
|
93 | <widget class="SqpSidePane" name="rightInspectorSidePane" native="true"/> | |
|
94 | 92 | <widget class="QWidget" name="rightMainInspectorWidget" native="true"> |
|
95 | 93 | <layout class="QVBoxLayout" name="verticalLayout_3"> |
|
96 | 94 | <property name="spacing"> |
|
97 | 95 | <number>0</number> |
|
98 | 96 | </property> |
|
99 | 97 | <property name="leftMargin"> |
|
100 | 98 | <number>0</number> |
|
101 | 99 | </property> |
|
102 | 100 | <property name="topMargin"> |
|
103 | 101 | <number>0</number> |
|
104 | 102 | </property> |
|
105 | 103 | <property name="rightMargin"> |
|
106 | 104 | <number>0</number> |
|
107 | 105 | </property> |
|
108 | 106 | <property name="bottomMargin"> |
|
109 | 107 | <number>0</number> |
|
110 | 108 | </property> |
|
111 | 109 | <item> |
|
112 | 110 | <widget class="QWidget" name="commonPropertyInspectorWidget" native="true"/> |
|
113 | 111 | </item> |
|
114 | 112 | <item> |
|
115 | 113 | <widget class="QTreeWidget" name="catalogWidget"> |
|
116 | 114 | <column> |
|
117 | 115 | <property name="text"> |
|
118 | 116 | <string notr="true">Name</string> |
|
119 | 117 | </property> |
|
120 | 118 | </column> |
|
121 | 119 | </widget> |
|
122 | 120 | </item> |
|
123 | 121 | </layout> |
|
124 | 122 | </widget> |
|
125 | 123 | </widget> |
|
126 | 124 | </item> |
|
127 | 125 | </layout> |
|
128 | 126 | </widget> |
|
129 | 127 | <widget class="QMenuBar" name="menuBar"> |
|
130 | 128 | <property name="geometry"> |
|
131 | 129 | <rect> |
|
132 | 130 | <x>0</x> |
|
133 | 131 | <y>0</y> |
|
134 | 132 | <width>800</width> |
|
135 |
<height> |
|
|
133 | <height>41</height> | |
|
136 | 134 | </rect> |
|
137 | 135 | </property> |
|
138 | 136 | </widget> |
|
139 | 137 | <widget class="QStatusBar" name="statusBar"/> |
|
140 | 138 | </widget> |
|
141 | 139 | <layoutdefault spacing="6" margin="11"/> |
|
142 | 140 | <customwidgets> |
|
143 | 141 | <customwidget> |
|
144 | 142 | <class>VisualizationWidget</class> |
|
145 | 143 | <extends>QWidget</extends> |
|
146 | 144 | <header location="global">Visualization/VisualizationWidget.h</header> |
|
147 | 145 | <container>1</container> |
|
148 | 146 | </customwidget> |
|
149 | 147 | <customwidget> |
|
150 | <class>SqpSidePane</class> | |
|
151 | <extends>QWidget</extends> | |
|
152 | <header location="global">SidePane/SqpSidePane.h</header> | |
|
153 | <container>1</container> | |
|
154 | </customwidget> | |
|
155 | <customwidget> | |
|
156 | 148 | <class>DataSourceWidget</class> |
|
157 | 149 | <extends>QWidget</extends> |
|
158 | 150 | <header location="global">DataSource/DataSourceWidget.h</header> |
|
159 | 151 | <container>1</container> |
|
160 | 152 | </customwidget> |
|
161 | 153 | <customwidget> |
|
162 | 154 | <class>VariableInspectorWidget</class> |
|
163 | 155 | <extends>QWidget</extends> |
|
164 | 156 | <header location="global">Variable/VariableInspectorWidget.h</header> |
|
165 | 157 | <container>1</container> |
|
166 | 158 | </customwidget> |
|
167 | 159 | </customwidgets> |
|
168 | 160 | <resources/> |
|
169 | 161 | <connections/> |
|
170 | 162 | </ui> |
General Comments 0
You need to be logged in to leave comments.
Login now