@@ -1,97 +1,104 | |||||
1 | cmake_minimum_required(VERSION 3.6) |
|
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 | include(GNUInstallDirs) |
|
9 | include(GNUInstallDirs) | |
5 |
|
10 | |||
6 | 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") | |
7 |
|
12 | |||
8 | OPTION (CPPCHECK "Analyzes the source code with cppcheck" OFF) |
|
13 | OPTION (CPPCHECK "Analyzes the source code with cppcheck" OFF) | |
9 | OPTION (CLANG_TIDY "Analyzes the source code with Clang Tidy" OFF) |
|
14 | OPTION (CLANG_TIDY "Analyzes the source code with Clang Tidy" OFF) | |
10 | 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) | |
11 | OPTION (Coverage "Enables code coverage" OFF) |
|
16 | OPTION (Coverage "Enables code coverage" OFF) | |
12 | OPTION (BUILD_APP "Build SciQLop application" ON) |
|
17 | OPTION (BUILD_APP "Build SciQLop application" ON) | |
13 | OPTION (BUILD_CORE "Build SciQLop Core module" ON) |
|
18 | OPTION (BUILD_CORE "Build SciQLop Core module" ON) | |
14 | OPTION (BUILD_GUI "Build SciQLop GUI module" ON) |
|
19 | OPTION (BUILD_GUI "Build SciQLop GUI module" ON) | |
15 | OPTION (BUILD_PLUGINS "Build SciQLop plugins" ON) |
|
20 | OPTION (BUILD_PLUGINS "Build SciQLop plugins" ON) | |
16 | OPTION (ENABLE_WIN32_CONSOLE "Enables console on Win32 platfrom" OFF) |
|
21 | OPTION (ENABLE_WIN32_CONSOLE "Enables console on Win32 platfrom" OFF) | |
17 |
|
22 | |||
18 | set(CMAKE_CXX_STANDARD 17) |
|
23 | set(CMAKE_CXX_STANDARD 17) | |
19 |
|
24 | |||
20 | set(CMAKE_AUTOMOC ON) |
|
25 | set(CMAKE_AUTOMOC ON) | |
21 | #https://gitlab.kitware.com/cmake/cmake/issues/15227 |
|
26 | #https://gitlab.kitware.com/cmake/cmake/issues/15227 | |
22 | #set(CMAKE_AUTOUIC ON) |
|
27 | #set(CMAKE_AUTOUIC ON) | |
23 | if(POLICY CMP0071) |
|
28 | if(POLICY CMP0071) | |
24 | cmake_policy(SET CMP0071 OLD) |
|
29 | cmake_policy(SET CMP0071 OLD) | |
25 | endif() |
|
30 | endif() | |
26 | set(CMAKE_AUTORCC ON) |
|
31 | set(CMAKE_AUTORCC ON) | |
27 | set(CMAKE_INCLUDE_CURRENT_DIR ON) |
|
32 | set(CMAKE_INCLUDE_CURRENT_DIR ON) | |
28 |
|
33 | |||
29 | if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH) |
|
34 | if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH) | |
30 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) |
|
35 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | |
31 | endif() |
|
36 | endif() | |
32 | if(NOT DEFINED CMAKE_MACOSX_RPATH) |
|
37 | if(NOT DEFINED CMAKE_MACOSX_RPATH) | |
33 | set(CMAKE_MACOSX_RPATH TRUE) |
|
38 | set(CMAKE_MACOSX_RPATH TRUE) | |
34 | endif() |
|
39 | endif() | |
35 |
|
40 | |||
36 | if(NOT CMAKE_BUILD_TYPE) |
|
41 | if(NOT CMAKE_BUILD_TYPE) | |
37 | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) |
|
42 | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) | |
38 | endif() |
|
43 | endif() | |
39 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g3") |
|
44 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g3") | |
40 |
|
45 | |||
41 | find_package(Qt5 COMPONENTS Core Widgets Network PrintSupport Svg Test REQUIRED) |
|
46 | find_package(Qt5 COMPONENTS Core Widgets Network PrintSupport Svg Test REQUIRED) | |
42 |
|
47 | |||
43 | IF(CPPCHECK) |
|
48 | IF(CPPCHECK) | |
44 | set(CMAKE_CXX_CPPCHECK "cppcheck;--enable=warning,style") |
|
49 | set(CMAKE_CXX_CPPCHECK "cppcheck;--enable=warning,style") | |
45 | ENDIF(CPPCHECK) |
|
50 | ENDIF(CPPCHECK) | |
46 |
|
51 | |||
47 | IF(CLANG_TIDY) |
|
52 | IF(CLANG_TIDY) | |
48 | set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-style=file;-checks=*") |
|
53 | set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-style=file;-checks=*") | |
49 | ENDIF(CLANG_TIDY) |
|
54 | ENDIF(CLANG_TIDY) | |
50 |
|
55 | |||
51 | IF(IWYU) |
|
56 | IF(IWYU) | |
52 | set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "include-what-you-use") |
|
57 | set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "include-what-you-use") | |
53 | ENDIF(IWYU) |
|
58 | ENDIF(IWYU) | |
54 |
|
59 | |||
55 | IF(Coverage) |
|
60 | IF(Coverage) | |
56 | 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") | |
57 | 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 \ | |
58 | -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers \ |
|
63 | -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers \ | |
59 | -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage") |
|
64 | -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage") | |
60 | 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") | |
61 |
|
66 | |||
62 | add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gcov.html |
|
67 | add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gcov.html | |
63 | 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 | |
64 | ) |
|
69 | ) | |
65 | add_custom_target(gcovr |
|
70 | add_custom_target(gcovr | |
66 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gcov.html gcovr |
|
71 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gcov.html gcovr | |
67 | ) |
|
72 | ) | |
68 | add_custom_target(show_coverage |
|
73 | add_custom_target(show_coverage | |
69 | COMMAND xdg-open ${CMAKE_CURRENT_BINARY_DIR}/gcov.html |
|
74 | COMMAND xdg-open ${CMAKE_CURRENT_BINARY_DIR}/gcov.html | |
70 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gcov.html gcovr |
|
75 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gcov.html gcovr | |
71 | ) |
|
76 | ) | |
72 | ENDIF(Coverage) |
|
77 | ENDIF(Coverage) | |
73 |
|
78 | |||
74 | enable_testing() |
|
79 | enable_testing() | |
75 |
|
80 | |||
|
81 | add_definitions(-DSCIQLOP_VERSION="${SCIQLOP_VERSION}") | |||
|
82 | ||||
76 | if(BUILD_CORE) |
|
83 | if(BUILD_CORE) | |
77 | find_package(SciQLOPCore CONFIG QUIET) |
|
84 | find_package(SciQLOPCore CONFIG QUIET) | |
78 | if (NOT SciQLOPCore_FOUND) |
|
85 | if (NOT SciQLOPCore_FOUND) | |
79 | if(NOT IS_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/core) |
|
86 | if(NOT IS_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/core) | |
80 | message("Init submodule Core") |
|
87 | message("Init submodule Core") | |
81 | 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}) | |
82 | 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}) | |
83 | endif() |
|
90 | endif() | |
84 | add_subdirectory(core) |
|
91 | add_subdirectory(core) | |
85 | endif() |
|
92 | endif() | |
86 | endif() |
|
93 | endif() | |
87 |
|
94 | |||
88 | if(BUILD_GUI) |
|
95 | if(BUILD_GUI) | |
89 | add_subdirectory(gui) |
|
96 | add_subdirectory(gui) | |
90 | endif() |
|
97 | endif() | |
91 | if(BUILD_APP) |
|
98 | if(BUILD_APP) | |
92 | add_subdirectory(app) |
|
99 | add_subdirectory(app) | |
93 | endif() |
|
100 | endif() | |
94 | if(BUILD_PLUGINS) |
|
101 | if(BUILD_PLUGINS) | |
95 | add_subdirectory(plugins) |
|
102 | add_subdirectory(plugins) | |
96 | endif() |
|
103 | endif() | |
97 | #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 <Catalogue/CatalogueExplorer.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 | #include "iostream" |
|
|||
48 |
|
47 | |||
49 | Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow") |
|
48 | Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow") | |
50 |
|
49 | |||
51 | namespace |
|
50 | namespace | |
52 | { |
|
51 | { | |
53 | const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0; |
|
52 | const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0; | |
54 | const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1; |
|
53 | const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1; | |
55 | const auto VIEWPLITTERINDEX = 2; |
|
54 | const auto VIEWPLITTERINDEX = 2; | |
56 | const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3; |
|
55 | const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3; | |
57 | const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4; |
|
56 | const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4; | |
58 | } |
|
57 | } | |
59 |
|
58 | |||
60 | class MainWindow::MainWindowPrivate |
|
59 | class MainWindow::MainWindowPrivate | |
61 | { |
|
60 | { | |
62 | public: |
|
61 | public: | |
63 | explicit MainWindowPrivate(MainWindow* mainWindow) |
|
62 | explicit MainWindowPrivate(MainWindow* mainWindow) | |
64 | : m_LastOpenLeftInspectorSize {} |
|
63 | : m_LastOpenLeftInspectorSize {} | |
65 | , m_LastOpenRightInspectorSize {} |
|
64 | , m_LastOpenRightInspectorSize {} | |
66 | , m_GeneralSettingsWidget { new SqpSettingsGeneralWidget { mainWindow } } |
|
65 | , m_GeneralSettingsWidget { new SqpSettingsGeneralWidget { mainWindow } } | |
67 | , m_SettingsDialog { new SqpSettingsDialog { mainWindow } } |
|
66 | , m_SettingsDialog { new SqpSettingsDialog { mainWindow } } | |
68 | //, m_CatalogExplorer { new CatalogueExplorer { mainWindow } } |
|
67 | //, m_CatalogExplorer { new CatalogueExplorer { mainWindow } } | |
69 | { |
|
68 | { | |
70 | } |
|
69 | } | |
71 |
|
70 | |||
72 | QSize m_LastOpenLeftInspectorSize; |
|
71 | QSize m_LastOpenLeftInspectorSize; | |
73 | QSize m_LastOpenRightInspectorSize; |
|
72 | QSize m_LastOpenRightInspectorSize; | |
74 | /// General settings widget. MainWindow has the ownership |
|
73 | /// General settings widget. MainWindow has the ownership | |
75 | SqpSettingsGeneralWidget* m_GeneralSettingsWidget; |
|
74 | SqpSettingsGeneralWidget* m_GeneralSettingsWidget; | |
76 | /// Settings dialog. MainWindow has the ownership |
|
75 | /// Settings dialog. MainWindow has the ownership | |
77 | SqpSettingsDialog* m_SettingsDialog; |
|
76 | SqpSettingsDialog* m_SettingsDialog; | |
78 | /// Catalogue dialog. MainWindow has the ownership |
|
77 | /// Catalogue dialog. MainWindow has the ownership | |
79 | // CatalogueExplorer* m_CatalogExplorer; |
|
78 | // CatalogueExplorer* m_CatalogExplorer; | |
80 |
|
79 | |||
81 | bool checkDataToSave(QWidget* parentWidget); |
|
80 | bool checkDataToSave(QWidget* parentWidget); | |
82 | }; |
|
81 | }; | |
83 |
|
82 | |||
84 | MainWindow::MainWindow(QWidget* parent) |
|
83 | MainWindow::MainWindow(QWidget* parent) | |
85 | : QMainWindow { parent } |
|
84 | : QMainWindow { parent } | |
86 | , m_Ui { new Ui::MainWindow } |
|
85 | , m_Ui { new Ui::MainWindow } | |
87 | , impl { spimpl::make_unique_impl<MainWindowPrivate>(this) } |
|
86 | , impl { spimpl::make_unique_impl<MainWindowPrivate>(this) } | |
88 | { |
|
87 | { | |
89 | m_Ui->setupUi(this); |
|
88 | m_Ui->setupUi(this); | |
|
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,162 +1,162 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <ui version="4.0"> |
|
2 | <ui version="4.0"> | |
3 | <class>MainWindow</class> |
|
3 | <class>MainWindow</class> | |
4 | <widget class="QMainWindow" name="MainWindow"> |
|
4 | <widget class="QMainWindow" name="MainWindow"> | |
5 | <property name="geometry"> |
|
5 | <property name="geometry"> | |
6 | <rect> |
|
6 | <rect> | |
7 | <x>0</x> |
|
7 | <x>0</x> | |
8 | <y>0</y> |
|
8 | <y>0</y> | |
9 | <width>800</width> |
|
9 | <width>800</width> | |
10 | <height>600</height> |
|
10 | <height>600</height> | |
11 | </rect> |
|
11 | </rect> | |
12 | </property> |
|
12 | </property> | |
13 | <property name="windowTitle"> |
|
13 | <property name="windowTitle"> | |
14 |
<string>SciQlop |
|
14 | <string>SciQlop</string> | |
15 | </property> |
|
15 | </property> | |
16 | <property name="dockNestingEnabled"> |
|
16 | <property name="dockNestingEnabled"> | |
17 | <bool>true</bool> |
|
17 | <bool>true</bool> | |
18 | </property> |
|
18 | </property> | |
19 | <widget class="QWidget" name="centralWidget"> |
|
19 | <widget class="QWidget" name="centralWidget"> | |
20 | <property name="enabled"> |
|
20 | <property name="enabled"> | |
21 | <bool>true</bool> |
|
21 | <bool>true</bool> | |
22 | </property> |
|
22 | </property> | |
23 | <property name="sizePolicy"> |
|
23 | <property name="sizePolicy"> | |
24 | <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> |
|
24 | <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> | |
25 | <horstretch>0</horstretch> |
|
25 | <horstretch>0</horstretch> | |
26 | <verstretch>0</verstretch> |
|
26 | <verstretch>0</verstretch> | |
27 | </sizepolicy> |
|
27 | </sizepolicy> | |
28 | </property> |
|
28 | </property> | |
29 | <property name="maximumSize"> |
|
29 | <property name="maximumSize"> | |
30 | <size> |
|
30 | <size> | |
31 | <width>16777215</width> |
|
31 | <width>16777215</width> | |
32 | <height>16777215</height> |
|
32 | <height>16777215</height> | |
33 | </size> |
|
33 | </size> | |
34 | </property> |
|
34 | </property> | |
35 | <layout class="QHBoxLayout" name="horizontalLayout"> |
|
35 | <layout class="QHBoxLayout" name="horizontalLayout"> | |
36 | <property name="spacing"> |
|
36 | <property name="spacing"> | |
37 | <number>0</number> |
|
37 | <number>0</number> | |
38 | </property> |
|
38 | </property> | |
39 | <property name="leftMargin"> |
|
39 | <property name="leftMargin"> | |
40 | <number>0</number> |
|
40 | <number>0</number> | |
41 | </property> |
|
41 | </property> | |
42 | <property name="topMargin"> |
|
42 | <property name="topMargin"> | |
43 | <number>0</number> |
|
43 | <number>0</number> | |
44 | </property> |
|
44 | </property> | |
45 | <property name="rightMargin"> |
|
45 | <property name="rightMargin"> | |
46 | <number>0</number> |
|
46 | <number>0</number> | |
47 | </property> |
|
47 | </property> | |
48 | <property name="bottomMargin"> |
|
48 | <property name="bottomMargin"> | |
49 | <number>0</number> |
|
49 | <number>0</number> | |
50 | </property> |
|
50 | </property> | |
51 | <item> |
|
51 | <item> | |
52 | <widget class="QSplitter" name="splitter"> |
|
52 | <widget class="QSplitter" name="splitter"> | |
53 | <property name="orientation"> |
|
53 | <property name="orientation"> | |
54 | <enum>Qt::Horizontal</enum> |
|
54 | <enum>Qt::Horizontal</enum> | |
55 | </property> |
|
55 | </property> | |
56 | <widget class="QWidget" name="leftMainInspectorWidget" native="true"> |
|
56 | <widget class="QWidget" name="leftMainInspectorWidget" native="true"> | |
57 | <layout class="QVBoxLayout" name="verticalLayout"> |
|
57 | <layout class="QVBoxLayout" name="verticalLayout"> | |
58 | <property name="spacing"> |
|
58 | <property name="spacing"> | |
59 | <number>0</number> |
|
59 | <number>0</number> | |
60 | </property> |
|
60 | </property> | |
61 | <property name="leftMargin"> |
|
61 | <property name="leftMargin"> | |
62 | <number>0</number> |
|
62 | <number>0</number> | |
63 | </property> |
|
63 | </property> | |
64 | <property name="topMargin"> |
|
64 | <property name="topMargin"> | |
65 | <number>0</number> |
|
65 | <number>0</number> | |
66 | </property> |
|
66 | </property> | |
67 | <property name="rightMargin"> |
|
67 | <property name="rightMargin"> | |
68 | <number>0</number> |
|
68 | <number>0</number> | |
69 | </property> |
|
69 | </property> | |
70 | <property name="bottomMargin"> |
|
70 | <property name="bottomMargin"> | |
71 | <number>0</number> |
|
71 | <number>0</number> | |
72 | </property> |
|
72 | </property> | |
73 | <item> |
|
73 | <item> | |
74 | <widget class="DataSourceWidget" name="dataSourceWidget" native="true"/> |
|
74 | <widget class="DataSourceWidget" name="dataSourceWidget" native="true"/> | |
75 | </item> |
|
75 | </item> | |
76 | <item> |
|
76 | <item> | |
77 | <widget class="QWidget" name="dateTimeWidget" native="true"/> |
|
77 | <widget class="QWidget" name="dateTimeWidget" native="true"/> | |
78 | </item> |
|
78 | </item> | |
79 | <item> |
|
79 | <item> | |
80 | <widget class="VariableInspectorWidget" name="variableInspectorWidget" native="true"/> |
|
80 | <widget class="VariableInspectorWidget" name="variableInspectorWidget" native="true"/> | |
81 | </item> |
|
81 | </item> | |
82 | </layout> |
|
82 | </layout> | |
83 | </widget> |
|
83 | </widget> | |
84 | <widget class="VisualizationWidget" name="view" native="true"> |
|
84 | <widget class="VisualizationWidget" name="view" native="true"> | |
85 | <property name="sizePolicy"> |
|
85 | <property name="sizePolicy"> | |
86 | <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> |
|
86 | <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> | |
87 | <horstretch>0</horstretch> |
|
87 | <horstretch>0</horstretch> | |
88 | <verstretch>0</verstretch> |
|
88 | <verstretch>0</verstretch> | |
89 | </sizepolicy> |
|
89 | </sizepolicy> | |
90 | </property> |
|
90 | </property> | |
91 | </widget> |
|
91 | </widget> | |
92 | <widget class="QWidget" name="rightMainInspectorWidget" native="true"> |
|
92 | <widget class="QWidget" name="rightMainInspectorWidget" native="true"> | |
93 | <layout class="QVBoxLayout" name="verticalLayout_3"> |
|
93 | <layout class="QVBoxLayout" name="verticalLayout_3"> | |
94 | <property name="spacing"> |
|
94 | <property name="spacing"> | |
95 | <number>0</number> |
|
95 | <number>0</number> | |
96 | </property> |
|
96 | </property> | |
97 | <property name="leftMargin"> |
|
97 | <property name="leftMargin"> | |
98 | <number>0</number> |
|
98 | <number>0</number> | |
99 | </property> |
|
99 | </property> | |
100 | <property name="topMargin"> |
|
100 | <property name="topMargin"> | |
101 | <number>0</number> |
|
101 | <number>0</number> | |
102 | </property> |
|
102 | </property> | |
103 | <property name="rightMargin"> |
|
103 | <property name="rightMargin"> | |
104 | <number>0</number> |
|
104 | <number>0</number> | |
105 | </property> |
|
105 | </property> | |
106 | <property name="bottomMargin"> |
|
106 | <property name="bottomMargin"> | |
107 | <number>0</number> |
|
107 | <number>0</number> | |
108 | </property> |
|
108 | </property> | |
109 | <item> |
|
109 | <item> | |
110 | <widget class="QWidget" name="commonPropertyInspectorWidget" native="true"/> |
|
110 | <widget class="QWidget" name="commonPropertyInspectorWidget" native="true"/> | |
111 | </item> |
|
111 | </item> | |
112 | <item> |
|
112 | <item> | |
113 | <widget class="QTreeWidget" name="catalogWidget"> |
|
113 | <widget class="QTreeWidget" name="catalogWidget"> | |
114 | <column> |
|
114 | <column> | |
115 | <property name="text"> |
|
115 | <property name="text"> | |
116 | <string notr="true">Name</string> |
|
116 | <string notr="true">Name</string> | |
117 | </property> |
|
117 | </property> | |
118 | </column> |
|
118 | </column> | |
119 | </widget> |
|
119 | </widget> | |
120 | </item> |
|
120 | </item> | |
121 | </layout> |
|
121 | </layout> | |
122 | </widget> |
|
122 | </widget> | |
123 | </widget> |
|
123 | </widget> | |
124 | </item> |
|
124 | </item> | |
125 | </layout> |
|
125 | </layout> | |
126 | </widget> |
|
126 | </widget> | |
127 | <widget class="QMenuBar" name="menuBar"> |
|
127 | <widget class="QMenuBar" name="menuBar"> | |
128 | <property name="geometry"> |
|
128 | <property name="geometry"> | |
129 | <rect> |
|
129 | <rect> | |
130 | <x>0</x> |
|
130 | <x>0</x> | |
131 | <y>0</y> |
|
131 | <y>0</y> | |
132 | <width>800</width> |
|
132 | <width>800</width> | |
133 |
<height>4 |
|
133 | <height>24</height> | |
134 | </rect> |
|
134 | </rect> | |
135 | </property> |
|
135 | </property> | |
136 | </widget> |
|
136 | </widget> | |
137 | <widget class="QStatusBar" name="statusBar"/> |
|
137 | <widget class="QStatusBar" name="statusBar"/> | |
138 | </widget> |
|
138 | </widget> | |
139 | <layoutdefault spacing="6" margin="11"/> |
|
139 | <layoutdefault spacing="6" margin="11"/> | |
140 | <customwidgets> |
|
140 | <customwidgets> | |
141 | <customwidget> |
|
141 | <customwidget> | |
142 | <class>VisualizationWidget</class> |
|
142 | <class>VisualizationWidget</class> | |
143 | <extends>QWidget</extends> |
|
143 | <extends>QWidget</extends> | |
144 | <header location="global">Visualization/VisualizationWidget.h</header> |
|
144 | <header location="global">Visualization/VisualizationWidget.h</header> | |
145 | <container>1</container> |
|
145 | <container>1</container> | |
146 | </customwidget> |
|
146 | </customwidget> | |
147 | <customwidget> |
|
147 | <customwidget> | |
148 | <class>DataSourceWidget</class> |
|
148 | <class>DataSourceWidget</class> | |
149 | <extends>QWidget</extends> |
|
149 | <extends>QWidget</extends> | |
150 | <header location="global">DataSource/DataSourceWidget.h</header> |
|
150 | <header location="global">DataSource/DataSourceWidget.h</header> | |
151 | <container>1</container> |
|
151 | <container>1</container> | |
152 | </customwidget> |
|
152 | </customwidget> | |
153 | <customwidget> |
|
153 | <customwidget> | |
154 | <class>VariableInspectorWidget</class> |
|
154 | <class>VariableInspectorWidget</class> | |
155 | <extends>QWidget</extends> |
|
155 | <extends>QWidget</extends> | |
156 | <header location="global">Variable/VariableInspectorWidget.h</header> |
|
156 | <header location="global">Variable/VariableInspectorWidget.h</header> | |
157 | <container>1</container> |
|
157 | <container>1</container> | |
158 | </customwidget> |
|
158 | </customwidget> | |
159 | </customwidgets> |
|
159 | </customwidgets> | |
160 | <resources/> |
|
160 | <resources/> | |
161 | <connections/> |
|
161 | <connections/> | |
162 | </ui> |
|
162 | </ui> |
General Comments 0
You need to be logged in to leave comments.
Login now