@@ -1,104 +1,104 | |||
|
1 | 1 | cmake_minimum_required(VERSION 3.6) |
|
2 |
set(SCIQLOP_VERSION 1. |
|
|
2 | set(SCIQLOP_VERSION 1.1.0) | |
|
3 | 3 | project(SciQLOP |
|
4 | 4 | VERSION ${SCIQLOP_VERSION} |
|
5 | 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 | 6 | HOMEPAGE_URL https://github.com/LaboratoryOfPlasmaPhysics/SciQLOP |
|
7 | 7 | LANGUAGES CXX) |
|
8 | 8 | |
|
9 | 9 | include(GNUInstallDirs) |
|
10 | 10 | |
|
11 | 11 | SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake") |
|
12 | 12 | |
|
13 | 13 | OPTION (CPPCHECK "Analyzes the source code with cppcheck" OFF) |
|
14 | 14 | OPTION (CLANG_TIDY "Analyzes the source code with Clang Tidy" OFF) |
|
15 | 15 | OPTION (IWYU "Analyzes the source code with Include What You Use" OFF) |
|
16 | 16 | OPTION (Coverage "Enables code coverage" OFF) |
|
17 | 17 | OPTION (BUILD_APP "Build SciQLop application" ON) |
|
18 | 18 | OPTION (BUILD_CORE "Build SciQLop Core module" ON) |
|
19 | 19 | OPTION (BUILD_GUI "Build SciQLop GUI module" ON) |
|
20 | 20 | OPTION (BUILD_PLUGINS "Build SciQLop plugins" ON) |
|
21 | 21 | OPTION (ENABLE_WIN32_CONSOLE "Enables console on Win32 platfrom" OFF) |
|
22 | 22 | |
|
23 | 23 | set(CMAKE_CXX_STANDARD 17) |
|
24 | 24 | |
|
25 | 25 | set(CMAKE_AUTOMOC ON) |
|
26 | 26 | #https://gitlab.kitware.com/cmake/cmake/issues/15227 |
|
27 | 27 | #set(CMAKE_AUTOUIC ON) |
|
28 | 28 | if(POLICY CMP0071) |
|
29 | 29 | cmake_policy(SET CMP0071 OLD) |
|
30 | 30 | endif() |
|
31 | 31 | set(CMAKE_AUTORCC ON) |
|
32 | 32 | set(CMAKE_INCLUDE_CURRENT_DIR ON) |
|
33 | 33 | |
|
34 | 34 | if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH) |
|
35 | 35 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) |
|
36 | 36 | endif() |
|
37 | 37 | if(NOT DEFINED CMAKE_MACOSX_RPATH) |
|
38 | 38 | set(CMAKE_MACOSX_RPATH TRUE) |
|
39 | 39 | endif() |
|
40 | 40 | |
|
41 | 41 | if(NOT CMAKE_BUILD_TYPE) |
|
42 | 42 | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) |
|
43 | 43 | endif() |
|
44 | 44 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g3") |
|
45 | 45 | |
|
46 | 46 | find_package(Qt5 COMPONENTS Core Widgets Network PrintSupport Svg Test REQUIRED) |
|
47 | 47 | |
|
48 | 48 | IF(CPPCHECK) |
|
49 | 49 | set(CMAKE_CXX_CPPCHECK "cppcheck;--enable=warning,style") |
|
50 | 50 | ENDIF(CPPCHECK) |
|
51 | 51 | |
|
52 | 52 | IF(CLANG_TIDY) |
|
53 | 53 | set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-style=file;-checks=*") |
|
54 | 54 | ENDIF(CLANG_TIDY) |
|
55 | 55 | |
|
56 | 56 | IF(IWYU) |
|
57 | 57 | set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "include-what-you-use") |
|
58 | 58 | ENDIF(IWYU) |
|
59 | 59 | |
|
60 | 60 | IF(Coverage) |
|
61 | 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") |
|
62 | 62 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -O0 -Wall -W -Wshadow -Wunused-variable \ |
|
63 | 63 | -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers \ |
|
64 | 64 | -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage") |
|
65 | 65 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") |
|
66 | 66 | |
|
67 | 67 | add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gcov.html |
|
68 | 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 |
|
69 | 69 | ) |
|
70 | 70 | add_custom_target(gcovr |
|
71 | 71 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gcov.html gcovr |
|
72 | 72 | ) |
|
73 | 73 | add_custom_target(show_coverage |
|
74 | 74 | COMMAND xdg-open ${CMAKE_CURRENT_BINARY_DIR}/gcov.html |
|
75 | 75 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gcov.html gcovr |
|
76 | 76 | ) |
|
77 | 77 | ENDIF(Coverage) |
|
78 | 78 | |
|
79 | 79 | enable_testing() |
|
80 | 80 | |
|
81 | 81 | add_definitions(-DSCIQLOP_VERSION="${SCIQLOP_VERSION}") |
|
82 | 82 | |
|
83 | 83 | if(BUILD_CORE) |
|
84 | 84 | find_package(SciQLOPCore CONFIG QUIET) |
|
85 | 85 | if (NOT SciQLOPCore_FOUND) |
|
86 | 86 | if(NOT IS_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/core) |
|
87 | 87 | message("Init submodule Core") |
|
88 | 88 | execute_process(COMMAND git submodule init core WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
|
89 | 89 | execute_process(COMMAND git submodule update core WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
|
90 | 90 | endif() |
|
91 | 91 | add_subdirectory(core) |
|
92 | 92 | endif() |
|
93 | 93 | endif() |
|
94 | 94 | |
|
95 | 95 | if(BUILD_GUI) |
|
96 | 96 | add_subdirectory(gui) |
|
97 | 97 | endif() |
|
98 | 98 | if(BUILD_APP) |
|
99 | 99 | add_subdirectory(app) |
|
100 | 100 | endif() |
|
101 | 101 | if(BUILD_PLUGINS) |
|
102 | 102 | add_subdirectory(plugins) |
|
103 | 103 | endif() |
|
104 | 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 <Catalogue2/browser.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 | 47 | |
|
48 | 48 | Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow") |
|
49 | 49 | |
|
50 | 50 | namespace |
|
51 | 51 | { |
|
52 | 52 | const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0; |
|
53 | 53 | const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1; |
|
54 | 54 | const auto VIEWPLITTERINDEX = 2; |
|
55 | 55 | const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3; |
|
56 | 56 | const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4; |
|
57 | 57 | } |
|
58 | 58 | |
|
59 | 59 | class MainWindow::MainWindowPrivate |
|
60 | 60 | { |
|
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 CataloguesBrowser { 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 | CataloguesBrowser* 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 | 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 |
|
|
|
276 |
|
|
|
275 | mainToolBar->addAction(QIcon(":/icones/catalogue.png"), "Catalogues", | |
|
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,1 +1,1 | |||
|
1 | Subproject commit 854c0145877d96f95e0fb6ba08e32cb15cd49cf9 | |
|
1 | Subproject commit 39bf3ff40b41fc01170241f3e471c708c866118b |
@@ -1,27 +1,30 | |||
|
1 | 1 | #ifndef BROWSER_H |
|
2 | 2 | #define BROWSER_H |
|
3 | 3 | |
|
4 | #include <QWidget> | |
|
5 | 4 | #include <Catalogue/CatalogueController.h> |
|
5 | #include <QWidget> | |
|
6 | 6 | |
|
7 |
namespace Ui |
|
|
7 | namespace Ui | |
|
8 | { | |
|
8 | 9 | class Browser; |
|
9 | 10 | } |
|
10 | 11 | |
|
11 | class Browser : public QWidget | |
|
12 | class CataloguesBrowser : public QWidget | |
|
12 | 13 | { |
|
13 | 14 | Q_OBJECT |
|
14 | 15 | |
|
15 | 16 | public: |
|
16 |
explicit Browser(QWidget |
|
|
17 | ~Browser(); | |
|
17 | explicit CataloguesBrowser(QWidget* parent = nullptr); | |
|
18 | ~CataloguesBrowser(); | |
|
18 | 19 | private slots: |
|
19 | 20 | void repositorySelected(const QString& repo); |
|
20 | 21 | void catalogueSelected(const CatalogueController::Catalogue_ptr& catalogue); |
|
21 | 22 | void eventSelected(const CatalogueController::Event_ptr& event); |
|
22 | void productSelected(const CatalogueController::Product_t& product, const CatalogueController::Event_ptr& event); | |
|
23 | void productSelected( | |
|
24 | const CatalogueController::Product_t& product, const CatalogueController::Event_ptr& event); | |
|
25 | ||
|
23 | 26 | private: |
|
24 |
Ui::Browser |
|
|
27 | Ui::Browser* ui; | |
|
25 | 28 | }; |
|
26 | 29 | |
|
27 | 30 | #endif // BROWSER_H |
@@ -1,50 +1,53 | |||
|
1 | 1 | #include "Catalogue2/browser.h" |
|
2 | 2 | #include "ui_browser.h" |
|
3 | 3 | #include <SqpApplication.h> |
|
4 | 4 | |
|
5 | Browser::Browser(QWidget* parent) : QWidget(parent), ui(new Ui::Browser) | |
|
5 | CataloguesBrowser::CataloguesBrowser(QWidget* parent) | |
|
6 | : QWidget(parent, Qt::Window), ui(new Ui::Browser) | |
|
6 | 7 | { |
|
7 | 8 | ui->setupUi(this); |
|
8 | 9 | connect(ui->repositories, &RepositoriesTreeView::repositorySelected, this, |
|
9 | &Browser::repositorySelected); | |
|
10 | &CataloguesBrowser::repositorySelected); | |
|
10 | 11 | connect(ui->repositories, &RepositoriesTreeView::catalogueSelected, this, |
|
11 | &Browser::catalogueSelected); | |
|
12 | connect(ui->events, &EventsTreeView::eventSelected, this, &Browser::eventSelected); | |
|
13 | connect(ui->events, &EventsTreeView::productSelected, this, &Browser::productSelected); | |
|
12 | &CataloguesBrowser::catalogueSelected); | |
|
13 | connect(ui->events, &EventsTreeView::eventSelected, this, &CataloguesBrowser::eventSelected); | |
|
14 | connect( | |
|
15 | ui->events, &EventsTreeView::productSelected, this, &CataloguesBrowser::productSelected); | |
|
14 | 16 | } |
|
15 | 17 | |
|
16 | Browser::~Browser() | |
|
18 | CataloguesBrowser::~CataloguesBrowser() | |
|
17 | 19 | { |
|
18 | 20 | delete ui; |
|
19 | 21 | } |
|
20 | 22 | |
|
21 | void Browser::repositorySelected(const QString& repo) | |
|
23 | void CataloguesBrowser::repositorySelected(const QString& repo) | |
|
22 | 24 | { |
|
23 | 25 | this->ui->Infos->setCurrentIndex(0); |
|
24 | 26 | this->ui->events->setEvents(sqpApp->catalogueController().events(repo)); |
|
25 | 27 | // TODO add a statistic API |
|
26 | 28 | this->ui->catalogues_count->setText( |
|
27 | 29 | QString::number(sqpApp->catalogueController().catalogues(repo).size())); |
|
28 | 30 | this->ui->rep_events_count->setText( |
|
29 | 31 | QString::number(sqpApp->catalogueController().events(repo).size())); |
|
30 | 32 | } |
|
31 | 33 | |
|
32 | void Browser::catalogueSelected(const CatalogueController::Catalogue_ptr& catalogue) | |
|
34 | void CataloguesBrowser::catalogueSelected(const CatalogueController::Catalogue_ptr& catalogue) | |
|
33 | 35 | { |
|
34 | 36 | this->ui->Infos->setCurrentIndex(1); |
|
35 | 37 | this->ui->events->setEvents(sqpApp->catalogueController().events(catalogue)); |
|
36 | 38 | this->ui->cat_events_count->setText( |
|
37 | 39 | QString::number(sqpApp->catalogueController().events(catalogue).size())); |
|
38 | 40 | } |
|
39 | 41 | |
|
40 | void Browser::eventSelected(const CatalogueController::Event_ptr& event) | |
|
42 | void CataloguesBrowser::eventSelected(const CatalogueController::Event_ptr& event) | |
|
41 | 43 | { |
|
42 | 44 | this->ui->Infos->setCurrentIndex(2); |
|
43 | 45 | this->ui->Event->setEvent(event); |
|
44 | 46 | } |
|
45 | 47 | |
|
46 | void Browser::productSelected(const CatalogueController::Product_t& product, const CatalogueController::Event_ptr& event) | |
|
48 | void CataloguesBrowser::productSelected( | |
|
49 | const CatalogueController::Product_t& product, const CatalogueController::Event_ptr& event) | |
|
47 | 50 | { |
|
48 | 51 | this->ui->Infos->setCurrentIndex(2); |
|
49 | this->ui->Event->setProduct(product,event); | |
|
52 | this->ui->Event->setProduct(product, event); | |
|
50 | 53 | } |
@@ -1,70 +1,70 | |||
|
1 | 1 | #include <QMainWindow> |
|
2 | 2 | #include <QObject> |
|
3 | 3 | #include <QScreen> |
|
4 | 4 | #include <QString> |
|
5 | 5 | #include <QWheelEvent> |
|
6 | 6 | #include <QtTest> |
|
7 | 7 | |
|
8 | 8 | |
|
9 | 9 | #include <Common/cpp_utils.h> |
|
10 | 10 | #include <SqpApplication.h> |
|
11 | 11 | |
|
12 | 12 | #include <GUITestUtils.h> |
|
13 | 13 | #include <TestProviders.h> |
|
14 | 14 | |
|
15 | 15 | #include <Catalogue/CatalogueController.h> |
|
16 | 16 | #include <Catalogue2/browser.h> |
|
17 | 17 | |
|
18 | 18 | |
|
19 | 19 | class A_CatalogueBrowser : public QObject |
|
20 | 20 | { |
|
21 | 21 | Q_OBJECT |
|
22 | 22 | public: |
|
23 | 23 | explicit A_CatalogueBrowser(QObject* parent = Q_NULLPTR) : QObject(parent) {} |
|
24 | 24 | |
|
25 | 25 | private slots: |
|
26 | 26 | }; |
|
27 | 27 | |
|
28 | 28 | // QT_BEGIN_NAMESPACE |
|
29 | 29 | // QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS |
|
30 | 30 | // QT_END_NAMESPACE |
|
31 | 31 | // int main(int argc, char* argv[]) |
|
32 | 32 | //{ |
|
33 | 33 | // SqpApplication app { argc, argv }; |
|
34 | 34 | // app.setAttribute(Qt::AA_Use96Dpi, true); |
|
35 | 35 | // QTEST_DISABLE_KEYPAD_NAVIGATION; |
|
36 | 36 | // QTEST_ADD_GPU_BLACKLIST_SUPPORT; |
|
37 | 37 | // An_EventList tc; |
|
38 | 38 | // QTEST_SET_MAIN_SOURCE_PATH; |
|
39 | 39 | // return QTest::qExec(&tc, argc, argv); |
|
40 | 40 | //} |
|
41 | 41 | |
|
42 | 42 | #include "main.moc" |
|
43 | 43 | |
|
44 | 44 | |
|
45 | 45 | int main(int argc, char* argv[]) |
|
46 | 46 | { |
|
47 | 47 | Q_INIT_RESOURCE(sqpguiresources); |
|
48 | 48 | QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); |
|
49 | 49 | |
|
50 | 50 | SqpApplication a { argc, argv }; |
|
51 | Browser w; | |
|
51 | CataloguesBrowser w; | |
|
52 | 52 | sqpApp->catalogueController().add("test"); |
|
53 | 53 | sqpApp->catalogueController().add("stuff"); |
|
54 | 54 | sqpApp->catalogueController().add("default"); |
|
55 | 55 | sqpApp->catalogueController().add("new catalogue", "default"); |
|
56 | 56 | auto catalogue = sqpApp->catalogueController().add("new catalogue2", "default"); |
|
57 | 57 | for (auto _ : std::array<char, 1000>()) |
|
58 | 58 | { |
|
59 | 59 | static int i = 0; |
|
60 | 60 | auto event = CatalogueController::make_event_ptr(); |
|
61 | 61 | event->name = std::string("Event ") + std::to_string(i++); |
|
62 | 62 | event->tags = {"tag1", "tag2"}; |
|
63 | 63 | event->products = { CatalogueController::Event_t::Product_t { "Product1", 10., 11. }, |
|
64 | 64 | CatalogueController::Event_t::Product_t { "Product2", 11., 12. }, |
|
65 | 65 | CatalogueController::Event_t::Product_t { "Product3", 10.2, 11. } }; |
|
66 | 66 | catalogue->add(event); |
|
67 | 67 | } |
|
68 | 68 | w.show(); |
|
69 | 69 | return a.exec(); |
|
70 | 70 | } |
@@ -1,52 +1,52 | |||
|
1 | 1 | project('SciQLOP', 'cpp',default_options : ['cpp_std=c++17'], meson_version:'>=0.47.0') |
|
2 |
add_global_arguments('-DSCIQLOP_VERSION="1. |
|
|
2 | add_global_arguments('-DSCIQLOP_VERSION="1.1.0"', language : 'cpp') | |
|
3 | 3 | |
|
4 | 4 | qt5 = import('qt5') |
|
5 | 5 | qt5core = dependency('qt5', modules : 'Core') |
|
6 | 6 | qt5widgets = dependency('qt5', modules : 'Widgets') |
|
7 | 7 | qt5gui = dependency('qt5', modules : 'Gui') |
|
8 | 8 | qt5svg = dependency('qt5', modules : 'Svg') |
|
9 | 9 | qt5xml = dependency('qt5', modules : 'Xml') |
|
10 | 10 | qt5network = dependency('qt5', modules : 'Network') |
|
11 | 11 | qt5printsupport = dependency('qt5', modules : 'PrintSupport') |
|
12 | 12 | qt5Concurrent = dependency('qt5', modules : 'Concurrent') |
|
13 | 13 | qt5test = dependency('qt5', modules : 'Test') |
|
14 | 14 | |
|
15 | 15 | moc = find_program('moc-qt5','moc') |
|
16 | 16 | rcc = find_program('rcc-qt5','rcc') |
|
17 | 17 | |
|
18 | 18 | if build_machine.system()=='darwin' |
|
19 | 19 | add_global_link_arguments('-headerpad_max_install_names', language : 'cpp') |
|
20 | 20 | install_data('build_cfg/mac/sciqlopLOGO.icns', install_dir : 'Contents/Resources') |
|
21 | 21 | install_data('build_cfg/mac/Info.plist', install_dir : 'Contents') |
|
22 | 22 | meson.add_install_script('build_cfg/mac/install_script.sh') |
|
23 | 23 | elif host_machine.system()=='windows' |
|
24 | 24 | meson.add_install_script('build_cfg/windows/install_script.sh') |
|
25 | 25 | elif host_machine.system()=='linux' |
|
26 | 26 | install_data('app/resources/sciqlopLOGO.svg', install_dir : 'share/icons/hicolor/scalable/') |
|
27 | 27 | install_data('app/resources/SciQLOP.desktop', install_dir : 'share/applications') |
|
28 | 28 | install_data('app/resources/SciQLOP.appdata.xml', install_dir : 'share/metainfo') |
|
29 | 29 | endif |
|
30 | 30 | |
|
31 | 31 | # Sets AMDA server that will be used during execution. |
|
32 | 32 | # Available values are: |
|
33 | 33 | # - "default": default AMDA server |
|
34 | 34 | # - "amdatest": AMDA test server |
|
35 | 35 | # - "hybrid": use both the default server and the test server (the server used is relative to each product, according to its "server" property in the JSON file) |
|
36 | 36 | # - "localhost": use local AMDA server |
|
37 | 37 | # Any other value will lead to the use of the default server |
|
38 | 38 | add_project_arguments('-DSCIQLOP_AMDA_SERVER="hybrid"', language : 'cpp') |
|
39 | 39 | |
|
40 | 40 | subdir('core') |
|
41 | 41 | subdir('gui') |
|
42 | 42 | subdir('plugins') |
|
43 | 43 | subdir('app') |
|
44 | 44 | |
|
45 | 45 | cppcheck = find_program('cppcheck', required : false) |
|
46 | 46 | |
|
47 | 47 | if cppcheck.found() |
|
48 | 48 | run_target('cppcheck', |
|
49 | 49 | command : [cppcheck, '--enable=all', |
|
50 | 50 | '--project=' + join_paths(meson.build_root(), 'compile_commands.json')] |
|
51 | 51 | ) |
|
52 | 52 | endif |
General Comments 0
You need to be logged in to leave comments.
Login now