@@ -1,97 +1,104 | |||
|
1 | 1 | cmake_minimum_required(VERSION 3.6) |
|
2 | project(SciQLOP CXX) | |
|
2 | set(SCIQLOP_VERSION 1.0.0) | |
|
3 | project(SciQLOP | |
|
4 | VERSION ${SCIQLOP_VERSION} | |
|
5 | DESCRIPTION "SciQLOP (SCIentific Qt application for Learning from Observations of Plasmas) is an ergonomic and powerful tool enabling visualization and analysis of in situ spacecraft plasma data." | |
|
6 | HOMEPAGE_URL https://github.com/LaboratoryOfPlasmaPhysics/SciQLOP | |
|
7 | LANGUAGES CXX) | |
|
3 | 8 | |
|
4 | 9 | include(GNUInstallDirs) |
|
5 | 10 | |
|
6 | 11 | SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake") |
|
7 | 12 | |
|
8 | 13 | OPTION (CPPCHECK "Analyzes the source code with cppcheck" OFF) |
|
9 | 14 | OPTION (CLANG_TIDY "Analyzes the source code with Clang Tidy" OFF) |
|
10 | 15 | OPTION (IWYU "Analyzes the source code with Include What You Use" OFF) |
|
11 | 16 | OPTION (Coverage "Enables code coverage" OFF) |
|
12 | 17 | OPTION (BUILD_APP "Build SciQLop application" ON) |
|
13 | 18 | OPTION (BUILD_CORE "Build SciQLop Core module" ON) |
|
14 | 19 | OPTION (BUILD_GUI "Build SciQLop GUI module" ON) |
|
15 | 20 | OPTION (BUILD_PLUGINS "Build SciQLop plugins" ON) |
|
16 | 21 | OPTION (ENABLE_WIN32_CONSOLE "Enables console on Win32 platfrom" OFF) |
|
17 | 22 | |
|
18 | 23 | set(CMAKE_CXX_STANDARD 17) |
|
19 | 24 | |
|
20 | 25 | set(CMAKE_AUTOMOC ON) |
|
21 | 26 | #https://gitlab.kitware.com/cmake/cmake/issues/15227 |
|
22 | 27 | #set(CMAKE_AUTOUIC ON) |
|
23 | 28 | if(POLICY CMP0071) |
|
24 | 29 | cmake_policy(SET CMP0071 OLD) |
|
25 | 30 | endif() |
|
26 | 31 | set(CMAKE_AUTORCC ON) |
|
27 | 32 | set(CMAKE_INCLUDE_CURRENT_DIR ON) |
|
28 | 33 | |
|
29 | 34 | if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH) |
|
30 | 35 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) |
|
31 | 36 | endif() |
|
32 | 37 | if(NOT DEFINED CMAKE_MACOSX_RPATH) |
|
33 | 38 | set(CMAKE_MACOSX_RPATH TRUE) |
|
34 | 39 | endif() |
|
35 | 40 | |
|
36 | 41 | if(NOT CMAKE_BUILD_TYPE) |
|
37 | 42 | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) |
|
38 | 43 | endif() |
|
39 | 44 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g3") |
|
40 | 45 | |
|
41 | 46 | find_package(Qt5 COMPONENTS Core Widgets Network PrintSupport Svg Test REQUIRED) |
|
42 | 47 | |
|
43 | 48 | IF(CPPCHECK) |
|
44 | 49 | set(CMAKE_CXX_CPPCHECK "cppcheck;--enable=warning,style") |
|
45 | 50 | ENDIF(CPPCHECK) |
|
46 | 51 | |
|
47 | 52 | IF(CLANG_TIDY) |
|
48 | 53 | set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-style=file;-checks=*") |
|
49 | 54 | ENDIF(CLANG_TIDY) |
|
50 | 55 | |
|
51 | 56 | IF(IWYU) |
|
52 | 57 | set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "include-what-you-use") |
|
53 | 58 | ENDIF(IWYU) |
|
54 | 59 | |
|
55 | 60 | IF(Coverage) |
|
56 | 61 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage") |
|
57 | 62 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -O0 -Wall -W -Wshadow -Wunused-variable \ |
|
58 | 63 | -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers \ |
|
59 | 64 | -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage") |
|
60 | 65 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") |
|
61 | 66 | |
|
62 | 67 | add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gcov.html |
|
63 | 68 | COMMAND gcovr --exclude='.*Test.*' --exclude='.*external.*' --object-directory ${CMAKE_BINARY_DIR} -r ${CMAKE_SOURCE_DIR} --html --html-details -o ${CMAKE_CURRENT_BINARY_DIR}/gcov.html |
|
64 | 69 | ) |
|
65 | 70 | add_custom_target(gcovr |
|
66 | 71 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gcov.html gcovr |
|
67 | 72 | ) |
|
68 | 73 | add_custom_target(show_coverage |
|
69 | 74 | COMMAND xdg-open ${CMAKE_CURRENT_BINARY_DIR}/gcov.html |
|
70 | 75 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gcov.html gcovr |
|
71 | 76 | ) |
|
72 | 77 | ENDIF(Coverage) |
|
73 | 78 | |
|
74 | 79 | enable_testing() |
|
75 | 80 | |
|
81 | add_definitions(-DSCIQLOP_VERSION="${SCIQLOP_VERSION}") | |
|
82 | ||
|
76 | 83 | if(BUILD_CORE) |
|
77 | 84 | find_package(SciQLOPCore CONFIG QUIET) |
|
78 | 85 | if (NOT SciQLOPCore_FOUND) |
|
79 | 86 | if(NOT IS_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/core) |
|
80 | 87 | message("Init submodule Core") |
|
81 | 88 | execute_process(COMMAND git submodule init core WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
|
82 | 89 | execute_process(COMMAND git submodule update core WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
|
83 | 90 | endif() |
|
84 | 91 | add_subdirectory(core) |
|
85 | 92 | endif() |
|
86 | 93 | endif() |
|
87 | 94 | |
|
88 | 95 | if(BUILD_GUI) |
|
89 | 96 | add_subdirectory(gui) |
|
90 | 97 | endif() |
|
91 | 98 | if(BUILD_APP) |
|
92 | 99 | add_subdirectory(app) |
|
93 | 100 | endif() |
|
94 | 101 | if(BUILD_PLUGINS) |
|
95 | 102 | add_subdirectory(plugins) |
|
96 | 103 | endif() |
|
97 | 104 | #add_subdirectory(docs) |
@@ -1,395 +1,395 | |||
|
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 <Visualization/VisualizationController.h> |
|
36 | 36 | |
|
37 | 37 | #include <QAction> |
|
38 | 38 | #include <QCloseEvent> |
|
39 | 39 | #include <QDate> |
|
40 | 40 | #include <QDir> |
|
41 | 41 | #include <QFileDialog> |
|
42 | 42 | #include <QMessageBox> |
|
43 | 43 | #include <QToolBar> |
|
44 | 44 | #include <QToolButton> |
|
45 | 45 | #include <memory.h> |
|
46 | 46 | |
|
47 | #include "iostream" | |
|
48 | 47 | |
|
49 | 48 | Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow") |
|
50 | 49 | |
|
51 | 50 | namespace |
|
52 | 51 | { |
|
53 | 52 | const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0; |
|
54 | 53 | const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1; |
|
55 | 54 | const auto VIEWPLITTERINDEX = 2; |
|
56 | 55 | const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3; |
|
57 | 56 | const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4; |
|
58 | 57 | } |
|
59 | 58 | |
|
60 | 59 | class MainWindow::MainWindowPrivate |
|
61 | 60 | { |
|
62 | 61 | public: |
|
63 | 62 | explicit MainWindowPrivate(MainWindow* mainWindow) |
|
64 | 63 | : m_LastOpenLeftInspectorSize {} |
|
65 | 64 | , m_LastOpenRightInspectorSize {} |
|
66 | 65 | , m_GeneralSettingsWidget { new SqpSettingsGeneralWidget { mainWindow } } |
|
67 | 66 | , m_SettingsDialog { new SqpSettingsDialog { mainWindow } } |
|
68 | 67 | //, m_CatalogExplorer { new CatalogueExplorer { mainWindow } } |
|
69 | 68 | { |
|
70 | 69 | } |
|
71 | 70 | |
|
72 | 71 | QSize m_LastOpenLeftInspectorSize; |
|
73 | 72 | QSize m_LastOpenRightInspectorSize; |
|
74 | 73 | /// General settings widget. MainWindow has the ownership |
|
75 | 74 | SqpSettingsGeneralWidget* m_GeneralSettingsWidget; |
|
76 | 75 | /// Settings dialog. MainWindow has the ownership |
|
77 | 76 | SqpSettingsDialog* m_SettingsDialog; |
|
78 | 77 | /// Catalogue dialog. MainWindow has the ownership |
|
79 | 78 | // CatalogueExplorer* m_CatalogExplorer; |
|
80 | 79 | |
|
81 | 80 | bool checkDataToSave(QWidget* parentWidget); |
|
82 | 81 | }; |
|
83 | 82 | |
|
84 | 83 | MainWindow::MainWindow(QWidget* parent) |
|
85 | 84 | : QMainWindow { parent } |
|
86 | 85 | , m_Ui { new Ui::MainWindow } |
|
87 | 86 | , impl { spimpl::make_unique_impl<MainWindowPrivate>(this) } |
|
88 | 87 | { |
|
89 | 88 | m_Ui->setupUi(this); |
|
89 | setWindowTitle(QString("SciQLop v%1").arg(SCIQLOP_VERSION)); | |
|
90 | 90 | |
|
91 | 91 | m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false); |
|
92 | 92 | m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false); |
|
93 | 93 | |
|
94 | 94 | // impl->m_CatalogExplorer->setVisualizationWidget(m_Ui->view); |
|
95 | 95 | |
|
96 | 96 | |
|
97 | 97 | auto spacerLeftTop = new QWidget {}; |
|
98 | 98 | spacerLeftTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
99 | 99 | |
|
100 | 100 | auto spacerLeftBottom = new QWidget {}; |
|
101 | 101 | spacerLeftBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
102 | 102 | |
|
103 | 103 | |
|
104 | 104 | auto spacerRightTop = new QWidget {}; |
|
105 | 105 | spacerRightTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
106 | 106 | |
|
107 | 107 | auto spacerRightBottom = new QWidget {}; |
|
108 | 108 | spacerRightBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
109 | 109 | |
|
110 | 110 | |
|
111 | 111 | auto openInspector = [this](bool checked, bool right, auto action) { |
|
112 | 112 | action->setIcon( |
|
113 | 113 | QIcon { (checked ^ right) ? ":/icones/next.png" : ":/icones/previous.png" }); |
|
114 | 114 | |
|
115 | 115 | auto& lastInspectorSize |
|
116 | 116 | = right ? impl->m_LastOpenRightInspectorSize : impl->m_LastOpenLeftInspectorSize; |
|
117 | 117 | |
|
118 | 118 | auto nextInspectorSize = right ? m_Ui->rightMainInspectorWidget->size() |
|
119 | 119 | : m_Ui->leftMainInspectorWidget->size(); |
|
120 | 120 | |
|
121 | 121 | // Update of the last opened geometry |
|
122 | 122 | if (checked) |
|
123 | 123 | { |
|
124 | 124 | lastInspectorSize = nextInspectorSize; |
|
125 | 125 | } |
|
126 | 126 | |
|
127 | 127 | auto startSize = lastInspectorSize; |
|
128 | 128 | auto endSize = startSize; |
|
129 | 129 | endSize.setWidth(0); |
|
130 | 130 | |
|
131 | 131 | auto splitterInspectorIndex |
|
132 | 132 | = right ? RIGHTMAININSPECTORWIDGETSPLITTERINDEX : LEFTMAININSPECTORWIDGETSPLITTERINDEX; |
|
133 | 133 | |
|
134 | 134 | auto currentSizes = m_Ui->splitter->sizes(); |
|
135 | 135 | if (checked) |
|
136 | 136 | { |
|
137 | 137 | // adjust sizes individually here, e.g. |
|
138 | 138 | currentSizes[splitterInspectorIndex] -= lastInspectorSize.width(); |
|
139 | 139 | currentSizes[VIEWPLITTERINDEX] += lastInspectorSize.width(); |
|
140 | 140 | m_Ui->splitter->setSizes(currentSizes); |
|
141 | 141 | } |
|
142 | 142 | else |
|
143 | 143 | { |
|
144 | 144 | // adjust sizes individually here, e.g. |
|
145 | 145 | currentSizes[splitterInspectorIndex] += lastInspectorSize.width(); |
|
146 | 146 | currentSizes[VIEWPLITTERINDEX] -= lastInspectorSize.width(); |
|
147 | 147 | m_Ui->splitter->setSizes(currentSizes); |
|
148 | 148 | } |
|
149 | 149 | }; |
|
150 | 150 | |
|
151 | 151 | |
|
152 | 152 | // //////////////// // |
|
153 | 153 | // Menu and Toolbar // |
|
154 | 154 | // //////////////// // |
|
155 | 155 | this->menuBar()->addAction(tr("File")); |
|
156 | 156 | auto toolsMenu = this->menuBar()->addMenu(tr("Tools")); |
|
157 | 157 | toolsMenu->addAction(tr("Settings..."), [this]() { |
|
158 | 158 | // Loads settings |
|
159 | 159 | impl->m_SettingsDialog->loadSettings(); |
|
160 | 160 | |
|
161 | 161 | // Open settings dialog and save settings if the dialog is accepted |
|
162 | 162 | if (impl->m_SettingsDialog->exec() == QDialog::Accepted) |
|
163 | 163 | { |
|
164 | 164 | impl->m_SettingsDialog->saveSettings(); |
|
165 | 165 | } |
|
166 | 166 | }); |
|
167 | 167 | |
|
168 | 168 | auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar")); |
|
169 | 169 | |
|
170 | 170 | auto timeWidget = new TimeWidget {}; |
|
171 | 171 | mainToolBar->addWidget(timeWidget); |
|
172 | 172 | |
|
173 | 173 | // Interaction modes |
|
174 | 174 | auto actionPointerMode = new QAction { QIcon(":/icones/pointer.png"), "Move", this }; |
|
175 | 175 | actionPointerMode->setCheckable(true); |
|
176 | 176 | actionPointerMode->setChecked( |
|
177 | 177 | sqpApp->plotsInteractionMode() == SqpApplication::PlotsInteractionMode::None); |
|
178 | 178 | connect(actionPointerMode, &QAction::triggered, |
|
179 | 179 | []() { sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::None); }); |
|
180 | 180 | |
|
181 | 181 | auto actionZoomMode = new QAction { QIcon(":/icones/zoom.png"), "Zoom", this }; |
|
182 | 182 | actionZoomMode->setCheckable(true); |
|
183 | 183 | actionZoomMode->setChecked( |
|
184 | 184 | sqpApp->plotsInteractionMode() == SqpApplication::PlotsInteractionMode::ZoomBox); |
|
185 | 185 | connect(actionZoomMode, &QAction::triggered, |
|
186 | 186 | []() { sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::ZoomBox); }); |
|
187 | 187 | |
|
188 | 188 | auto actionOrganisationMode = new QAction { QIcon(":/icones/drag.png"), "Organize", this }; |
|
189 | 189 | actionOrganisationMode->setCheckable(true); |
|
190 | 190 | actionOrganisationMode->setChecked( |
|
191 | 191 | sqpApp->plotsInteractionMode() == SqpApplication::PlotsInteractionMode::DragAndDrop); |
|
192 | 192 | connect(actionOrganisationMode, &QAction::triggered, []() { |
|
193 | 193 | sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::DragAndDrop); |
|
194 | 194 | }); |
|
195 | 195 | |
|
196 | 196 | auto actionZonesMode = new QAction { QIcon(":/icones/rectangle.png"), "Zones", this }; |
|
197 | 197 | actionZonesMode->setCheckable(true); |
|
198 | 198 | actionZonesMode->setChecked( |
|
199 | 199 | sqpApp->plotsInteractionMode() == SqpApplication::PlotsInteractionMode::SelectionZones); |
|
200 | 200 | connect(actionZonesMode, &QAction::triggered, []() { |
|
201 | 201 | sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::SelectionZones); |
|
202 | 202 | }); |
|
203 | 203 | |
|
204 | 204 | auto modeActionGroup = new QActionGroup { this }; |
|
205 | 205 | modeActionGroup->addAction(actionZoomMode); |
|
206 | 206 | modeActionGroup->addAction(actionZonesMode); |
|
207 | 207 | modeActionGroup->addAction(actionOrganisationMode); |
|
208 | 208 | modeActionGroup->addAction(actionPointerMode); |
|
209 | 209 | modeActionGroup->setExclusive(true); |
|
210 | 210 | |
|
211 | 211 | mainToolBar->addSeparator(); |
|
212 | 212 | mainToolBar->addAction(actionPointerMode); |
|
213 | 213 | mainToolBar->addAction(actionZoomMode); |
|
214 | 214 | mainToolBar->addAction(actionOrganisationMode); |
|
215 | 215 | mainToolBar->addAction(actionZonesMode); |
|
216 | 216 | mainToolBar->addSeparator(); |
|
217 | 217 | |
|
218 | 218 | // Cursors |
|
219 | 219 | auto btnCursor = new QToolButton { this }; |
|
220 | 220 | btnCursor->setIcon(QIcon(":/icones/cursor.png")); |
|
221 | 221 | btnCursor->setText("Cursor"); |
|
222 | 222 | btnCursor->setToolTip("Cursor"); |
|
223 | 223 | btnCursor->setPopupMode(QToolButton::InstantPopup); |
|
224 | 224 | auto cursorMenu = new QMenu("CursorMenu", this); |
|
225 | 225 | btnCursor->setMenu(cursorMenu); |
|
226 | 226 | |
|
227 | 227 | auto noCursorAction = cursorMenu->addAction("No Cursor"); |
|
228 | 228 | noCursorAction->setCheckable(true); |
|
229 | 229 | noCursorAction->setChecked( |
|
230 | 230 | sqpApp->plotsCursorMode() == SqpApplication::PlotsCursorMode::NoCursor); |
|
231 | 231 | connect(noCursorAction, &QAction::triggered, |
|
232 | 232 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::NoCursor); }); |
|
233 | 233 | |
|
234 | 234 | cursorMenu->addSeparator(); |
|
235 | 235 | auto verticalCursorAction = cursorMenu->addAction("Vertical Cursor"); |
|
236 | 236 | verticalCursorAction->setCheckable(true); |
|
237 | 237 | verticalCursorAction->setChecked( |
|
238 | 238 | sqpApp->plotsCursorMode() == SqpApplication::PlotsCursorMode::Vertical); |
|
239 | 239 | connect(verticalCursorAction, &QAction::triggered, |
|
240 | 240 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Vertical); }); |
|
241 | 241 | |
|
242 | 242 | auto temporalCursorAction = cursorMenu->addAction("Temporal Cursor"); |
|
243 | 243 | temporalCursorAction->setCheckable(true); |
|
244 | 244 | temporalCursorAction->setChecked( |
|
245 | 245 | sqpApp->plotsCursorMode() == SqpApplication::PlotsCursorMode::Temporal); |
|
246 | 246 | connect(temporalCursorAction, &QAction::triggered, |
|
247 | 247 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Temporal); }); |
|
248 | 248 | |
|
249 | 249 | auto horizontalCursorAction = cursorMenu->addAction("Horizontal Cursor"); |
|
250 | 250 | horizontalCursorAction->setCheckable(true); |
|
251 | 251 | horizontalCursorAction->setChecked( |
|
252 | 252 | sqpApp->plotsCursorMode() == SqpApplication::PlotsCursorMode::Horizontal); |
|
253 | 253 | connect(horizontalCursorAction, &QAction::triggered, |
|
254 | 254 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Horizontal); }); |
|
255 | 255 | |
|
256 | 256 | auto crossCursorAction = cursorMenu->addAction("Cross Cursor"); |
|
257 | 257 | crossCursorAction->setCheckable(true); |
|
258 | 258 | crossCursorAction->setChecked( |
|
259 | 259 | sqpApp->plotsCursorMode() == SqpApplication::PlotsCursorMode::Cross); |
|
260 | 260 | connect(crossCursorAction, &QAction::triggered, |
|
261 | 261 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Cross); }); |
|
262 | 262 | |
|
263 | 263 | mainToolBar->addWidget(btnCursor); |
|
264 | 264 | |
|
265 | 265 | auto cursorModeActionGroup = new QActionGroup { this }; |
|
266 | 266 | cursorModeActionGroup->setExclusive(true); |
|
267 | 267 | cursorModeActionGroup->addAction(noCursorAction); |
|
268 | 268 | cursorModeActionGroup->addAction(verticalCursorAction); |
|
269 | 269 | cursorModeActionGroup->addAction(temporalCursorAction); |
|
270 | 270 | cursorModeActionGroup->addAction(horizontalCursorAction); |
|
271 | 271 | cursorModeActionGroup->addAction(crossCursorAction); |
|
272 | 272 | |
|
273 | 273 | // Catalog |
|
274 | 274 | mainToolBar->addSeparator(); |
|
275 | 275 | // mainToolBar->addAction(QIcon(":/icones/catalogue.png"), "Catalogues", |
|
276 | 276 | // [this]() { impl->m_CatalogExplorer->show(); }); |
|
277 | 277 | |
|
278 | 278 | // //////// // |
|
279 | 279 | // Settings // |
|
280 | 280 | // //////// // |
|
281 | 281 | |
|
282 | 282 | // Registers "general settings" widget to the settings dialog |
|
283 | 283 | impl->m_SettingsDialog->registerWidget( |
|
284 | 284 | QStringLiteral("General"), impl->m_GeneralSettingsWidget); |
|
285 | 285 | |
|
286 | 286 | // /////////// // |
|
287 | 287 | // Connections // |
|
288 | 288 | // /////////// // |
|
289 | 289 | |
|
290 | 290 | // Controllers / controllers connections |
|
291 | 291 | // connect(&sqpApp->timeController(), SIGNAL(timeUpdated(DateTimeRange)), |
|
292 | 292 | // &sqpApp->variableController(), |
|
293 | 293 | // SLOT(onDateTimeOnSelection(DateTimeRange))); |
|
294 | 294 | |
|
295 | 295 | // Widgets / controllers connections |
|
296 | 296 | |
|
297 | 297 | // DataSource |
|
298 | 298 | connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem*)), |
|
299 | 299 | m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem*))); |
|
300 | 300 | |
|
301 | 301 | // Time |
|
302 | 302 | connect(timeWidget, SIGNAL(timeUpdated(DateTimeRange)), &sqpApp->timeController(), |
|
303 | 303 | SLOT(onTimeToUpdate(DateTimeRange))); |
|
304 | 304 | |
|
305 | 305 | // Visualization |
|
306 | 306 | connect(&sqpApp->visualizationController(), |
|
307 | 307 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable2>)), m_Ui->view, |
|
308 | 308 | SLOT(onVariableAboutToBeDeleted(std::shared_ptr<Variable2>))); |
|
309 | 309 | |
|
310 | 310 | connect(&sqpApp->visualizationController(), |
|
311 | 311 | SIGNAL(rangeChanged(std::shared_ptr<Variable2>, const DateTimeRange&)), m_Ui->view, |
|
312 | 312 | SLOT(onRangeChanged(std::shared_ptr<Variable2>, const DateTimeRange&))); |
|
313 | 313 | |
|
314 | 314 | // Widgets / widgets connections |
|
315 | 315 | |
|
316 | 316 | // For the following connections, we use DirectConnection to allow each widget that can |
|
317 | 317 | // potentially attach a menu to the variable's menu to do so before this menu is displayed. |
|
318 | 318 | // The order of connections is also important, since it determines the order in which each |
|
319 | 319 | // widget will attach its menu |
|
320 | 320 | connect(m_Ui->variableInspectorWidget, |
|
321 | 321 | SIGNAL(tableMenuAboutToBeDisplayed(QMenu*, const QVector<std::shared_ptr<Variable>>&)), |
|
322 | 322 | m_Ui->view, SLOT(attachVariableMenu(QMenu*, const QVector<std::shared_ptr<Variable>>&)), |
|
323 | 323 | Qt::DirectConnection); |
|
324 | 324 | } |
|
325 | 325 | |
|
326 | 326 | MainWindow::~MainWindow() {} |
|
327 | 327 | |
|
328 | 328 | void MainWindow::changeEvent(QEvent* e) |
|
329 | 329 | { |
|
330 | 330 | QMainWindow::changeEvent(e); |
|
331 | 331 | switch (e->type()) |
|
332 | 332 | { |
|
333 | 333 | case QEvent::LanguageChange: |
|
334 | 334 | m_Ui->retranslateUi(this); |
|
335 | 335 | break; |
|
336 | 336 | default: |
|
337 | 337 | break; |
|
338 | 338 | } |
|
339 | 339 | } |
|
340 | 340 | |
|
341 | 341 | void MainWindow::closeEvent(QCloseEvent* event) |
|
342 | 342 | { |
|
343 | 343 | if (!impl->checkDataToSave(this)) |
|
344 | 344 | { |
|
345 | 345 | event->ignore(); |
|
346 | 346 | } |
|
347 | 347 | else |
|
348 | 348 | { |
|
349 | 349 | event->accept(); |
|
350 | 350 | } |
|
351 | 351 | } |
|
352 | 352 | |
|
353 | 353 | void MainWindow::keyPressEvent(QKeyEvent* event) |
|
354 | 354 | { |
|
355 | 355 | switch (event->key()) |
|
356 | 356 | { |
|
357 | 357 | case Qt::Key_F11: |
|
358 | 358 | if (this->isFullScreen()) |
|
359 | 359 | { |
|
360 | 360 | this->showNormal(); |
|
361 | 361 | } |
|
362 | 362 | else |
|
363 | 363 | { |
|
364 | 364 | this->showFullScreen(); |
|
365 | 365 | } |
|
366 | 366 | break; |
|
367 | 367 | default: |
|
368 | 368 | break; |
|
369 | 369 | } |
|
370 | 370 | } |
|
371 | 371 | |
|
372 | 372 | bool MainWindow::MainWindowPrivate::checkDataToSave(QWidget* parentWidget) |
|
373 | 373 | { |
|
374 | 374 | // auto hasChanges = sqpApp->catalogueController().hasChanges(); |
|
375 | 375 | // if (hasChanges) |
|
376 | 376 | // { |
|
377 | 377 | // // There are some unsaved changes |
|
378 | 378 | // switch (QMessageBox::question(parentWidget, tr("Save changes"), |
|
379 | 379 | // tr("The catalogue controller has unsaved changes.\nDo you want to save them ?"), |
|
380 | 380 | // QMessageBox::SaveAll | QMessageBox::Discard | QMessageBox::Cancel, |
|
381 | 381 | // QMessageBox::SaveAll)) |
|
382 | 382 | // { |
|
383 | 383 | // case QMessageBox::SaveAll: |
|
384 | 384 | // sqpApp->catalogueController().saveAll(); |
|
385 | 385 | // break; |
|
386 | 386 | // case QMessageBox::Discard: |
|
387 | 387 | // break; |
|
388 | 388 | // case QMessageBox::Cancel: |
|
389 | 389 | // default: |
|
390 | 390 | // return false; |
|
391 | 391 | // } |
|
392 | 392 | // } |
|
393 | 393 | |
|
394 | 394 | return true; |
|
395 | 395 | } |
@@ -1,162 +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 |
<string>SciQlop |
|
|
14 | <string>SciQlop</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 | 84 | <widget class="VisualizationWidget" name="view" native="true"> |
|
85 | 85 | <property name="sizePolicy"> |
|
86 | 86 | <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> |
|
87 | 87 | <horstretch>0</horstretch> |
|
88 | 88 | <verstretch>0</verstretch> |
|
89 | 89 | </sizepolicy> |
|
90 | 90 | </property> |
|
91 | 91 | </widget> |
|
92 | 92 | <widget class="QWidget" name="rightMainInspectorWidget" native="true"> |
|
93 | 93 | <layout class="QVBoxLayout" name="verticalLayout_3"> |
|
94 | 94 | <property name="spacing"> |
|
95 | 95 | <number>0</number> |
|
96 | 96 | </property> |
|
97 | 97 | <property name="leftMargin"> |
|
98 | 98 | <number>0</number> |
|
99 | 99 | </property> |
|
100 | 100 | <property name="topMargin"> |
|
101 | 101 | <number>0</number> |
|
102 | 102 | </property> |
|
103 | 103 | <property name="rightMargin"> |
|
104 | 104 | <number>0</number> |
|
105 | 105 | </property> |
|
106 | 106 | <property name="bottomMargin"> |
|
107 | 107 | <number>0</number> |
|
108 | 108 | </property> |
|
109 | 109 | <item> |
|
110 | 110 | <widget class="QWidget" name="commonPropertyInspectorWidget" native="true"/> |
|
111 | 111 | </item> |
|
112 | 112 | <item> |
|
113 | 113 | <widget class="QTreeWidget" name="catalogWidget"> |
|
114 | 114 | <column> |
|
115 | 115 | <property name="text"> |
|
116 | 116 | <string notr="true">Name</string> |
|
117 | 117 | </property> |
|
118 | 118 | </column> |
|
119 | 119 | </widget> |
|
120 | 120 | </item> |
|
121 | 121 | </layout> |
|
122 | 122 | </widget> |
|
123 | 123 | </widget> |
|
124 | 124 | </item> |
|
125 | 125 | </layout> |
|
126 | 126 | </widget> |
|
127 | 127 | <widget class="QMenuBar" name="menuBar"> |
|
128 | 128 | <property name="geometry"> |
|
129 | 129 | <rect> |
|
130 | 130 | <x>0</x> |
|
131 | 131 | <y>0</y> |
|
132 | 132 | <width>800</width> |
|
133 |
<height>4 |
|
|
133 | <height>24</height> | |
|
134 | 134 | </rect> |
|
135 | 135 | </property> |
|
136 | 136 | </widget> |
|
137 | 137 | <widget class="QStatusBar" name="statusBar"/> |
|
138 | 138 | </widget> |
|
139 | 139 | <layoutdefault spacing="6" margin="11"/> |
|
140 | 140 | <customwidgets> |
|
141 | 141 | <customwidget> |
|
142 | 142 | <class>VisualizationWidget</class> |
|
143 | 143 | <extends>QWidget</extends> |
|
144 | 144 | <header location="global">Visualization/VisualizationWidget.h</header> |
|
145 | 145 | <container>1</container> |
|
146 | 146 | </customwidget> |
|
147 | 147 | <customwidget> |
|
148 | 148 | <class>DataSourceWidget</class> |
|
149 | 149 | <extends>QWidget</extends> |
|
150 | 150 | <header location="global">DataSource/DataSourceWidget.h</header> |
|
151 | 151 | <container>1</container> |
|
152 | 152 | </customwidget> |
|
153 | 153 | <customwidget> |
|
154 | 154 | <class>VariableInspectorWidget</class> |
|
155 | 155 | <extends>QWidget</extends> |
|
156 | 156 | <header location="global">Variable/VariableInspectorWidget.h</header> |
|
157 | 157 | <container>1</container> |
|
158 | 158 | </customwidget> |
|
159 | 159 | </customwidgets> |
|
160 | 160 | <resources/> |
|
161 | 161 | <connections/> |
|
162 | 162 | </ui> |
General Comments 0
You need to be logged in to leave comments.
Login now