@@ -0,0 +1,3 | |||||
|
1 | [submodule "external/CatalogueAPI"] | |||
|
2 | path = external/CatalogueAPI | |||
|
3 | url = https://hephaistos.lpp.polytechnique.fr/rhodecode/HG_REPOSITORIES/LPP/INSTRUMENTATION/USERS/JEANDET/CatalogueAPI |
@@ -0,0 +1,18 | |||||
|
1 | [Desktop Entry] | |||
|
2 | Version=1.0 | |||
|
3 | Name=QLop | |||
|
4 | Name[en_US]=SciQLOP | |||
|
5 | ||||
|
6 | Type=Application | |||
|
7 | GenericName=SciQLOP | |||
|
8 | Comment=SCIentific Qt application for Learning from Observations of Plasmas | |||
|
9 | ||||
|
10 | Exec=sciqlopapp | |||
|
11 | Icon=/usr/share/SciQLOP/icons/sciqlopLOGO.svg | |||
|
12 | Terminal=false | |||
|
13 | ||||
|
14 | Categories=Qt;Education;Science; | |||
|
15 | ||||
|
16 | #MimeType=text/x-python; | |||
|
17 | ||||
|
18 |
@@ -0,0 +1,5 | |||||
|
1 | macro(declare_test testname testexe sources libraries) | |||
|
2 | add_executable(${testexe} ${sources}) | |||
|
3 | target_link_libraries(${testexe} ${libraries}) | |||
|
4 | add_test(NAME ${testname} COMMAND ${testexe}) | |||
|
5 | endmacro(declare_test) |
@@ -0,0 +1,33 | |||||
|
1 | include(sciqlop_tests) | |||
|
2 | ||||
|
3 | add_definitions(-DCORE_TESTS_RESOURCES_DIR="${CMAKE_CURRENT_LIST_DIR}/../tests-resources") | |||
|
4 | ||||
|
5 | ||||
|
6 | declare_test(TestStringUtils TestStringUtils Common/TestStringUtils.cpp "sciqlopcore;Qt5::Test") | |||
|
7 | ||||
|
8 | declare_test(TestDataSeriesUtils TestDataSeriesUtils Data/TestDataSeriesUtils.cpp "sciqlopcore;Qt5::Test") | |||
|
9 | declare_test(TestOptionalAxis TestOptionalAxis Data/TestOptionalAxis.cpp "sciqlopcore;Qt5::Test") | |||
|
10 | declare_test(TestSpectrogramSeries TestSpectrogramSeries | |||
|
11 | "Data/TestSpectrogramSeries.cpp;Data/DataSeriesBuilders.h;Data/DataSeriesBuilders.cpp;Data/DataSeriesTestsUtils.h;Data/DataSeriesTestsUtils.cpp" | |||
|
12 | "sciqlopcore;Qt5::Test") | |||
|
13 | declare_test(TestOneDimArrayData TestOneDimArrayData Data/TestOneDimArrayData.cpp "sciqlopcore;Qt5::Test") | |||
|
14 | declare_test(TestScalarSeries TestScalarSeries | |||
|
15 | "Data/TestScalarSeries.cpp;Data/DataSeriesBuilders.h;Data/DataSeriesBuilders.cpp;Data/DataSeriesTestsUtils.h;Data/DataSeriesTestsUtils.cpp" | |||
|
16 | "sciqlopcore;Qt5::Test") | |||
|
17 | declare_test(TestTwoDimArrayData TestTwoDimArrayData Data/TestTwoDimArrayData.cpp "sciqlopcore;Qt5::Test") | |||
|
18 | declare_test(TestVectorSeries TestVectorSeries | |||
|
19 | "Data/TestVectorSeries.cpp;Data/DataSeriesBuilders.h;Data/DataSeriesBuilders.cpp;Data/DataSeriesTestsUtils.h;Data/DataSeriesTestsUtils.cpp" | |||
|
20 | "sciqlopcore;Qt5::Test") | |||
|
21 | ||||
|
22 | declare_test(TestDataSourceController TestDataSourceController | |||
|
23 | "DataSource/TestDataSourceController.cpp;DataSource/DataSourceItemBuilder.cpp" | |||
|
24 | "sciqlopcore;Qt5::Test") | |||
|
25 | declare_test(TestDataSourceItem TestDataSourceItem | |||
|
26 | "DataSource/TestDataSourceItem.cpp;DataSource/DataSourceItemBuilder.cpp" | |||
|
27 | "sciqlopcore;Qt5::Test") | |||
|
28 | ||||
|
29 | declare_test(TestVariable TestVariable Variable/TestVariable.cpp "sciqlopcore;Qt5::Test") | |||
|
30 | declare_test(TestVariableCacheController TestVariableCacheController Variable/TestVariableCacheController.cpp "sciqlopcore;Qt5::Test") | |||
|
31 | declare_test(TestVariableController TestVariableController Variable/TestVariableController.cpp "sciqlopcore;Qt5::Test") | |||
|
32 | declare_test(TestVariableSync TestVariableSync Variable/TestVariableSync.cpp "sciqlopcore;Qt5::Test") | |||
|
33 |
@@ -0,0 +1,13 | |||||
|
1 | find_package(Doxygen) | |||
|
2 | if(DOXYGEN_FOUND) | |||
|
3 | set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.dox.in) | |||
|
4 | set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) | |||
|
5 | configure_file(${doxyfile_in} ${doxyfile} @ONLY) | |||
|
6 | ||||
|
7 | add_custom_target(doc | |||
|
8 | COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile} | |||
|
9 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} | |||
|
10 | COMMENT "Generating API documentation with Doxygen" | |||
|
11 | VERBATIM) | |||
|
12 | ||||
|
13 | endif() |
@@ -0,0 +1,1 | |||||
|
1 | Subproject commit 70f95c7d91c9a4e1ab52c427372757cc83a57de2 |
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
@@ -0,0 +1,23 | |||||
|
1 | include(ExternalProject) | |||
|
2 | ||||
|
3 | find_program(meson meson) | |||
|
4 | find_program(ninja ninja) | |||
|
5 | ||||
|
6 | SET(SOURCES_PATH ${CMAKE_SOURCE_DIR}/3rdparty/CatalogueAPI) | |||
|
7 | SET(BUILD_PATH ${CATALOGUEAPI_SOURCES_PATH}/build) | |||
|
8 | SET(CATALOGUEAPI_QXORM_LIB_PATH ${CATALOGUEAPI_BUILD_PATH}/subprojects/QxOrm) | |||
|
9 | ||||
|
10 | ExternalProject_Add( | |||
|
11 | CatalogueAPI | |||
|
12 | GIT_REPOSITORY https://perrinel@hephaistos.lpp.polytechnique.fr/rhodecode/GIT_REPOSITORIES/LPP/Users/mperrinel/CatalogueAPI | |||
|
13 | GIT_TAG develop | |||
|
14 | ||||
|
15 | SOURCE_DIR ${CMAKE_BINARY_DIR}/CatalogueAPI_src | |||
|
16 | BINARY_DIR ${CMAKE_BINARY_DIR}/CatalogueAPI_build | |||
|
17 | INSTALL_DIR ${CMAKE_BINARY_DIR}/CatalogueAPI | |||
|
18 | ||||
|
19 | CONFIGURE_COMMAND ${meson} --prefix=${CATALOGUEAPI_SOURCES_PATH} --buildtype=${CMAKE_BUILD_TYPE_TOLOWER} "${CATALOGUEAPI_SOURCES_PATH}" "${CATALOGUEAPI_BUILD_PATH}" | |||
|
20 | BUILD_COMMAND ${ninja} -C "${CATALOGUEAPI_BUILD_PATH}" | |||
|
21 | INSTALL_COMMAND ${ninja} -C "${CATALOGUEAPI_BUILD_PATH}" install | |||
|
22 | ||||
|
23 | ) |
@@ -1,18 +1,61 | |||||
1 | |
|
1 | cmake_minimum_required(VERSION 3.6) | |
|
2 | project(SciQLOP CXX) | |||
2 |
|
3 | |||
3 | ## Main CMakeLists for SCIQLOP |
|
4 | include(GNUInstallDirs) | |
4 | CMAKE_MINIMUM_REQUIRED (VERSION 3.6.1) |
|
|||
5 | cmake_policy(VERSION 3.6) |
|
|||
6 |
|
5 | |||
7 | PROJECT(SCIQLOP) |
|
6 | SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake") | |
8 |
|
7 | |||
|
8 | OPTION (CPPCHECK "Analyzes the source code with cppcheck" OFF) | |||
|
9 | OPTION (CLANG_TIDY "Analyzes the source code with Clang Tidy" OFF) | |||
|
10 | OPTION (IWYU "Analyzes the source code with Include What You Use" OFF) | |||
9 |
|
11 | |||
10 | # |
|
12 | set(CMAKE_CXX_STANDARD 14) | |
11 | # build the CatalogueAPI dependencu |
|
|||
12 | # |
|
|||
13 | INCLUDE("extern/CatalogueAPI.cmake") |
|
|||
14 |
|
13 | |||
15 | # |
|
14 | set(CMAKE_AUTOMOC ON) | |
16 | # build the project |
|
15 | #https://gitlab.kitware.com/cmake/cmake/issues/15227 | |
17 | # |
|
16 | #set(CMAKE_AUTOUIC ON) | |
18 | INCLUDE("cmake/sciqlop.cmake") |
|
17 | if(POLICY CMP0071) | |
|
18 | cmake_policy(SET CMP0071 OLD) | |||
|
19 | endif() | |||
|
20 | set(CMAKE_AUTORCC ON) | |||
|
21 | set(CMAKE_INCLUDE_CURRENT_DIR ON) | |||
|
22 | ||||
|
23 | if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH) | |||
|
24 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | |||
|
25 | endif() | |||
|
26 | if(NOT DEFINED CMAKE_MACOSX_RPATH) | |||
|
27 | set(CMAKE_MACOSX_RPATH TRUE) | |||
|
28 | endif() | |||
|
29 | ||||
|
30 | if(NOT CMAKE_BUILD_TYPE) | |||
|
31 | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) | |||
|
32 | endif() | |||
|
33 | ||||
|
34 | find_package(Qt5 COMPONENTS Core Widgets Network PrintSupport Svg Test REQUIRED) | |||
|
35 | ||||
|
36 | IF(CPPCHECK) | |||
|
37 | set(CMAKE_CXX_CPPCHECK "cppcheck;--enable=warning,style") | |||
|
38 | ENDIF(CPPCHECK) | |||
|
39 | ||||
|
40 | IF(CLANG_TIDY) | |||
|
41 | set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-style=file;-checks=*") | |||
|
42 | ENDIF(CLANG_TIDY) | |||
|
43 | ||||
|
44 | IF(IWYU) | |||
|
45 | set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "include-what-you-use") | |||
|
46 | ENDIF(IWYU) | |||
|
47 | ||||
|
48 | enable_testing() | |||
|
49 | ||||
|
50 | ||||
|
51 | find_package(CatalogueAPI CONFIG QUIET) | |||
|
52 | if (NOT CatalogueAPI_FOUND) | |||
|
53 | execute_process(COMMAND git submodule update --init external/CatalogueAPI WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) | |||
|
54 | add_subdirectory(external/CatalogueAPI) | |||
|
55 | endif() | |||
|
56 | ||||
|
57 | add_subdirectory(core) | |||
|
58 | add_subdirectory(gui) | |||
|
59 | add_subdirectory(app) | |||
|
60 | add_subdirectory(plugins) | |||
|
61 | add_subdirectory(docs) |
@@ -1,31 +1,37 | |||||
1 | ![](gui/resources/icones/sciqlop2PNG_1024.png){:.some-css-class style="width: 20%"} |
|
1 | ||
|
2 | <div style="text-align:center"> | |||
|
3 | <img src="gui/resources/icones/sciqlop2PNG_1024.png" alt="sciqlop_logo" style="width: 200px;"/> | |||
|
4 | <br /><br /> | |||
|
5 | <img src="pictures/sciqlop_screenshot.png" alt="sciqlop_logo" style="width: 80%;"/> | |||
|
6 | </div> | |||
|
7 | ||||
2 |
|
8 | |||
3 |
|
9 | |||
4 | # Overview |
|
10 | # Overview | |
5 |
|
11 | |||
6 | ** SciQLOP ** (**SCI**entific **Q**t application for **L**earning from **O**bservations of **P**lasmas) aims to be an ergonomic |
|
12 | ** SciQLOP ** (**SCI**entific **Q**t application for **L**earning from **O**bservations of **P**lasmas) aims to be an ergonomic | |
7 | and powerful tool enabling visualization and analysis of in-situ space plasma data. This goal rises some |
|
13 | and powerful tool enabling visualization and analysis of in-situ space plasma data. This goal rises some | |
8 | challenges either technical and in the conception and the design. |
|
14 | challenges either technical and in the conception and the design. | |
9 | The time resolution allowed by nowadays measurements imply the ability to plot millions of points just for |
|
15 | The time resolution allowed by nowadays measurements imply the ability to plot millions of points just for | |
10 | one sensor with no compromise on interactivity. Plots may stay responsive even with millions of points. |
|
16 | one sensor with no compromise on interactivity. Plots may stay responsive even with millions of points. | |
11 | Being able to scroll, zoom, move and export the plots with the mouse are the minimal interactions expected by the user. |
|
17 | Being able to scroll, zoom, move and export the plots with the mouse are the minimal interactions expected by the user. | |
12 | SciQLOP may also abstract the manipulation of physic data while providing contextual features such as |
|
18 | SciQLOP may also abstract the manipulation of physic data while providing contextual features such as | |
13 | coordinate transform, physical quantity extraction from data. |
|
19 | coordinate transform, physical quantity extraction from data. | |
14 | That said increasing graphical features usually lead to slower software and more complex GUI. Keeping |
|
20 | That said increasing graphical features usually lead to slower software and more complex GUI. Keeping | |
15 | SciQLOP lightweight and intuitive is one of the priorities to make it usable and competitive. |
|
21 | SciQLOP lightweight and intuitive is one of the priorities to make it usable and competitive. | |
16 |
|
22 | |||
17 |
|
23 | |||
18 | ## How to build |
|
24 | ## How to build | |
19 |
|
25 | |||
20 | ``` |
|
26 | ``` | |
21 | git clone https://hephaistos.lpp.polytechnique.fr/rhodecode/HG_REPOSITORIES/LPP/SciQLOP_Repos/SciQLop |
|
27 | git clone https://hephaistos.lpp.polytechnique.fr/rhodecode/HG_REPOSITORIES/LPP/SciQLOP_Repos/SciQLop | |
22 | cd SciQLop |
|
28 | cd SciQLop | |
23 | mkdir build && cd build |
|
29 | mkdir build && cd build | |
24 | cmake ../ |
|
30 | cmake ../ | |
25 | make |
|
31 | make | |
26 |
|
32 | |||
27 | ``` |
|
33 | ``` | |
28 |
|
34 | |||
29 | ## How to contribute |
|
35 | ## How to contribute | |
30 |
|
36 | |||
31 | Contact sciqlop@lpp.polytechnique.fr |
|
37 | Contact sciqlop@lpp.polytechnique.fr |
@@ -1,157 +1,34 | |||||
|
1 | include_directories(include) | |||
1 |
|
2 | |||
2 | ## sciqlop - CMakeLists.txt |
|
3 | FILE (GLOB_RECURSE app_SRCS | |
3 | SET(EXECUTABLE_NAME "sciqlop") |
|
4 | include/*.h | |
4 | SCIQLOP_SET_TO_PARENT_SCOPE(EXECUTABLE_NAME) |
|
5 | src/*.cpp | |
5 | SET(SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/) |
|
6 | resources/*.qrc | |
6 | SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") |
|
|||
7 | SET(UI_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/ui) |
|
|||
8 | SET(RES_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/resources) |
|
|||
9 |
|
||||
10 | # Include gui directory |
|
|||
11 | include_directories("${INCLUDES_DIR}") |
|
|||
12 |
|
||||
13 | # |
|
|||
14 | # Find Qt modules |
|
|||
15 | # |
|
|||
16 | SCIQLOP_FIND_QT(Core Widgets) |
|
|||
17 |
|
||||
18 |
|
||||
19 | # |
|
|||
20 | # Find dependent libraries |
|
|||
21 | # ======================== |
|
|||
22 | find_package(sciqlop-gui) |
|
|||
23 |
|
||||
24 | SET(LIBRARIES ${SCIQLOP-GUI_LIBRARIES}) |
|
|||
25 | SET(EXTERN_SHARED_LIBRARIES) |
|
|||
26 |
|
||||
27 | INCLUDE_DIRECTORIES(${SCIQLOP-GUI_INCLUDE_DIR}) |
|
|||
28 |
|
||||
29 | # Add sqpcore to the list of libraries to use |
|
|||
30 | list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME}) |
|
|||
31 |
|
||||
32 | # Include core directory |
|
|||
33 | include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../core/include") |
|
|||
34 |
|
||||
35 | # Add dependent shared libraries |
|
|||
36 | list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES}) |
|
|||
37 |
|
||||
38 | # Retrieve the location of the dynamic library to copy it to the output path |
|
|||
39 | #get_property(sqpcoreLocation TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY LOCATION) |
|
|||
40 | list(APPEND SHARED_LIBRARIES_FROM_TARGETS ${sqpcoreLocation}) |
|
|||
41 |
|
||||
42 | # Ui files |
|
|||
43 | FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui) |
|
|||
44 |
|
||||
45 | # |
|
|||
46 | # Compile the application |
|
|||
47 | # |
|
|||
48 | FILE (GLOB_RECURSE APPLICATION_SOURCES |
|
|||
49 | ${INCLUDES_DIR}/*.h |
|
|||
50 | ${SOURCES_DIR}/*.c |
|
|||
51 | ${SOURCES_DIR}/*.cpp |
|
|||
52 | ${SOURCES_DIR}/*.h |
|
|||
53 | ${PROJECT_FORMS}) |
|
|||
54 |
|
||||
55 | FILE (GLOB_RECURSE APPLICATION_RESOURCES ${RES_FOLDER}/*.qrc) |
|
|||
56 |
|
||||
57 | QT5_ADD_RESOURCES(RCC_HDRS ${APPLICATION_RESOURCES} ) |
|
|||
58 |
|
||||
59 | QT5_WRAP_UI(UIS_HDRS |
|
|||
60 | ${PROJECT_FORMS} |
|
|||
61 | ) |
|
7 | ) | |
62 |
|
8 | |||
63 |
|
9 | QT5_WRAP_UI(UiGenerated_SRCS | ||
64 | ADD_EXECUTABLE(${EXECUTABLE_NAME} ${APPLICATION_SOURCES} ${RCC_HDRS} ${UIS_HDRS}) |
|
10 | ui/MainWindow.ui | |
65 | set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 14) |
|
|||
66 | set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
|||
67 | target_link_libraries(${EXECUTABLE_NAME} |
|
|||
68 | ${LIBRARIES}) |
|
|||
69 |
|
||||
70 | INSTALL(TARGETS ${EXECUTABLE_NAME} |
|
|||
71 | RUNTIME DESTINATION ${INSTALL_BINARY_DIR} |
|
|||
72 | LIBRARY DESTINATION ${INSTALL_BINARY_DIR} |
|
|||
73 | ARCHIVE DESTINATION ${INSTALL_BINARY_DIR} |
|
|||
74 | ) |
|
11 | ) | |
75 | # Link with Qt5 modules |
|
|||
76 | qt5_use_modules(${EXECUTABLE_NAME} Core Widgets) |
|
|||
77 |
|
||||
78 |
|
||||
79 | add_dependencies(${EXECUTABLE_NAME} ${SQPGUI_LIBRARY_NAME} ${SQPCORE_LIBRARY_NAME}) |
|
|||
80 |
|
||||
81 |
|
||||
82 |
|
||||
83 | # Add the files to the list of files to be analyzed |
|
|||
84 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${APPLICATION_SOURCES}) |
|
|||
85 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) |
|
|||
86 | # Vera++ exclusion files |
|
|||
87 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt) |
|
|||
88 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) |
|
|||
89 |
|
||||
90 | # |
|
|||
91 | # Compile the tests |
|
|||
92 | # |
|
|||
93 | IF(BUILD_TESTS) |
|
|||
94 |
|
||||
95 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) |
|
|||
96 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) |
|
|||
97 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) |
|
|||
98 | SET( TEST_LIBRARIES ${LIBRARIES}) |
|
|||
99 |
|
12 | |||
100 | FOREACH( testFile ${TESTS_SOURCES} ) |
|
13 | add_executable(sciqlopapp ${app_SRCS} ${UiGenerated_SRCS}) | |
101 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) |
|
14 | if(NOT BUILD_SHARED_LIBS) | |
102 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) |
|
15 | add_definitions(-DQT_STATICPLUGIN) | |
103 |
|
16 | target_link_libraries(sciqlopapp mockplugin) | ||
104 | # Add to the list of sources files all the sources in the same |
|
17 | target_link_libraries(sciqlopapp amdaplugin) | |
105 | # directory that aren't another test |
|
18 | endif() | |
106 | FILE (GLOB currentTestSources |
|
19 | ||
107 | ${testDirectory}/*.c |
|
20 | target_link_libraries(sciqlopapp | |
108 | ${testDirectory}/*.cpp |
|
21 | Qt5::Core | |
109 | ${testDirectory}/*.h) |
|
22 | Qt5::Widgets | |
110 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) |
|
23 | Qt5::Network | |
111 | LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) |
|
24 | Qt5::PrintSupport | |
112 |
|
25 | Qt5::Svg | ||
113 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) |
|
26 | sciqlopgui | |
114 | TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES}) |
|
27 | sciqlopcore | |
115 | qt5_use_modules(${testName} Test) |
|
28 | ) | |
116 |
|
||||
117 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) |
|
|||
118 |
|
||||
119 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName}) |
|
|||
120 | ENDFOREACH( testFile ) |
|
|||
121 |
|
||||
122 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) |
|
|||
123 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) |
|
|||
124 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) |
|
|||
125 |
|
||||
126 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
|||
127 | ENDIF(BUILD_TESTS) |
|
|||
128 |
|
29 | |||
129 | # |
|
30 | install(TARGETS sciqlopapp DESTINATION ${CMAKE_INSTALL_BINDIR}) | |
130 | # Set the files that must be formatted by clang-format. |
|
31 | install(FILES resources/SciQLOP.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/) | |
131 | # |
|
32 | install(FILES resources/sciqlopLOGO.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/SciQLOP/icons/) | |
132 | LIST (APPEND FORMATTING_INPUT_FILES ${APPLICATION_SOURCES}) |
|
|||
133 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
|||
134 |
|
33 | |||
135 | # |
|
|||
136 | # Set the directories that doxygen must browse to generate the |
|
|||
137 | # documentation. |
|
|||
138 | # |
|
|||
139 | # Source directories: |
|
|||
140 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") |
|
|||
141 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
|||
142 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) |
|
|||
143 | # Source directories to exclude from the documentation generation |
|
|||
144 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") |
|
|||
145 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) |
|
|||
146 |
|
34 | |||
147 | # |
|
|||
148 | # Set the directories with the sources to analyze and propagate the |
|
|||
149 | # modification to the parent scope |
|
|||
150 | # |
|
|||
151 | # Source directories to analyze: |
|
|||
152 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
|||
153 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") |
|
|||
154 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) |
|
|||
155 | # Source directories to exclude from the analysis |
|
|||
156 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") |
|
|||
157 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS) |
|
@@ -1,91 +1,91 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the QLop Software |
|
2 | -- This file is a part of the QLop Software | |
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2015, 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 <QProcessEnvironment> |
|
23 | #include <QProcessEnvironment> | |
24 | #include <QThread> |
|
24 | #include <QThread> | |
25 | #include <SqpApplication.h> |
|
25 | #include <SqpApplication.h> | |
26 | #include <qglobal.h> |
|
26 | #include <qglobal.h> | |
27 |
|
27 | |||
28 | #include <Plugin/PluginManager.h> |
|
28 | #include <PluginManager/PluginManager.h> | |
29 | #include <QDir> |
|
29 | #include <QDir> | |
30 | #include <QtPlugin> |
|
30 | #include <QtPlugin> | |
31 |
|
31 | |||
32 | #include <QLoggingCategory> |
|
32 | #include <QLoggingCategory> | |
33 |
|
33 | |||
34 | Q_LOGGING_CATEGORY(LOG_Main, "Main") |
|
34 | Q_LOGGING_CATEGORY(LOG_Main, "Main") | |
35 |
|
35 | |||
36 | namespace { |
|
36 | namespace { | |
37 |
|
37 | |||
38 | const auto PLUGIN_DIRECTORY_NAME = QStringLiteral("plugins"); |
|
38 | const auto PLUGIN_DIRECTORY_NAME = QStringLiteral("plugins"); | |
39 |
|
39 | |||
40 |
|
40 | |||
41 | } // namespace |
|
41 | } // namespace | |
42 |
|
42 | |||
43 | int main(int argc, char *argv[]) |
|
43 | int main(int argc, char *argv[]) | |
44 | { |
|
44 | { | |
45 | #ifdef QT_STATICPLUGIN |
|
45 | #ifdef QT_STATICPLUGIN | |
46 | Q_IMPORT_PLUGIN(MockPlugin) |
|
46 | Q_IMPORT_PLUGIN(MockPlugin) | |
47 | Q_IMPORT_PLUGIN(AmdaPlugin) |
|
47 | Q_IMPORT_PLUGIN(AmdaPlugin) | |
48 | Q_INIT_RESOURCE(amdaresources); |
|
48 | Q_INIT_RESOURCE(amdaresources); | |
49 | #endif |
|
49 | #endif | |
50 | Q_INIT_RESOURCE(sqpguiresources); |
|
50 | Q_INIT_RESOURCE(sqpguiresources); | |
51 |
|
51 | |||
52 | SqpApplication::setOrganizationName("LPP"); |
|
52 | SqpApplication::setOrganizationName("LPP"); | |
53 | SqpApplication::setOrganizationDomain("lpp.fr"); |
|
53 | SqpApplication::setOrganizationDomain("lpp.fr"); | |
54 | SqpApplication::setApplicationName("SciQLop"); |
|
54 | SqpApplication::setApplicationName("SciQLop"); | |
55 |
|
55 | |||
56 | SqpApplication a{argc, argv}; |
|
56 | SqpApplication a{argc, argv}; | |
57 |
|
57 | |||
58 | MainWindow w; |
|
58 | MainWindow w; | |
59 | w.show(); |
|
59 | w.show(); | |
60 |
|
60 | |||
61 | // Loads plugins |
|
61 | // Loads plugins | |
62 | auto pluginDir = QDir{a.applicationDirPath()}; |
|
62 | auto pluginDir = QDir{a.applicationDirPath()}; | |
63 | auto pluginLookupPath = { |
|
63 | auto pluginLookupPath = { | |
64 | a.applicationDirPath(), |
|
64 | a.applicationDirPath(), | |
65 | a.applicationDirPath() + "/" + PLUGIN_DIRECTORY_NAME, |
|
65 | a.applicationDirPath() + "/" + PLUGIN_DIRECTORY_NAME, | |
66 | a.applicationDirPath() + "/../lib64/SciQlop", |
|
66 | a.applicationDirPath() + "/../lib64/SciQlop", | |
67 | a.applicationDirPath() + "/../lib64/sciqlop", |
|
67 | a.applicationDirPath() + "/../lib64/sciqlop", | |
68 | a.applicationDirPath() + "/../lib/SciQlop", |
|
68 | a.applicationDirPath() + "/../lib/SciQlop", | |
69 | a.applicationDirPath() + "/../lib/sciqlop", |
|
69 | a.applicationDirPath() + "/../lib/sciqlop", | |
70 | a.applicationDirPath() + "/../plugins", |
|
70 | a.applicationDirPath() + "/../plugins", | |
71 | }; |
|
71 | }; | |
72 |
|
72 | |||
73 | #if _WIN32 || _WIN64 |
|
73 | #if _WIN32 || _WIN64 | |
74 | pluginDir.mkdir(PLUGIN_DIRECTORY_NAME); |
|
74 | pluginDir.mkdir(PLUGIN_DIRECTORY_NAME); | |
75 | pluginDir.cd(PLUGIN_DIRECTORY_NAME); |
|
75 | pluginDir.cd(PLUGIN_DIRECTORY_NAME); | |
76 | #endif |
|
76 | #endif | |
77 |
|
77 | |||
78 | PluginManager pluginManager{}; |
|
78 | PluginManager pluginManager{}; | |
79 |
|
79 | |||
80 | for (auto &&path : pluginLookupPath) { |
|
80 | for (auto &&path : pluginLookupPath) { | |
81 | QDir directory{path}; |
|
81 | QDir directory{path}; | |
82 | if (directory.exists()) { |
|
82 | if (directory.exists()) { | |
83 | qCDebug(LOG_Main()) |
|
83 | qCDebug(LOG_Main()) | |
84 | << QObject::tr("Plugin directory: %1").arg(directory.absolutePath()); |
|
84 | << QObject::tr("Plugin directory: %1").arg(directory.absolutePath()); | |
85 | pluginManager.loadPlugins(directory); |
|
85 | pluginManager.loadPlugins(directory); | |
86 | } |
|
86 | } | |
87 | } |
|
87 | } | |
88 | pluginManager.loadStaticPlugins(); |
|
88 | pluginManager.loadStaticPlugins(); | |
89 |
|
89 | |||
90 | return a.exec(); |
|
90 | return a.exec(); | |
91 | } |
|
91 | } |
@@ -1,405 +1,405 | |||||
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 <Variable/Variable.h> |
|
35 | #include <Variable/Variable.h> | |
36 | #include <Variable/VariableController.h> |
|
36 | #include <Variable/VariableController.h> | |
37 | #include <Visualization/VisualizationController.h> |
|
37 | #include <Visualization/VisualizationController.h> | |
38 |
|
38 | |||
39 | #include <QAction> |
|
39 | #include <QAction> | |
40 | #include <QCloseEvent> |
|
40 | #include <QCloseEvent> | |
41 | #include <QDate> |
|
41 | #include <QDate> | |
42 | #include <QDir> |
|
42 | #include <QDir> | |
43 | #include <QFileDialog> |
|
43 | #include <QFileDialog> | |
44 | #include <QMessageBox> |
|
44 | #include <QMessageBox> | |
45 | #include <QToolBar> |
|
45 | #include <QToolBar> | |
46 | #include <QToolButton> |
|
46 | #include <QToolButton> | |
47 | #include <memory.h> |
|
47 | #include <memory.h> | |
48 |
|
48 | |||
49 | #include "iostream" |
|
49 | #include "iostream" | |
50 |
|
50 | |||
51 | Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow") |
|
51 | Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow") | |
52 |
|
52 | |||
53 | namespace { |
|
53 | namespace { | |
54 | const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0; |
|
54 | const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0; | |
55 | const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1; |
|
55 | const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1; | |
56 | const auto VIEWPLITTERINDEX = 2; |
|
56 | const auto VIEWPLITTERINDEX = 2; | |
57 | const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3; |
|
57 | const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3; | |
58 | const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4; |
|
58 | const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4; | |
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 | class MainWindow::MainWindowPrivate { |
|
61 | class MainWindow::MainWindowPrivate { | |
62 | public: |
|
62 | public: | |
63 | explicit MainWindowPrivate(MainWindow *mainWindow) |
|
63 | explicit MainWindowPrivate(MainWindow *mainWindow) | |
64 | : m_LastOpenLeftInspectorSize{}, |
|
64 | : m_LastOpenLeftInspectorSize{}, | |
65 | m_LastOpenRightInspectorSize{}, |
|
65 | m_LastOpenRightInspectorSize{}, | |
66 | m_GeneralSettingsWidget{new SqpSettingsGeneralWidget{mainWindow}}, |
|
66 | m_GeneralSettingsWidget{new SqpSettingsGeneralWidget{mainWindow}}, | |
67 | m_SettingsDialog{new SqpSettingsDialog{mainWindow}}, |
|
67 | m_SettingsDialog{new SqpSettingsDialog{mainWindow}}, | |
68 | m_CatalogExplorer{new CatalogueExplorer{mainWindow}} |
|
68 | m_CatalogExplorer{new CatalogueExplorer{mainWindow}} | |
69 | { |
|
69 | { | |
70 | } |
|
70 | } | |
71 |
|
71 | |||
72 | QSize m_LastOpenLeftInspectorSize; |
|
72 | QSize m_LastOpenLeftInspectorSize; | |
73 | QSize m_LastOpenRightInspectorSize; |
|
73 | QSize m_LastOpenRightInspectorSize; | |
74 | /// General settings widget. MainWindow has the ownership |
|
74 | /// General settings widget. MainWindow has the ownership | |
75 | SqpSettingsGeneralWidget *m_GeneralSettingsWidget; |
|
75 | SqpSettingsGeneralWidget *m_GeneralSettingsWidget; | |
76 | /// Settings dialog. MainWindow has the ownership |
|
76 | /// Settings dialog. MainWindow has the ownership | |
77 | SqpSettingsDialog *m_SettingsDialog; |
|
77 | SqpSettingsDialog *m_SettingsDialog; | |
78 | /// Catalogue dialog. MainWindow has the ownership |
|
78 | /// Catalogue dialog. MainWindow has the ownership | |
79 | CatalogueExplorer *m_CatalogExplorer; |
|
79 | CatalogueExplorer *m_CatalogExplorer; | |
80 |
|
80 | |||
81 | bool checkDataToSave(QWidget *parentWidget); |
|
81 | bool checkDataToSave(QWidget *parentWidget); | |
82 | }; |
|
82 | }; | |
83 |
|
83 | |||
84 | MainWindow::MainWindow(QWidget *parent) |
|
84 | MainWindow::MainWindow(QWidget *parent) | |
85 | : QMainWindow{parent}, |
|
85 | : QMainWindow{parent}, | |
86 | m_Ui{new Ui::MainWindow}, |
|
86 | m_Ui{new Ui::MainWindow}, | |
87 | impl{spimpl::make_unique_impl<MainWindowPrivate>(this)} |
|
87 | impl{spimpl::make_unique_impl<MainWindowPrivate>(this)} | |
88 | { |
|
88 | { | |
89 | m_Ui->setupUi(this); |
|
89 | m_Ui->setupUi(this); | |
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 leftSidePane = m_Ui->leftInspectorSidePane->sidePane(); |
|
97 | auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane(); | |
98 | auto openLeftInspectorAction = new QAction{QIcon{ |
|
98 | auto openLeftInspectorAction = new QAction{QIcon{ | |
99 | ":/icones/previous.png", |
|
99 | ":/icones/previous.png", | |
100 | }, |
|
100 | }, | |
101 | tr("Show/hide the left inspector"), this}; |
|
101 | tr("Show/hide the left inspector"), this}; | |
102 |
|
102 | |||
103 |
|
103 | |||
104 | auto spacerLeftTop = new QWidget{}; |
|
104 | auto spacerLeftTop = new QWidget{}; | |
105 | spacerLeftTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
105 | spacerLeftTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
106 |
|
106 | |||
107 | auto spacerLeftBottom = new QWidget{}; |
|
107 | auto spacerLeftBottom = new QWidget{}; | |
108 | spacerLeftBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
108 | spacerLeftBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
109 |
|
109 | |||
110 | leftSidePane->addWidget(spacerLeftTop); |
|
110 | leftSidePane->addWidget(spacerLeftTop); | |
111 | leftSidePane->addAction(openLeftInspectorAction); |
|
111 | leftSidePane->addAction(openLeftInspectorAction); | |
112 | leftSidePane->addWidget(spacerLeftBottom); |
|
112 | leftSidePane->addWidget(spacerLeftBottom); | |
113 |
|
113 | |||
114 |
|
114 | |||
115 | auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane(); |
|
115 | auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane(); | |
116 | auto openRightInspectorAction = new QAction{QIcon{ |
|
116 | auto openRightInspectorAction = new QAction{QIcon{ | |
117 | ":/icones/next.png", |
|
117 | ":/icones/next.png", | |
118 | }, |
|
118 | }, | |
119 | tr("Show/hide the right inspector"), this}; |
|
119 | tr("Show/hide the right inspector"), this}; | |
120 |
|
120 | |||
121 | auto spacerRightTop = new QWidget{}; |
|
121 | auto spacerRightTop = new QWidget{}; | |
122 | spacerRightTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
122 | spacerRightTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
123 |
|
123 | |||
124 | auto spacerRightBottom = new QWidget{}; |
|
124 | auto spacerRightBottom = new QWidget{}; | |
125 | spacerRightBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
125 | spacerRightBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
126 |
|
126 | |||
127 | rightSidePane->addWidget(spacerRightTop); |
|
127 | rightSidePane->addWidget(spacerRightTop); | |
128 | rightSidePane->addAction(openRightInspectorAction); |
|
128 | rightSidePane->addAction(openRightInspectorAction); | |
129 | rightSidePane->addWidget(spacerRightBottom); |
|
129 | rightSidePane->addWidget(spacerRightBottom); | |
130 |
|
130 | |||
131 | openLeftInspectorAction->setCheckable(true); |
|
131 | openLeftInspectorAction->setCheckable(true); | |
132 | openRightInspectorAction->setCheckable(true); |
|
132 | openRightInspectorAction->setCheckable(true); | |
133 |
|
133 | |||
134 | auto openInspector = [this](bool checked, bool right, auto action) { |
|
134 | auto openInspector = [this](bool checked, bool right, auto action) { | |
135 |
|
135 | |||
136 |
action->setIcon(QIcon{(checked |
|
136 | action->setIcon(QIcon{(checked ^ right) ? ":/icones/next.png" : ":/icones/previous.png"}); | |
137 |
|
137 | |||
138 | auto &lastInspectorSize |
|
138 | auto &lastInspectorSize | |
139 | = right ? impl->m_LastOpenRightInspectorSize : impl->m_LastOpenLeftInspectorSize; |
|
139 | = right ? impl->m_LastOpenRightInspectorSize : impl->m_LastOpenLeftInspectorSize; | |
140 |
|
140 | |||
141 | auto nextInspectorSize = right ? m_Ui->rightMainInspectorWidget->size() |
|
141 | auto nextInspectorSize = right ? m_Ui->rightMainInspectorWidget->size() | |
142 | : m_Ui->leftMainInspectorWidget->size(); |
|
142 | : m_Ui->leftMainInspectorWidget->size(); | |
143 |
|
143 | |||
144 | // Update of the last opened geometry |
|
144 | // Update of the last opened geometry | |
145 | if (checked) { |
|
145 | if (checked) { | |
146 | lastInspectorSize = nextInspectorSize; |
|
146 | lastInspectorSize = nextInspectorSize; | |
147 | } |
|
147 | } | |
148 |
|
148 | |||
149 | auto startSize = lastInspectorSize; |
|
149 | auto startSize = lastInspectorSize; | |
150 | auto endSize = startSize; |
|
150 | auto endSize = startSize; | |
151 | endSize.setWidth(0); |
|
151 | endSize.setWidth(0); | |
152 |
|
152 | |||
153 | auto splitterInspectorIndex |
|
153 | auto splitterInspectorIndex | |
154 | = right ? RIGHTMAININSPECTORWIDGETSPLITTERINDEX : LEFTMAININSPECTORWIDGETSPLITTERINDEX; |
|
154 | = right ? RIGHTMAININSPECTORWIDGETSPLITTERINDEX : LEFTMAININSPECTORWIDGETSPLITTERINDEX; | |
155 |
|
155 | |||
156 | auto currentSizes = m_Ui->splitter->sizes(); |
|
156 | auto currentSizes = m_Ui->splitter->sizes(); | |
157 | if (checked) { |
|
157 | if (checked) { | |
158 | // adjust sizes individually here, e.g. |
|
158 | // adjust sizes individually here, e.g. | |
159 | currentSizes[splitterInspectorIndex] -= lastInspectorSize.width(); |
|
159 | currentSizes[splitterInspectorIndex] -= lastInspectorSize.width(); | |
160 | currentSizes[VIEWPLITTERINDEX] += lastInspectorSize.width(); |
|
160 | currentSizes[VIEWPLITTERINDEX] += lastInspectorSize.width(); | |
161 | m_Ui->splitter->setSizes(currentSizes); |
|
161 | m_Ui->splitter->setSizes(currentSizes); | |
162 | } |
|
162 | } | |
163 | else { |
|
163 | else { | |
164 | // adjust sizes individually here, e.g. |
|
164 | // adjust sizes individually here, e.g. | |
165 | currentSizes[splitterInspectorIndex] += lastInspectorSize.width(); |
|
165 | currentSizes[splitterInspectorIndex] += lastInspectorSize.width(); | |
166 | currentSizes[VIEWPLITTERINDEX] -= lastInspectorSize.width(); |
|
166 | currentSizes[VIEWPLITTERINDEX] -= lastInspectorSize.width(); | |
167 | m_Ui->splitter->setSizes(currentSizes); |
|
167 | m_Ui->splitter->setSizes(currentSizes); | |
168 | } |
|
168 | } | |
169 |
|
169 | |||
170 | }; |
|
170 | }; | |
171 |
|
171 | |||
172 |
|
172 | |||
173 | connect(openLeftInspectorAction, &QAction::triggered, |
|
173 | connect(openLeftInspectorAction, &QAction::triggered, | |
174 | [openInspector, openLeftInspectorAction](bool checked) { |
|
174 | [openInspector, openLeftInspectorAction](bool checked) { | |
175 | openInspector(checked, false, openLeftInspectorAction); |
|
175 | openInspector(checked, false, openLeftInspectorAction); | |
176 | }); |
|
176 | }); | |
177 | connect(openRightInspectorAction, &QAction::triggered, |
|
177 | connect(openRightInspectorAction, &QAction::triggered, | |
178 | [openInspector, openRightInspectorAction](bool checked) { |
|
178 | [openInspector, openRightInspectorAction](bool checked) { | |
179 | openInspector(checked, true, openRightInspectorAction); |
|
179 | openInspector(checked, true, openRightInspectorAction); | |
180 | }); |
|
180 | }); | |
181 |
|
181 | |||
182 | // //////////////// // |
|
182 | // //////////////// // | |
183 | // Menu and Toolbar // |
|
183 | // Menu and Toolbar // | |
184 | // //////////////// // |
|
184 | // //////////////// // | |
185 | this->menuBar()->addAction(tr("File")); |
|
185 | this->menuBar()->addAction(tr("File")); | |
186 | auto toolsMenu = this->menuBar()->addMenu(tr("Tools")); |
|
186 | auto toolsMenu = this->menuBar()->addMenu(tr("Tools")); | |
187 | toolsMenu->addAction(tr("Settings..."), [this]() { |
|
187 | toolsMenu->addAction(tr("Settings..."), [this]() { | |
188 | // Loads settings |
|
188 | // Loads settings | |
189 | impl->m_SettingsDialog->loadSettings(); |
|
189 | impl->m_SettingsDialog->loadSettings(); | |
190 |
|
190 | |||
191 | // Open settings dialog and save settings if the dialog is accepted |
|
191 | // Open settings dialog and save settings if the dialog is accepted | |
192 | if (impl->m_SettingsDialog->exec() == QDialog::Accepted) { |
|
192 | if (impl->m_SettingsDialog->exec() == QDialog::Accepted) { | |
193 | impl->m_SettingsDialog->saveSettings(); |
|
193 | impl->m_SettingsDialog->saveSettings(); | |
194 | } |
|
194 | } | |
195 |
|
195 | |||
196 | }); |
|
196 | }); | |
197 |
|
197 | |||
198 | auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar")); |
|
198 | auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar")); | |
199 |
|
199 | |||
200 | auto timeWidget = new TimeWidget{}; |
|
200 | auto timeWidget = new TimeWidget{}; | |
201 | mainToolBar->addWidget(timeWidget); |
|
201 | mainToolBar->addWidget(timeWidget); | |
202 |
|
202 | |||
203 | // Interaction modes |
|
203 | // Interaction modes | |
204 | auto actionPointerMode = new QAction{QIcon(":/icones/pointer.png"), "Move", this}; |
|
204 | auto actionPointerMode = new QAction{QIcon(":/icones/pointer.png"), "Move", this}; | |
205 | actionPointerMode->setCheckable(true); |
|
205 | actionPointerMode->setCheckable(true); | |
206 | actionPointerMode->setChecked(sqpApp->plotsInteractionMode() |
|
206 | actionPointerMode->setChecked(sqpApp->plotsInteractionMode() | |
207 | == SqpApplication::PlotsInteractionMode::None); |
|
207 | == SqpApplication::PlotsInteractionMode::None); | |
208 | connect(actionPointerMode, &QAction::triggered, |
|
208 | connect(actionPointerMode, &QAction::triggered, | |
209 | []() { sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::None); }); |
|
209 | []() { sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::None); }); | |
210 |
|
210 | |||
211 | auto actionZoomMode = new QAction{QIcon(":/icones/zoom.png"), "Zoom", this}; |
|
211 | auto actionZoomMode = new QAction{QIcon(":/icones/zoom.png"), "Zoom", this}; | |
212 | actionZoomMode->setCheckable(true); |
|
212 | actionZoomMode->setCheckable(true); | |
213 | actionZoomMode->setChecked(sqpApp->plotsInteractionMode() |
|
213 | actionZoomMode->setChecked(sqpApp->plotsInteractionMode() | |
214 | == SqpApplication::PlotsInteractionMode::ZoomBox); |
|
214 | == SqpApplication::PlotsInteractionMode::ZoomBox); | |
215 | connect(actionZoomMode, &QAction::triggered, []() { |
|
215 | connect(actionZoomMode, &QAction::triggered, []() { | |
216 | sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::ZoomBox); |
|
216 | sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::ZoomBox); | |
217 | }); |
|
217 | }); | |
218 |
|
218 | |||
219 | auto actionOrganisationMode = new QAction{QIcon(":/icones/drag.png"), "Organize", this}; |
|
219 | auto actionOrganisationMode = new QAction{QIcon(":/icones/drag.png"), "Organize", this}; | |
220 | actionOrganisationMode->setCheckable(true); |
|
220 | actionOrganisationMode->setCheckable(true); | |
221 | actionOrganisationMode->setChecked(sqpApp->plotsInteractionMode() |
|
221 | actionOrganisationMode->setChecked(sqpApp->plotsInteractionMode() | |
222 | == SqpApplication::PlotsInteractionMode::DragAndDrop); |
|
222 | == SqpApplication::PlotsInteractionMode::DragAndDrop); | |
223 | connect(actionOrganisationMode, &QAction::triggered, []() { |
|
223 | connect(actionOrganisationMode, &QAction::triggered, []() { | |
224 | sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::DragAndDrop); |
|
224 | sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::DragAndDrop); | |
225 | }); |
|
225 | }); | |
226 |
|
226 | |||
227 | auto actionZonesMode = new QAction{QIcon(":/icones/rectangle.png"), "Zones", this}; |
|
227 | auto actionZonesMode = new QAction{QIcon(":/icones/rectangle.png"), "Zones", this}; | |
228 | actionZonesMode->setCheckable(true); |
|
228 | actionZonesMode->setCheckable(true); | |
229 | actionZonesMode->setChecked(sqpApp->plotsInteractionMode() |
|
229 | actionZonesMode->setChecked(sqpApp->plotsInteractionMode() | |
230 | == SqpApplication::PlotsInteractionMode::SelectionZones); |
|
230 | == SqpApplication::PlotsInteractionMode::SelectionZones); | |
231 | connect(actionZonesMode, &QAction::triggered, []() { |
|
231 | connect(actionZonesMode, &QAction::triggered, []() { | |
232 | sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::SelectionZones); |
|
232 | sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::SelectionZones); | |
233 | }); |
|
233 | }); | |
234 |
|
234 | |||
235 | auto modeActionGroup = new QActionGroup{this}; |
|
235 | auto modeActionGroup = new QActionGroup{this}; | |
236 | modeActionGroup->addAction(actionZoomMode); |
|
236 | modeActionGroup->addAction(actionZoomMode); | |
237 | modeActionGroup->addAction(actionZonesMode); |
|
237 | modeActionGroup->addAction(actionZonesMode); | |
238 | modeActionGroup->addAction(actionOrganisationMode); |
|
238 | modeActionGroup->addAction(actionOrganisationMode); | |
239 | modeActionGroup->addAction(actionPointerMode); |
|
239 | modeActionGroup->addAction(actionPointerMode); | |
240 | modeActionGroup->setExclusive(true); |
|
240 | modeActionGroup->setExclusive(true); | |
241 |
|
241 | |||
242 | mainToolBar->addSeparator(); |
|
242 | mainToolBar->addSeparator(); | |
243 | mainToolBar->addAction(actionPointerMode); |
|
243 | mainToolBar->addAction(actionPointerMode); | |
244 | mainToolBar->addAction(actionZoomMode); |
|
244 | mainToolBar->addAction(actionZoomMode); | |
245 | mainToolBar->addAction(actionOrganisationMode); |
|
245 | mainToolBar->addAction(actionOrganisationMode); | |
246 | mainToolBar->addAction(actionZonesMode); |
|
246 | mainToolBar->addAction(actionZonesMode); | |
247 | mainToolBar->addSeparator(); |
|
247 | mainToolBar->addSeparator(); | |
248 |
|
248 | |||
249 | // Cursors |
|
249 | // Cursors | |
250 | auto btnCursor = new QToolButton{this}; |
|
250 | auto btnCursor = new QToolButton{this}; | |
251 | btnCursor->setIcon(QIcon(":/icones/cursor.png")); |
|
251 | btnCursor->setIcon(QIcon(":/icones/cursor.png")); | |
252 | btnCursor->setText("Cursor"); |
|
252 | btnCursor->setText("Cursor"); | |
253 | btnCursor->setToolTip("Cursor"); |
|
253 | btnCursor->setToolTip("Cursor"); | |
254 | btnCursor->setPopupMode(QToolButton::InstantPopup); |
|
254 | btnCursor->setPopupMode(QToolButton::InstantPopup); | |
255 | auto cursorMenu = new QMenu("CursorMenu", this); |
|
255 | auto cursorMenu = new QMenu("CursorMenu", this); | |
256 | btnCursor->setMenu(cursorMenu); |
|
256 | btnCursor->setMenu(cursorMenu); | |
257 |
|
257 | |||
258 | auto noCursorAction = cursorMenu->addAction("No Cursor"); |
|
258 | auto noCursorAction = cursorMenu->addAction("No Cursor"); | |
259 | noCursorAction->setCheckable(true); |
|
259 | noCursorAction->setCheckable(true); | |
260 | noCursorAction->setChecked(sqpApp->plotsCursorMode() |
|
260 | noCursorAction->setChecked(sqpApp->plotsCursorMode() | |
261 | == SqpApplication::PlotsCursorMode::NoCursor); |
|
261 | == SqpApplication::PlotsCursorMode::NoCursor); | |
262 | connect(noCursorAction, &QAction::triggered, |
|
262 | connect(noCursorAction, &QAction::triggered, | |
263 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::NoCursor); }); |
|
263 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::NoCursor); }); | |
264 |
|
264 | |||
265 | cursorMenu->addSeparator(); |
|
265 | cursorMenu->addSeparator(); | |
266 | auto verticalCursorAction = cursorMenu->addAction("Vertical Cursor"); |
|
266 | auto verticalCursorAction = cursorMenu->addAction("Vertical Cursor"); | |
267 | verticalCursorAction->setCheckable(true); |
|
267 | verticalCursorAction->setCheckable(true); | |
268 | verticalCursorAction->setChecked(sqpApp->plotsCursorMode() |
|
268 | verticalCursorAction->setChecked(sqpApp->plotsCursorMode() | |
269 | == SqpApplication::PlotsCursorMode::Vertical); |
|
269 | == SqpApplication::PlotsCursorMode::Vertical); | |
270 | connect(verticalCursorAction, &QAction::triggered, |
|
270 | connect(verticalCursorAction, &QAction::triggered, | |
271 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Vertical); }); |
|
271 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Vertical); }); | |
272 |
|
272 | |||
273 | auto temporalCursorAction = cursorMenu->addAction("Temporal Cursor"); |
|
273 | auto temporalCursorAction = cursorMenu->addAction("Temporal Cursor"); | |
274 | temporalCursorAction->setCheckable(true); |
|
274 | temporalCursorAction->setCheckable(true); | |
275 | temporalCursorAction->setChecked(sqpApp->plotsCursorMode() |
|
275 | temporalCursorAction->setChecked(sqpApp->plotsCursorMode() | |
276 | == SqpApplication::PlotsCursorMode::Temporal); |
|
276 | == SqpApplication::PlotsCursorMode::Temporal); | |
277 | connect(temporalCursorAction, &QAction::triggered, |
|
277 | connect(temporalCursorAction, &QAction::triggered, | |
278 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Temporal); }); |
|
278 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Temporal); }); | |
279 |
|
279 | |||
280 | auto horizontalCursorAction = cursorMenu->addAction("Horizontal Cursor"); |
|
280 | auto horizontalCursorAction = cursorMenu->addAction("Horizontal Cursor"); | |
281 | horizontalCursorAction->setCheckable(true); |
|
281 | horizontalCursorAction->setCheckable(true); | |
282 | horizontalCursorAction->setChecked(sqpApp->plotsCursorMode() |
|
282 | horizontalCursorAction->setChecked(sqpApp->plotsCursorMode() | |
283 | == SqpApplication::PlotsCursorMode::Horizontal); |
|
283 | == SqpApplication::PlotsCursorMode::Horizontal); | |
284 | connect(horizontalCursorAction, &QAction::triggered, |
|
284 | connect(horizontalCursorAction, &QAction::triggered, | |
285 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Horizontal); }); |
|
285 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Horizontal); }); | |
286 |
|
286 | |||
287 | auto crossCursorAction = cursorMenu->addAction("Cross Cursor"); |
|
287 | auto crossCursorAction = cursorMenu->addAction("Cross Cursor"); | |
288 | crossCursorAction->setCheckable(true); |
|
288 | crossCursorAction->setCheckable(true); | |
289 | crossCursorAction->setChecked(sqpApp->plotsCursorMode() |
|
289 | crossCursorAction->setChecked(sqpApp->plotsCursorMode() | |
290 | == SqpApplication::PlotsCursorMode::Cross); |
|
290 | == SqpApplication::PlotsCursorMode::Cross); | |
291 | connect(crossCursorAction, &QAction::triggered, |
|
291 | connect(crossCursorAction, &QAction::triggered, | |
292 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Cross); }); |
|
292 | []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Cross); }); | |
293 |
|
293 | |||
294 | mainToolBar->addWidget(btnCursor); |
|
294 | mainToolBar->addWidget(btnCursor); | |
295 |
|
295 | |||
296 | auto cursorModeActionGroup = new QActionGroup{this}; |
|
296 | auto cursorModeActionGroup = new QActionGroup{this}; | |
297 | cursorModeActionGroup->setExclusive(true); |
|
297 | cursorModeActionGroup->setExclusive(true); | |
298 | cursorModeActionGroup->addAction(noCursorAction); |
|
298 | cursorModeActionGroup->addAction(noCursorAction); | |
299 | cursorModeActionGroup->addAction(verticalCursorAction); |
|
299 | cursorModeActionGroup->addAction(verticalCursorAction); | |
300 | cursorModeActionGroup->addAction(temporalCursorAction); |
|
300 | cursorModeActionGroup->addAction(temporalCursorAction); | |
301 | cursorModeActionGroup->addAction(horizontalCursorAction); |
|
301 | cursorModeActionGroup->addAction(horizontalCursorAction); | |
302 | cursorModeActionGroup->addAction(crossCursorAction); |
|
302 | cursorModeActionGroup->addAction(crossCursorAction); | |
303 |
|
303 | |||
304 | // Catalog |
|
304 | // Catalog | |
305 | mainToolBar->addSeparator(); |
|
305 | mainToolBar->addSeparator(); | |
306 | mainToolBar->addAction(QIcon(":/icones/catalogue.png"), "Catalogues", |
|
306 | mainToolBar->addAction(QIcon(":/icones/catalogue.png"), "Catalogues", | |
307 | [this]() { impl->m_CatalogExplorer->show(); }); |
|
307 | [this]() { impl->m_CatalogExplorer->show(); }); | |
308 |
|
308 | |||
309 | // //////// // |
|
309 | // //////// // | |
310 | // Settings // |
|
310 | // Settings // | |
311 | // //////// // |
|
311 | // //////// // | |
312 |
|
312 | |||
313 | // Registers "general settings" widget to the settings dialog |
|
313 | // Registers "general settings" widget to the settings dialog | |
314 | impl->m_SettingsDialog->registerWidget(QStringLiteral("General"), |
|
314 | impl->m_SettingsDialog->registerWidget(QStringLiteral("General"), | |
315 | impl->m_GeneralSettingsWidget); |
|
315 | impl->m_GeneralSettingsWidget); | |
316 |
|
316 | |||
317 | // /////////// // |
|
317 | // /////////// // | |
318 | // Connections // |
|
318 | // Connections // | |
319 | // /////////// // |
|
319 | // /////////// // | |
320 |
|
320 | |||
321 | // Controllers / controllers connections |
|
321 | // Controllers / controllers connections | |
322 | connect(&sqpApp->timeController(), SIGNAL(timeUpdated(SqpRange)), &sqpApp->variableController(), |
|
322 | connect(&sqpApp->timeController(), SIGNAL(timeUpdated(SqpRange)), &sqpApp->variableController(), | |
323 | SLOT(onDateTimeOnSelection(SqpRange))); |
|
323 | SLOT(onDateTimeOnSelection(SqpRange))); | |
324 |
|
324 | |||
325 | // Widgets / controllers connections |
|
325 | // Widgets / controllers connections | |
326 |
|
326 | |||
327 | // DataSource |
|
327 | // DataSource | |
328 | connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)), |
|
328 | connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)), | |
329 | m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *))); |
|
329 | m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *))); | |
330 |
|
330 | |||
331 | // Time |
|
331 | // Time | |
332 | connect(timeWidget, SIGNAL(timeUpdated(SqpRange)), &sqpApp->timeController(), |
|
332 | connect(timeWidget, SIGNAL(timeUpdated(SqpRange)), &sqpApp->timeController(), | |
333 | SLOT(onTimeToUpdate(SqpRange))); |
|
333 | SLOT(onTimeToUpdate(SqpRange))); | |
334 |
|
334 | |||
335 | // Visualization |
|
335 | // Visualization | |
336 | connect(&sqpApp->visualizationController(), |
|
336 | connect(&sqpApp->visualizationController(), | |
337 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), m_Ui->view, |
|
337 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), m_Ui->view, | |
338 | SLOT(onVariableAboutToBeDeleted(std::shared_ptr<Variable>))); |
|
338 | SLOT(onVariableAboutToBeDeleted(std::shared_ptr<Variable>))); | |
339 |
|
339 | |||
340 | connect(&sqpApp->visualizationController(), |
|
340 | connect(&sqpApp->visualizationController(), | |
341 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &)), m_Ui->view, |
|
341 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &)), m_Ui->view, | |
342 | SLOT(onRangeChanged(std::shared_ptr<Variable>, const SqpRange &))); |
|
342 | SLOT(onRangeChanged(std::shared_ptr<Variable>, const SqpRange &))); | |
343 |
|
343 | |||
344 | // Widgets / widgets connections |
|
344 | // Widgets / widgets connections | |
345 |
|
345 | |||
346 | // For the following connections, we use DirectConnection to allow each widget that can |
|
346 | // For the following connections, we use DirectConnection to allow each widget that can | |
347 | // potentially attach a menu to the variable's menu to do so before this menu is displayed. |
|
347 | // potentially attach a menu to the variable's menu to do so before this menu is displayed. | |
348 | // The order of connections is also important, since it determines the order in which each |
|
348 | // The order of connections is also important, since it determines the order in which each | |
349 | // widget will attach its menu |
|
349 | // widget will attach its menu | |
350 | connect( |
|
350 | connect( | |
351 | m_Ui->variableInspectorWidget, |
|
351 | m_Ui->variableInspectorWidget, | |
352 | SIGNAL(tableMenuAboutToBeDisplayed(QMenu *, const QVector<std::shared_ptr<Variable> > &)), |
|
352 | SIGNAL(tableMenuAboutToBeDisplayed(QMenu *, const QVector<std::shared_ptr<Variable> > &)), | |
353 | m_Ui->view, SLOT(attachVariableMenu(QMenu *, const QVector<std::shared_ptr<Variable> > &)), |
|
353 | m_Ui->view, SLOT(attachVariableMenu(QMenu *, const QVector<std::shared_ptr<Variable> > &)), | |
354 | Qt::DirectConnection); |
|
354 | Qt::DirectConnection); | |
355 | } |
|
355 | } | |
356 |
|
356 | |||
357 | MainWindow::~MainWindow() |
|
357 | MainWindow::~MainWindow() | |
358 | { |
|
358 | { | |
359 | } |
|
359 | } | |
360 |
|
360 | |||
361 | void MainWindow::changeEvent(QEvent *e) |
|
361 | void MainWindow::changeEvent(QEvent *e) | |
362 | { |
|
362 | { | |
363 | QMainWindow::changeEvent(e); |
|
363 | QMainWindow::changeEvent(e); | |
364 | switch (e->type()) { |
|
364 | switch (e->type()) { | |
365 | case QEvent::LanguageChange: |
|
365 | case QEvent::LanguageChange: | |
366 | m_Ui->retranslateUi(this); |
|
366 | m_Ui->retranslateUi(this); | |
367 | break; |
|
367 | break; | |
368 | default: |
|
368 | default: | |
369 | break; |
|
369 | break; | |
370 | } |
|
370 | } | |
371 | } |
|
371 | } | |
372 |
|
372 | |||
373 | void MainWindow::closeEvent(QCloseEvent *event) |
|
373 | void MainWindow::closeEvent(QCloseEvent *event) | |
374 | { |
|
374 | { | |
375 | if (!impl->checkDataToSave(this)) { |
|
375 | if (!impl->checkDataToSave(this)) { | |
376 | event->ignore(); |
|
376 | event->ignore(); | |
377 | } |
|
377 | } | |
378 | else { |
|
378 | else { | |
379 | event->accept(); |
|
379 | event->accept(); | |
380 | } |
|
380 | } | |
381 | } |
|
381 | } | |
382 |
|
382 | |||
383 | bool MainWindow::MainWindowPrivate::checkDataToSave(QWidget *parentWidget) |
|
383 | bool MainWindow::MainWindowPrivate::checkDataToSave(QWidget *parentWidget) | |
384 | { |
|
384 | { | |
385 | auto hasChanges = sqpApp->catalogueController().hasChanges(); |
|
385 | auto hasChanges = sqpApp->catalogueController().hasChanges(); | |
386 | if (hasChanges) { |
|
386 | if (hasChanges) { | |
387 | // There are some unsaved changes |
|
387 | // There are some unsaved changes | |
388 | switch (QMessageBox::question( |
|
388 | switch (QMessageBox::question( | |
389 | parentWidget, tr("Save changes"), |
|
389 | parentWidget, tr("Save changes"), | |
390 | tr("The catalogue controller has unsaved changes.\nDo you want to save them ?"), |
|
390 | tr("The catalogue controller has unsaved changes.\nDo you want to save them ?"), | |
391 | QMessageBox::SaveAll | QMessageBox::Discard | QMessageBox::Cancel, |
|
391 | QMessageBox::SaveAll | QMessageBox::Discard | QMessageBox::Cancel, | |
392 | QMessageBox::SaveAll)) { |
|
392 | QMessageBox::SaveAll)) { | |
393 | case QMessageBox::SaveAll: |
|
393 | case QMessageBox::SaveAll: | |
394 | sqpApp->catalogueController().saveAll(); |
|
394 | sqpApp->catalogueController().saveAll(); | |
395 | break; |
|
395 | break; | |
396 | case QMessageBox::Discard: |
|
396 | case QMessageBox::Discard: | |
397 | break; |
|
397 | break; | |
398 | case QMessageBox::Cancel: |
|
398 | case QMessageBox::Cancel: | |
399 | default: |
|
399 | default: | |
400 | return false; |
|
400 | return false; | |
401 | } |
|
401 | } | |
402 | } |
|
402 | } | |
403 |
|
403 | |||
404 | return true; |
|
404 | return true; | |
405 | } |
|
405 | } |
@@ -1,173 +1,31 | |||||
1 | ## core - CMakeLists.txt |
|
1 | FILE (GLOB_RECURSE core_SRCS | |
2 | STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX) |
|
2 | include/*.h | |
3 | SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}") |
|
3 | src/*.cpp | |
4 | SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/") |
|
|||
5 | SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/") |
|
|||
6 | SET(TESTS_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests-resources") |
|
|||
7 |
|
||||
8 | # Include core directory |
|
|||
9 | include_directories("${INCLUDES_DIR}") |
|
|||
10 |
|
||||
11 | # Set a variable to display a warning in the version files. |
|
|||
12 | SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.") |
|
|||
13 | # Generate the version file from the cmake version variables. The version |
|
|||
14 | # variables are defined in the cmake/sciqlop_version.cmake file. |
|
|||
15 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in" |
|
|||
16 | "${INCLUDES_DIR}/Version.h") |
|
|||
17 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in" |
|
|||
18 | "${SOURCES_DIR}/Version.cpp") |
|
|||
19 |
|
||||
20 | # Find dependent modules |
|
|||
21 | find_package(sciqlop-plugin) |
|
|||
22 | INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR}) |
|
|||
23 |
|
||||
24 | # |
|
|||
25 | # Find Qt modules |
|
|||
26 | # |
|
|||
27 | SCIQLOP_FIND_QT(Core Network) |
|
|||
28 |
|
||||
29 | # |
|
|||
30 | # Compile the library library |
|
|||
31 | # |
|
|||
32 |
|
||||
33 | ADD_DEFINITIONS(-DCORE_LIB) |
|
|||
34 |
|
||||
35 | FILE (GLOB_RECURSE MODULE_SOURCES |
|
|||
36 | ${INCLUDES_DIR}/*.h |
|
|||
37 | ${SOURCES_DIR}/*.c |
|
|||
38 | ${SOURCES_DIR}/*.cpp |
|
|||
39 | ${SOURCES_DIR}/*.h) |
|
|||
40 |
|
||||
41 | ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES}) |
|
|||
42 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) |
|
|||
43 | set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
|||
44 | TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME}) |
|
|||
45 | qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core Network) |
|
|||
46 |
|
||||
47 | # Find CATALOGUE_API |
|
|||
48 | include_directories("${CATALOGUEAPI_INCLUDE}") |
|
|||
49 | TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES}) |
|
|||
50 | INSTALL(TARGETS ${SQPCORE_LIBRARY_NAME} |
|
|||
51 | RUNTIME DESTINATION ${INSTALL_BINARY_DIR} |
|
|||
52 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} |
|
|||
53 | ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} |
|
|||
54 | ) |
|
4 | ) | |
55 |
|
5 | |||
56 | add_dependencies(${SQPCORE_LIBRARY_NAME} CatalogueAPI) |
|
6 | add_definitions(-DCORE_STATIC) | |
57 |
|
||||
58 | # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html |
|
|||
59 | # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order. |
|
|||
60 | # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets |
|
|||
61 | IF(BUILD_SHARED_LIBS) |
|
|||
62 | SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT") |
|
|||
63 | ELSE() |
|
|||
64 | TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES") |
|
|||
65 | ENDIF() |
|
|||
66 |
|
||||
67 | # Set the variable to parent scope so that the other projects can copy the |
|
|||
68 | # dependent shared libraries |
|
|||
69 | SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME) |
|
|||
70 |
|
||||
71 | ## Copy extern shared libraries to the lib folder |
|
|||
72 | LIST (APPEND ${EXTERN_SHARED_LIBRARIES} ${CATALOGUEAPI_LIBRARIES}) |
|
|||
73 |
|
||||
74 |
|
7 | |||
75 | SET (COPY_LIBS_DESTINATION LIBRARY) |
|
8 | add_library(sciqlopcore ${core_SRCS}) | |
76 | if(APPLE) |
|
9 | SET_TARGET_PROPERTIES(sciqlopcore PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) | |
77 | SET (COPY_LIBS_DESTINATION RUNTIME) |
|
|||
78 | endif() |
|
|||
79 |
|
10 | |||
80 | add_custom_command(TARGET ${SQPCORE_LIBRARY_NAME} POST_BUILD |
|
11 | target_include_directories(sciqlopcore PUBLIC | |
81 | COMMAND ${CMAKE_COMMAND} -E copy ${CATALOGUEAPI_LIBRARIES} ${EXECUTABLE_OUTPUT_PATH} |
|
12 | $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | |
|
13 | $<INSTALL_INTERFACE:include/SciQLOP> | |||
82 | ) |
|
14 | ) | |
83 |
|
15 | |||
84 | # Add the files to the list of files to be analyzed |
|
16 | target_link_libraries(sciqlopcore PUBLIC | |
85 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) |
|
17 | Qt5::Core | |
86 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) |
|
18 | Qt5::Network | |
87 | # Vera++ exclusion files |
|
19 | CatalogueAPI | |
88 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt) |
|
20 | ) | |
89 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) |
|
|||
90 |
|
||||
91 | # |
|
|||
92 | # Compile the tests |
|
|||
93 | # |
|
|||
94 | IF(BUILD_TESTS) |
|
|||
95 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) |
|
|||
96 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) |
|
|||
97 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) |
|
|||
98 | SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME}) |
|
|||
99 | list(APPEND TEST_LIBRARIES ${CATALOGUEAPI_LIBRARIES}) |
|
|||
100 |
|
||||
101 | SET(TARGETS_COV) |
|
|||
102 | FOREACH( testFile ${TESTS_SOURCES} ) |
|
|||
103 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) |
|
|||
104 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) |
|
|||
105 |
|
||||
106 | # Add to the list of sources files all the sources in the same |
|
|||
107 | # directory that aren't another test |
|
|||
108 | FILE (GLOB currentTestSources |
|
|||
109 | ${testDirectory}/*.c |
|
|||
110 | ${testDirectory}/*.cpp |
|
|||
111 | ${testDirectory}/*.h) |
|
|||
112 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) |
|
|||
113 | # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) |
|
|||
114 |
|
||||
115 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) |
|
|||
116 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14) |
|
|||
117 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
|||
118 | TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES}) |
|
|||
119 | qt5_use_modules(${testName} Test) |
|
|||
120 |
|
||||
121 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) |
|
|||
122 |
|
||||
123 | set(Coverage_NAME ${testName}) |
|
|||
124 | if(UNIX) |
|
|||
125 | SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName}) |
|
|||
126 | LIST( APPEND TARGETS_COV ${testName}_coverage) |
|
|||
127 | endif(UNIX) |
|
|||
128 |
|
||||
129 | ENDFOREACH( testFile ) |
|
|||
130 |
|
||||
131 | add_custom_target(coverage) |
|
|||
132 |
|
||||
133 | FOREACH( target_cov ${TARGETS_COV} ) |
|
|||
134 | add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov}) |
|
|||
135 | ENDFOREACH( target_cov ) |
|
|||
136 |
|
||||
137 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) |
|
|||
138 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) |
|
|||
139 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) |
|
|||
140 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
|||
141 |
|
||||
142 | ADD_DEFINITIONS(-DCORE_TESTS_RESOURCES_DIR="${TESTS_RESOURCES_DIR}") |
|
|||
143 | ENDIF(BUILD_TESTS) |
|
|||
144 |
|
21 | |||
145 | # |
|
22 | install(TARGETS sciqlopcore EXPORT SciQLOPCoreConfig | |
146 | # Set the files that must be formatted by clang-format. |
|
23 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | |
147 | # |
|
24 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | |
148 | LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES}) |
|
25 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | |
149 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
|||
150 |
|
26 | |||
151 | # |
|
27 | install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SciQLOP) | |
152 | # Set the directories that doxygen must browse to generate the |
|
28 | install(EXPORT SciQLOPCoreConfig DESTINATION share/SciQLOPCore/cmake) | |
153 | # documentation. |
|
29 | export(TARGETS sciqlopcore FILE SciQLOPCoreConfig.cmake) | |
154 | # |
|
|||
155 | # Source directories: |
|
|||
156 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") |
|
|||
157 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
|||
158 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) |
|
|||
159 | # Source directories to exclude from the documentation generation |
|
|||
160 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") |
|
|||
161 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) |
|
|||
162 |
|
30 | |||
163 | # |
|
31 | add_subdirectory(tests) | |
164 | # Set the directories with the sources to analyze and propagate the |
|
|||
165 | # modification to the parent scope |
|
|||
166 | # |
|
|||
167 | # Source directories to analyze: |
|
|||
168 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
|||
169 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") |
|
|||
170 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) |
|
|||
171 | # Source directories to exclude from the analysis |
|
|||
172 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") |
|
|||
173 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS) |
|
1 | NO CONTENT: file renamed from plugin/include/Plugin/IPlugin.h to core/include/Plugin/IPlugin.h |
|
NO CONTENT: file renamed from plugin/include/Plugin/IPlugin.h to core/include/Plugin/IPlugin.h |
@@ -1,41 +1,41 | |||||
1 | #ifndef SCIQLOP_PLUGINMANAGER_H |
|
1 | #ifndef SCIQLOP_PLUGINMANAGER_H | |
2 | #define SCIQLOP_PLUGINMANAGER_H |
|
2 | #define SCIQLOP_PLUGINMANAGER_H | |
3 |
|
3 | |||
4 | #include "CoreGlobal.h" |
|
4 | #include "CoreGlobal.h" | |
5 |
|
5 | |||
6 | #include <Common/spimpl.h> |
|
6 | #include <Common/spimpl.h> | |
7 |
|
7 | |||
8 | #include <QLoggingCategory> |
|
8 | #include <QLoggingCategory> | |
9 |
|
9 | |||
10 | class QDir; |
|
10 | class QDir; | |
11 |
|
11 | |||
12 | Q_DECLARE_LOGGING_CATEGORY(LOG_PluginManager) |
|
12 | Q_DECLARE_LOGGING_CATEGORY(LOG_PluginManager) | |
13 |
|
13 | |||
14 | /** |
|
14 | /** | |
15 | * @brief The PluginManager class aims to handle the plugins loaded dynamically into SciQLop. |
|
15 | * @brief The PluginManager class aims to handle the plugins loaded dynamically into SciQLop. | |
16 | */ |
|
16 | */ | |
17 |
class |
|
17 | class PluginManager { | |
18 | public: |
|
18 | public: | |
19 | explicit PluginManager(); |
|
19 | explicit PluginManager(); | |
20 |
|
20 | |||
21 | /** |
|
21 | /** | |
22 | * Loads plugins into SciQlop. The loaded plugins are those located in the directory passed in |
|
22 | * Loads plugins into SciQlop. The loaded plugins are those located in the directory passed in | |
23 | * parameter |
|
23 | * parameter | |
24 | * @param pluginDir the directory containing the plugins |
|
24 | * @param pluginDir the directory containing the plugins | |
25 | */ |
|
25 | */ | |
26 | void loadPlugins(const QDir &pluginDir); |
|
26 | void loadPlugins(const QDir &pluginDir); | |
27 |
|
27 | |||
28 | /** |
|
28 | /** | |
29 | * Loads static plugins into SciQlop. SciQLOP supports statically linked plugins. |
|
29 | * Loads static plugins into SciQlop. SciQLOP supports statically linked plugins. | |
30 | */ |
|
30 | */ | |
31 | void loadStaticPlugins(); |
|
31 | void loadStaticPlugins(); | |
32 |
|
32 | |||
33 | /// @returns the number of plugins loaded |
|
33 | /// @returns the number of plugins loaded | |
34 | int nbPluginsLoaded() const noexcept; |
|
34 | int nbPluginsLoaded() const noexcept; | |
35 |
|
35 | |||
36 | private: |
|
36 | private: | |
37 | struct PluginManagerPrivate; |
|
37 | struct PluginManagerPrivate; | |
38 | spimpl::unique_impl_ptr<PluginManagerPrivate> impl; |
|
38 | spimpl::unique_impl_ptr<PluginManagerPrivate> impl; | |
39 | }; |
|
39 | }; | |
40 |
|
40 | |||
41 | #endif // SCIQLOP_PLUGINMANAGER_H |
|
41 | #endif // SCIQLOP_PLUGINMANAGER_H |
@@ -1,137 +1,137 | |||||
1 | #include <Plugin/PluginManager.h> |
|
1 | #include <PluginManager/PluginManager.h> | |
2 |
|
2 | |||
3 | #include <Plugin/IPlugin.h> |
|
3 | #include <Plugin/IPlugin.h> | |
4 |
|
4 | |||
5 | #include <QDir> |
|
5 | #include <QDir> | |
6 | #include <QLibrary> |
|
6 | #include <QLibrary> | |
7 | #include <QPluginLoader> |
|
7 | #include <QPluginLoader> | |
8 |
|
8 | |||
9 | Q_LOGGING_CATEGORY(LOG_PluginManager, "PluginManager") |
|
9 | Q_LOGGING_CATEGORY(LOG_PluginManager, "PluginManager") | |
10 |
|
10 | |||
11 | namespace { |
|
11 | namespace { | |
12 |
|
12 | |||
13 | /// Key for retrieving metadata of the plugin |
|
13 | /// Key for retrieving metadata of the plugin | |
14 | const auto PLUGIN_METADATA_KEY = QStringLiteral("MetaData"); |
|
14 | const auto PLUGIN_METADATA_KEY = QStringLiteral("MetaData"); | |
15 |
|
15 | |||
16 | /// Key for retrieving the name of the plugin in its metadata |
|
16 | /// Key for retrieving the name of the plugin in its metadata | |
17 | const auto PLUGIN_NAME_KEY = QStringLiteral("name"); |
|
17 | const auto PLUGIN_NAME_KEY = QStringLiteral("name"); | |
18 |
|
18 | |||
19 | /// Helper to state the plugin loading operation |
|
19 | /// Helper to state the plugin loading operation | |
20 | struct LoadPluginState { |
|
20 | struct LoadPluginState { | |
21 | explicit LoadPluginState(const QString &pluginPath) |
|
21 | explicit LoadPluginState(const QString &pluginPath) | |
22 | : m_PluginPath{pluginPath}, m_Valid{true}, m_ErrorMessage{} |
|
22 | : m_PluginPath{pluginPath}, m_Valid{true}, m_ErrorMessage{} | |
23 | { |
|
23 | { | |
24 | } |
|
24 | } | |
25 |
|
25 | |||
26 | void log() const |
|
26 | void log() const | |
27 | { |
|
27 | { | |
28 | if (m_Valid) { |
|
28 | if (m_Valid) { | |
29 | qCDebug(LOG_PluginManager()) |
|
29 | qCDebug(LOG_PluginManager()) | |
30 | << QObject::tr("File '%1' has been loaded as a plugin").arg(m_PluginPath); |
|
30 | << QObject::tr("File '%1' has been loaded as a plugin").arg(m_PluginPath); | |
31 | } |
|
31 | } | |
32 | else { |
|
32 | else { | |
33 | qCWarning(LOG_PluginManager()) |
|
33 | qCWarning(LOG_PluginManager()) | |
34 | << QObject::tr("File '%1' can't be loaded as a plugin: %2") |
|
34 | << QObject::tr("File '%1' can't be loaded as a plugin: %2") | |
35 | .arg(m_PluginPath) |
|
35 | .arg(m_PluginPath) | |
36 | .arg(m_ErrorMessage); |
|
36 | .arg(m_ErrorMessage); | |
37 | } |
|
37 | } | |
38 | } |
|
38 | } | |
39 |
|
39 | |||
40 | void setError(const QString &errorMessage) |
|
40 | void setError(const QString &errorMessage) | |
41 | { |
|
41 | { | |
42 | m_Valid = false; |
|
42 | m_Valid = false; | |
43 | m_ErrorMessage = errorMessage; |
|
43 | m_ErrorMessage = errorMessage; | |
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 | QString m_PluginPath; |
|
46 | QString m_PluginPath; | |
47 | bool m_Valid; |
|
47 | bool m_Valid; | |
48 | QString m_ErrorMessage; |
|
48 | QString m_ErrorMessage; | |
49 | }; |
|
49 | }; | |
50 |
|
50 | |||
51 | } // namespace |
|
51 | } // namespace | |
52 |
|
52 | |||
53 | struct PluginManager::PluginManagerPrivate { |
|
53 | struct PluginManager::PluginManagerPrivate { | |
54 | /** |
|
54 | /** | |
55 | * Loads a single plugin into SciQlop. The method has no effect if the plugin is malformed (e.g. |
|
55 | * Loads a single plugin into SciQlop. The method has no effect if the plugin is malformed (e.g. | |
56 | * wrong library type, missing metadata, etc.) |
|
56 | * wrong library type, missing metadata, etc.) | |
57 | * @param pluginPath the path to the plugin library. |
|
57 | * @param pluginPath the path to the plugin library. | |
58 | */ |
|
58 | */ | |
59 | void loadPlugin(const QString &pluginPath) |
|
59 | void loadPlugin(const QString &pluginPath) | |
60 | { |
|
60 | { | |
61 | qCDebug(LOG_PluginManager()) |
|
61 | qCDebug(LOG_PluginManager()) | |
62 | << QObject::tr("Attempting to load file '%1' as a plugin").arg(pluginPath); |
|
62 | << QObject::tr("Attempting to load file '%1' as a plugin").arg(pluginPath); | |
63 |
|
63 | |||
64 | LoadPluginState loadState{pluginPath}; |
|
64 | LoadPluginState loadState{pluginPath}; | |
65 |
|
65 | |||
66 | if (QLibrary::isLibrary(pluginPath)) { |
|
66 | if (QLibrary::isLibrary(pluginPath)) { | |
67 | QPluginLoader pluginLoader{pluginPath}; |
|
67 | QPluginLoader pluginLoader{pluginPath}; | |
68 |
|
68 | |||
69 | // Retrieving the plugin name to check if it can be loaded (i.e. no plugin with the same |
|
69 | // Retrieving the plugin name to check if it can be loaded (i.e. no plugin with the same | |
70 | // name has been registered yet) |
|
70 | // name has been registered yet) | |
71 | auto metadata = pluginLoader.metaData().value(PLUGIN_METADATA_KEY).toObject(); |
|
71 | auto metadata = pluginLoader.metaData().value(PLUGIN_METADATA_KEY).toObject(); | |
72 | auto pluginName = metadata.value(PLUGIN_NAME_KEY).toString(); |
|
72 | auto pluginName = metadata.value(PLUGIN_NAME_KEY).toString(); | |
73 |
|
73 | |||
74 | if (pluginName.isEmpty()) { |
|
74 | if (pluginName.isEmpty()) { | |
75 | loadState.setError(QObject::tr("empty file name")); |
|
75 | loadState.setError(QObject::tr("empty file name")); | |
76 | } |
|
76 | } | |
77 | else if (m_RegisteredPlugins.contains(pluginName)) { |
|
77 | else if (m_RegisteredPlugins.contains(pluginName)) { | |
78 | loadState.setError(QObject::tr("name '%1' already registered").arg(pluginName)); |
|
78 | loadState.setError(QObject::tr("name '%1' already registered").arg(pluginName)); | |
79 | } |
|
79 | } | |
80 | else { |
|
80 | else { | |
81 | if (auto pluginInstance = qobject_cast<IPlugin *>(pluginLoader.instance())) { |
|
81 | if (auto pluginInstance = qobject_cast<IPlugin *>(pluginLoader.instance())) { | |
82 | pluginInstance->initialize(); |
|
82 | pluginInstance->initialize(); | |
83 | m_RegisteredPlugins.insert(pluginName, pluginPath); |
|
83 | m_RegisteredPlugins.insert(pluginName, pluginPath); | |
84 | } |
|
84 | } | |
85 | else { |
|
85 | else { | |
86 | loadState.setError(QObject::tr("the file is not a Sciqlop plugin")); |
|
86 | loadState.setError(QObject::tr("the file is not a Sciqlop plugin")); | |
87 | } |
|
87 | } | |
88 | } |
|
88 | } | |
89 | } |
|
89 | } | |
90 | else { |
|
90 | else { | |
91 | loadState.setError(QObject::tr("the file is not a library")); |
|
91 | loadState.setError(QObject::tr("the file is not a library")); | |
92 | } |
|
92 | } | |
93 |
|
93 | |||
94 | // Log loading result |
|
94 | // Log loading result | |
95 | loadState.log(); |
|
95 | loadState.log(); | |
96 | } |
|
96 | } | |
97 |
|
97 | |||
98 | void loadStaticPlugins() |
|
98 | void loadStaticPlugins() | |
99 | { |
|
99 | { | |
100 | for (QObject *plugin : QPluginLoader::staticInstances()) { |
|
100 | for (QObject *plugin : QPluginLoader::staticInstances()) { | |
101 | qobject_cast<IPlugin *>(plugin)->initialize(); |
|
101 | qobject_cast<IPlugin *>(plugin)->initialize(); | |
102 | m_RegisteredPlugins.insert(plugin->metaObject()->className(), "StaticPlugin"); |
|
102 | m_RegisteredPlugins.insert(plugin->metaObject()->className(), "StaticPlugin"); | |
103 | } |
|
103 | } | |
104 | } |
|
104 | } | |
105 |
|
105 | |||
106 | /// Registered plugins (key: plugin name, value: plugin path) |
|
106 | /// Registered plugins (key: plugin name, value: plugin path) | |
107 | QHash<QString, QString> m_RegisteredPlugins; |
|
107 | QHash<QString, QString> m_RegisteredPlugins; | |
108 | }; |
|
108 | }; | |
109 |
|
109 | |||
110 | PluginManager::PluginManager() : impl{spimpl::make_unique_impl<PluginManagerPrivate>()} |
|
110 | PluginManager::PluginManager() : impl{spimpl::make_unique_impl<PluginManagerPrivate>()} | |
111 | { |
|
111 | { | |
112 | } |
|
112 | } | |
113 |
|
113 | |||
114 | void PluginManager::loadPlugins(const QDir &pluginDir) |
|
114 | void PluginManager::loadPlugins(const QDir &pluginDir) | |
115 | { |
|
115 | { | |
116 | // Load plugins |
|
116 | // Load plugins | |
117 | auto pluginInfoList |
|
117 | auto pluginInfoList | |
118 | = pluginDir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); |
|
118 | = pluginDir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); | |
119 | for (auto entryInfo : qAsConst(pluginInfoList)) { |
|
119 | for (auto entryInfo : qAsConst(pluginInfoList)) { | |
120 | if (entryInfo.isDir()) { |
|
120 | if (entryInfo.isDir()) { | |
121 | this->loadPlugins(QDir{entryInfo.absoluteFilePath()}); |
|
121 | this->loadPlugins(QDir{entryInfo.absoluteFilePath()}); | |
122 | } |
|
122 | } | |
123 | else if (QLibrary::isLibrary(entryInfo.absoluteFilePath())) { |
|
123 | else if (QLibrary::isLibrary(entryInfo.absoluteFilePath())) { | |
124 | impl->loadPlugin(entryInfo.absoluteFilePath()); |
|
124 | impl->loadPlugin(entryInfo.absoluteFilePath()); | |
125 | } |
|
125 | } | |
126 | } |
|
126 | } | |
127 | } |
|
127 | } | |
128 |
|
128 | |||
129 | void PluginManager::loadStaticPlugins() |
|
129 | void PluginManager::loadStaticPlugins() | |
130 | { |
|
130 | { | |
131 | impl->loadStaticPlugins(); |
|
131 | impl->loadStaticPlugins(); | |
132 | } |
|
132 | } | |
133 |
|
133 | |||
134 | int PluginManager::nbPluginsLoaded() const noexcept |
|
134 | int PluginManager::nbPluginsLoaded() const noexcept | |
135 | { |
|
135 | { | |
136 | return impl->m_RegisteredPlugins.size(); |
|
136 | return impl->m_RegisteredPlugins.size(); | |
137 | } |
|
137 | } |
@@ -1,179 +1,52 | |||||
1 |
|
1 | FILE (GLOB_RECURSE gui_SRCS | ||
2 | ## gui - CMakeLists.txt |
|
2 | include/*.h | |
3 | STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX) |
|
3 | src/*.cpp | |
4 | SET(SQPGUI_LIBRARY_NAME "${LIBRARY_PREFFIX}_gui${DEBUG_SUFFIX}") |
|
4 | resources/*.qrc | |
5 | SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
|||
6 | SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") |
|
|||
7 | SET(UI_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/ui") |
|
|||
8 | SET(RES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/resources") |
|
|||
9 |
|
||||
10 | # Include gui directory |
|
|||
11 | include_directories("${INCLUDES_DIR}") |
|
|||
12 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") |
|
|||
13 |
|
||||
14 | # Set a variable to display a warning in the version files. |
|
|||
15 | SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.") |
|
|||
16 |
|
||||
17 | # |
|
|||
18 | # Find Qt modules |
|
|||
19 | # |
|
|||
20 | SCIQLOP_FIND_QT(Core Widgets PrintSupport) |
|
|||
21 |
|
||||
22 | # |
|
|||
23 | # Find dependent libraries |
|
|||
24 | # ======================== |
|
|||
25 | find_package(sciqlop-core) |
|
|||
26 |
|
||||
27 | SET(LIBRARIES ${SCIQLOP-CORE_LIBRARIES}) |
|
|||
28 |
|
||||
29 | INCLUDE_DIRECTORIES(${SCIQLOP-CORE_INCLUDE_DIR}) |
|
|||
30 |
|
||||
31 | # Add sqpcore to the list of libraries to use |
|
|||
32 | list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME}) |
|
|||
33 |
|
||||
34 | # Add dependent shared libraries |
|
|||
35 | list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES}) |
|
|||
36 |
|
||||
37 |
|
||||
38 | # Ui files |
|
|||
39 | FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui) |
|
|||
40 |
|
||||
41 | # Resources files |
|
|||
42 | FILE (GLOB_RECURSE PROJECT_RESOURCES ${RES_FOLDER}/*.qrc) |
|
|||
43 |
|
||||
44 | # |
|
|||
45 | # Compile the library library |
|
|||
46 | # |
|
|||
47 | FILE (GLOB_RECURSE MODULE_SOURCES |
|
|||
48 | ${INCLUDES_DIR}/*.h |
|
|||
49 | ${SOURCES_DIR}/*.c |
|
|||
50 | ${SOURCES_DIR}/*.cpp |
|
|||
51 | ${SOURCES_DIR}/*.h |
|
|||
52 | ${PROJECT_FORMS}) |
|
|||
53 |
|
||||
54 | QT5_ADD_RESOURCES(RCC_HDRS |
|
|||
55 | ${PROJECT_RESOURCES} |
|
|||
56 | ) |
|
5 | ) | |
57 |
|
6 | |||
58 |
QT5_WRAP_UI( |
|
7 | QT5_WRAP_UI( | |
59 | ${PROJECT_FORMS} |
|
8 | UiGenerated_SRCS | |
|
9 | ui/DataSource/DataSourceWidget.ui | |||
|
10 | ui/Settings/SqpSettingsDialog.ui | |||
|
11 | ui/Settings/SqpSettingsGeneralWidget.ui | |||
|
12 | ui/SidePane/SqpSidePane.ui | |||
|
13 | ui/TimeWidget/TimeWidget.ui | |||
|
14 | ui/Variable/RenameVariableDialog.ui | |||
|
15 | ui/Variable/VariableInspectorWidget.ui | |||
|
16 | ui/Variable/VariableMenuHeaderWidget.ui | |||
|
17 | ui/Visualization/ColorScaleEditor.ui | |||
|
18 | ui/Visualization/VisualizationGraphWidget.ui | |||
|
19 | ui/Visualization/VisualizationTabWidget.ui | |||
|
20 | ui/Visualization/VisualizationWidget.ui | |||
|
21 | ui/Visualization/VisualizationZoneWidget.ui | |||
|
22 | ui/Visualization/VisualizationMultiZoneSelectionDialog.ui | |||
|
23 | ui/Catalogue/CatalogueEventsWidget.ui | |||
|
24 | ui/Catalogue/CatalogueExplorer.ui | |||
|
25 | ui/Catalogue/CatalogueInspectorWidget.ui | |||
|
26 | ui/Catalogue/CatalogueSideBarWidget.ui | |||
|
27 | ui/Catalogue/CreateEventDialog.ui | |||
60 | ) |
|
28 | ) | |
61 |
|
29 | |||
|
30 | add_library(sciqlopgui ${gui_SRCS} ${UiGenerated_SRCS}) | |||
|
31 | SET_TARGET_PROPERTIES(sciqlopgui PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) | |||
62 |
|
32 | |||
63 | ADD_LIBRARY(${SQPGUI_LIBRARY_NAME} ${MODULE_SOURCES} ${UIS_HDRS} ${RCC_HDRS}) |
|
33 | target_include_directories(sciqlopgui PUBLIC | |
64 | set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) |
|
34 | $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | |
65 | set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
35 | $<INSTALL_INTERFACE:include/SciQLOP> | |
66 |
|
||||
67 | TARGET_LINK_LIBRARIES(${SQPGUI_LIBRARY_NAME} ${LIBRARIES}) |
|
|||
68 | qt5_use_modules(${SQPGUI_LIBRARY_NAME} Core Widgets PrintSupport) |
|
|||
69 |
|
||||
70 |
|
||||
71 | INSTALL(TARGETS ${SQPGUI_LIBRARY_NAME} |
|
|||
72 | RUNTIME DESTINATION ${INSTALL_BINARY_DIR} |
|
|||
73 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} |
|
|||
74 | ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} |
|
|||
75 | ) |
|
36 | ) | |
76 | add_dependencies(${SQPGUI_LIBRARY_NAME} ${SQPCORE_LIBRARY_NAME}) |
|
|||
77 |
|
37 | |||
78 | # Find CATALOGUE_API |
|
38 | target_link_libraries(sciqlopgui PUBLIC | |
79 | include_directories("${CATALOGUEAPI_INCLUDE}") |
|
39 | Qt5::Widgets | |
80 | TARGET_LINK_LIBRARIES(${SQPGUI_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES}) |
|
40 | Qt5::PrintSupport | |
81 | INSTALL(TARGETS ${SQPGUI_LIBRARY_NAME} |
|
41 | Qt5::Svg | |
82 | RUNTIME DESTINATION ${INSTALL_BINARY_DIR} |
|
42 | sciqlopcore | |
83 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} |
|
|||
84 | ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} |
|
|||
85 | ) |
|
43 | ) | |
86 |
|
44 | |||
87 | add_dependencies(${SQPGUI_LIBRARY_NAME} CatalogueAPI) |
|
45 | install(TARGETS sciqlopgui EXPORT SciQLOPGuiConfig | |
88 |
|
46 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
89 | # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html |
|
47 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | |
90 | # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order. |
|
48 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | |
91 | # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets |
|
|||
92 | IF(BUILD_SHARED_LIBS) |
|
|||
93 | SET_TARGET_PROPERTIES(${SQPGUI_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT") |
|
|||
94 | ELSE() |
|
|||
95 | TARGET_COMPILE_DEFINITIONS(${SQPGUI_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES") |
|
|||
96 | ENDIF() |
|
|||
97 |
|
||||
98 | # Set the variable to parent scope so that the other projects can copy the |
|
|||
99 | # dependent shared libraries |
|
|||
100 | SCIQLOP_SET_TO_PARENT_SCOPE(SQPGUI_LIBRARY_NAME) |
|
|||
101 |
|
||||
102 | # Copy extern shared libraries to the lib folder |
|
|||
103 | SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPGUI_LIBRARY_NAME}) |
|
|||
104 |
|
||||
105 | # Add the files to the list of files to be analyzed |
|
|||
106 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) |
|
|||
107 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) |
|
|||
108 | # Vera++ exclusion files |
|
|||
109 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt) |
|
|||
110 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) |
|
|||
111 |
|
||||
112 | # |
|
|||
113 | # Compile the tests |
|
|||
114 | # |
|
|||
115 | IF(BUILD_TESTS) |
|
|||
116 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) |
|
|||
117 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) |
|
|||
118 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) |
|
|||
119 | SET( TEST_LIBRARIES ${SQPGUI_LIBRARY_NAME}) |
|
|||
120 |
|
||||
121 | FOREACH( testFile ${TESTS_SOURCES} ) |
|
|||
122 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) |
|
|||
123 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) |
|
|||
124 |
|
||||
125 | # Add to the list of sources files all the sources in the same |
|
|||
126 | # directory that aren't another test |
|
|||
127 | FILE (GLOB currentTestSources |
|
|||
128 | ${testDirectory}/*.c |
|
|||
129 | ${testDirectory}/*.cpp |
|
|||
130 | ${testDirectory}/*.h) |
|
|||
131 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) |
|
|||
132 | # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) |
|
|||
133 |
|
||||
134 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) |
|
|||
135 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14) |
|
|||
136 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
|||
137 | TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} ) |
|
|||
138 | qt5_use_modules(${testName} Test) |
|
|||
139 |
|
||||
140 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) |
|
|||
141 |
|
||||
142 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES}) |
|
|||
143 | ENDFOREACH( testFile ) |
|
|||
144 |
|
||||
145 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) |
|
|||
146 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) |
|
|||
147 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) |
|
|||
148 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
|||
149 | ENDIF(BUILD_TESTS) |
|
|||
150 |
|
||||
151 | # |
|
|||
152 | # Set the files that must be formatted by clang-format. |
|
|||
153 | # |
|
|||
154 | LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES}) |
|
|||
155 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
|||
156 |
|
||||
157 | # |
|
|||
158 | # Set the directories that doxygen must browse to generate the |
|
|||
159 | # documentation. |
|
|||
160 | # |
|
|||
161 | # Source directories: |
|
|||
162 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") |
|
|||
163 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
|||
164 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) |
|
|||
165 | # Source directories to exclude from the documentation generation |
|
|||
166 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") |
|
|||
167 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) |
|
|||
168 |
|
49 | |||
169 | # |
|
50 | install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SciQLOP) | |
170 | # Set the directories with the sources to analyze and propagate the |
|
51 | install(EXPORT SciQLOPGuiConfig DESTINATION share/SciQLOPGui/cmake) | |
171 | # modification to the parent scope |
|
52 | export(TARGETS sciqlopgui FILE SciQLOPGuiConfig.cmake) | |
172 | # |
|
|||
173 | # Source directories to analyze: |
|
|||
174 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
|||
175 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") |
|
|||
176 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) |
|
|||
177 | # Source directories to exclude from the analysis |
|
|||
178 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") |
|
|||
179 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS) |
|
@@ -1,168 +1,31 | |||||
1 | ## amda - CMakeLists.txt |
|
1 | include_directories(include) | |
2 | STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX) |
|
2 | FILE (GLOB_RECURSE amdaplugin_SRCS | |
3 | SET(SQPAMDA_LIBRARY_NAME "${LIBRARY_PREFFIX}_amda${DEBUG_SUFFIX}") |
|
3 | include/*.h | |
4 | SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
4 | src/*.cpp | |
5 | SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") |
|
5 | resources/*.qrc | |
6 | SET(RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/resources") |
|
|||
7 | SET(TESTS_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests-resources") |
|
|||
8 |
|
||||
9 | # Include amda directory |
|
|||
10 | INCLUDE_DIRECTORIES(${INCLUDES_DIR}) |
|
|||
11 | INCLUDE_DIRECTORIES(${RESOURCES_DIR}) |
|
|||
12 |
|
||||
13 | # |
|
|||
14 | # Find Qt modules |
|
|||
15 | # |
|
|||
16 | SCIQLOP_FIND_QT(Core Widgets Network) |
|
|||
17 |
|
||||
18 | # |
|
|||
19 | # Find dependent libraries |
|
|||
20 | # ======================== |
|
|||
21 |
|
||||
22 | # sciqlop plugin |
|
|||
23 | find_package(sciqlop-plugin) |
|
|||
24 | INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR}) |
|
|||
25 |
|
||||
26 | # sciqlop core |
|
|||
27 | find_package(sciqlop-core) |
|
|||
28 | INCLUDE_DIRECTORIES(${SCIQLOP-CORE_INCLUDE_DIR}) |
|
|||
29 | list(APPEND LIBRARIES ${SCIQLOP-CORE_LIBRARIES}) |
|
|||
30 |
|
||||
31 | # sciqlop gui |
|
|||
32 | find_package(sciqlop-gui) |
|
|||
33 | INCLUDE_DIRECTORIES(${SCIQLOP-GUI_INCLUDE_DIR}) |
|
|||
34 | list(APPEND LIBRARIES ${SCIQLOP-GUI_LIBRARIES}) |
|
|||
35 |
|
||||
36 | # Description file |
|
|||
37 | FILE (GLOB_RECURSE PLUGIN_FILE ${RESOURCES_DIR}/amda.json) |
|
|||
38 |
|
||||
39 | # Resources files |
|
|||
40 | FILE (GLOB_RECURSE PROJECT_RESOURCES ${RESOURCES_DIR}/*.qrc) |
|
|||
41 |
|
||||
42 | # |
|
|||
43 | # Compile the library |
|
|||
44 | # |
|
|||
45 |
|
||||
46 | ADD_DEFINITIONS(-DAMDA_LIB) |
|
|||
47 |
|
||||
48 | FILE (GLOB_RECURSE MODULE_SOURCES |
|
|||
49 | ${INCLUDES_DIR}/*.h |
|
|||
50 | ${SOURCES_DIR}/*.c |
|
|||
51 | ${SOURCES_DIR}/*.cpp |
|
|||
52 | ${SOURCES_DIR}/*.h |
|
|||
53 | ${PLUGIN_FILE}) |
|
|||
54 |
|
||||
55 | QT5_ADD_RESOURCES(RCC_AMDA |
|
|||
56 | ${PROJECT_RESOURCES} |
|
|||
57 | ) |
|
6 | ) | |
58 |
|
7 | |||
59 | ADD_LIBRARY(${SQPAMDA_LIBRARY_NAME} ${MODULE_SOURCES} ${RCC_AMDA}) |
|
8 | add_definitions(-DQT_PLUGIN) | |
60 | set_property(TARGET ${SQPAMDA_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) |
|
9 | add_definitions(-DSCIQLOP_PLUGIN_JSON_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/resources/amda.json") | |
61 | set_property(TARGET ${SQPAMDA_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
10 | if(NOT BUILD_SHARED_LIBS) | |
62 |
|
11 | add_definitions(-DQT_STATICPLUGIN) | ||
63 | INSTALL(TARGETS ${SQPAMDA_LIBRARY_NAME} |
|
12 | endif() | |
64 | RUNTIME DESTINATION ${INSTALL_BINARY_DIR} |
|
|||
65 | LIBRARY DESTINATION ${INSTALL_PLUGINS_LIBRARY_DIR} |
|
|||
66 | ARCHIVE DESTINATION ${INSTALL_PLUGINS_LIBRARY_DIR} |
|
|||
67 | ) |
|
|||
68 |
|
||||
69 |
|
||||
70 | TARGET_LINK_LIBRARIES(${SQPAMDA_LIBRARY_NAME} ${LIBRARIES}) |
|
|||
71 | qt5_use_modules(${SQPAMDA_LIBRARY_NAME} Core Widgets Network) |
|
|||
72 |
|
||||
73 | add_dependencies(${SQPAMDA_LIBRARY_NAME} ${SQPPLUGIN_LIBRARY_NAME} ${SQPGUI_LIBRARY_NAME} ${SQPCORE_LIBRARY_NAME}) |
|
|||
74 |
|
||||
75 | # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html |
|
|||
76 | # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order. |
|
|||
77 | # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets |
|
|||
78 | IF(BUILD_SHARED_LIBS) |
|
|||
79 | SET_TARGET_PROPERTIES(${SQPAMDA_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT") |
|
|||
80 | ELSE() |
|
|||
81 | TARGET_COMPILE_DEFINITIONS(${SQPAMDA_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES") |
|
|||
82 | ENDIF() |
|
|||
83 |
|
||||
84 | # Set the variable to parent scope so that the other projects can copy the |
|
|||
85 | # dependent shared libraries |
|
|||
86 | SCIQLOP_SET_TO_PARENT_SCOPE(SQPAMDA_LIBRARY_NAME) |
|
|||
87 |
|
||||
88 | # Copy extern shared libraries to the lib folder |
|
|||
89 | SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPAMDA_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES}) |
|
|||
90 |
|
||||
91 | # Add the files to the list of files to be analyzed |
|
|||
92 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) |
|
|||
93 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) |
|
|||
94 | # Vera++ exclusion files |
|
|||
95 | LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt) |
|
|||
96 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) |
|
|||
97 |
|
||||
98 | # |
|
|||
99 | # Compile the tests |
|
|||
100 | # |
|
|||
101 | IF(BUILD_TESTS) |
|
|||
102 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) |
|
|||
103 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) |
|
|||
104 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) |
|
|||
105 | SET( TEST_LIBRARIES ${SQPAMDA_LIBRARY_NAME}) |
|
|||
106 |
|
||||
107 | FOREACH( testFile ${TESTS_SOURCES} ) |
|
|||
108 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) |
|
|||
109 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) |
|
|||
110 |
|
||||
111 | # Add to the list of sources files all the sources in the same |
|
|||
112 | # directory that aren't another test |
|
|||
113 | FILE (GLOB currentTestSources |
|
|||
114 | ${testDirectory}/*.c |
|
|||
115 | ${testDirectory}/*.cpp |
|
|||
116 | ${testDirectory}/*.h) |
|
|||
117 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) |
|
|||
118 | LIST(APPEND testFilesToFormat ${currentTestSources}) |
|
|||
119 | # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) |
|
|||
120 |
|
||||
121 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) |
|
|||
122 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14) |
|
|||
123 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
|||
124 | TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} ) |
|
|||
125 | qt5_use_modules(${testName} Test) |
|
|||
126 |
|
13 | |||
127 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) |
|
14 | add_library(amdaplugin ${amdaplugin_SRCS}) | |
|
15 | SET_TARGET_PROPERTIES(amdaplugin PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) | |||
128 |
|
16 | |||
129 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES}) |
|
17 | target_link_libraries(amdaplugin PUBLIC sciqlopgui) | |
130 | ENDFOREACH( testFile ) |
|
|||
131 |
|
18 | |||
132 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) |
|
19 | install(TARGETS amdaplugin | |
133 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) |
|
20 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/SciQlop | |
134 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) |
|
21 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/SciQlop | |
135 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
22 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | |
136 |
|
23 | |||
137 | ADD_DEFINITIONS(-DAMDA_TESTS_RESOURCES_DIR="${TESTS_RESOURCES_DIR}") |
|
24 | include(sciqlop_tests) | |
138 | ENDIF(BUILD_TESTS) |
|
|||
139 |
|
25 | |||
140 | # |
|
26 | add_definitions(-DAMDA_TESTS_RESOURCES_DIR="${CMAKE_CURRENT_LIST_DIR}/tests-resources") | |
141 | # Set the files that must be formatted by clang-format. |
|
|||
142 | # |
|
|||
143 | LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES}) |
|
|||
144 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
|||
145 |
|
27 | |||
146 | # |
|
28 | declare_test(TestAmdaParser TestAmdaParser tests/TestAmdaParser.cpp "amdaplugin;Qt5::Test") | |
147 | # Set the directories that doxygen must browse to generate the |
|
29 | declare_test(TestAmdaResultParser TestAmdaResultParser tests/TestAmdaResultParser.cpp "amdaplugin;Qt5::Test") | |
148 | # documentation. |
|
30 | declare_test(TestAmdaAcquisition TestAmdaAcquisition tests/TestAmdaAcquisition.cpp "amdaplugin;Qt5::Test") | |
149 | # |
|
|||
150 | # Source directories: |
|
|||
151 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") |
|
|||
152 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
|||
153 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) |
|
|||
154 | # Source directories to exclude from the documentation generation |
|
|||
155 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") |
|
|||
156 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) |
|
|||
157 |
|
31 | |||
158 | # |
|
|||
159 | # Set the directories with the sources to analyze and propagate the |
|
|||
160 | # modification to the parent scope |
|
|||
161 | # |
|
|||
162 | # Source directories to analyze: |
|
|||
163 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
|||
164 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") |
|
|||
165 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) |
|
|||
166 | # Source directories to exclude from the analysis |
|
|||
167 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") |
|
|||
168 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS) |
|
@@ -1,160 +1,29 | |||||
1 | ## mockplugin - CMakeLists.txt |
|
1 | include_directories(include) | |
2 | STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX) |
|
2 | FILE (GLOB_RECURSE mockplugin_SRCS | |
3 | SET(SQPMOCKPLUGIN_LIBRARY_NAME "${LIBRARY_PREFFIX}_mockplugin${DEBUG_SUFFIX}") |
|
3 | include/*.h | |
4 | SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
4 | src/*.cpp | |
5 | SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") |
|
5 | resources/*.qrc | |
6 | SET(RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/resources") |
|
|||
7 | SET(TESTS_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests-resources") |
|
|||
8 |
|
||||
9 | # Include mockplugin directory |
|
|||
10 | INCLUDE_DIRECTORIES(${INCLUDES_DIR}) |
|
|||
11 | INCLUDE_DIRECTORIES(${RESOURCES_DIR}) |
|
|||
12 |
|
||||
13 | # |
|
|||
14 | # Find Qt modules |
|
|||
15 | # |
|
|||
16 | SCIQLOP_FIND_QT(Core Widgets) |
|
|||
17 |
|
||||
18 | # |
|
|||
19 | # Find dependent libraries |
|
|||
20 | # ======================== |
|
|||
21 |
|
||||
22 | # sciqlop plugin |
|
|||
23 | find_package(sciqlop-plugin) |
|
|||
24 | INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR}) |
|
|||
25 |
|
||||
26 | # sciqlop core |
|
|||
27 | find_package(sciqlop-core) |
|
|||
28 | INCLUDE_DIRECTORIES(${SCIQLOP-CORE_INCLUDE_DIR}) |
|
|||
29 | list(APPEND LIBRARIES ${SCIQLOP-CORE_LIBRARIES}) |
|
|||
30 |
|
||||
31 | # sciqlop gui |
|
|||
32 | find_package(sciqlop-gui) |
|
|||
33 | INCLUDE_DIRECTORIES(${SCIQLOP-GUI_INCLUDE_DIR}) |
|
|||
34 | list(APPEND LIBRARIES ${SCIQLOP-GUI_LIBRARIES}) |
|
|||
35 |
|
||||
36 | # Description file |
|
|||
37 | FILE (GLOB_RECURSE PLUGIN_FILE ${RESOURCES_DIR}/mockplugin.json) |
|
|||
38 |
|
||||
39 | # |
|
|||
40 | # Compile the library |
|
|||
41 | # |
|
|||
42 |
|
||||
43 | ADD_DEFINITIONS(-DMOCKPLUGIN_LIB) |
|
|||
44 |
|
||||
45 | FILE (GLOB_RECURSE MODULE_SOURCES |
|
|||
46 | ${INCLUDES_DIR}/*.h |
|
|||
47 | ${SOURCES_DIR}/*.c |
|
|||
48 | ${SOURCES_DIR}/*.cpp |
|
|||
49 | ${SOURCES_DIR}/*.h |
|
|||
50 | ${PLUGIN_FILE}) |
|
|||
51 |
|
||||
52 | ADD_LIBRARY(${SQPMOCKPLUGIN_LIBRARY_NAME} ${MODULE_SOURCES}) |
|
|||
53 | set_property(TARGET ${SQPMOCKPLUGIN_LIBRARY_NAME} PROPERTY CXX_STANDARD 14) |
|
|||
54 | set_property(TARGET ${SQPMOCKPLUGIN_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
|||
55 |
|
||||
56 | INSTALL(TARGETS ${SQPMOCKPLUGIN_LIBRARY_NAME} |
|
|||
57 | RUNTIME DESTINATION ${INSTALL_BINARY_DIR} |
|
|||
58 | LIBRARY DESTINATION ${INSTALL_PLUGINS_LIBRARY_DIR} |
|
|||
59 | ARCHIVE DESTINATION ${INSTALL_PLUGINS_LIBRARY_DIR} |
|
|||
60 | ) |
|
6 | ) | |
61 |
|
7 | |||
|
8 | add_definitions(-DQT_PLUGIN) | |||
|
9 | add_definitions(-DPLUGIN_JSON_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/resources/mockplugin.json") | |||
|
10 | if(NOT BUILD_SHARED_LIBS) | |||
|
11 | add_definitions(-DQT_STATICPLUGIN) | |||
|
12 | endif() | |||
62 |
|
13 | |||
63 | TARGET_LINK_LIBRARIES(${SQPMOCKPLUGIN_LIBRARY_NAME} ${LIBRARIES}) |
|
14 | add_library(mockplugin ${mockplugin_SRCS}) | |
64 | qt5_use_modules(${SQPMOCKPLUGIN_LIBRARY_NAME} Core Widgets) |
|
15 | SET_TARGET_PROPERTIES(mockplugin PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) | |
65 |
|
||||
66 | add_dependencies(${SQPMOCKPLUGIN_LIBRARY_NAME} ${SQPPLUGIN_LIBRARY_NAME} ${SQPGUI_LIBRARY_NAME} ${SQPCORE_LIBRARY_NAME}) |
|
|||
67 |
|
||||
68 | # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html |
|
|||
69 | # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order. |
|
|||
70 | # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets |
|
|||
71 | IF(BUILD_SHARED_LIBS) |
|
|||
72 | SET_TARGET_PROPERTIES(${SQPMOCKPLUGIN_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT") |
|
|||
73 | ELSE() |
|
|||
74 | TARGET_COMPILE_DEFINITIONS(${SQPMOCKPLUGIN_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES") |
|
|||
75 | ENDIF() |
|
|||
76 |
|
||||
77 | # Set the variable to parent scope so that the other projects can copy the |
|
|||
78 | # dependent shared libraries |
|
|||
79 | SCIQLOP_SET_TO_PARENT_SCOPE(SQPMOCKPLUGIN_LIBRARY_NAME) |
|
|||
80 |
|
||||
81 | # Copy extern shared libraries to the lib folder |
|
|||
82 | SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPMOCKPLUGIN_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES}) |
|
|||
83 |
|
||||
84 | # Add the files to the list of files to be analyzed |
|
|||
85 | LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES}) |
|
|||
86 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES) |
|
|||
87 | # Vera++ exclusion files |
|
|||
88 | #LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt) |
|
|||
89 | SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES) |
|
|||
90 |
|
||||
91 | # |
|
|||
92 | # Compile the tests |
|
|||
93 | # |
|
|||
94 | IF(BUILD_TESTS) |
|
|||
95 | INCLUDE_DIRECTORIES(${SOURCES_DIR}) |
|
|||
96 | FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp) |
|
|||
97 | FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h) |
|
|||
98 | SET( TEST_LIBRARIES ${SQPMOCKPLUGIN_LIBRARY_NAME}) |
|
|||
99 |
|
||||
100 | FOREACH( testFile ${TESTS_SOURCES} ) |
|
|||
101 | GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY ) |
|
|||
102 | GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE ) |
|
|||
103 |
|
||||
104 | # Add to the list of sources files all the sources in the same |
|
|||
105 | # directory that aren't another test |
|
|||
106 | FILE (GLOB currentTestSources |
|
|||
107 | ${testDirectory}/*.c |
|
|||
108 | ${testDirectory}/*.cpp |
|
|||
109 | ${testDirectory}/*.h) |
|
|||
110 | LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES}) |
|
|||
111 | # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS}) |
|
|||
112 |
|
||||
113 | ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources}) |
|
|||
114 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14) |
|
|||
115 | set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON) |
|
|||
116 | TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} ) |
|
|||
117 | qt5_use_modules(${testName} Test) |
|
|||
118 |
|
||||
119 | ADD_TEST( NAME ${testName} COMMAND ${testName} ) |
|
|||
120 |
|
16 | |||
121 | SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES}) |
|
17 | target_link_libraries(mockplugin sciqlopgui) | |
122 | ENDFOREACH( testFile ) |
|
|||
123 |
|
18 | |||
124 | LIST(APPEND testFilesToFormat ${TESTS_SOURCES}) |
|
19 | install(TARGETS mockplugin | |
125 | LIST(APPEND testFilesToFormat ${TESTS_HEADERS}) |
|
20 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/SciQlop | |
126 | LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat}) |
|
21 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/SciQlop | |
127 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
22 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | |
128 |
|
23 | |||
129 | ADD_DEFINITIONS(-DMOCKPLUGIN_TESTS_RESOURCES_DIR="${TESTS_RESOURCES_DIR}") |
|
24 | include(sciqlop_tests) | |
130 | ENDIF(BUILD_TESTS) |
|
|||
131 |
|
25 | |||
132 | # |
|
26 | add_definitions(-DMOCKPLUGIN_TESTS_RESOURCES_DIR="${CMAKE_CURRENT_LIST_DIR}/tests-resources") | |
133 | # Set the files that must be formatted by clang-format. |
|
|||
134 | # |
|
|||
135 | LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES}) |
|
|||
136 | SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES) |
|
|||
137 |
|
27 | |||
138 | # |
|
28 | declare_test(TestCosinusAcquisition TestCosinusAcquisition tests/TestCosinusAcquisition.cpp "mockplugin;Qt5::Test") | |
139 | # Set the directories that doxygen must browse to generate the |
|
|||
140 | # documentation. |
|
|||
141 | # |
|
|||
142 | # Source directories: |
|
|||
143 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs") |
|
|||
144 | LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
|||
145 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS) |
|
|||
146 | # Source directories to exclude from the documentation generation |
|
|||
147 | #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*") |
|
|||
148 | SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS) |
|
|||
149 |
|
29 | |||
150 | # |
|
|||
151 | # Set the directories with the sources to analyze and propagate the |
|
|||
152 | # modification to the parent scope |
|
|||
153 | # |
|
|||
154 | # Source directories to analyze: |
|
|||
155 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
|||
156 | LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests") |
|
|||
157 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS) |
|
|||
158 | # Source directories to exclude from the analysis |
|
|||
159 | #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir") |
|
|||
160 | SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS) |
|
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now