##// END OF EJS Templates
Set revision to 1.1.0 some work to bring back catalogs...
jeandet -
r1460:ffe37c282008
parent child
Show More
@@ -1,104 +1,104
1 cmake_minimum_required(VERSION 3.6)
1 cmake_minimum_required(VERSION 3.6)
2 set(SCIQLOP_VERSION 1.0.0)
2 set(SCIQLOP_VERSION 1.1.0)
3 project(SciQLOP
3 project(SciQLOP
4 VERSION ${SCIQLOP_VERSION}
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."
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
6 HOMEPAGE_URL https://github.com/LaboratoryOfPlasmaPhysics/SciQLOP
7 LANGUAGES CXX)
7 LANGUAGES CXX)
8
8
9 include(GNUInstallDirs)
9 include(GNUInstallDirs)
10
10
11 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake")
11 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake")
12
12
13 OPTION (CPPCHECK "Analyzes the source code with cppcheck" OFF)
13 OPTION (CPPCHECK "Analyzes the source code with cppcheck" OFF)
14 OPTION (CLANG_TIDY "Analyzes the source code with Clang Tidy" OFF)
14 OPTION (CLANG_TIDY "Analyzes the source code with Clang Tidy" OFF)
15 OPTION (IWYU "Analyzes the source code with Include What You Use" OFF)
15 OPTION (IWYU "Analyzes the source code with Include What You Use" OFF)
16 OPTION (Coverage "Enables code coverage" OFF)
16 OPTION (Coverage "Enables code coverage" OFF)
17 OPTION (BUILD_APP "Build SciQLop application" ON)
17 OPTION (BUILD_APP "Build SciQLop application" ON)
18 OPTION (BUILD_CORE "Build SciQLop Core module" ON)
18 OPTION (BUILD_CORE "Build SciQLop Core module" ON)
19 OPTION (BUILD_GUI "Build SciQLop GUI module" ON)
19 OPTION (BUILD_GUI "Build SciQLop GUI module" ON)
20 OPTION (BUILD_PLUGINS "Build SciQLop plugins" ON)
20 OPTION (BUILD_PLUGINS "Build SciQLop plugins" ON)
21 OPTION (ENABLE_WIN32_CONSOLE "Enables console on Win32 platfrom" OFF)
21 OPTION (ENABLE_WIN32_CONSOLE "Enables console on Win32 platfrom" OFF)
22
22
23 set(CMAKE_CXX_STANDARD 17)
23 set(CMAKE_CXX_STANDARD 17)
24
24
25 set(CMAKE_AUTOMOC ON)
25 set(CMAKE_AUTOMOC ON)
26 #https://gitlab.kitware.com/cmake/cmake/issues/15227
26 #https://gitlab.kitware.com/cmake/cmake/issues/15227
27 #set(CMAKE_AUTOUIC ON)
27 #set(CMAKE_AUTOUIC ON)
28 if(POLICY CMP0071)
28 if(POLICY CMP0071)
29 cmake_policy(SET CMP0071 OLD)
29 cmake_policy(SET CMP0071 OLD)
30 endif()
30 endif()
31 set(CMAKE_AUTORCC ON)
31 set(CMAKE_AUTORCC ON)
32 set(CMAKE_INCLUDE_CURRENT_DIR ON)
32 set(CMAKE_INCLUDE_CURRENT_DIR ON)
33
33
34 if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH)
34 if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH)
35 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
35 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
36 endif()
36 endif()
37 if(NOT DEFINED CMAKE_MACOSX_RPATH)
37 if(NOT DEFINED CMAKE_MACOSX_RPATH)
38 set(CMAKE_MACOSX_RPATH TRUE)
38 set(CMAKE_MACOSX_RPATH TRUE)
39 endif()
39 endif()
40
40
41 if(NOT CMAKE_BUILD_TYPE)
41 if(NOT CMAKE_BUILD_TYPE)
42 set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
42 set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
43 endif()
43 endif()
44 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g3")
44 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g3")
45
45
46 find_package(Qt5 COMPONENTS Core Widgets Network PrintSupport Svg Test REQUIRED)
46 find_package(Qt5 COMPONENTS Core Widgets Network PrintSupport Svg Test REQUIRED)
47
47
48 IF(CPPCHECK)
48 IF(CPPCHECK)
49 set(CMAKE_CXX_CPPCHECK "cppcheck;--enable=warning,style")
49 set(CMAKE_CXX_CPPCHECK "cppcheck;--enable=warning,style")
50 ENDIF(CPPCHECK)
50 ENDIF(CPPCHECK)
51
51
52 IF(CLANG_TIDY)
52 IF(CLANG_TIDY)
53 set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-style=file;-checks=*")
53 set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-style=file;-checks=*")
54 ENDIF(CLANG_TIDY)
54 ENDIF(CLANG_TIDY)
55
55
56 IF(IWYU)
56 IF(IWYU)
57 set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "include-what-you-use")
57 set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "include-what-you-use")
58 ENDIF(IWYU)
58 ENDIF(IWYU)
59
59
60 IF(Coverage)
60 IF(Coverage)
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")
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 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -O0 -Wall -W -Wshadow -Wunused-variable \
62 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -O0 -Wall -W -Wshadow -Wunused-variable \
63 -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers \
63 -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers \
64 -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage")
64 -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage")
65 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
65 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
66
66
67 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gcov.html
67 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gcov.html
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
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 add_custom_target(gcovr
70 add_custom_target(gcovr
71 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gcov.html gcovr
71 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gcov.html gcovr
72 )
72 )
73 add_custom_target(show_coverage
73 add_custom_target(show_coverage
74 COMMAND xdg-open ${CMAKE_CURRENT_BINARY_DIR}/gcov.html
74 COMMAND xdg-open ${CMAKE_CURRENT_BINARY_DIR}/gcov.html
75 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gcov.html gcovr
75 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gcov.html gcovr
76 )
76 )
77 ENDIF(Coverage)
77 ENDIF(Coverage)
78
78
79 enable_testing()
79 enable_testing()
80
80
81 add_definitions(-DSCIQLOP_VERSION="${SCIQLOP_VERSION}")
81 add_definitions(-DSCIQLOP_VERSION="${SCIQLOP_VERSION}")
82
82
83 if(BUILD_CORE)
83 if(BUILD_CORE)
84 find_package(SciQLOPCore CONFIG QUIET)
84 find_package(SciQLOPCore CONFIG QUIET)
85 if (NOT SciQLOPCore_FOUND)
85 if (NOT SciQLOPCore_FOUND)
86 if(NOT IS_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/core)
86 if(NOT IS_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/core)
87 message("Init submodule Core")
87 message("Init submodule Core")
88 execute_process(COMMAND git submodule init core WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
88 execute_process(COMMAND git submodule init core WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
89 execute_process(COMMAND git submodule update core WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
89 execute_process(COMMAND git submodule update core WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
90 endif()
90 endif()
91 add_subdirectory(core)
91 add_subdirectory(core)
92 endif()
92 endif()
93 endif()
93 endif()
94
94
95 if(BUILD_GUI)
95 if(BUILD_GUI)
96 add_subdirectory(gui)
96 add_subdirectory(gui)
97 endif()
97 endif()
98 if(BUILD_APP)
98 if(BUILD_APP)
99 add_subdirectory(app)
99 add_subdirectory(app)
100 endif()
100 endif()
101 if(BUILD_PLUGINS)
101 if(BUILD_PLUGINS)
102 add_subdirectory(plugins)
102 add_subdirectory(plugins)
103 endif()
103 endif()
104 #add_subdirectory(docs)
104 #add_subdirectory(docs)
@@ -1,395 +1,395
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/CatalogueController.h>
25 #include <Catalogue/CatalogueController.h>
26 //#include <Catalogue/CatalogueExplorer.h>
26 #include <Catalogue2/browser.h>
27 #include <DataSource/DataSourceController.h>
27 #include <DataSource/DataSourceController.h>
28 #include <DataSource/DataSourceWidget.h>
28 #include <DataSource/DataSourceWidget.h>
29 #include <Settings/SqpSettingsDialog.h>
29 #include <Settings/SqpSettingsDialog.h>
30 #include <Settings/SqpSettingsGeneralWidget.h>
30 #include <Settings/SqpSettingsGeneralWidget.h>
31 #include <SidePane/SqpSidePane.h>
31 #include <SidePane/SqpSidePane.h>
32 #include <SqpApplication.h>
32 #include <SqpApplication.h>
33 #include <Time/TimeController.h>
33 #include <Time/TimeController.h>
34 #include <TimeWidget/TimeWidget.h>
34 #include <TimeWidget/TimeWidget.h>
35 #include <Visualization/VisualizationController.h>
35 #include <Visualization/VisualizationController.h>
36
36
37 #include <QAction>
37 #include <QAction>
38 #include <QCloseEvent>
38 #include <QCloseEvent>
39 #include <QDate>
39 #include <QDate>
40 #include <QDir>
40 #include <QDir>
41 #include <QFileDialog>
41 #include <QFileDialog>
42 #include <QMessageBox>
42 #include <QMessageBox>
43 #include <QToolBar>
43 #include <QToolBar>
44 #include <QToolButton>
44 #include <QToolButton>
45 #include <memory.h>
45 #include <memory.h>
46
46
47
47
48 Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow")
48 Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow")
49
49
50 namespace
50 namespace
51 {
51 {
52 const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0;
52 const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0;
53 const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1;
53 const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1;
54 const auto VIEWPLITTERINDEX = 2;
54 const auto VIEWPLITTERINDEX = 2;
55 const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3;
55 const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3;
56 const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4;
56 const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4;
57 }
57 }
58
58
59 class MainWindow::MainWindowPrivate
59 class MainWindow::MainWindowPrivate
60 {
60 {
61 public:
61 public:
62 explicit MainWindowPrivate(MainWindow* mainWindow)
62 explicit MainWindowPrivate(MainWindow* mainWindow)
63 : m_LastOpenLeftInspectorSize {}
63 : m_LastOpenLeftInspectorSize {}
64 , m_LastOpenRightInspectorSize {}
64 , m_LastOpenRightInspectorSize {}
65 , m_GeneralSettingsWidget { new SqpSettingsGeneralWidget { mainWindow } }
65 , m_GeneralSettingsWidget { new SqpSettingsGeneralWidget { mainWindow } }
66 , m_SettingsDialog { new SqpSettingsDialog { mainWindow } }
66 , m_SettingsDialog { new SqpSettingsDialog { mainWindow } }
67 //, m_CatalogExplorer { new CatalogueExplorer { mainWindow } }
67 , m_CatalogExplorer { new CataloguesBrowser { mainWindow } }
68 {
68 {
69 }
69 }
70
70
71 QSize m_LastOpenLeftInspectorSize;
71 QSize m_LastOpenLeftInspectorSize;
72 QSize m_LastOpenRightInspectorSize;
72 QSize m_LastOpenRightInspectorSize;
73 /// General settings widget. MainWindow has the ownership
73 /// General settings widget. MainWindow has the ownership
74 SqpSettingsGeneralWidget* m_GeneralSettingsWidget;
74 SqpSettingsGeneralWidget* m_GeneralSettingsWidget;
75 /// Settings dialog. MainWindow has the ownership
75 /// Settings dialog. MainWindow has the ownership
76 SqpSettingsDialog* m_SettingsDialog;
76 SqpSettingsDialog* m_SettingsDialog;
77 /// Catalogue dialog. MainWindow has the ownership
77 /// Catalogue dialog. MainWindow has the ownership
78 // CatalogueExplorer* m_CatalogExplorer;
78 CataloguesBrowser* m_CatalogExplorer;
79
79
80 bool checkDataToSave(QWidget* parentWidget);
80 bool checkDataToSave(QWidget* parentWidget);
81 };
81 };
82
82
83 MainWindow::MainWindow(QWidget* parent)
83 MainWindow::MainWindow(QWidget* parent)
84 : QMainWindow { parent }
84 : QMainWindow { parent }
85 , m_Ui { new Ui::MainWindow }
85 , m_Ui { new Ui::MainWindow }
86 , impl { spimpl::make_unique_impl<MainWindowPrivate>(this) }
86 , impl { spimpl::make_unique_impl<MainWindowPrivate>(this) }
87 {
87 {
88 m_Ui->setupUi(this);
88 m_Ui->setupUi(this);
89 setWindowTitle(QString("SciQLop v%1").arg(SCIQLOP_VERSION));
89 setWindowTitle(QString("SciQLop v%1").arg(SCIQLOP_VERSION));
90
90
91 m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false);
91 m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false);
92 m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false);
92 m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false);
93
93
94 // impl->m_CatalogExplorer->setVisualizationWidget(m_Ui->view);
94 // impl->m_CatalogExplorer->setVisualizationWidget(m_Ui->view);
95
95
96
96
97 auto spacerLeftTop = new QWidget {};
97 auto spacerLeftTop = new QWidget {};
98 spacerLeftTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
98 spacerLeftTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
99
99
100 auto spacerLeftBottom = new QWidget {};
100 auto spacerLeftBottom = new QWidget {};
101 spacerLeftBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
101 spacerLeftBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
102
102
103
103
104 auto spacerRightTop = new QWidget {};
104 auto spacerRightTop = new QWidget {};
105 spacerRightTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
105 spacerRightTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
106
106
107 auto spacerRightBottom = new QWidget {};
107 auto spacerRightBottom = new QWidget {};
108 spacerRightBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
108 spacerRightBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
109
109
110
110
111 auto openInspector = [this](bool checked, bool right, auto action) {
111 auto openInspector = [this](bool checked, bool right, auto action) {
112 action->setIcon(
112 action->setIcon(
113 QIcon { (checked ^ right) ? ":/icones/next.png" : ":/icones/previous.png" });
113 QIcon { (checked ^ right) ? ":/icones/next.png" : ":/icones/previous.png" });
114
114
115 auto& lastInspectorSize
115 auto& lastInspectorSize
116 = right ? impl->m_LastOpenRightInspectorSize : impl->m_LastOpenLeftInspectorSize;
116 = right ? impl->m_LastOpenRightInspectorSize : impl->m_LastOpenLeftInspectorSize;
117
117
118 auto nextInspectorSize = right ? m_Ui->rightMainInspectorWidget->size()
118 auto nextInspectorSize = right ? m_Ui->rightMainInspectorWidget->size()
119 : m_Ui->leftMainInspectorWidget->size();
119 : m_Ui->leftMainInspectorWidget->size();
120
120
121 // Update of the last opened geometry
121 // Update of the last opened geometry
122 if (checked)
122 if (checked)
123 {
123 {
124 lastInspectorSize = nextInspectorSize;
124 lastInspectorSize = nextInspectorSize;
125 }
125 }
126
126
127 auto startSize = lastInspectorSize;
127 auto startSize = lastInspectorSize;
128 auto endSize = startSize;
128 auto endSize = startSize;
129 endSize.setWidth(0);
129 endSize.setWidth(0);
130
130
131 auto splitterInspectorIndex
131 auto splitterInspectorIndex
132 = right ? RIGHTMAININSPECTORWIDGETSPLITTERINDEX : LEFTMAININSPECTORWIDGETSPLITTERINDEX;
132 = right ? RIGHTMAININSPECTORWIDGETSPLITTERINDEX : LEFTMAININSPECTORWIDGETSPLITTERINDEX;
133
133
134 auto currentSizes = m_Ui->splitter->sizes();
134 auto currentSizes = m_Ui->splitter->sizes();
135 if (checked)
135 if (checked)
136 {
136 {
137 // adjust sizes individually here, e.g.
137 // adjust sizes individually here, e.g.
138 currentSizes[splitterInspectorIndex] -= lastInspectorSize.width();
138 currentSizes[splitterInspectorIndex] -= lastInspectorSize.width();
139 currentSizes[VIEWPLITTERINDEX] += lastInspectorSize.width();
139 currentSizes[VIEWPLITTERINDEX] += lastInspectorSize.width();
140 m_Ui->splitter->setSizes(currentSizes);
140 m_Ui->splitter->setSizes(currentSizes);
141 }
141 }
142 else
142 else
143 {
143 {
144 // adjust sizes individually here, e.g.
144 // adjust sizes individually here, e.g.
145 currentSizes[splitterInspectorIndex] += lastInspectorSize.width();
145 currentSizes[splitterInspectorIndex] += lastInspectorSize.width();
146 currentSizes[VIEWPLITTERINDEX] -= lastInspectorSize.width();
146 currentSizes[VIEWPLITTERINDEX] -= lastInspectorSize.width();
147 m_Ui->splitter->setSizes(currentSizes);
147 m_Ui->splitter->setSizes(currentSizes);
148 }
148 }
149 };
149 };
150
150
151
151
152 // //////////////// //
152 // //////////////// //
153 // Menu and Toolbar //
153 // Menu and Toolbar //
154 // //////////////// //
154 // //////////////// //
155 this->menuBar()->addAction(tr("File"));
155 this->menuBar()->addAction(tr("File"));
156 auto toolsMenu = this->menuBar()->addMenu(tr("Tools"));
156 auto toolsMenu = this->menuBar()->addMenu(tr("Tools"));
157 toolsMenu->addAction(tr("Settings..."), [this]() {
157 toolsMenu->addAction(tr("Settings..."), [this]() {
158 // Loads settings
158 // Loads settings
159 impl->m_SettingsDialog->loadSettings();
159 impl->m_SettingsDialog->loadSettings();
160
160
161 // Open settings dialog and save settings if the dialog is accepted
161 // Open settings dialog and save settings if the dialog is accepted
162 if (impl->m_SettingsDialog->exec() == QDialog::Accepted)
162 if (impl->m_SettingsDialog->exec() == QDialog::Accepted)
163 {
163 {
164 impl->m_SettingsDialog->saveSettings();
164 impl->m_SettingsDialog->saveSettings();
165 }
165 }
166 });
166 });
167
167
168 auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar"));
168 auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar"));
169
169
170 auto timeWidget = new TimeWidget {};
170 auto timeWidget = new TimeWidget {};
171 mainToolBar->addWidget(timeWidget);
171 mainToolBar->addWidget(timeWidget);
172
172
173 // Interaction modes
173 // Interaction modes
174 auto actionPointerMode = new QAction { QIcon(":/icones/pointer.png"), "Move", this };
174 auto actionPointerMode = new QAction { QIcon(":/icones/pointer.png"), "Move", this };
175 actionPointerMode->setCheckable(true);
175 actionPointerMode->setCheckable(true);
176 actionPointerMode->setChecked(
176 actionPointerMode->setChecked(
177 sqpApp->plotsInteractionMode() == SqpApplication::PlotsInteractionMode::None);
177 sqpApp->plotsInteractionMode() == SqpApplication::PlotsInteractionMode::None);
178 connect(actionPointerMode, &QAction::triggered,
178 connect(actionPointerMode, &QAction::triggered,
179 []() { sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::None); });
179 []() { sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::None); });
180
180
181 auto actionZoomMode = new QAction { QIcon(":/icones/zoom.png"), "Zoom", this };
181 auto actionZoomMode = new QAction { QIcon(":/icones/zoom.png"), "Zoom", this };
182 actionZoomMode->setCheckable(true);
182 actionZoomMode->setCheckable(true);
183 actionZoomMode->setChecked(
183 actionZoomMode->setChecked(
184 sqpApp->plotsInteractionMode() == SqpApplication::PlotsInteractionMode::ZoomBox);
184 sqpApp->plotsInteractionMode() == SqpApplication::PlotsInteractionMode::ZoomBox);
185 connect(actionZoomMode, &QAction::triggered,
185 connect(actionZoomMode, &QAction::triggered,
186 []() { sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::ZoomBox); });
186 []() { sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::ZoomBox); });
187
187
188 auto actionOrganisationMode = new QAction { QIcon(":/icones/drag.png"), "Organize", this };
188 auto actionOrganisationMode = new QAction { QIcon(":/icones/drag.png"), "Organize", this };
189 actionOrganisationMode->setCheckable(true);
189 actionOrganisationMode->setCheckable(true);
190 actionOrganisationMode->setChecked(
190 actionOrganisationMode->setChecked(
191 sqpApp->plotsInteractionMode() == SqpApplication::PlotsInteractionMode::DragAndDrop);
191 sqpApp->plotsInteractionMode() == SqpApplication::PlotsInteractionMode::DragAndDrop);
192 connect(actionOrganisationMode, &QAction::triggered, []() {
192 connect(actionOrganisationMode, &QAction::triggered, []() {
193 sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::DragAndDrop);
193 sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::DragAndDrop);
194 });
194 });
195
195
196 auto actionZonesMode = new QAction { QIcon(":/icones/rectangle.png"), "Zones", this };
196 auto actionZonesMode = new QAction { QIcon(":/icones/rectangle.png"), "Zones", this };
197 actionZonesMode->setCheckable(true);
197 actionZonesMode->setCheckable(true);
198 actionZonesMode->setChecked(
198 actionZonesMode->setChecked(
199 sqpApp->plotsInteractionMode() == SqpApplication::PlotsInteractionMode::SelectionZones);
199 sqpApp->plotsInteractionMode() == SqpApplication::PlotsInteractionMode::SelectionZones);
200 connect(actionZonesMode, &QAction::triggered, []() {
200 connect(actionZonesMode, &QAction::triggered, []() {
201 sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::SelectionZones);
201 sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::SelectionZones);
202 });
202 });
203
203
204 auto modeActionGroup = new QActionGroup { this };
204 auto modeActionGroup = new QActionGroup { this };
205 modeActionGroup->addAction(actionZoomMode);
205 modeActionGroup->addAction(actionZoomMode);
206 modeActionGroup->addAction(actionZonesMode);
206 modeActionGroup->addAction(actionZonesMode);
207 modeActionGroup->addAction(actionOrganisationMode);
207 modeActionGroup->addAction(actionOrganisationMode);
208 modeActionGroup->addAction(actionPointerMode);
208 modeActionGroup->addAction(actionPointerMode);
209 modeActionGroup->setExclusive(true);
209 modeActionGroup->setExclusive(true);
210
210
211 mainToolBar->addSeparator();
211 mainToolBar->addSeparator();
212 mainToolBar->addAction(actionPointerMode);
212 mainToolBar->addAction(actionPointerMode);
213 mainToolBar->addAction(actionZoomMode);
213 mainToolBar->addAction(actionZoomMode);
214 mainToolBar->addAction(actionOrganisationMode);
214 mainToolBar->addAction(actionOrganisationMode);
215 mainToolBar->addAction(actionZonesMode);
215 mainToolBar->addAction(actionZonesMode);
216 mainToolBar->addSeparator();
216 mainToolBar->addSeparator();
217
217
218 // Cursors
218 // Cursors
219 auto btnCursor = new QToolButton { this };
219 auto btnCursor = new QToolButton { this };
220 btnCursor->setIcon(QIcon(":/icones/cursor.png"));
220 btnCursor->setIcon(QIcon(":/icones/cursor.png"));
221 btnCursor->setText("Cursor");
221 btnCursor->setText("Cursor");
222 btnCursor->setToolTip("Cursor");
222 btnCursor->setToolTip("Cursor");
223 btnCursor->setPopupMode(QToolButton::InstantPopup);
223 btnCursor->setPopupMode(QToolButton::InstantPopup);
224 auto cursorMenu = new QMenu("CursorMenu", this);
224 auto cursorMenu = new QMenu("CursorMenu", this);
225 btnCursor->setMenu(cursorMenu);
225 btnCursor->setMenu(cursorMenu);
226
226
227 auto noCursorAction = cursorMenu->addAction("No Cursor");
227 auto noCursorAction = cursorMenu->addAction("No Cursor");
228 noCursorAction->setCheckable(true);
228 noCursorAction->setCheckable(true);
229 noCursorAction->setChecked(
229 noCursorAction->setChecked(
230 sqpApp->plotsCursorMode() == SqpApplication::PlotsCursorMode::NoCursor);
230 sqpApp->plotsCursorMode() == SqpApplication::PlotsCursorMode::NoCursor);
231 connect(noCursorAction, &QAction::triggered,
231 connect(noCursorAction, &QAction::triggered,
232 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::NoCursor); });
232 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::NoCursor); });
233
233
234 cursorMenu->addSeparator();
234 cursorMenu->addSeparator();
235 auto verticalCursorAction = cursorMenu->addAction("Vertical Cursor");
235 auto verticalCursorAction = cursorMenu->addAction("Vertical Cursor");
236 verticalCursorAction->setCheckable(true);
236 verticalCursorAction->setCheckable(true);
237 verticalCursorAction->setChecked(
237 verticalCursorAction->setChecked(
238 sqpApp->plotsCursorMode() == SqpApplication::PlotsCursorMode::Vertical);
238 sqpApp->plotsCursorMode() == SqpApplication::PlotsCursorMode::Vertical);
239 connect(verticalCursorAction, &QAction::triggered,
239 connect(verticalCursorAction, &QAction::triggered,
240 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Vertical); });
240 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Vertical); });
241
241
242 auto temporalCursorAction = cursorMenu->addAction("Temporal Cursor");
242 auto temporalCursorAction = cursorMenu->addAction("Temporal Cursor");
243 temporalCursorAction->setCheckable(true);
243 temporalCursorAction->setCheckable(true);
244 temporalCursorAction->setChecked(
244 temporalCursorAction->setChecked(
245 sqpApp->plotsCursorMode() == SqpApplication::PlotsCursorMode::Temporal);
245 sqpApp->plotsCursorMode() == SqpApplication::PlotsCursorMode::Temporal);
246 connect(temporalCursorAction, &QAction::triggered,
246 connect(temporalCursorAction, &QAction::triggered,
247 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Temporal); });
247 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Temporal); });
248
248
249 auto horizontalCursorAction = cursorMenu->addAction("Horizontal Cursor");
249 auto horizontalCursorAction = cursorMenu->addAction("Horizontal Cursor");
250 horizontalCursorAction->setCheckable(true);
250 horizontalCursorAction->setCheckable(true);
251 horizontalCursorAction->setChecked(
251 horizontalCursorAction->setChecked(
252 sqpApp->plotsCursorMode() == SqpApplication::PlotsCursorMode::Horizontal);
252 sqpApp->plotsCursorMode() == SqpApplication::PlotsCursorMode::Horizontal);
253 connect(horizontalCursorAction, &QAction::triggered,
253 connect(horizontalCursorAction, &QAction::triggered,
254 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Horizontal); });
254 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Horizontal); });
255
255
256 auto crossCursorAction = cursorMenu->addAction("Cross Cursor");
256 auto crossCursorAction = cursorMenu->addAction("Cross Cursor");
257 crossCursorAction->setCheckable(true);
257 crossCursorAction->setCheckable(true);
258 crossCursorAction->setChecked(
258 crossCursorAction->setChecked(
259 sqpApp->plotsCursorMode() == SqpApplication::PlotsCursorMode::Cross);
259 sqpApp->plotsCursorMode() == SqpApplication::PlotsCursorMode::Cross);
260 connect(crossCursorAction, &QAction::triggered,
260 connect(crossCursorAction, &QAction::triggered,
261 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Cross); });
261 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Cross); });
262
262
263 mainToolBar->addWidget(btnCursor);
263 mainToolBar->addWidget(btnCursor);
264
264
265 auto cursorModeActionGroup = new QActionGroup { this };
265 auto cursorModeActionGroup = new QActionGroup { this };
266 cursorModeActionGroup->setExclusive(true);
266 cursorModeActionGroup->setExclusive(true);
267 cursorModeActionGroup->addAction(noCursorAction);
267 cursorModeActionGroup->addAction(noCursorAction);
268 cursorModeActionGroup->addAction(verticalCursorAction);
268 cursorModeActionGroup->addAction(verticalCursorAction);
269 cursorModeActionGroup->addAction(temporalCursorAction);
269 cursorModeActionGroup->addAction(temporalCursorAction);
270 cursorModeActionGroup->addAction(horizontalCursorAction);
270 cursorModeActionGroup->addAction(horizontalCursorAction);
271 cursorModeActionGroup->addAction(crossCursorAction);
271 cursorModeActionGroup->addAction(crossCursorAction);
272
272
273 // Catalog
273 // Catalog
274 mainToolBar->addSeparator();
274 mainToolBar->addSeparator();
275 // mainToolBar->addAction(QIcon(":/icones/catalogue.png"), "Catalogues",
275 mainToolBar->addAction(QIcon(":/icones/catalogue.png"), "Catalogues",
276 // [this]() { impl->m_CatalogExplorer->show(); });
276 [this]() { impl->m_CatalogExplorer->show(); });
277
277
278 // //////// //
278 // //////// //
279 // Settings //
279 // Settings //
280 // //////// //
280 // //////// //
281
281
282 // Registers "general settings" widget to the settings dialog
282 // Registers "general settings" widget to the settings dialog
283 impl->m_SettingsDialog->registerWidget(
283 impl->m_SettingsDialog->registerWidget(
284 QStringLiteral("General"), impl->m_GeneralSettingsWidget);
284 QStringLiteral("General"), impl->m_GeneralSettingsWidget);
285
285
286 // /////////// //
286 // /////////// //
287 // Connections //
287 // Connections //
288 // /////////// //
288 // /////////// //
289
289
290 // Controllers / controllers connections
290 // Controllers / controllers connections
291 // connect(&sqpApp->timeController(), SIGNAL(timeUpdated(DateTimeRange)),
291 // connect(&sqpApp->timeController(), SIGNAL(timeUpdated(DateTimeRange)),
292 // &sqpApp->variableController(),
292 // &sqpApp->variableController(),
293 // SLOT(onDateTimeOnSelection(DateTimeRange)));
293 // SLOT(onDateTimeOnSelection(DateTimeRange)));
294
294
295 // Widgets / controllers connections
295 // Widgets / controllers connections
296
296
297 // DataSource
297 // DataSource
298 connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem*)),
298 connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem*)),
299 m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem*)));
299 m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem*)));
300
300
301 // Time
301 // Time
302 connect(timeWidget, SIGNAL(timeUpdated(DateTimeRange)), &sqpApp->timeController(),
302 connect(timeWidget, SIGNAL(timeUpdated(DateTimeRange)), &sqpApp->timeController(),
303 SLOT(onTimeToUpdate(DateTimeRange)));
303 SLOT(onTimeToUpdate(DateTimeRange)));
304
304
305 // Visualization
305 // Visualization
306 connect(&sqpApp->visualizationController(),
306 connect(&sqpApp->visualizationController(),
307 SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable2>)), m_Ui->view,
307 SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable2>)), m_Ui->view,
308 SLOT(onVariableAboutToBeDeleted(std::shared_ptr<Variable2>)));
308 SLOT(onVariableAboutToBeDeleted(std::shared_ptr<Variable2>)));
309
309
310 connect(&sqpApp->visualizationController(),
310 connect(&sqpApp->visualizationController(),
311 SIGNAL(rangeChanged(std::shared_ptr<Variable2>, const DateTimeRange&)), m_Ui->view,
311 SIGNAL(rangeChanged(std::shared_ptr<Variable2>, const DateTimeRange&)), m_Ui->view,
312 SLOT(onRangeChanged(std::shared_ptr<Variable2>, const DateTimeRange&)));
312 SLOT(onRangeChanged(std::shared_ptr<Variable2>, const DateTimeRange&)));
313
313
314 // Widgets / widgets connections
314 // Widgets / widgets connections
315
315
316 // For the following connections, we use DirectConnection to allow each widget that can
316 // For the following connections, we use DirectConnection to allow each widget that can
317 // potentially attach a menu to the variable's menu to do so before this menu is displayed.
317 // potentially attach a menu to the variable's menu to do so before this menu is displayed.
318 // The order of connections is also important, since it determines the order in which each
318 // The order of connections is also important, since it determines the order in which each
319 // widget will attach its menu
319 // widget will attach its menu
320 connect(m_Ui->variableInspectorWidget,
320 connect(m_Ui->variableInspectorWidget,
321 SIGNAL(tableMenuAboutToBeDisplayed(QMenu*, const QVector<std::shared_ptr<Variable>>&)),
321 SIGNAL(tableMenuAboutToBeDisplayed(QMenu*, const QVector<std::shared_ptr<Variable>>&)),
322 m_Ui->view, SLOT(attachVariableMenu(QMenu*, const QVector<std::shared_ptr<Variable>>&)),
322 m_Ui->view, SLOT(attachVariableMenu(QMenu*, const QVector<std::shared_ptr<Variable>>&)),
323 Qt::DirectConnection);
323 Qt::DirectConnection);
324 }
324 }
325
325
326 MainWindow::~MainWindow() {}
326 MainWindow::~MainWindow() {}
327
327
328 void MainWindow::changeEvent(QEvent* e)
328 void MainWindow::changeEvent(QEvent* e)
329 {
329 {
330 QMainWindow::changeEvent(e);
330 QMainWindow::changeEvent(e);
331 switch (e->type())
331 switch (e->type())
332 {
332 {
333 case QEvent::LanguageChange:
333 case QEvent::LanguageChange:
334 m_Ui->retranslateUi(this);
334 m_Ui->retranslateUi(this);
335 break;
335 break;
336 default:
336 default:
337 break;
337 break;
338 }
338 }
339 }
339 }
340
340
341 void MainWindow::closeEvent(QCloseEvent* event)
341 void MainWindow::closeEvent(QCloseEvent* event)
342 {
342 {
343 if (!impl->checkDataToSave(this))
343 if (!impl->checkDataToSave(this))
344 {
344 {
345 event->ignore();
345 event->ignore();
346 }
346 }
347 else
347 else
348 {
348 {
349 event->accept();
349 event->accept();
350 }
350 }
351 }
351 }
352
352
353 void MainWindow::keyPressEvent(QKeyEvent* event)
353 void MainWindow::keyPressEvent(QKeyEvent* event)
354 {
354 {
355 switch (event->key())
355 switch (event->key())
356 {
356 {
357 case Qt::Key_F11:
357 case Qt::Key_F11:
358 if (this->isFullScreen())
358 if (this->isFullScreen())
359 {
359 {
360 this->showNormal();
360 this->showNormal();
361 }
361 }
362 else
362 else
363 {
363 {
364 this->showFullScreen();
364 this->showFullScreen();
365 }
365 }
366 break;
366 break;
367 default:
367 default:
368 break;
368 break;
369 }
369 }
370 }
370 }
371
371
372 bool MainWindow::MainWindowPrivate::checkDataToSave(QWidget* parentWidget)
372 bool MainWindow::MainWindowPrivate::checkDataToSave(QWidget* parentWidget)
373 {
373 {
374 // auto hasChanges = sqpApp->catalogueController().hasChanges();
374 // auto hasChanges = sqpApp->catalogueController().hasChanges();
375 // if (hasChanges)
375 // if (hasChanges)
376 // {
376 // {
377 // // There are some unsaved changes
377 // // There are some unsaved changes
378 // switch (QMessageBox::question(parentWidget, tr("Save changes"),
378 // switch (QMessageBox::question(parentWidget, tr("Save changes"),
379 // tr("The catalogue controller has unsaved changes.\nDo you want to save them ?"),
379 // tr("The catalogue controller has unsaved changes.\nDo you want to save them ?"),
380 // QMessageBox::SaveAll | QMessageBox::Discard | QMessageBox::Cancel,
380 // QMessageBox::SaveAll | QMessageBox::Discard | QMessageBox::Cancel,
381 // QMessageBox::SaveAll))
381 // QMessageBox::SaveAll))
382 // {
382 // {
383 // case QMessageBox::SaveAll:
383 // case QMessageBox::SaveAll:
384 // sqpApp->catalogueController().saveAll();
384 // sqpApp->catalogueController().saveAll();
385 // break;
385 // break;
386 // case QMessageBox::Discard:
386 // case QMessageBox::Discard:
387 // break;
387 // break;
388 // case QMessageBox::Cancel:
388 // case QMessageBox::Cancel:
389 // default:
389 // default:
390 // return false;
390 // return false;
391 // }
391 // }
392 // }
392 // }
393
393
394 return true;
394 return true;
395 }
395 }
@@ -1,1 +1,1
1 Subproject commit 854c0145877d96f95e0fb6ba08e32cb15cd49cf9
1 Subproject commit 39bf3ff40b41fc01170241f3e471c708c866118b
@@ -1,27 +1,30
1 #ifndef BROWSER_H
1 #ifndef BROWSER_H
2 #define BROWSER_H
2 #define BROWSER_H
3
3
4 #include <QWidget>
5 #include <Catalogue/CatalogueController.h>
4 #include <Catalogue/CatalogueController.h>
5 #include <QWidget>
6
6
7 namespace Ui {
7 namespace Ui
8 {
8 class Browser;
9 class Browser;
9 }
10 }
10
11
11 class Browser : public QWidget
12 class CataloguesBrowser : public QWidget
12 {
13 {
13 Q_OBJECT
14 Q_OBJECT
14
15
15 public:
16 public:
16 explicit Browser(QWidget *parent = nullptr);
17 explicit CataloguesBrowser(QWidget* parent = nullptr);
17 ~Browser();
18 ~CataloguesBrowser();
18 private slots:
19 private slots:
19 void repositorySelected(const QString& repo);
20 void repositorySelected(const QString& repo);
20 void catalogueSelected(const CatalogueController::Catalogue_ptr& catalogue);
21 void catalogueSelected(const CatalogueController::Catalogue_ptr& catalogue);
21 void eventSelected(const CatalogueController::Event_ptr& event);
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 private:
26 private:
24 Ui::Browser *ui;
27 Ui::Browser* ui;
25 };
28 };
26
29
27 #endif // BROWSER_H
30 #endif // BROWSER_H
@@ -1,50 +1,53
1 #include "Catalogue2/browser.h"
1 #include "Catalogue2/browser.h"
2 #include "ui_browser.h"
2 #include "ui_browser.h"
3 #include <SqpApplication.h>
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 ui->setupUi(this);
8 ui->setupUi(this);
8 connect(ui->repositories, &RepositoriesTreeView::repositorySelected, this,
9 connect(ui->repositories, &RepositoriesTreeView::repositorySelected, this,
9 &Browser::repositorySelected);
10 &CataloguesBrowser::repositorySelected);
10 connect(ui->repositories, &RepositoriesTreeView::catalogueSelected, this,
11 connect(ui->repositories, &RepositoriesTreeView::catalogueSelected, this,
11 &Browser::catalogueSelected);
12 &CataloguesBrowser::catalogueSelected);
12 connect(ui->events, &EventsTreeView::eventSelected, this, &Browser::eventSelected);
13 connect(ui->events, &EventsTreeView::eventSelected, this, &CataloguesBrowser::eventSelected);
13 connect(ui->events, &EventsTreeView::productSelected, this, &Browser::productSelected);
14 connect(
15 ui->events, &EventsTreeView::productSelected, this, &CataloguesBrowser::productSelected);
14 }
16 }
15
17
16 Browser::~Browser()
18 CataloguesBrowser::~CataloguesBrowser()
17 {
19 {
18 delete ui;
20 delete ui;
19 }
21 }
20
22
21 void Browser::repositorySelected(const QString& repo)
23 void CataloguesBrowser::repositorySelected(const QString& repo)
22 {
24 {
23 this->ui->Infos->setCurrentIndex(0);
25 this->ui->Infos->setCurrentIndex(0);
24 this->ui->events->setEvents(sqpApp->catalogueController().events(repo));
26 this->ui->events->setEvents(sqpApp->catalogueController().events(repo));
25 // TODO add a statistic API
27 // TODO add a statistic API
26 this->ui->catalogues_count->setText(
28 this->ui->catalogues_count->setText(
27 QString::number(sqpApp->catalogueController().catalogues(repo).size()));
29 QString::number(sqpApp->catalogueController().catalogues(repo).size()));
28 this->ui->rep_events_count->setText(
30 this->ui->rep_events_count->setText(
29 QString::number(sqpApp->catalogueController().events(repo).size()));
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 this->ui->Infos->setCurrentIndex(1);
36 this->ui->Infos->setCurrentIndex(1);
35 this->ui->events->setEvents(sqpApp->catalogueController().events(catalogue));
37 this->ui->events->setEvents(sqpApp->catalogueController().events(catalogue));
36 this->ui->cat_events_count->setText(
38 this->ui->cat_events_count->setText(
37 QString::number(sqpApp->catalogueController().events(catalogue).size()));
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 this->ui->Infos->setCurrentIndex(2);
44 this->ui->Infos->setCurrentIndex(2);
43 this->ui->Event->setEvent(event);
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 this->ui->Infos->setCurrentIndex(2);
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 #include <QMainWindow>
1 #include <QMainWindow>
2 #include <QObject>
2 #include <QObject>
3 #include <QScreen>
3 #include <QScreen>
4 #include <QString>
4 #include <QString>
5 #include <QWheelEvent>
5 #include <QWheelEvent>
6 #include <QtTest>
6 #include <QtTest>
7
7
8
8
9 #include <Common/cpp_utils.h>
9 #include <Common/cpp_utils.h>
10 #include <SqpApplication.h>
10 #include <SqpApplication.h>
11
11
12 #include <GUITestUtils.h>
12 #include <GUITestUtils.h>
13 #include <TestProviders.h>
13 #include <TestProviders.h>
14
14
15 #include <Catalogue/CatalogueController.h>
15 #include <Catalogue/CatalogueController.h>
16 #include <Catalogue2/browser.h>
16 #include <Catalogue2/browser.h>
17
17
18
18
19 class A_CatalogueBrowser : public QObject
19 class A_CatalogueBrowser : public QObject
20 {
20 {
21 Q_OBJECT
21 Q_OBJECT
22 public:
22 public:
23 explicit A_CatalogueBrowser(QObject* parent = Q_NULLPTR) : QObject(parent) {}
23 explicit A_CatalogueBrowser(QObject* parent = Q_NULLPTR) : QObject(parent) {}
24
24
25 private slots:
25 private slots:
26 };
26 };
27
27
28 // QT_BEGIN_NAMESPACE
28 // QT_BEGIN_NAMESPACE
29 // QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
29 // QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
30 // QT_END_NAMESPACE
30 // QT_END_NAMESPACE
31 // int main(int argc, char* argv[])
31 // int main(int argc, char* argv[])
32 //{
32 //{
33 // SqpApplication app { argc, argv };
33 // SqpApplication app { argc, argv };
34 // app.setAttribute(Qt::AA_Use96Dpi, true);
34 // app.setAttribute(Qt::AA_Use96Dpi, true);
35 // QTEST_DISABLE_KEYPAD_NAVIGATION;
35 // QTEST_DISABLE_KEYPAD_NAVIGATION;
36 // QTEST_ADD_GPU_BLACKLIST_SUPPORT;
36 // QTEST_ADD_GPU_BLACKLIST_SUPPORT;
37 // An_EventList tc;
37 // An_EventList tc;
38 // QTEST_SET_MAIN_SOURCE_PATH;
38 // QTEST_SET_MAIN_SOURCE_PATH;
39 // return QTest::qExec(&tc, argc, argv);
39 // return QTest::qExec(&tc, argc, argv);
40 //}
40 //}
41
41
42 #include "main.moc"
42 #include "main.moc"
43
43
44
44
45 int main(int argc, char* argv[])
45 int main(int argc, char* argv[])
46 {
46 {
47 Q_INIT_RESOURCE(sqpguiresources);
47 Q_INIT_RESOURCE(sqpguiresources);
48 QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
48 QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
49
49
50 SqpApplication a { argc, argv };
50 SqpApplication a { argc, argv };
51 Browser w;
51 CataloguesBrowser w;
52 sqpApp->catalogueController().add("test");
52 sqpApp->catalogueController().add("test");
53 sqpApp->catalogueController().add("stuff");
53 sqpApp->catalogueController().add("stuff");
54 sqpApp->catalogueController().add("default");
54 sqpApp->catalogueController().add("default");
55 sqpApp->catalogueController().add("new catalogue", "default");
55 sqpApp->catalogueController().add("new catalogue", "default");
56 auto catalogue = sqpApp->catalogueController().add("new catalogue2", "default");
56 auto catalogue = sqpApp->catalogueController().add("new catalogue2", "default");
57 for (auto _ : std::array<char, 1000>())
57 for (auto _ : std::array<char, 1000>())
58 {
58 {
59 static int i = 0;
59 static int i = 0;
60 auto event = CatalogueController::make_event_ptr();
60 auto event = CatalogueController::make_event_ptr();
61 event->name = std::string("Event ") + std::to_string(i++);
61 event->name = std::string("Event ") + std::to_string(i++);
62 event->tags = {"tag1", "tag2"};
62 event->tags = {"tag1", "tag2"};
63 event->products = { CatalogueController::Event_t::Product_t { "Product1", 10., 11. },
63 event->products = { CatalogueController::Event_t::Product_t { "Product1", 10., 11. },
64 CatalogueController::Event_t::Product_t { "Product2", 11., 12. },
64 CatalogueController::Event_t::Product_t { "Product2", 11., 12. },
65 CatalogueController::Event_t::Product_t { "Product3", 10.2, 11. } };
65 CatalogueController::Event_t::Product_t { "Product3", 10.2, 11. } };
66 catalogue->add(event);
66 catalogue->add(event);
67 }
67 }
68 w.show();
68 w.show();
69 return a.exec();
69 return a.exec();
70 }
70 }
@@ -1,52 +1,52
1 project('SciQLOP', 'cpp',default_options : ['cpp_std=c++17'], meson_version:'>=0.47.0')
1 project('SciQLOP', 'cpp',default_options : ['cpp_std=c++17'], meson_version:'>=0.47.0')
2 add_global_arguments('-DSCIQLOP_VERSION="1.0.0"', language : 'cpp')
2 add_global_arguments('-DSCIQLOP_VERSION="1.1.0"', language : 'cpp')
3
3
4 qt5 = import('qt5')
4 qt5 = import('qt5')
5 qt5core = dependency('qt5', modules : 'Core')
5 qt5core = dependency('qt5', modules : 'Core')
6 qt5widgets = dependency('qt5', modules : 'Widgets')
6 qt5widgets = dependency('qt5', modules : 'Widgets')
7 qt5gui = dependency('qt5', modules : 'Gui')
7 qt5gui = dependency('qt5', modules : 'Gui')
8 qt5svg = dependency('qt5', modules : 'Svg')
8 qt5svg = dependency('qt5', modules : 'Svg')
9 qt5xml = dependency('qt5', modules : 'Xml')
9 qt5xml = dependency('qt5', modules : 'Xml')
10 qt5network = dependency('qt5', modules : 'Network')
10 qt5network = dependency('qt5', modules : 'Network')
11 qt5printsupport = dependency('qt5', modules : 'PrintSupport')
11 qt5printsupport = dependency('qt5', modules : 'PrintSupport')
12 qt5Concurrent = dependency('qt5', modules : 'Concurrent')
12 qt5Concurrent = dependency('qt5', modules : 'Concurrent')
13 qt5test = dependency('qt5', modules : 'Test')
13 qt5test = dependency('qt5', modules : 'Test')
14
14
15 moc = find_program('moc-qt5','moc')
15 moc = find_program('moc-qt5','moc')
16 rcc = find_program('rcc-qt5','rcc')
16 rcc = find_program('rcc-qt5','rcc')
17
17
18 if build_machine.system()=='darwin'
18 if build_machine.system()=='darwin'
19 add_global_link_arguments('-headerpad_max_install_names', language : 'cpp')
19 add_global_link_arguments('-headerpad_max_install_names', language : 'cpp')
20 install_data('build_cfg/mac/sciqlopLOGO.icns', install_dir : 'Contents/Resources')
20 install_data('build_cfg/mac/sciqlopLOGO.icns', install_dir : 'Contents/Resources')
21 install_data('build_cfg/mac/Info.plist', install_dir : 'Contents')
21 install_data('build_cfg/mac/Info.plist', install_dir : 'Contents')
22 meson.add_install_script('build_cfg/mac/install_script.sh')
22 meson.add_install_script('build_cfg/mac/install_script.sh')
23 elif host_machine.system()=='windows'
23 elif host_machine.system()=='windows'
24 meson.add_install_script('build_cfg/windows/install_script.sh')
24 meson.add_install_script('build_cfg/windows/install_script.sh')
25 elif host_machine.system()=='linux'
25 elif host_machine.system()=='linux'
26 install_data('app/resources/sciqlopLOGO.svg', install_dir : 'share/icons/hicolor/scalable/')
26 install_data('app/resources/sciqlopLOGO.svg', install_dir : 'share/icons/hicolor/scalable/')
27 install_data('app/resources/SciQLOP.desktop', install_dir : 'share/applications')
27 install_data('app/resources/SciQLOP.desktop', install_dir : 'share/applications')
28 install_data('app/resources/SciQLOP.appdata.xml', install_dir : 'share/metainfo')
28 install_data('app/resources/SciQLOP.appdata.xml', install_dir : 'share/metainfo')
29 endif
29 endif
30
30
31 # Sets AMDA server that will be used during execution.
31 # Sets AMDA server that will be used during execution.
32 # Available values are:
32 # Available values are:
33 # - "default": default AMDA server
33 # - "default": default AMDA server
34 # - "amdatest": AMDA test server
34 # - "amdatest": AMDA test server
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)
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 # - "localhost": use local AMDA server
36 # - "localhost": use local AMDA server
37 # Any other value will lead to the use of the default server
37 # Any other value will lead to the use of the default server
38 add_project_arguments('-DSCIQLOP_AMDA_SERVER="hybrid"', language : 'cpp')
38 add_project_arguments('-DSCIQLOP_AMDA_SERVER="hybrid"', language : 'cpp')
39
39
40 subdir('core')
40 subdir('core')
41 subdir('gui')
41 subdir('gui')
42 subdir('plugins')
42 subdir('plugins')
43 subdir('app')
43 subdir('app')
44
44
45 cppcheck = find_program('cppcheck', required : false)
45 cppcheck = find_program('cppcheck', required : false)
46
46
47 if cppcheck.found()
47 if cppcheck.found()
48 run_target('cppcheck',
48 run_target('cppcheck',
49 command : [cppcheck, '--enable=all',
49 command : [cppcheck, '--enable=all',
50 '--project=' + join_paths(meson.build_root(), 'compile_commands.json')]
50 '--project=' + join_paths(meson.build_root(), 'compile_commands.json')]
51 )
51 )
52 endif
52 endif
General Comments 0
You need to be logged in to leave comments. Login now