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