##// END OF EJS Templates
Display catalogues and events with CatalogueAPI
trabillard -
r1162:9abcd350a712
parent child
Show More
@@ -0,0 +1,22
1 #ifndef SCIQLOP_CATALOGUETREEWIDGETITEM_H
2 #define SCIQLOP_CATALOGUETREEWIDGETITEM_H
3
4 #include <Common/spimpl.h>
5 #include <QTreeWidgetItem>
6
7 #include <DBCatalogue.h>
8
9
10 class CatalogueTreeWidgetItem : public QTreeWidgetItem {
11 public:
12 CatalogueTreeWidgetItem(DBCatalogue catalogue, int type = QTreeWidgetItem::Type);
13
14 QVariant data(int column, int role) const override;
15 DBCatalogue catalogue() const;
16
17 private:
18 class CatalogueTreeWidgetItemPrivate;
19 spimpl::unique_impl_ptr<CatalogueTreeWidgetItemPrivate> impl;
20 };
21
22 #endif // SCIQLOP_CATALOGUETREEWIDGETITEM_H
@@ -0,0 +1,32
1 #include "Catalogue/CatalogueTreeWidgetItem.h"
2
3 struct CatalogueTreeWidgetItem::CatalogueTreeWidgetItemPrivate {
4
5 DBCatalogue m_Catalogue;
6
7 CatalogueTreeWidgetItemPrivate(DBCatalogue catalogue) : m_Catalogue(catalogue) {}
8 };
9
10
11 CatalogueTreeWidgetItem::CatalogueTreeWidgetItem(DBCatalogue catalogue, int type)
12 : QTreeWidgetItem(type),
13 impl{spimpl::make_unique_impl<CatalogueTreeWidgetItemPrivate>(catalogue)}
14 {
15 }
16
17 QVariant CatalogueTreeWidgetItem::data(int column, int role) const
18 {
19 switch (role) {
20 case Qt::DisplayRole:
21 return impl->m_Catalogue.getName();
22 default:
23 break;
24 }
25
26 return QTreeWidgetItem::data(column, role);
27 }
28
29 DBCatalogue CatalogueTreeWidgetItem::catalogue() const
30 {
31 return impl->m_Catalogue;
32 }
@@ -1,169 +1,179
1
1
2 ## gui - CMakeLists.txt
2 ## gui - CMakeLists.txt
3 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
3 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
4 SET(SQPGUI_LIBRARY_NAME "${LIBRARY_PREFFIX}_gui${DEBUG_SUFFIX}")
4 SET(SQPGUI_LIBRARY_NAME "${LIBRARY_PREFFIX}_gui${DEBUG_SUFFIX}")
5 SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
5 SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
6 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
6 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
7 SET(UI_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/ui")
7 SET(UI_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/ui")
8 SET(RES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/resources")
8 SET(RES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/resources")
9
9
10 # Include gui directory
10 # Include gui directory
11 include_directories("${INCLUDES_DIR}")
11 include_directories("${INCLUDES_DIR}")
12 include_directories("${CMAKE_CURRENT_BINARY_DIR}")
12 include_directories("${CMAKE_CURRENT_BINARY_DIR}")
13
13
14 # Set a variable to display a warning in the version files.
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.")
15 SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.")
16
16
17 #
17 #
18 # Find Qt modules
18 # Find Qt modules
19 #
19 #
20 SCIQLOP_FIND_QT(Core Widgets PrintSupport)
20 SCIQLOP_FIND_QT(Core Widgets PrintSupport)
21
21
22 #
22 #
23 # Find dependent libraries
23 # Find dependent libraries
24 # ========================
24 # ========================
25 find_package(sciqlop-core)
25 find_package(sciqlop-core)
26
26
27 SET(LIBRARIES ${SCIQLOP-CORE_LIBRARIES})
27 SET(LIBRARIES ${SCIQLOP-CORE_LIBRARIES})
28
28
29 INCLUDE_DIRECTORIES(${SCIQLOP-CORE_INCLUDE_DIR})
29 INCLUDE_DIRECTORIES(${SCIQLOP-CORE_INCLUDE_DIR})
30
30
31 # Add sqpcore to the list of libraries to use
31 # Add sqpcore to the list of libraries to use
32 list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME})
32 list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME})
33
33
34 # Add dependent shared libraries
34 # Add dependent shared libraries
35 list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES})
35 list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES})
36
36
37
37
38 # Ui files
38 # Ui files
39 FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui)
39 FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui)
40
40
41 # Resources files
41 # Resources files
42 FILE (GLOB_RECURSE PROJECT_RESOURCES ${RES_FOLDER}/*.qrc)
42 FILE (GLOB_RECURSE PROJECT_RESOURCES ${RES_FOLDER}/*.qrc)
43
43
44 #
44 #
45 # Compile the library library
45 # Compile the library library
46 #
46 #
47 FILE (GLOB_RECURSE MODULE_SOURCES
47 FILE (GLOB_RECURSE MODULE_SOURCES
48 ${INCLUDES_DIR}/*.h
48 ${INCLUDES_DIR}/*.h
49 ${SOURCES_DIR}/*.c
49 ${SOURCES_DIR}/*.c
50 ${SOURCES_DIR}/*.cpp
50 ${SOURCES_DIR}/*.cpp
51 ${SOURCES_DIR}/*.h
51 ${SOURCES_DIR}/*.h
52 ${PROJECT_FORMS})
52 ${PROJECT_FORMS})
53
53
54 QT5_ADD_RESOURCES(RCC_HDRS
54 QT5_ADD_RESOURCES(RCC_HDRS
55 ${PROJECT_RESOURCES}
55 ${PROJECT_RESOURCES}
56 )
56 )
57
57
58 QT5_WRAP_UI(UIS_HDRS
58 QT5_WRAP_UI(UIS_HDRS
59 ${PROJECT_FORMS}
59 ${PROJECT_FORMS}
60 )
60 )
61
61
62
62
63 ADD_LIBRARY(${SQPGUI_LIBRARY_NAME} ${MODULE_SOURCES} ${UIS_HDRS} ${RCC_HDRS})
63 ADD_LIBRARY(${SQPGUI_LIBRARY_NAME} ${MODULE_SOURCES} ${UIS_HDRS} ${RCC_HDRS})
64 set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
64 set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
65 set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
65 set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
66
66
67 TARGET_LINK_LIBRARIES(${SQPGUI_LIBRARY_NAME} ${LIBRARIES})
67 TARGET_LINK_LIBRARIES(${SQPGUI_LIBRARY_NAME} ${LIBRARIES})
68 qt5_use_modules(${SQPGUI_LIBRARY_NAME} Core Widgets PrintSupport)
68 qt5_use_modules(${SQPGUI_LIBRARY_NAME} Core Widgets PrintSupport)
69
69
70
70
71 INSTALL(TARGETS ${SQPGUI_LIBRARY_NAME}
71 INSTALL(TARGETS ${SQPGUI_LIBRARY_NAME}
72 RUNTIME DESTINATION ${INSTALL_BINARY_DIR}
72 RUNTIME DESTINATION ${INSTALL_BINARY_DIR}
73 LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
73 LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
74 ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}
74 ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}
75 )
75 )
76 add_dependencies(${SQPGUI_LIBRARY_NAME} ${SQPCORE_LIBRARY_NAME})
76 add_dependencies(${SQPGUI_LIBRARY_NAME} ${SQPCORE_LIBRARY_NAME})
77
77
78 # Find CATALOGUE_API
79 include_directories("${CATALOGUEAPI_INCLUDE}")
80 TARGET_LINK_LIBRARIES(${SQPGUI_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES})
81 INSTALL(TARGETS ${SQPGUI_LIBRARY_NAME}
82 RUNTIME DESTINATION ${INSTALL_BINARY_DIR}
83 LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
84 ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}
85 )
86
87 add_dependencies(${SQPGUI_LIBRARY_NAME} CatalogueAPI)
78
88
79 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
89 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
80 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
90 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
81 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
91 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
82 IF(BUILD_SHARED_LIBS)
92 IF(BUILD_SHARED_LIBS)
83 SET_TARGET_PROPERTIES(${SQPGUI_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
93 SET_TARGET_PROPERTIES(${SQPGUI_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
84 ELSE()
94 ELSE()
85 TARGET_COMPILE_DEFINITIONS(${SQPGUI_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
95 TARGET_COMPILE_DEFINITIONS(${SQPGUI_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
86 ENDIF()
96 ENDIF()
87
97
88 # Set the variable to parent scope so that the other projects can copy the
98 # Set the variable to parent scope so that the other projects can copy the
89 # dependent shared libraries
99 # dependent shared libraries
90 SCIQLOP_SET_TO_PARENT_SCOPE(SQPGUI_LIBRARY_NAME)
100 SCIQLOP_SET_TO_PARENT_SCOPE(SQPGUI_LIBRARY_NAME)
91
101
92 # Copy extern shared libraries to the lib folder
102 # Copy extern shared libraries to the lib folder
93 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPGUI_LIBRARY_NAME})
103 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPGUI_LIBRARY_NAME})
94
104
95 # Add the files to the list of files to be analyzed
105 # Add the files to the list of files to be analyzed
96 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
106 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
97 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
107 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
98 # Vera++ exclusion files
108 # Vera++ exclusion files
99 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
109 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
100 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
110 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
101
111
102 #
112 #
103 # Compile the tests
113 # Compile the tests
104 #
114 #
105 IF(BUILD_TESTS)
115 IF(BUILD_TESTS)
106 INCLUDE_DIRECTORIES(${SOURCES_DIR})
116 INCLUDE_DIRECTORIES(${SOURCES_DIR})
107 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
117 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
108 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
118 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
109 SET( TEST_LIBRARIES ${SQPGUI_LIBRARY_NAME})
119 SET( TEST_LIBRARIES ${SQPGUI_LIBRARY_NAME})
110
120
111 FOREACH( testFile ${TESTS_SOURCES} )
121 FOREACH( testFile ${TESTS_SOURCES} )
112 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
122 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
113 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
123 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
114
124
115 # Add to the list of sources files all the sources in the same
125 # Add to the list of sources files all the sources in the same
116 # directory that aren't another test
126 # directory that aren't another test
117 FILE (GLOB currentTestSources
127 FILE (GLOB currentTestSources
118 ${testDirectory}/*.c
128 ${testDirectory}/*.c
119 ${testDirectory}/*.cpp
129 ${testDirectory}/*.cpp
120 ${testDirectory}/*.h)
130 ${testDirectory}/*.h)
121 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
131 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
122 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
132 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
123
133
124 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
134 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
125 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
135 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
126 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
136 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
127 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
137 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
128 qt5_use_modules(${testName} Test)
138 qt5_use_modules(${testName} Test)
129
139
130 ADD_TEST( NAME ${testName} COMMAND ${testName} )
140 ADD_TEST( NAME ${testName} COMMAND ${testName} )
131
141
132 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
142 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
133 ENDFOREACH( testFile )
143 ENDFOREACH( testFile )
134
144
135 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
145 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
136 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
146 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
137 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
147 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
138 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
148 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
139 ENDIF(BUILD_TESTS)
149 ENDIF(BUILD_TESTS)
140
150
141 #
151 #
142 # Set the files that must be formatted by clang-format.
152 # Set the files that must be formatted by clang-format.
143 #
153 #
144 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
154 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
145 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
155 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
146
156
147 #
157 #
148 # Set the directories that doxygen must browse to generate the
158 # Set the directories that doxygen must browse to generate the
149 # documentation.
159 # documentation.
150 #
160 #
151 # Source directories:
161 # Source directories:
152 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
162 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
153 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
163 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
154 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
164 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
155 # Source directories to exclude from the documentation generation
165 # Source directories to exclude from the documentation generation
156 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
166 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
157 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
167 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
158
168
159 #
169 #
160 # Set the directories with the sources to analyze and propagate the
170 # Set the directories with the sources to analyze and propagate the
161 # modification to the parent scope
171 # modification to the parent scope
162 #
172 #
163 # Source directories to analyze:
173 # Source directories to analyze:
164 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
174 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
165 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
175 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
166 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
176 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
167 # Source directories to exclude from the analysis
177 # Source directories to exclude from the analysis
168 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
178 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
169 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
179 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
@@ -1,31 +1,34
1 #ifndef SCIQLOP_CATALOGUEEVENTSWIDGET_H
1 #ifndef SCIQLOP_CATALOGUEEVENTSWIDGET_H
2 #define SCIQLOP_CATALOGUEEVENTSWIDGET_H
2 #define SCIQLOP_CATALOGUEEVENTSWIDGET_H
3
3
4 #include <Common/spimpl.h>
4 #include <Common/spimpl.h>
5 #include <QWidget>
5 #include <QWidget>
6
6
7 class DBCatalogue;
8 class DBEvent;
9
7 namespace Ui {
10 namespace Ui {
8 class CatalogueEventsWidget;
11 class CatalogueEventsWidget;
9 }
12 }
10
13
11 class CatalogueEventsWidget : public QWidget {
14 class CatalogueEventsWidget : public QWidget {
12 Q_OBJECT
15 Q_OBJECT
13
16
14 signals:
17 signals:
15 void eventSelected(const QString &event);
18 void eventSelected(const DBEvent &event);
16
19
17 public:
20 public:
18 explicit CatalogueEventsWidget(QWidget *parent = 0);
21 explicit CatalogueEventsWidget(QWidget *parent = 0);
19 virtual ~CatalogueEventsWidget();
22 virtual ~CatalogueEventsWidget();
20
23
21 public slots:
24 public slots:
22 void populateWithCatalogue(const QString &catalogue);
25 void populateWithCatalogue(const DBCatalogue &catalogue);
23
26
24 private:
27 private:
25 Ui::CatalogueEventsWidget *ui;
28 Ui::CatalogueEventsWidget *ui;
26
29
27 class CatalogueEventsWidgetPrivate;
30 class CatalogueEventsWidgetPrivate;
28 spimpl::unique_impl_ptr<CatalogueEventsWidgetPrivate> impl;
31 spimpl::unique_impl_ptr<CatalogueEventsWidgetPrivate> impl;
29 };
32 };
30
33
31 #endif // SCIQLOP_CATALOGUEEVENTSWIDGET_H
34 #endif // SCIQLOP_CATALOGUEEVENTSWIDGET_H
@@ -1,32 +1,35
1 #ifndef SCIQLOP_CATALOGUEINSPECTORWIDGET_H
1 #ifndef SCIQLOP_CATALOGUEINSPECTORWIDGET_H
2 #define SCIQLOP_CATALOGUEINSPECTORWIDGET_H
2 #define SCIQLOP_CATALOGUEINSPECTORWIDGET_H
3
3
4 #include <QWidget>
4 #include <QWidget>
5
5
6 namespace Ui {
6 namespace Ui {
7 class CatalogueInspectorWidget;
7 class CatalogueInspectorWidget;
8 }
8 }
9
9
10 class DBCatalogue;
11 class DBEvent;
12
10 class CatalogueInspectorWidget : public QWidget {
13 class CatalogueInspectorWidget : public QWidget {
11 Q_OBJECT
14 Q_OBJECT
12
15
13 public:
16 public:
14 explicit CatalogueInspectorWidget(QWidget *parent = 0);
17 explicit CatalogueInspectorWidget(QWidget *parent = 0);
15 virtual ~CatalogueInspectorWidget();
18 virtual ~CatalogueInspectorWidget();
16
19
17 /// Enum matching the pages inside the stacked widget
20 /// Enum matching the pages inside the stacked widget
18 enum class Page { Empty, CatalogueProperties, EventProperties };
21 enum class Page { Empty, CatalogueProperties, EventProperties };
19
22
20 Page currentPage() const;
23 Page currentPage() const;
21
24
22 void setEvent(const QString &event);
25 void setEvent(const DBEvent &event);
23 void setCatalogue(const QString &catalogue);
26 void setCatalogue(const DBCatalogue &catalogue);
24
27
25 public slots:
28 public slots:
26 void showPage(Page page);
29 void showPage(Page page);
27
30
28 private:
31 private:
29 Ui::CatalogueInspectorWidget *ui;
32 Ui::CatalogueInspectorWidget *ui;
30 };
33 };
31
34
32 #endif // SCIQLOP_CATALOGUEINSPECTORWIDGET_H
35 #endif // SCIQLOP_CATALOGUEINSPECTORWIDGET_H
@@ -1,31 +1,33
1 #ifndef SCIQLOP_CATALOGUESIDEBARWIDGET_H
1 #ifndef SCIQLOP_CATALOGUESIDEBARWIDGET_H
2 #define SCIQLOP_CATALOGUESIDEBARWIDGET_H
2 #define SCIQLOP_CATALOGUESIDEBARWIDGET_H
3
3
4 #include <Common/spimpl.h>
4 #include <Common/spimpl.h>
5 #include <QTreeWidgetItem>
5 #include <QTreeWidgetItem>
6 #include <QWidget>
6 #include <QWidget>
7
7
8 #include <DBCatalogue.h>
9
8 namespace Ui {
10 namespace Ui {
9 class CatalogueSideBarWidget;
11 class CatalogueSideBarWidget;
10 }
12 }
11
13
12 class CatalogueSideBarWidget : public QWidget {
14 class CatalogueSideBarWidget : public QWidget {
13 Q_OBJECT
15 Q_OBJECT
14
16
15 signals:
17 signals:
16 void catalogueSelected(const QString &catalogue);
18 void catalogueSelected(const DBCatalogue &catalogue);
17 void allEventsSelected();
19 void allEventsSelected();
18 void trashSelected();
20 void trashSelected();
19
21
20 public:
22 public:
21 explicit CatalogueSideBarWidget(QWidget *parent = 0);
23 explicit CatalogueSideBarWidget(QWidget *parent = 0);
22 virtual ~CatalogueSideBarWidget();
24 virtual ~CatalogueSideBarWidget();
23
25
24 private:
26 private:
25 Ui::CatalogueSideBarWidget *ui;
27 Ui::CatalogueSideBarWidget *ui;
26
28
27 class CatalogueSideBarWidgetPrivate;
29 class CatalogueSideBarWidgetPrivate;
28 spimpl::unique_impl_ptr<CatalogueSideBarWidgetPrivate> impl;
30 spimpl::unique_impl_ptr<CatalogueSideBarWidgetPrivate> impl;
29 };
31 };
30
32
31 #endif // SCIQLOP_CATALOGUESIDEBARWIDGET_H
33 #endif // SCIQLOP_CATALOGUESIDEBARWIDGET_H
@@ -1,122 +1,126
1
1
2 qxorm_dep = dependency('QxOrm', required : true, fallback:['QxOrm','qxorm_dep'])
3 catalogueapi_dep = dependency('CatalogueAPI', required : true, fallback:['CatalogueAPI','CatalogueAPI_dep'])
4
2 gui_moc_headers = [
5 gui_moc_headers = [
3 'include/DataSource/DataSourceWidget.h',
6 'include/DataSource/DataSourceWidget.h',
4 'include/Settings/SqpSettingsDialog.h',
7 'include/Settings/SqpSettingsDialog.h',
5 'include/Settings/SqpSettingsGeneralWidget.h',
8 'include/Settings/SqpSettingsGeneralWidget.h',
6 'include/SidePane/SqpSidePane.h',
9 'include/SidePane/SqpSidePane.h',
7 'include/SqpApplication.h',
10 'include/SqpApplication.h',
8 'include/DragAndDrop/DragDropScroller.h',
11 'include/DragAndDrop/DragDropScroller.h',
9 'include/DragAndDrop/DragDropTabSwitcher.h',
12 'include/DragAndDrop/DragDropTabSwitcher.h',
10 'include/TimeWidget/TimeWidget.h',
13 'include/TimeWidget/TimeWidget.h',
11 'include/Variable/VariableInspectorWidget.h',
14 'include/Variable/VariableInspectorWidget.h',
12 'include/Variable/RenameVariableDialog.h',
15 'include/Variable/RenameVariableDialog.h',
13 'include/Visualization/qcustomplot.h',
16 'include/Visualization/qcustomplot.h',
14 'include/Visualization/VisualizationGraphWidget.h',
17 'include/Visualization/VisualizationGraphWidget.h',
15 'include/Visualization/VisualizationTabWidget.h',
18 'include/Visualization/VisualizationTabWidget.h',
16 'include/Visualization/VisualizationWidget.h',
19 'include/Visualization/VisualizationWidget.h',
17 'include/Visualization/VisualizationZoneWidget.h',
20 'include/Visualization/VisualizationZoneWidget.h',
18 'include/Visualization/VisualizationDragDropContainer.h',
21 'include/Visualization/VisualizationDragDropContainer.h',
19 'include/Visualization/VisualizationDragWidget.h',
22 'include/Visualization/VisualizationDragWidget.h',
20 'include/Visualization/ColorScaleEditor.h',
23 'include/Visualization/ColorScaleEditor.h',
21 'include/Actions/SelectionZoneAction.h',
24 'include/Actions/SelectionZoneAction.h',
22 'include/Visualization/VisualizationMultiZoneSelectionDialog.h',
25 'include/Visualization/VisualizationMultiZoneSelectionDialog.h',
23 'include/Catalogue/CatalogueExplorer.h',
26 'include/Catalogue/CatalogueExplorer.h',
24 'include/Catalogue/CatalogueEventsWidget.h',
27 'include/Catalogue/CatalogueEventsWidget.h',
25 'include/Catalogue/CatalogueSideBarWidget.h',
28 'include/Catalogue/CatalogueSideBarWidget.h',
26 'include/Catalogue/CatalogueInspectorWidget.h'
29 'include/Catalogue/CatalogueInspectorWidget.h'
27 ]
30 ]
28
31
29 gui_ui_files = [
32 gui_ui_files = [
30 'ui/DataSource/DataSourceWidget.ui',
33 'ui/DataSource/DataSourceWidget.ui',
31 'ui/Settings/SqpSettingsDialog.ui',
34 'ui/Settings/SqpSettingsDialog.ui',
32 'ui/Settings/SqpSettingsGeneralWidget.ui',
35 'ui/Settings/SqpSettingsGeneralWidget.ui',
33 'ui/SidePane/SqpSidePane.ui',
36 'ui/SidePane/SqpSidePane.ui',
34 'ui/TimeWidget/TimeWidget.ui',
37 'ui/TimeWidget/TimeWidget.ui',
35 'ui/Variable/VariableInspectorWidget.ui',
38 'ui/Variable/VariableInspectorWidget.ui',
36 'ui/Variable/RenameVariableDialog.ui',
39 'ui/Variable/RenameVariableDialog.ui',
37 'ui/Variable/VariableMenuHeaderWidget.ui',
40 'ui/Variable/VariableMenuHeaderWidget.ui',
38 'ui/Visualization/VisualizationGraphWidget.ui',
41 'ui/Visualization/VisualizationGraphWidget.ui',
39 'ui/Visualization/VisualizationTabWidget.ui',
42 'ui/Visualization/VisualizationTabWidget.ui',
40 'ui/Visualization/VisualizationWidget.ui',
43 'ui/Visualization/VisualizationWidget.ui',
41 'ui/Visualization/VisualizationZoneWidget.ui',
44 'ui/Visualization/VisualizationZoneWidget.ui',
42 'ui/Visualization/ColorScaleEditor.ui',
45 'ui/Visualization/ColorScaleEditor.ui',
43 'ui/Visualization/VisualizationMultiZoneSelectionDialog.ui',
46 'ui/Visualization/VisualizationMultiZoneSelectionDialog.ui',
44 'ui/Catalogue/CatalogueExplorer.ui',
47 'ui/Catalogue/CatalogueExplorer.ui',
45 'ui/Catalogue/CatalogueEventsWidget.ui',
48 'ui/Catalogue/CatalogueEventsWidget.ui',
46 'ui/Catalogue/CatalogueSideBarWidget.ui',
49 'ui/Catalogue/CatalogueSideBarWidget.ui',
47 'ui/Catalogue/CatalogueInspectorWidget.ui'
50 'ui/Catalogue/CatalogueInspectorWidget.ui'
48 ]
51 ]
49
52
50 gui_qresources = ['resources/sqpguiresources.qrc']
53 gui_qresources = ['resources/sqpguiresources.qrc']
51
54
52 gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers,
55 gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers,
53 ui_files : gui_ui_files,
56 ui_files : gui_ui_files,
54 qresources : gui_qresources)
57 qresources : gui_qresources)
55
58
56 gui_sources = [
59 gui_sources = [
57 'src/SqpApplication.cpp',
60 'src/SqpApplication.cpp',
58 'src/DragAndDrop/DragDropGuiController.cpp',
61 'src/DragAndDrop/DragDropGuiController.cpp',
59 'src/DragAndDrop/DragDropScroller.cpp',
62 'src/DragAndDrop/DragDropScroller.cpp',
60 'src/DragAndDrop/DragDropTabSwitcher.cpp',
63 'src/DragAndDrop/DragDropTabSwitcher.cpp',
61 'src/Common/ColorUtils.cpp',
64 'src/Common/ColorUtils.cpp',
62 'src/Common/VisualizationDef.cpp',
65 'src/Common/VisualizationDef.cpp',
63 'src/DataSource/DataSourceTreeWidgetItem.cpp',
66 'src/DataSource/DataSourceTreeWidgetItem.cpp',
64 'src/DataSource/DataSourceTreeWidgetHelper.cpp',
67 'src/DataSource/DataSourceTreeWidgetHelper.cpp',
65 'src/DataSource/DataSourceWidget.cpp',
68 'src/DataSource/DataSourceWidget.cpp',
66 'src/DataSource/DataSourceTreeWidget.cpp',
69 'src/DataSource/DataSourceTreeWidget.cpp',
67 'src/Settings/SqpSettingsDialog.cpp',
70 'src/Settings/SqpSettingsDialog.cpp',
68 'src/Settings/SqpSettingsGeneralWidget.cpp',
71 'src/Settings/SqpSettingsGeneralWidget.cpp',
69 'src/SidePane/SqpSidePane.cpp',
72 'src/SidePane/SqpSidePane.cpp',
70 'src/TimeWidget/TimeWidget.cpp',
73 'src/TimeWidget/TimeWidget.cpp',
71 'src/Variable/VariableInspectorWidget.cpp',
74 'src/Variable/VariableInspectorWidget.cpp',
72 'src/Variable/VariableInspectorTableView.cpp',
75 'src/Variable/VariableInspectorTableView.cpp',
73 'src/Variable/VariableMenuHeaderWidget.cpp',
76 'src/Variable/VariableMenuHeaderWidget.cpp',
74 'src/Variable/RenameVariableDialog.cpp',
77 'src/Variable/RenameVariableDialog.cpp',
75 'src/Visualization/VisualizationGraphHelper.cpp',
78 'src/Visualization/VisualizationGraphHelper.cpp',
76 'src/Visualization/VisualizationGraphRenderingDelegate.cpp',
79 'src/Visualization/VisualizationGraphRenderingDelegate.cpp',
77 'src/Visualization/VisualizationGraphWidget.cpp',
80 'src/Visualization/VisualizationGraphWidget.cpp',
78 'src/Visualization/VisualizationTabWidget.cpp',
81 'src/Visualization/VisualizationTabWidget.cpp',
79 'src/Visualization/VisualizationWidget.cpp',
82 'src/Visualization/VisualizationWidget.cpp',
80 'src/Visualization/VisualizationZoneWidget.cpp',
83 'src/Visualization/VisualizationZoneWidget.cpp',
81 'src/Visualization/qcustomplot.cpp',
84 'src/Visualization/qcustomplot.cpp',
82 'src/Visualization/QCustomPlotSynchronizer.cpp',
85 'src/Visualization/QCustomPlotSynchronizer.cpp',
83 'src/Visualization/operations/FindVariableOperation.cpp',
86 'src/Visualization/operations/FindVariableOperation.cpp',
84 'src/Visualization/operations/GenerateVariableMenuOperation.cpp',
87 'src/Visualization/operations/GenerateVariableMenuOperation.cpp',
85 'src/Visualization/operations/MenuBuilder.cpp',
88 'src/Visualization/operations/MenuBuilder.cpp',
86 'src/Visualization/operations/RemoveVariableOperation.cpp',
89 'src/Visualization/operations/RemoveVariableOperation.cpp',
87 'src/Visualization/operations/RescaleAxeOperation.cpp',
90 'src/Visualization/operations/RescaleAxeOperation.cpp',
88 'src/Visualization/VisualizationDragDropContainer.cpp',
91 'src/Visualization/VisualizationDragDropContainer.cpp',
89 'src/Visualization/VisualizationDragWidget.cpp',
92 'src/Visualization/VisualizationDragWidget.cpp',
90 'src/Visualization/AxisRenderingUtils.cpp',
93 'src/Visualization/AxisRenderingUtils.cpp',
91 'src/Visualization/PlottablesRenderingUtils.cpp',
94 'src/Visualization/PlottablesRenderingUtils.cpp',
92 'src/Visualization/MacScrollBarStyle.cpp',
95 'src/Visualization/MacScrollBarStyle.cpp',
93 'src/Visualization/VisualizationCursorItem.cpp',
96 'src/Visualization/VisualizationCursorItem.cpp',
94 'src/Visualization/ColorScaleEditor.cpp',
97 'src/Visualization/ColorScaleEditor.cpp',
95 'src/Visualization/SqpColorScale.cpp',
98 'src/Visualization/SqpColorScale.cpp',
96 'src/Visualization/QCPColorMapIterator.cpp',
99 'src/Visualization/QCPColorMapIterator.cpp',
97 'src/Visualization/VisualizationSelectionZoneItem.cpp',
100 'src/Visualization/VisualizationSelectionZoneItem.cpp',
98 'src/Visualization/VisualizationSelectionZoneManager.cpp',
101 'src/Visualization/VisualizationSelectionZoneManager.cpp',
99 'src/Actions/SelectionZoneAction.cpp',
102 'src/Actions/SelectionZoneAction.cpp',
100 'src/Actions/ActionsGuiController.cpp',
103 'src/Actions/ActionsGuiController.cpp',
101 'src/Visualization/VisualizationActionManager.cpp',
104 'src/Visualization/VisualizationActionManager.cpp',
102 'src/Visualization/VisualizationMultiZoneSelectionDialog.cpp',
105 'src/Visualization/VisualizationMultiZoneSelectionDialog.cpp',
103 'src/Catalogue/CatalogueExplorer.cpp',
106 'src/Catalogue/CatalogueExplorer.cpp',
104 'src/Catalogue/CatalogueEventsWidget.cpp',
107 'src/Catalogue/CatalogueEventsWidget.cpp',
105 'src/Catalogue/CatalogueSideBarWidget.cpp',
108 'src/Catalogue/CatalogueSideBarWidget.cpp',
106 'src/Catalogue/CatalogueInspectorWidget.cpp'
109 'src/Catalogue/CatalogueInspectorWidget.cpp',
110 'src/Catalogue/CatalogueTreeWidgetItem.cpp'
107 ]
111 ]
108
112
109 gui_inc = include_directories(['include'])
113 gui_inc = include_directories(['include'])
110
114
111 sciqlop_gui_lib = library('sciqlopgui',
115 sciqlop_gui_lib = library('sciqlopgui',
112 gui_sources,
116 gui_sources,
113 gui_moc_files,
117 gui_moc_files,
114 include_directories : [gui_inc],
118 include_directories : [gui_inc],
115 dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core],
119 dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core, catalogueapi_dep],
116 install : true
120 install : true
117 )
121 )
118
122
119 sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib,
123 sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib,
120 include_directories : gui_inc,
124 include_directories : gui_inc,
121 dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core])
125 dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core, catalogueapi_dep])
122
126
@@ -1,100 +1,115
1 #include "Catalogue/CatalogueEventsWidget.h"
1 #include "Catalogue/CatalogueEventsWidget.h"
2 #include "ui_CatalogueEventsWidget.h"
2 #include "ui_CatalogueEventsWidget.h"
3
3
4 #include <QtDebug>
4 #include <Catalogue/CatalogueController.h>
5 #include <CatalogueDao.h>
6 #include <DBCatalogue.h>
7 #include <SqpApplication.h>
8
9
10 /// Format of the dates appearing in the label of a cursor
11 const auto DATETIME_FORMAT = QStringLiteral("yyyy/MM/dd hh:mm:ss");
5
12
6 struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate {
13 struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate {
7 void addEventItem(const QStringList &data, QTableWidget *tableWidget);
14 void addEventItem(const QStringList &data, QTableWidget *tableWidget);
8
15
9 enum class Column { Event, TStart, TEnd, Tags, Product, NbColumn };
16 enum class Column { Event, TStart, TEnd, Tags, Product, NbColumn };
10 QStringList columnNames() { return QStringList{"Event", "TStart", "TEnd", "Tags", "Product"}; }
17 QStringList columnNames() { return QStringList{"Event", "TStart", "TEnd", "Tags", "Product"}; }
18
19 QVector<DBEvent> m_Events;
11 };
20 };
12
21
13
22
14 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
23 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
15 : QWidget(parent),
24 : QWidget(parent),
16 ui(new Ui::CatalogueEventsWidget),
25 ui(new Ui::CatalogueEventsWidget),
17 impl{spimpl::make_unique_impl<CatalogueEventsWidgetPrivate>()}
26 impl{spimpl::make_unique_impl<CatalogueEventsWidgetPrivate>()}
18 {
27 {
19 ui->setupUi(this);
28 ui->setupUi(this);
20
29
21 connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) {
30 connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) {
22 if (checked) {
31 if (checked) {
23 ui->btnChart->setChecked(false);
32 ui->btnChart->setChecked(false);
24 }
33 }
25 });
34 });
26
35
27 connect(ui->btnChart, &QToolButton::clicked, [this](auto checked) {
36 connect(ui->btnChart, &QToolButton::clicked, [this](auto checked) {
28 if (checked) {
37 if (checked) {
29 ui->btnTime->setChecked(false);
38 ui->btnTime->setChecked(false);
30 }
39 }
31 });
40 });
32
41
33 connect(ui->tableWidget, &QTableWidget::cellClicked, [this](auto row, auto column) {
42 connect(ui->tableWidget, &QTableWidget::cellClicked, [this](auto row, auto column) {
34 auto event = ui->tableWidget->item(row, 0)->text();
43 auto event = impl->m_Events.value(row);
35 emit this->eventSelected(event);
44 emit this->eventSelected(event);
36 });
45 });
37
46
38 connect(ui->tableWidget, &QTableWidget::currentItemChanged,
47 connect(ui->tableWidget, &QTableWidget::currentItemChanged,
39 [this](auto current, auto previous) {
48 [this](auto current, auto previous) {
40 if (current && current->row() >= 0) {
49 if (current && current->row() >= 0) {
41 auto event = ui->tableWidget->item(current->row(), 0)->text();
50 auto event = impl->m_Events.value(current->row());
42 emit this->eventSelected(event);
51 emit this->eventSelected(event);
43 }
52 }
44 });
53 });
45
54
46 connect(ui->tableWidget, &QTableWidget::itemSelectionChanged, [this]() {
55 connect(ui->tableWidget, &QTableWidget::itemSelectionChanged, [this]() {
47 auto selection = ui->tableWidget->selectedRanges();
56 auto selection = ui->tableWidget->selectedRanges();
48 auto isNotMultiSelection
57 auto isNotMultiSelection
49 = selection.isEmpty() || (selection.count() == 1 && selection.first().rowCount() == 1);
58 = selection.isEmpty() || (selection.count() == 1 && selection.first().rowCount() == 1);
50 ui->btnChart->setEnabled(isNotMultiSelection);
59 ui->btnChart->setEnabled(isNotMultiSelection);
51 ui->btnTime->setEnabled(isNotMultiSelection);
60 ui->btnTime->setEnabled(isNotMultiSelection);
52 });
61 });
53
62
54 Q_ASSERT(impl->columnNames().count() == (int)CatalogueEventsWidgetPrivate::Column::NbColumn);
63 Q_ASSERT(impl->columnNames().count() == (int)CatalogueEventsWidgetPrivate::Column::NbColumn);
55 ui->tableWidget->setColumnCount((int)CatalogueEventsWidgetPrivate::Column::NbColumn);
64 ui->tableWidget->setColumnCount((int)CatalogueEventsWidgetPrivate::Column::NbColumn);
56 ui->tableWidget->setHorizontalHeaderLabels(impl->columnNames());
65 ui->tableWidget->setHorizontalHeaderLabels(impl->columnNames());
57 ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
66 ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
58 ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
67 ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
59 ui->tableWidget->horizontalHeader()->setSortIndicatorShown(true);
68 ui->tableWidget->horizontalHeader()->setSortIndicatorShown(true);
60 }
69 }
61
70
62 CatalogueEventsWidget::~CatalogueEventsWidget()
71 CatalogueEventsWidget::~CatalogueEventsWidget()
63 {
72 {
64 delete ui;
73 delete ui;
65 }
74 }
66
75
67 void CatalogueEventsWidget::populateWithCatalogue(const QString &catalogue)
76 void CatalogueEventsWidget::populateWithCatalogue(const DBCatalogue &catalogue)
68 {
77 {
69 ui->tableWidget->clearContents();
78 ui->tableWidget->clearContents();
70 ui->tableWidget->setRowCount(0);
79 ui->tableWidget->setRowCount(0);
71
80
72 // TODO
81 auto &dao = sqpApp->catalogueController().getDao();
73 impl->addEventItem(
82 auto events = dao.getCatalogueEvents(catalogue);
74 {catalogue + " - Event 1", "12/12/2012 12:12", "12/12/2042 12:52", "cloud", "mfi/b_gse42"},
83
75 ui->tableWidget);
84 for (auto event : events) {
76 impl->addEventItem(
85 impl->m_Events << event;
77 {catalogue + " - Event 2", "12/12/2012 12:10", "12/12/2042 12:42", "Acloud", "mfi/b_gse1"},
86
78 ui->tableWidget);
87 auto tags = event.getTags();
79 impl->addEventItem(
88 QString tagList;
80 {catalogue + " - Event 3", "12/12/2012 12:22", "12/12/2042 12:12", "Gcloud", "mfi/b_gse2"},
89 for (auto tag : tags) {
81 ui->tableWidget);
90 tagList += tag.getName();
82 impl->addEventItem(
91 tagList += ' ';
83 {catalogue + " - Event 4", "12/12/2012 12:00", "12/12/2042 12:62", "Bcloud", "mfi/b_gse3"},
92 }
84 ui->tableWidget);
93
94 impl->addEventItem({event.getName(),
95 DateUtils::dateTime(event.getTStart()).toString(DATETIME_FORMAT),
96 DateUtils::dateTime(event.getTEnd()).toString(DATETIME_FORMAT), tagList,
97 event.getProduct()},
98 ui->tableWidget);
99 }
85 }
100 }
86
101
87 void CatalogueEventsWidget::CatalogueEventsWidgetPrivate::addEventItem(const QStringList &data,
102 void CatalogueEventsWidget::CatalogueEventsWidgetPrivate::addEventItem(const QStringList &data,
88 QTableWidget *tableWidget)
103 QTableWidget *tableWidget)
89 {
104 {
90 tableWidget->setSortingEnabled(false);
105 tableWidget->setSortingEnabled(false);
91 auto row = tableWidget->rowCount();
106 auto row = tableWidget->rowCount();
92 tableWidget->setRowCount(row + 1);
107 tableWidget->setRowCount(row + 1);
93
108
94 for (auto i = 0; i < (int)Column::NbColumn; ++i) {
109 for (auto i = 0; i < (int)Column::NbColumn; ++i) {
95 auto item = new QTableWidgetItem(data.value(i));
110 auto item = new QTableWidgetItem(data.value(i));
96 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
111 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
97 tableWidget->setItem(row, i, item);
112 tableWidget->setItem(row, i, item);
98 }
113 }
99 tableWidget->setSortingEnabled(true);
114 tableWidget->setSortingEnabled(true);
100 }
115 }
@@ -1,22 +1,25
1 #include "Catalogue/CatalogueExplorer.h"
1 #include "Catalogue/CatalogueExplorer.h"
2 #include "ui_CatalogueExplorer.h"
2 #include "ui_CatalogueExplorer.h"
3
3
4 #include <DBCatalogue.h>
5 #include <DBEvent.h>
6
4 CatalogueExplorer::CatalogueExplorer(QWidget *parent)
7 CatalogueExplorer::CatalogueExplorer(QWidget *parent)
5 : QDialog(parent, Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
8 : QDialog(parent, Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
6 ui(new Ui::CatalogueExplorer)
9 ui(new Ui::CatalogueExplorer)
7 {
10 {
8 ui->setupUi(this);
11 ui->setupUi(this);
9
12
10 connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSelected, [this](auto name) {
13 connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSelected, [this](auto catalogue) {
11 ui->inspector->setCatalogue(name);
14 ui->inspector->setCatalogue(catalogue);
12 ui->events->populateWithCatalogue(name);
15 ui->events->populateWithCatalogue(catalogue);
13 });
16 });
14
17
15 connect(ui->events, &CatalogueEventsWidget::eventSelected,
18 connect(ui->events, &CatalogueEventsWidget::eventSelected,
16 [this](auto name) { ui->inspector->setEvent(name); });
19 [this](auto event) { ui->inspector->setEvent(event); });
17 }
20 }
18
21
19 CatalogueExplorer::~CatalogueExplorer()
22 CatalogueExplorer::~CatalogueExplorer()
20 {
23 {
21 delete ui;
24 delete ui;
22 }
25 }
@@ -1,36 +1,56
1 #include "Catalogue/CatalogueInspectorWidget.h"
1 #include "Catalogue/CatalogueInspectorWidget.h"
2 #include "ui_CatalogueInspectorWidget.h"
2 #include "ui_CatalogueInspectorWidget.h"
3
3
4 #include <Common/DateUtils.h>
5 #include <DBCatalogue.h>
6 #include <DBEvent.h>
7 #include <DBTag.h>
8
4 CatalogueInspectorWidget::CatalogueInspectorWidget(QWidget *parent)
9 CatalogueInspectorWidget::CatalogueInspectorWidget(QWidget *parent)
5 : QWidget(parent), ui(new Ui::CatalogueInspectorWidget)
10 : QWidget(parent), ui(new Ui::CatalogueInspectorWidget)
6 {
11 {
7 ui->setupUi(this);
12 ui->setupUi(this);
8 showPage(Page::Empty);
13 showPage(Page::Empty);
9 }
14 }
10
15
11 CatalogueInspectorWidget::~CatalogueInspectorWidget()
16 CatalogueInspectorWidget::~CatalogueInspectorWidget()
12 {
17 {
13 delete ui;
18 delete ui;
14 }
19 }
15
20
16 void CatalogueInspectorWidget::showPage(CatalogueInspectorWidget::Page page)
21 void CatalogueInspectorWidget::showPage(CatalogueInspectorWidget::Page page)
17 {
22 {
18 ui->stackedWidget->setCurrentIndex(static_cast<int>(page));
23 ui->stackedWidget->setCurrentIndex(static_cast<int>(page));
19 }
24 }
20
25
21 CatalogueInspectorWidget::Page CatalogueInspectorWidget::currentPage() const
26 CatalogueInspectorWidget::Page CatalogueInspectorWidget::currentPage() const
22 {
27 {
23 return static_cast<Page>(ui->stackedWidget->currentIndex());
28 return static_cast<Page>(ui->stackedWidget->currentIndex());
24 }
29 }
25
30
26 void CatalogueInspectorWidget::setEvent(const QString &event)
31 void CatalogueInspectorWidget::setEvent(const DBEvent &event)
27 {
32 {
28 showPage(Page::EventProperties);
33 showPage(Page::EventProperties);
29 ui->leEventName->setText(event);
34 ui->leEventName->setText(event.getName());
35 ui->leEventMission->setText(event.getMission());
36 ui->leEventProduct->setText(event.getProduct());
37
38 QString tagList;
39 auto tags = const_cast<DBEvent *>(&event)->getTags();
40 for (auto tag : tags) {
41 tagList += tag.getName();
42 tagList += ' ';
43 }
44
45 ui->leEventTags->setText(tagList);
46
47 ui->dateTimeEventTStart->setDateTime(DateUtils::dateTime(event.getTStart()));
48 ui->dateTimeEventTEnd->setDateTime(DateUtils::dateTime(event.getTEnd()));
30 }
49 }
31
50
32 void CatalogueInspectorWidget::setCatalogue(const QString &catalogue)
51 void CatalogueInspectorWidget::setCatalogue(const DBCatalogue &catalogue)
33 {
52 {
34 showPage(Page::CatalogueProperties);
53 showPage(Page::CatalogueProperties);
35 ui->leCatalogueName->setText(catalogue);
54 ui->leCatalogueName->setText(catalogue.getName());
55 ui->leCatalogueAuthor->setText(catalogue.getAuthor());
36 }
56 }
@@ -1,101 +1,113
1 #include "Catalogue/CatalogueSideBarWidget.h"
1 #include "Catalogue/CatalogueSideBarWidget.h"
2 #include "ui_CatalogueSideBarWidget.h"
2 #include "ui_CatalogueSideBarWidget.h"
3 #include <SqpApplication.h>
4
5 #include <Catalogue/CatalogueController.h>
6 #include <Catalogue/CatalogueTreeWidgetItem.h>
7 #include <CatalogueDao.h>
8 #include <ComparaisonPredicate.h>
9 #include <DBCatalogue.h>
10
3
11
4 constexpr auto ALL_EVENT_ITEM_TYPE = QTreeWidgetItem::UserType;
12 constexpr auto ALL_EVENT_ITEM_TYPE = QTreeWidgetItem::UserType;
5 constexpr auto TRASH_ITEM_TYPE = QTreeWidgetItem::UserType + 1;
13 constexpr auto TRASH_ITEM_TYPE = QTreeWidgetItem::UserType + 1;
6 constexpr auto CATALOGUE_ITEM_TYPE = QTreeWidgetItem::UserType + 2;
14 constexpr auto CATALOGUE_ITEM_TYPE = QTreeWidgetItem::UserType + 2;
7 constexpr auto DATABASE_ITEM_TYPE = QTreeWidgetItem::UserType + 3;
15 constexpr auto DATABASE_ITEM_TYPE = QTreeWidgetItem::UserType + 3;
8
16
9
17
10 struct CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate {
18 struct CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate {
19
20 QHash<QTreeWidgetItem *, DBCatalogue> m_CatalogueMap;
21
11 void configureTreeWidget(QTreeWidget *treeWidget);
22 void configureTreeWidget(QTreeWidget *treeWidget);
12 QTreeWidgetItem *addDatabaseItem(const QString &name, QTreeWidget *treeWidget);
23 QTreeWidgetItem *addDatabaseItem(const QString &name, QTreeWidget *treeWidget);
13 void addCatalogueItem(const QString &name, QTreeWidgetItem *parentDatabaseItem);
24 void addCatalogueItem(const DBCatalogue &catalogue, QTreeWidgetItem *parentDatabaseItem);
14 };
25 };
15
26
16 CatalogueSideBarWidget::CatalogueSideBarWidget(QWidget *parent)
27 CatalogueSideBarWidget::CatalogueSideBarWidget(QWidget *parent)
17 : QWidget(parent),
28 : QWidget(parent),
18 ui(new Ui::CatalogueSideBarWidget),
29 ui(new Ui::CatalogueSideBarWidget),
19 impl{spimpl::make_unique_impl<CatalogueSideBarWidgetPrivate>()}
30 impl{spimpl::make_unique_impl<CatalogueSideBarWidgetPrivate>()}
20 {
31 {
21 ui->setupUi(this);
32 ui->setupUi(this);
22 impl->configureTreeWidget(ui->treeWidget);
33 impl->configureTreeWidget(ui->treeWidget);
23
34
24 auto emitSelection = [this](auto item) {
35 auto emitSelection = [this](auto item) {
25 switch (item->type()) {
36 switch (item->type()) {
26 case CATALOGUE_ITEM_TYPE:
37 case CATALOGUE_ITEM_TYPE:
27 emit this->catalogueSelected(item->text(0));
38 emit this->catalogueSelected(
39 static_cast<CatalogueTreeWidgetItem *>(item)->catalogue());
28 break;
40 break;
29 case ALL_EVENT_ITEM_TYPE:
41 case ALL_EVENT_ITEM_TYPE:
30 emit this->allEventsSelected();
42 emit this->allEventsSelected();
31 break;
43 break;
32 case TRASH_ITEM_TYPE:
44 case TRASH_ITEM_TYPE:
33 emit this->trashSelected();
45 emit this->trashSelected();
34 break;
46 break;
35 case DATABASE_ITEM_TYPE:
47 case DATABASE_ITEM_TYPE:
36 default:
48 default:
37 break;
49 break;
38 }
50 }
39 };
51 };
40
52
41 connect(ui->treeWidget, &QTreeWidget::itemClicked, emitSelection);
53 connect(ui->treeWidget, &QTreeWidget::itemClicked, emitSelection);
42 connect(ui->treeWidget, &QTreeWidget::currentItemChanged, emitSelection);
54 connect(ui->treeWidget, &QTreeWidget::currentItemChanged, emitSelection);
43 }
55 }
44
56
45 CatalogueSideBarWidget::~CatalogueSideBarWidget()
57 CatalogueSideBarWidget::~CatalogueSideBarWidget()
46 {
58 {
47 delete ui;
59 delete ui;
48 }
60 }
49
61
50 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::configureTreeWidget(
62 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::configureTreeWidget(
51 QTreeWidget *treeWidget)
63 QTreeWidget *treeWidget)
52 {
64 {
53 auto allEventsItem = new QTreeWidgetItem({"All Events"}, ALL_EVENT_ITEM_TYPE);
65 auto allEventsItem = new QTreeWidgetItem({"All Events"}, ALL_EVENT_ITEM_TYPE);
54 allEventsItem->setIcon(0, QIcon(":/icones/allEvents.png"));
66 allEventsItem->setIcon(0, QIcon(":/icones/allEvents.png"));
55 treeWidget->addTopLevelItem(allEventsItem);
67 treeWidget->addTopLevelItem(allEventsItem);
56
68
57 auto trashItem = new QTreeWidgetItem({"Trash"}, TRASH_ITEM_TYPE);
69 auto trashItem = new QTreeWidgetItem({"Trash"}, TRASH_ITEM_TYPE);
58 trashItem->setIcon(0, QIcon(":/icones/trash.png"));
70 trashItem->setIcon(0, QIcon(":/icones/trash.png"));
59 treeWidget->addTopLevelItem(trashItem);
71 treeWidget->addTopLevelItem(trashItem);
60
72
61 auto separator = new QFrame(treeWidget);
73 auto separator = new QFrame(treeWidget);
62 separator->setFrameShape(QFrame::HLine);
74 separator->setFrameShape(QFrame::HLine);
63
75
64 auto separatorItem = new QTreeWidgetItem();
76 auto separatorItem = new QTreeWidgetItem();
65 separatorItem->setFlags(Qt::NoItemFlags);
77 separatorItem->setFlags(Qt::NoItemFlags);
66 treeWidget->addTopLevelItem(separatorItem);
78 treeWidget->addTopLevelItem(separatorItem);
67 treeWidget->setItemWidget(separatorItem, 0, separator);
79 treeWidget->setItemWidget(separatorItem, 0, separator);
68
80
69 // Test
81 // Test
70 auto db = addDatabaseItem("Database 1", treeWidget);
82 auto &dao = sqpApp->catalogueController().getDao();
71 addCatalogueItem("Catalogue 1", db);
83 auto allPredicate = std::make_shared<ComparaisonPredicate>(QString{"uniqId"}, "-1",
72 addCatalogueItem("Catalogue 2", db);
84 ComparaisonOperation::DIFFERENT);
73 addCatalogueItem("Catalogue 3", db);
85
74 addCatalogueItem("Catalogue 4", db);
86 auto db = addDatabaseItem("Default", treeWidget);
75
87
76 auto db2 = addDatabaseItem("Database 2", treeWidget);
88 auto catalogues = dao.getCatalogues(allPredicate);
77 addCatalogueItem("Catalogue A", db2);
89 for (auto catalogue : catalogues) {
78 addCatalogueItem("Catalogue B", db2);
90 addCatalogueItem(catalogue, db);
79 addCatalogueItem("Catalogue C", db2);
91 }
80
92
81 treeWidget->expandAll();
93 treeWidget->expandAll();
82 }
94 }
83
95
84 QTreeWidgetItem *
96 QTreeWidgetItem *
85 CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::addDatabaseItem(const QString &name,
97 CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::addDatabaseItem(const QString &name,
86 QTreeWidget *treeWidget)
98 QTreeWidget *treeWidget)
87 {
99 {
88 auto databaseItem = new QTreeWidgetItem({name}, DATABASE_ITEM_TYPE);
100 auto databaseItem = new QTreeWidgetItem({name}, DATABASE_ITEM_TYPE);
89 databaseItem->setIcon(0, QIcon(":/icones/database.png"));
101 databaseItem->setIcon(0, QIcon(":/icones/database.png"));
90 treeWidget->addTopLevelItem(databaseItem);
102 treeWidget->addTopLevelItem(databaseItem);
91
103
92 return databaseItem;
104 return databaseItem;
93 }
105 }
94
106
95 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::addCatalogueItem(
107 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::addCatalogueItem(
96 const QString &name, QTreeWidgetItem *parentDatabaseItem)
108 const DBCatalogue &catalogue, QTreeWidgetItem *parentDatabaseItem)
97 {
109 {
98 auto catalogueItem = new QTreeWidgetItem({name}, CATALOGUE_ITEM_TYPE);
110 auto catalogueItem = new CatalogueTreeWidgetItem(catalogue, CATALOGUE_ITEM_TYPE);
99 catalogueItem->setIcon(0, QIcon(":/icones/catalogue.png"));
111 catalogueItem->setIcon(0, QIcon(":/icones/catalogue.png"));
100 parentDatabaseItem->addChild(catalogueItem);
112 parentDatabaseItem->addChild(catalogueItem);
101 }
113 }
General Comments 3
Under Review
author

Auto status change to "Under Review"

Approved

Status change > Approved

You need to be logged in to leave comments. Login now