##// END OF EJS Templates
Merge branch 'feature/CatalogueGui' into develop
trabillard -
r1145:d65e500c483d merge
parent child
Show More
@@ -0,0 +1,38
1 #ifndef SCIQLOP_CATALOGUEEVENTSTABLEMODEL_H
2 #define SCIQLOP_CATALOGUEEVENTSTABLEMODEL_H
3
4 #include <Common/spimpl.h>
5 #include <QAbstractTableModel>
6
7 class DBEvent;
8
9 class CatalogueEventsTableModel : public QAbstractTableModel {
10 public:
11 CatalogueEventsTableModel(QObject *parent = nullptr);
12
13 void setEvents(const QVector<std::shared_ptr<DBEvent> > &events);
14 std::shared_ptr<DBEvent> getEvent(int row) const;
15
16 void addEvent(const std::shared_ptr<DBEvent> &events);
17 void removeEvent(const std::shared_ptr<DBEvent> &events);
18
19 // Model
20 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
21 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
22 Qt::ItemFlags flags(const QModelIndex &index) const override;
23 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
24 QVariant headerData(int section, Qt::Orientation orientation,
25 int role = Qt::DisplayRole) const override;
26 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
27
28 Qt::DropActions supportedDragActions() const override;
29 QStringList mimeTypes() const override;
30 QMimeData *mimeData(const QModelIndexList &indexes) const override;
31
32
33 private:
34 class CatalogueEventsTableModelPrivate;
35 spimpl::unique_impl_ptr<CatalogueEventsTableModelPrivate> impl;
36 };
37
38 #endif // SCIQLOP_CATALOGUEEVENTSTABLEMODEL_H
@@ -0,0 +1,28
1 #ifndef SCIQLOP_CATALOGUETREEWIDGETITEM_H
2 #define SCIQLOP_CATALOGUETREEWIDGETITEM_H
3
4 #include <Common/spimpl.h>
5 #include <QTreeWidgetItem>
6
7 class DBCatalogue;
8
9
10 class CatalogueTreeWidgetItem : public QTreeWidgetItem {
11 public:
12 CatalogueTreeWidgetItem(std::shared_ptr<DBCatalogue> catalogue,
13 int type = QTreeWidgetItem::Type);
14
15 QVariant data(int column, int role) const override;
16 void setData(int column, int role, const QVariant &value) override;
17
18 /// Returns the catalogue represented by the item
19 std::shared_ptr<DBCatalogue> catalogue() const;
20
21 void setHasChanges(bool value);
22
23 private:
24 class CatalogueTreeWidgetItemPrivate;
25 spimpl::unique_impl_ptr<CatalogueTreeWidgetItemPrivate> impl;
26 };
27
28 #endif // SCIQLOP_CATALOGUETREEWIDGETITEM_H
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,185
1 #include "Catalogue/CatalogueEventsTableModel.h"
2
3 #include <Common/DateUtils.h>
4 #include <Common/MimeTypesDef.h>
5 #include <DBEvent.h>
6 #include <DBTag.h>
7 #include <Data/SqpRange.h>
8 #include <QMimeData>
9 #include <SqpApplication.h>
10 #include <Time/TimeController.h>
11
12 struct CatalogueEventsTableModel::CatalogueEventsTableModelPrivate {
13 QVector<std::shared_ptr<DBEvent> > m_Events;
14
15 enum class Column { Event, TStart, TEnd, Tags, Product, NbColumn };
16 QStringList columnNames()
17 {
18 return QStringList{tr("Event"), tr("TStart"), tr("TEnd"), tr("Tags"), tr("Product")};
19 }
20
21 QVariant eventData(int col, const std::shared_ptr<DBEvent> &event) const
22 {
23 switch (static_cast<Column>(col)) {
24 case Column::Event:
25 return event->getName();
26 case Column::TStart:
27 return DateUtils::dateTime(event->getTStart());
28 case Column::TEnd:
29 return DateUtils::dateTime(event->getTEnd());
30 case Column::Product:
31 return event->getProduct();
32 case Column::Tags: {
33 QString tagList;
34 auto tags = event->getTags();
35 for (auto tag : tags) {
36 tagList += tag.getName();
37 tagList += ' ';
38 }
39
40 return tagList;
41 }
42 default:
43 break;
44 }
45
46 Q_ASSERT(false);
47 return QStringLiteral("Unknown Data");
48 }
49 };
50
51 CatalogueEventsTableModel::CatalogueEventsTableModel(QObject *parent)
52 : QAbstractTableModel(parent),
53 impl{spimpl::make_unique_impl<CatalogueEventsTableModelPrivate>()}
54 {
55 }
56
57 void CatalogueEventsTableModel::setEvents(const QVector<std::shared_ptr<DBEvent> > &events)
58 {
59 beginResetModel();
60 impl->m_Events = events;
61 endResetModel();
62 }
63
64 std::shared_ptr<DBEvent> CatalogueEventsTableModel::getEvent(int row) const
65 {
66 return impl->m_Events.value(row);
67 }
68
69 void CatalogueEventsTableModel::addEvent(const std::shared_ptr<DBEvent> &events)
70 {
71 beginInsertRows(QModelIndex(), impl->m_Events.count() - 1, impl->m_Events.count() - 1);
72 // impl->m_Events.append(event); TODO
73 endInsertRows();
74 }
75
76 void CatalogueEventsTableModel::removeEvent(const std::shared_ptr<DBEvent> &events)
77 {
78 // TODO
79 auto index = -1; // impl->m_Events.indexOf(event);
80 if (index >= 0) {
81 beginRemoveRows(QModelIndex(), index, index);
82 impl->m_Events.removeAt(index);
83 endRemoveRows();
84 }
85 }
86
87 int CatalogueEventsTableModel::rowCount(const QModelIndex &parent) const
88 {
89 int r = impl->m_Events.count();
90 return r;
91 }
92
93 int CatalogueEventsTableModel::columnCount(const QModelIndex &parent) const
94 {
95 int c = static_cast<int>(CatalogueEventsTableModelPrivate::Column::NbColumn);
96 return c;
97 }
98
99 Qt::ItemFlags CatalogueEventsTableModel::flags(const QModelIndex &index) const
100 {
101 return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
102 }
103
104 QVariant CatalogueEventsTableModel::data(const QModelIndex &index, int role) const
105 {
106 if (index.isValid()) {
107 auto event = getEvent(index.row());
108
109 switch (role) {
110 case Qt::DisplayRole:
111 return impl->eventData(index.column(), event);
112 break;
113 }
114 }
115
116 return QVariant{};
117 }
118
119 QVariant CatalogueEventsTableModel::headerData(int section, Qt::Orientation orientation,
120 int role) const
121 {
122 if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
123 return impl->columnNames().value(section);
124 }
125
126 return QVariant();
127 }
128
129 void CatalogueEventsTableModel::sort(int column, Qt::SortOrder order)
130 {
131 std::sort(impl->m_Events.begin(), impl->m_Events.end(),
132 [this, column, order](auto e1, auto e2) {
133 auto data1 = impl->eventData(column, e1);
134 auto data2 = impl->eventData(column, e2);
135
136 auto result = data1.toString() < data2.toString();
137
138 return order == Qt::AscendingOrder ? result : !result;
139 });
140
141 emit dataChanged(QModelIndex(), QModelIndex());
142 }
143
144 Qt::DropActions CatalogueEventsTableModel::supportedDragActions() const
145 {
146 return Qt::CopyAction | Qt::MoveAction;
147 }
148
149 QStringList CatalogueEventsTableModel::mimeTypes() const
150 {
151 return {MIME_TYPE_EVENT_LIST, MIME_TYPE_TIME_RANGE};
152 }
153
154 QMimeData *CatalogueEventsTableModel::mimeData(const QModelIndexList &indexes) const
155 {
156 auto mimeData = new QMimeData;
157
158 QVector<std::shared_ptr<DBEvent> > eventList;
159
160 SqpRange firstTimeRange;
161 for (const auto &index : indexes) {
162 if (index.column() == 0) { // only the first column
163 auto event = getEvent(index.row());
164 if (eventList.isEmpty()) {
165 // Gets the range of the first variable
166 firstTimeRange.m_TStart = event->getTStart();
167 firstTimeRange.m_TEnd = event->getTEnd();
168 }
169
170 eventList << event;
171 }
172 }
173
174 auto eventsEncodedData
175 = QByteArray{}; // sqpApp->catalogueController().->mimeDataForEvents(eventList); //TODO
176 mimeData->setData(MIME_TYPE_EVENT_LIST, eventsEncodedData);
177
178 if (eventList.count() == 1) {
179 // No time range MIME data if multiple events are dragged
180 auto timeEncodedData = TimeController::mimeDataForTimeRange(firstTimeRange);
181 mimeData->setData(MIME_TYPE_TIME_RANGE, timeEncodedData);
182 }
183
184 return mimeData;
185 }
@@ -0,0 +1,93
1 #include "Catalogue/CatalogueTreeWidgetItem.h"
2
3 #include <memory>
4
5 #include <DBCatalogue.h>
6 #include <QBoxLayout>
7 #include <QToolButton>
8
9 const auto VALIDATION_BUTTON_ICON_SIZE = 12;
10
11 struct CatalogueTreeWidgetItem::CatalogueTreeWidgetItemPrivate {
12
13 std::shared_ptr<DBCatalogue> m_Catalogue;
14
15 CatalogueTreeWidgetItemPrivate(std::shared_ptr<DBCatalogue> catalogue) : m_Catalogue(catalogue)
16 {
17 }
18 };
19
20
21 CatalogueTreeWidgetItem::CatalogueTreeWidgetItem(std::shared_ptr<DBCatalogue> catalogue, int type)
22 : QTreeWidgetItem(type),
23 impl{spimpl::make_unique_impl<CatalogueTreeWidgetItemPrivate>(catalogue)}
24 {
25 setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable);
26 }
27
28 QVariant CatalogueTreeWidgetItem::data(int column, int role) const
29 {
30 if (column == 0) {
31 switch (role) {
32 case Qt::EditRole: // fallthrough
33 case Qt::DisplayRole:
34 return impl->m_Catalogue->getName();
35 default:
36 break;
37 }
38 }
39
40 return QTreeWidgetItem::data(column, role);
41 }
42
43 void CatalogueTreeWidgetItem::setData(int column, int role, const QVariant &value)
44 {
45 if (role == Qt::EditRole && column == 0) {
46 auto newName = value.toString();
47 if (newName != impl->m_Catalogue->getName()) {
48 setText(0, newName);
49 impl->m_Catalogue->setName(newName);
50 setHasChanges(true);
51 }
52 }
53 else {
54 QTreeWidgetItem::setData(column, role, value);
55 }
56 }
57
58 std::shared_ptr<DBCatalogue> CatalogueTreeWidgetItem::catalogue() const
59 {
60 return impl->m_Catalogue;
61 }
62
63 void CatalogueTreeWidgetItem::setHasChanges(bool value)
64 {
65 if (value) {
66 auto widet = new QWidget{treeWidget()};
67
68 auto layout = new QHBoxLayout{widet};
69 layout->setContentsMargins(0, 0, 0, 0);
70 layout->setSpacing(0);
71
72 auto btnValid = new QToolButton{widet};
73 btnValid->setIcon(QIcon{":/icones/save"});
74 btnValid->setIconSize(QSize{VALIDATION_BUTTON_ICON_SIZE, VALIDATION_BUTTON_ICON_SIZE});
75 btnValid->setAutoRaise(true);
76 QObject::connect(btnValid, &QToolButton::clicked, [this]() { setHasChanges(false); });
77 layout->addWidget(btnValid);
78
79 auto btnDiscard = new QToolButton{widet};
80 btnDiscard->setIcon(QIcon{":/icones/discard"});
81 btnDiscard->setIconSize(QSize{VALIDATION_BUTTON_ICON_SIZE, VALIDATION_BUTTON_ICON_SIZE});
82 btnDiscard->setAutoRaise(true);
83 QObject::connect(btnDiscard, &QToolButton::clicked, [this]() { setHasChanges(false); });
84 layout->addWidget(btnDiscard);
85
86 treeWidget()->setItemWidget(this, 1, {widet});
87 treeWidget()->resizeColumnToContents(1);
88 }
89 else {
90 // Note: the widget is destroyed
91 treeWidget()->setItemWidget(this, 1, nullptr);
92 }
93 }
@@ -86,6 +86,8 MainWindow::MainWindow(QWidget *parent)
86 m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false);
86 m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false);
87 m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false);
87 m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false);
88
88
89 impl->m_CatalogExplorer->setVisualizationWidget(m_Ui->view);
90
89
91
90 auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane();
92 auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane();
91 auto openLeftInspectorAction = new QAction{QIcon{
93 auto openLeftInspectorAction = new QAction{QIcon{
@@ -41,8 +41,7 public:
41 std::list<std::shared_ptr<DBEvent> > retrieveEvents(const QString &repository) const;
41 std::list<std::shared_ptr<DBEvent> > retrieveEvents(const QString &repository) const;
42 std::list<std::shared_ptr<DBEvent> > retrieveAllEvents() const;
42 std::list<std::shared_ptr<DBEvent> > retrieveAllEvents() const;
43 std::list<std::shared_ptr<DBEvent> >
43 std::list<std::shared_ptr<DBEvent> >
44 retrieveEventsFromCatalogue(const QString &repository,
44 retrieveEventsFromCatalogue(std::shared_ptr<DBCatalogue> catalogue) const;
45 std::shared_ptr<DBCatalogue> catalogue) const;
46 // void updateEvent(std::shared_ptr<DBEvent> event);
45 // void updateEvent(std::shared_ptr<DBEvent> event);
47 // void trashEvent(std::shared_ptr<DBEvent> event);
46 // void trashEvent(std::shared_ptr<DBEvent> event);
48 // void removeEvent(std::shared_ptr<DBEvent> event);
47 // void removeEvent(std::shared_ptr<DBEvent> event);
@@ -15,6 +15,7 extern SCIQLOP_CORE_EXPORT const QString MIME_TYPE_VARIABLE_LIST;
15 extern SCIQLOP_CORE_EXPORT const QString MIME_TYPE_PRODUCT_LIST;
15 extern SCIQLOP_CORE_EXPORT const QString MIME_TYPE_PRODUCT_LIST;
16 extern SCIQLOP_CORE_EXPORT const QString MIME_TYPE_TIME_RANGE;
16 extern SCIQLOP_CORE_EXPORT const QString MIME_TYPE_TIME_RANGE;
17 extern SCIQLOP_CORE_EXPORT const QString MIME_TYPE_SELECTION_ZONE;
17 extern SCIQLOP_CORE_EXPORT const QString MIME_TYPE_SELECTION_ZONE;
18 extern SCIQLOP_CORE_EXPORT const QString MIME_TYPE_EVENT_LIST;
18
19
19
20
20 #endif // SCIQLOP_MIMETYPESDEF_H
21 #endif // SCIQLOP_MIMETYPESDEF_H
@@ -103,8 +103,7 std::list<std::shared_ptr<DBEvent> > CatalogueController::retrieveAllEvents() co
103 }
103 }
104
104
105 std::list<std::shared_ptr<DBEvent> >
105 std::list<std::shared_ptr<DBEvent> >
106 CatalogueController::retrieveEventsFromCatalogue(const QString &repository,
106 CatalogueController::retrieveEventsFromCatalogue(std::shared_ptr<DBCatalogue> catalogue) const
107 std::shared_ptr<DBCatalogue> catalogue) const
108 {
107 {
109 auto eventsShared = std::list<std::shared_ptr<DBEvent> >{};
108 auto eventsShared = std::list<std::shared_ptr<DBEvent> >{};
110 auto events = impl->m_CatalogueDao.getCatalogueEvents(*catalogue);
109 auto events = impl->m_CatalogueDao.getCatalogueEvents(*catalogue);
@@ -6,3 +6,4 const QString MIME_TYPE_VARIABLE_LIST = QStringLiteral("sciqlop/var-list");
6 const QString MIME_TYPE_PRODUCT_LIST = QStringLiteral("sciqlop/product-list");
6 const QString MIME_TYPE_PRODUCT_LIST = QStringLiteral("sciqlop/product-list");
7 const QString MIME_TYPE_TIME_RANGE = QStringLiteral("sciqlop/time-range");
7 const QString MIME_TYPE_TIME_RANGE = QStringLiteral("sciqlop/time-range");
8 const QString MIME_TYPE_SELECTION_ZONE = QStringLiteral("sciqlop/selection-zone");
8 const QString MIME_TYPE_SELECTION_ZONE = QStringLiteral("sciqlop/selection-zone");
9 const QString MIME_TYPE_EVENT_LIST = QStringLiteral("sciqlop/event-list");
@@ -669,7 +669,7 AcquisitionZoomType VariableController::getZoomType(const SqpRange &range, const
669 qCDebug(LOG_VariableController()) << "zoomtype: PanLeft";
669 qCDebug(LOG_VariableController()) << "zoomtype: PanLeft";
670 zoomType = AcquisitionZoomType::PanLeft;
670 zoomType = AcquisitionZoomType::PanLeft;
671 }
671 }
672 else if (range.m_TStart > oldRange.m_TStart && oldRange.m_TEnd > range.m_TEnd) {
672 else if (range.m_TStart >= oldRange.m_TStart && oldRange.m_TEnd >= range.m_TEnd) {
673 qCDebug(LOG_VariableController()) << "zoomtype: ZoomIn";
673 qCDebug(LOG_VariableController()) << "zoomtype: ZoomIn";
674 zoomType = AcquisitionZoomType::ZoomIn;
674 zoomType = AcquisitionZoomType::ZoomIn;
675 }
675 }
@@ -40,7 +40,7 ExternalProject_Add(
40 GIT_REPOSITORY https://perrinel@hephaistos.lpp.polytechnique.fr/rhodecode/GIT_REPOSITORIES/LPP/Users/mperrinel/CatalogueAPI
40 GIT_REPOSITORY https://perrinel@hephaistos.lpp.polytechnique.fr/rhodecode/GIT_REPOSITORIES/LPP/Users/mperrinel/CatalogueAPI
41 GIT_TAG develop
41 GIT_TAG develop
42
42
43 UPDATE_COMMAND ${GIT_EXECUTABLE} pull
43 UPDATE_COMMAND ${GIT_EXECUTABLE} pull origin develop
44 PATCH_COMMAND ""
44 PATCH_COMMAND ""
45
45
46 SOURCE_DIR "${CATALOGUEAPI_SOURCES_PATH}"
46 SOURCE_DIR "${CATALOGUEAPI_SOURCES_PATH}"
@@ -75,6 +75,16 INSTALL(TARGETS ${SQPGUI_LIBRARY_NAME}
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.
@@ -2,24 +2,33
2 #define SCIQLOP_CATALOGUEEVENTSWIDGET_H
2 #define SCIQLOP_CATALOGUEEVENTSWIDGET_H
3
3
4 #include <Common/spimpl.h>
4 #include <Common/spimpl.h>
5 #include <QLoggingCategory>
5 #include <QWidget>
6 #include <QWidget>
6
7
8 class DBCatalogue;
9 class DBEvent;
10 class VisualizationWidget;
11
7 namespace Ui {
12 namespace Ui {
8 class CatalogueEventsWidget;
13 class CatalogueEventsWidget;
9 }
14 }
10
15
16 Q_DECLARE_LOGGING_CATEGORY(LOG_CatalogueEventsWidget)
17
11 class CatalogueEventsWidget : public QWidget {
18 class CatalogueEventsWidget : public QWidget {
12 Q_OBJECT
19 Q_OBJECT
13
20
14 signals:
21 signals:
15 void eventSelected(const QString &event);
22 void eventsSelected(const QVector<std::shared_ptr<DBEvent> > &event);
16
23
17 public:
24 public:
18 explicit CatalogueEventsWidget(QWidget *parent = 0);
25 explicit CatalogueEventsWidget(QWidget *parent = 0);
19 virtual ~CatalogueEventsWidget();
26 virtual ~CatalogueEventsWidget();
20
27
28 void setVisualizationWidget(VisualizationWidget *visualization);
29
21 public slots:
30 public slots:
22 void populateWithCatalogue(const QString &catalogue);
31 void populateWithCatalogues(const QVector<std::shared_ptr<DBCatalogue> > &catalogues);
23
32
24 private:
33 private:
25 Ui::CatalogueEventsWidget *ui;
34 Ui::CatalogueEventsWidget *ui;
@@ -1,12 +1,15
1 #ifndef SCIQLOP_CATALOGUEEXPLORER_H
1 #ifndef SCIQLOP_CATALOGUEEXPLORER_H
2 #define SCIQLOP_CATALOGUEEXPLORER_H
2 #define SCIQLOP_CATALOGUEEXPLORER_H
3
3
4 #include <Common/spimpl.h>
4 #include <QDialog>
5 #include <QDialog>
5
6
6 namespace Ui {
7 namespace Ui {
7 class CatalogueExplorer;
8 class CatalogueExplorer;
8 }
9 }
9
10
11 class VisualizationWidget;
12
10 class CatalogueExplorer : public QDialog {
13 class CatalogueExplorer : public QDialog {
11 Q_OBJECT
14 Q_OBJECT
12
15
@@ -14,8 +17,13 public:
14 explicit CatalogueExplorer(QWidget *parent = 0);
17 explicit CatalogueExplorer(QWidget *parent = 0);
15 virtual ~CatalogueExplorer();
18 virtual ~CatalogueExplorer();
16
19
20 void setVisualizationWidget(VisualizationWidget *visualization);
21
17 private:
22 private:
18 Ui::CatalogueExplorer *ui;
23 Ui::CatalogueExplorer *ui;
24
25 class CatalogueExplorerPrivate;
26 spimpl::unique_impl_ptr<CatalogueExplorerPrivate> impl;
19 };
27 };
20
28
21 #endif // SCIQLOP_CATALOGUEEXPLORER_H
29 #endif // SCIQLOP_CATALOGUEEXPLORER_H
@@ -2,11 +2,15
2 #define SCIQLOP_CATALOGUEINSPECTORWIDGET_H
2 #define SCIQLOP_CATALOGUEINSPECTORWIDGET_H
3
3
4 #include <QWidget>
4 #include <QWidget>
5 #include <memory>
5
6
6 namespace Ui {
7 namespace Ui {
7 class CatalogueInspectorWidget;
8 class CatalogueInspectorWidget;
8 }
9 }
9
10
11 class DBCatalogue;
12 class DBEvent;
13
10 class CatalogueInspectorWidget : public QWidget {
14 class CatalogueInspectorWidget : public QWidget {
11 Q_OBJECT
15 Q_OBJECT
12
16
@@ -19,8 +23,8 public:
19
23
20 Page currentPage() const;
24 Page currentPage() const;
21
25
22 void setEvent(const QString &event);
26 void setEvent(const std::shared_ptr<DBEvent> &event);
23 void setCatalogue(const QString &catalogue);
27 void setCatalogue(const std::shared_ptr<DBCatalogue> &catalogue);
24
28
25 public slots:
29 public slots:
26 void showPage(Page page);
30 void showPage(Page page);
@@ -5,6 +5,8
5 #include <QTreeWidgetItem>
5 #include <QTreeWidgetItem>
6 #include <QWidget>
6 #include <QWidget>
7
7
8 class DBCatalogue;
9
8 namespace Ui {
10 namespace Ui {
9 class CatalogueSideBarWidget;
11 class CatalogueSideBarWidget;
10 }
12 }
@@ -13,9 +15,11 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 QVector<std::shared_ptr<DBCatalogue> > &catalogues);
19 void databaseSelected(const QStringList &databases);
17 void allEventsSelected();
20 void allEventsSelected();
18 void trashSelected();
21 void trashSelected();
22 void selectionCleared();
19
23
20 public:
24 public:
21 explicit CatalogueSideBarWidget(QWidget *parent = 0);
25 explicit CatalogueSideBarWidget(QWidget *parent = 0);
@@ -26,6 +30,9 private:
26
30
27 class CatalogueSideBarWidgetPrivate;
31 class CatalogueSideBarWidgetPrivate;
28 spimpl::unique_impl_ptr<CatalogueSideBarWidgetPrivate> impl;
32 spimpl::unique_impl_ptr<CatalogueSideBarWidgetPrivate> impl;
33
34 private slots:
35 void onContextMenuRequested(const QPoint &pos);
29 };
36 };
30
37
31 #endif // SCIQLOP_CATALOGUESIDEBARWIDGET_H
38 #endif // SCIQLOP_CATALOGUESIDEBARWIDGET_H
@@ -22,6 +22,7 class VariableController;
22 class VisualizationController;
22 class VisualizationController;
23 class DragDropGuiController;
23 class DragDropGuiController;
24 class ActionsGuiController;
24 class ActionsGuiController;
25 class CatalogueController;
25
26
26 /**
27 /**
27 * @brief The SqpApplication class aims to make the link between SciQlop
28 * @brief The SqpApplication class aims to make the link between SciQlop
@@ -45,6 +46,7 public:
45 TimeController &timeController() noexcept;
46 TimeController &timeController() noexcept;
46 VariableController &variableController() noexcept;
47 VariableController &variableController() noexcept;
47 VisualizationController &visualizationController() noexcept;
48 VisualizationController &visualizationController() noexcept;
49 CatalogueController &catalogueController() noexcept;
48
50
49 /// Accessors for the differents sciqlop helpers, these helpers classes are like controllers but
51 /// Accessors for the differents sciqlop helpers, these helpers classes are like controllers but
50 /// doesn't live in a thread and access gui
52 /// doesn't live in a thread and access gui
@@ -25,11 +25,19 public:
25 explicit VisualizationTabWidget(const QString &name = {}, QWidget *parent = 0);
25 explicit VisualizationTabWidget(const QString &name = {}, QWidget *parent = 0);
26 virtual ~VisualizationTabWidget();
26 virtual ~VisualizationTabWidget();
27
27
28 /// Add a zone widget
28 /// Adds a zone widget
29 void addZone(VisualizationZoneWidget *zoneWidget);
29 void addZone(VisualizationZoneWidget *zoneWidget);
30
30
31 /// Inserts a zone widget at the specified position
31 void insertZone(int index, VisualizationZoneWidget *zoneWidget);
32 void insertZone(int index, VisualizationZoneWidget *zoneWidget);
32
33
34 /// Returns the list of zone widget names in the order they are displayed
35 QStringList availableZoneWidgets() const;
36
37 /// Returns the zone with the specified name.
38 /// If multiple zone with the same name exist, the first one is returned.
39 VisualizationZoneWidget *getZoneWithName(const QString &zoneName);
40
33 /**
41 /**
34 * Creates a zone using a variable. The variable will be displayed in a new graph of the new
42 * Creates a zone using a variable. The variable will be displayed in a new graph of the new
35 * zone. The zone is added at the end.
43 * zone. The zone is added at the end.
@@ -30,6 +30,8 public:
30 /// Returns the class which manage the selection of selection zone across the visualization
30 /// Returns the class which manage the selection of selection zone across the visualization
31 VisualizationSelectionZoneManager &selectionZoneManager() const;
31 VisualizationSelectionZoneManager &selectionZoneManager() const;
32
32
33 VisualizationTabWidget *currentTabWidget() const;
34
33 // IVisualizationWidget interface
35 // IVisualizationWidget interface
34 void accept(IVisualizationWidgetVisitor *visitor) override;
36 void accept(IVisualizationWidgetVisitor *visitor) override;
35 bool canDrop(const Variable &variable) const override;
37 bool canDrop(const Variable &variable) const override;
@@ -1,6 +1,7
1 #ifndef SCIQLOP_VISUALIZATIONZONEWIDGET_H
1 #ifndef SCIQLOP_VISUALIZATIONZONEWIDGET_H
2 #define SCIQLOP_VISUALIZATIONZONEWIDGET_H
2 #define SCIQLOP_VISUALIZATIONZONEWIDGET_H
3
3
4 #include "Data/SqpRange.h"
4 #include "Visualization/IVisualizationWidget.h"
5 #include "Visualization/IVisualizationWidget.h"
5 #include "Visualization/VisualizationDragWidget.h"
6 #include "Visualization/VisualizationDragWidget.h"
6
7
@@ -27,6 +28,10 public:
27 explicit VisualizationZoneWidget(const QString &name = {}, QWidget *parent = 0);
28 explicit VisualizationZoneWidget(const QString &name = {}, QWidget *parent = 0);
28 virtual ~VisualizationZoneWidget();
29 virtual ~VisualizationZoneWidget();
29
30
31 /// Sets the range of the zone, only works if there is at least one graph in the zone
32 /// Note: calibrations between graphs are lost.
33 void setZoneRange(const SqpRange &range);
34
30 /// Adds a graph widget
35 /// Adds a graph widget
31 void addGraph(VisualizationGraphWidget *graphWidget);
36 void addGraph(VisualizationGraphWidget *graphWidget);
32
37
@@ -1,4 +1,7
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',
@@ -103,7 +106,9 gui_sources = [
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',
111 'src/Catalogue/CatalogueEventsTableModel.cpp'
107 ]
112 ]
108
113
109 gui_inc = include_directories(['include'])
114 gui_inc = include_directories(['include'])
@@ -112,11 +117,11 sciqlop_gui_lib = library('sciqlopgui',
112 gui_sources,
117 gui_sources,
113 gui_moc_files,
118 gui_moc_files,
114 include_directories : [gui_inc],
119 include_directories : [gui_inc],
115 dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core],
120 dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core, catalogueapi_dep],
116 install : true
121 install : true
117 )
122 )
118
123
119 sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib,
124 sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib,
120 include_directories : gui_inc,
125 include_directories : gui_inc,
121 dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core])
126 dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core, catalogueapi_dep])
122
127
@@ -25,5 +25,7
25 <file>icones/allEvents.png</file>
25 <file>icones/allEvents.png</file>
26 <file>icones/trash.png</file>
26 <file>icones/trash.png</file>
27 <file>icones/database.png</file>
27 <file>icones/database.png</file>
28 <file>icones/save.png</file>
29 <file>icones/discard.png</file>
28 </qresource>
30 </qresource>
29 </RCC>
31 </RCC>
@@ -1,15 +1,198
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 <Catalogue/CatalogueEventsTableModel.h>
6 #include <CatalogueDao.h>
7 #include <DBCatalogue.h>
8 #include <SqpApplication.h>
9 #include <Visualization/VisualizationTabWidget.h>
10 #include <Visualization/VisualizationWidget.h>
11 #include <Visualization/VisualizationZoneWidget.h>
12
13 #include <QDialog>
14 #include <QDialogButtonBox>
15 #include <QListWidget>
16
17 Q_LOGGING_CATEGORY(LOG_CatalogueEventsWidget, "CatalogueEventsWidget")
18
19 /// Format of the dates appearing in the label of a cursor
20 const auto DATETIME_FORMAT = QStringLiteral("yyyy/MM/dd hh:mm:ss");
5
21
6 struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate {
22 struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate {
7 void addEventItem(const QStringList &data, QTableWidget *tableWidget);
8
23
9 enum class Column { Event, TStart, TEnd, Tags, Product, NbColumn };
24 CatalogueEventsTableModel *m_Model = nullptr;
10 QStringList columnNames() { return QStringList{"Event", "TStart", "TEnd", "Tags", "Product"}; }
25 QStringList m_ZonesForTimeMode;
11 };
26 QString m_ZoneForGraphMode;
27
28 VisualizationWidget *m_VisualizationWidget = nullptr;
29
30 void setEvents(const QVector<std::shared_ptr<DBEvent> > &events, QTableView *tableView)
31 {
32 tableView->setSortingEnabled(false);
33 m_Model->setEvents(events);
34 tableView->setSortingEnabled(true);
35 }
36
37 void addEvent(const std::shared_ptr<DBEvent> &event, QTableView *tableView)
38 {
39 tableView->setSortingEnabled(false);
40 m_Model->addEvent(event);
41 tableView->setSortingEnabled(true);
42 }
43
44 void removeEvent(const std::shared_ptr<DBEvent> &event, QTableView *tableView)
45 {
46 tableView->setSortingEnabled(false);
47 m_Model->removeEvent(event);
48 tableView->setSortingEnabled(true);
49 }
50
51 QStringList getAvailableVisualizationZoneList() const
52 {
53 if (m_VisualizationWidget) {
54 if (auto tab = m_VisualizationWidget->currentTabWidget()) {
55 return tab->availableZoneWidgets();
56 }
57 }
58
59 return QStringList{};
60 }
61
62 QStringList selectZone(QWidget *parent, const QStringList &selectedZones,
63 bool allowMultiSelection, const QPoint &location)
64 {
65 auto availableZones = getAvailableVisualizationZoneList();
66 if (availableZones.isEmpty()) {
67 return QStringList{};
68 }
69
70 QDialog d(parent, Qt::Tool);
71 d.setWindowTitle("Choose a zone");
72 auto layout = new QVBoxLayout{&d};
73 layout->setContentsMargins(0, 0, 0, 0);
74 auto listWidget = new QListWidget{&d};
75 layout->addWidget(listWidget);
76
77 QSet<QListWidgetItem *> checkedItems;
78 for (auto zone : availableZones) {
79 auto item = new QListWidgetItem{zone};
80 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
81 if (selectedZones.contains(zone)) {
82 item->setCheckState(Qt::Checked);
83 checkedItems << item;
84 }
85 else {
86 item->setCheckState(Qt::Unchecked);
87 }
88
89 listWidget->addItem(item);
90 }
91
92 auto buttonBox = new QDialogButtonBox{QDialogButtonBox::Ok, &d};
93 layout->addWidget(buttonBox);
94
95 QObject::connect(buttonBox, &QDialogButtonBox::accepted, &d, &QDialog::accept);
96 QObject::connect(buttonBox, &QDialogButtonBox::rejected, &d, &QDialog::reject);
97
98 QObject::connect(listWidget, &QListWidget::itemChanged,
99 [&checkedItems, allowMultiSelection, listWidget](auto item) {
100 if (item->checkState() == Qt::Checked) {
101 if (!allowMultiSelection) {
102 for (auto checkedItem : checkedItems) {
103 listWidget->blockSignals(true);
104 checkedItem->setCheckState(Qt::Unchecked);
105 listWidget->blockSignals(false);
106 }
107
108 checkedItems.clear();
109 }
110 checkedItems << item;
111 }
112 else {
113 checkedItems.remove(item);
114 }
115 });
116
117 QStringList result;
118
119 d.setMinimumWidth(120);
120 d.resize(d.minimumSizeHint());
121 d.move(location);
122 if (d.exec() == QDialog::Accepted) {
123 for (auto item : checkedItems) {
124 result += item->text();
125 }
126 }
127 else {
128 result = selectedZones;
129 }
130
131 return result;
132 }
133
134 void updateForTimeMode(QTableView *tableView)
135 {
136 auto selectedRows = tableView->selectionModel()->selectedRows();
12
137
138 if (selectedRows.count() == 1) {
139 auto event = m_Model->getEvent(selectedRows.first().row());
140 if (m_VisualizationWidget) {
141 if (auto tab = m_VisualizationWidget->currentTabWidget()) {
142
143 for (auto zoneName : m_ZonesForTimeMode) {
144 if (auto zone = tab->getZoneWithName(zoneName)) {
145 SqpRange eventRange;
146 eventRange.m_TStart = event->getTStart();
147 eventRange.m_TEnd = event->getTEnd();
148 zone->setZoneRange(eventRange);
149 }
150 }
151 }
152 else {
153 qCWarning(LOG_CatalogueEventsWidget())
154 << "updateTimeZone: no tab found in the visualization";
155 }
156 }
157 else {
158 qCWarning(LOG_CatalogueEventsWidget())
159 << "updateTimeZone: visualization widget not found";
160 }
161 }
162 else {
163 qCWarning(LOG_CatalogueEventsWidget())
164 << "updateTimeZone: not compatible with multiple events selected";
165 }
166 }
167
168 void updateForGraphMode(QTableView *tableView)
169 {
170 auto selectedRows = tableView->selectionModel()->selectedRows();
171
172 if (selectedRows.count() == 1) {
173 auto event = m_Model->getEvent(selectedRows.first().row());
174 if (m_VisualizationWidget) {
175 if (auto tab = m_VisualizationWidget->currentTabWidget()) {
176 if (auto zone = tab->getZoneWithName(m_ZoneForGraphMode)) {
177 // TODO
178 }
179 }
180 else {
181 qCWarning(LOG_CatalogueEventsWidget())
182 << "updateGraphMode: no tab found in the visualization";
183 }
184 }
185 else {
186 qCWarning(LOG_CatalogueEventsWidget())
187 << "updateGraphMode: visualization widget not found";
188 }
189 }
190 else {
191 qCWarning(LOG_CatalogueEventsWidget())
192 << "updateGraphMode: not compatible with multiple events selected";
193 }
194 }
195 };
13
196
14 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
197 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
15 : QWidget(parent),
198 : QWidget(parent),
@@ -18,45 +201,64 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
18 {
201 {
19 ui->setupUi(this);
202 ui->setupUi(this);
20
203
204 impl->m_Model = new CatalogueEventsTableModel{this};
205 ui->tableView->setModel(impl->m_Model);
206
207 ui->tableView->setSortingEnabled(true);
208 ui->tableView->setDragDropMode(QAbstractItemView::DragDrop);
209 ui->tableView->setDragEnabled(true);
210
21 connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) {
211 connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) {
22 if (checked) {
212 if (checked) {
23 ui->btnChart->setChecked(false);
213 ui->btnChart->setChecked(false);
214 impl->m_ZonesForTimeMode
215 = impl->selectZone(this, impl->m_ZonesForTimeMode, true,
216 this->mapToGlobal(ui->btnTime->frameGeometry().center()));
217
218 impl->updateForTimeMode(ui->tableView);
24 }
219 }
25 });
220 });
26
221
27 connect(ui->btnChart, &QToolButton::clicked, [this](auto checked) {
222 connect(ui->btnChart, &QToolButton::clicked, [this](auto checked) {
28 if (checked) {
223 if (checked) {
29 ui->btnTime->setChecked(false);
224 ui->btnTime->setChecked(false);
225 impl->m_ZoneForGraphMode
226 = impl->selectZone(this, {impl->m_ZoneForGraphMode}, false,
227 this->mapToGlobal(ui->btnChart->frameGeometry().center()))
228 .value(0);
229
230 impl->updateForGraphMode(ui->tableView);
30 }
231 }
31 });
232 });
32
233
33 connect(ui->tableWidget, &QTableWidget::cellClicked, [this](auto row, auto column) {
234 auto emitSelection = [this]() {
34 auto event = ui->tableWidget->item(row, 0)->text();
235 QVector<std::shared_ptr<DBEvent> > events;
35 emit this->eventSelected(event);
236 for (auto rowIndex : ui->tableView->selectionModel()->selectedRows()) {
36 });
237 events << impl->m_Model->getEvent(rowIndex.row());
238 }
37
239
38 connect(ui->tableWidget, &QTableWidget::currentItemChanged,
240 emit this->eventsSelected(events);
39 [this](auto current, auto previous) {
241 };
40 if (current && current->row() >= 0) {
41 auto event = ui->tableWidget->item(current->row(), 0)->text();
42 emit this->eventSelected(event);
43 }
44 });
45
242
46 connect(ui->tableWidget, &QTableWidget::itemSelectionChanged, [this]() {
243 connect(ui->tableView, &QTableView::clicked, emitSelection);
47 auto selection = ui->tableWidget->selectedRanges();
244 connect(ui->tableView->selectionModel(), &QItemSelectionModel::selectionChanged, emitSelection);
48 auto isNotMultiSelection
245
49 = selection.isEmpty() || (selection.count() == 1 && selection.first().rowCount() == 1);
246 connect(ui->tableView->selectionModel(), &QItemSelectionModel::selectionChanged, [this]() {
247 auto isNotMultiSelection = ui->tableView->selectionModel()->selectedRows().count() <= 1;
50 ui->btnChart->setEnabled(isNotMultiSelection);
248 ui->btnChart->setEnabled(isNotMultiSelection);
51 ui->btnTime->setEnabled(isNotMultiSelection);
249 ui->btnTime->setEnabled(isNotMultiSelection);
250
251 if (isNotMultiSelection && ui->btnTime->isChecked()) {
252 impl->updateForTimeMode(ui->tableView);
253 }
254 else if (isNotMultiSelection && ui->btnChart->isChecked()) {
255 impl->updateForGraphMode(ui->tableView);
256 }
52 });
257 });
53
258
54 Q_ASSERT(impl->columnNames().count() == (int)CatalogueEventsWidgetPrivate::Column::NbColumn);
259 ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
55 ui->tableWidget->setColumnCount((int)CatalogueEventsWidgetPrivate::Column::NbColumn);
260 ui->tableView->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
56 ui->tableWidget->setHorizontalHeaderLabels(impl->columnNames());
261 ui->tableView->horizontalHeader()->setSortIndicatorShown(true);
57 ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
58 ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
59 ui->tableWidget->horizontalHeader()->setSortIndicatorShown(true);
60 }
262 }
61
263
62 CatalogueEventsWidget::~CatalogueEventsWidget()
264 CatalogueEventsWidget::~CatalogueEventsWidget()
@@ -64,37 +266,26 CatalogueEventsWidget::~CatalogueEventsWidget()
64 delete ui;
266 delete ui;
65 }
267 }
66
268
67 void CatalogueEventsWidget::populateWithCatalogue(const QString &catalogue)
269 void CatalogueEventsWidget::setVisualizationWidget(VisualizationWidget *visualization)
68 {
270 {
69 ui->tableWidget->clearContents();
271 impl->m_VisualizationWidget = visualization;
70 ui->tableWidget->setRowCount(0);
71
72 // TODO
73 impl->addEventItem(
74 {catalogue + " - Event 1", "12/12/2012 12:12", "12/12/2042 12:52", "cloud", "mfi/b_gse42"},
75 ui->tableWidget);
76 impl->addEventItem(
77 {catalogue + " - Event 2", "12/12/2012 12:10", "12/12/2042 12:42", "Acloud", "mfi/b_gse1"},
78 ui->tableWidget);
79 impl->addEventItem(
80 {catalogue + " - Event 3", "12/12/2012 12:22", "12/12/2042 12:12", "Gcloud", "mfi/b_gse2"},
81 ui->tableWidget);
82 impl->addEventItem(
83 {catalogue + " - Event 4", "12/12/2012 12:00", "12/12/2042 12:62", "Bcloud", "mfi/b_gse3"},
84 ui->tableWidget);
85 }
272 }
86
273
87 void CatalogueEventsWidget::CatalogueEventsWidgetPrivate::addEventItem(const QStringList &data,
274 void CatalogueEventsWidget::populateWithCatalogues(
88 QTableWidget *tableWidget)
275 const QVector<std::shared_ptr<DBCatalogue> > &catalogues)
89 {
276 {
90 tableWidget->setSortingEnabled(false);
277 QSet<QUuid> eventIds;
91 auto row = tableWidget->rowCount();
278 QVector<std::shared_ptr<DBEvent> > events;
92 tableWidget->setRowCount(row + 1);
279
93
280 for (auto catalogue : catalogues) {
94 for (auto i = 0; i < (int)Column::NbColumn; ++i) {
281 auto catalogueEvents = sqpApp->catalogueController().retrieveEventsFromCatalogue(catalogue);
95 auto item = new QTableWidgetItem(data.value(i));
282 for (auto event : catalogueEvents) {
96 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
283 if (!eventIds.contains(event->getUniqId())) {
97 tableWidget->setItem(row, i, item);
284 events << event;
285 eventIds.insert(event->getUniqId());
286 }
287 }
98 }
288 }
99 tableWidget->setSortingEnabled(true);
289
290 impl->setEvents(events, ui->tableView);
100 }
291 }
@@ -1,22 +1,61
1 #include "Catalogue/CatalogueExplorer.h"
1 #include "Catalogue/CatalogueExplorer.h"
2 #include "ui_CatalogueExplorer.h"
2 #include "ui_CatalogueExplorer.h"
3
3
4 #include <Visualization/VisualizationWidget.h>
5
6 #include <DBCatalogue.h>
7 #include <DBEvent.h>
8
9 struct CatalogueExplorer::CatalogueExplorerPrivate {
10 };
11
4 CatalogueExplorer::CatalogueExplorer(QWidget *parent)
12 CatalogueExplorer::CatalogueExplorer(QWidget *parent)
5 : QDialog(parent, Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
13 : QDialog(parent, Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
6 ui(new Ui::CatalogueExplorer)
14 ui(new Ui::CatalogueExplorer),
15 impl{spimpl::make_unique_impl<CatalogueExplorerPrivate>()}
7 {
16 {
8 ui->setupUi(this);
17 ui->setupUi(this);
9
18
10 connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSelected, [this](auto name) {
19 connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSelected, [this](auto catalogues) {
11 ui->inspector->setCatalogue(name);
20 if (catalogues.count() == 1) {
12 ui->events->populateWithCatalogue(name);
21 ui->inspector->setCatalogue(catalogues.first());
22 }
23 else {
24 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
25 }
26
27 ui->events->populateWithCatalogues(catalogues);
13 });
28 });
14
29
15 connect(ui->events, &CatalogueEventsWidget::eventSelected,
30 connect(ui->catalogues, &CatalogueSideBarWidget::databaseSelected, [this](auto databases) {
16 [this](auto name) { ui->inspector->setEvent(name); });
31 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
32 });
33
34 connect(ui->catalogues, &CatalogueSideBarWidget::trashSelected,
35 [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); });
36
37 connect(ui->catalogues, &CatalogueSideBarWidget::allEventsSelected,
38 [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); });
39
40 connect(ui->catalogues, &CatalogueSideBarWidget::selectionCleared,
41 [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); });
42
43 connect(ui->events, &CatalogueEventsWidget::eventsSelected, [this](auto events) {
44 if (events.count() == 1) {
45 ui->inspector->setEvent(events.first());
46 }
47 else {
48 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
49 }
50 });
17 }
51 }
18
52
19 CatalogueExplorer::~CatalogueExplorer()
53 CatalogueExplorer::~CatalogueExplorer()
20 {
54 {
21 delete ui;
55 delete ui;
22 }
56 }
57
58 void CatalogueExplorer::setVisualizationWidget(VisualizationWidget *visualization)
59 {
60 ui->events->setVisualizationWidget(visualization);
61 }
@@ -1,6 +1,11
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 {
@@ -23,14 +28,29 CatalogueInspectorWidget::Page CatalogueInspectorWidget::currentPage() const
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 std::shared_ptr<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 = 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 std::shared_ptr<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,5 +1,15
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
11 #include <QMenu>
12
3
13
4 constexpr auto ALL_EVENT_ITEM_TYPE = QTreeWidgetItem::UserType;
14 constexpr auto ALL_EVENT_ITEM_TYPE = QTreeWidgetItem::UserType;
5 constexpr auto TRASH_ITEM_TYPE = QTreeWidgetItem::UserType + 1;
15 constexpr auto TRASH_ITEM_TYPE = QTreeWidgetItem::UserType + 1;
@@ -8,9 +18,12 constexpr auto DATABASE_ITEM_TYPE = QTreeWidgetItem::UserType + 3;
8
18
9
19
10 struct CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate {
20 struct CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate {
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 QTreeWidgetItem *getDatabaseItem(const QString &name, QTreeWidget *treeWidget);
25 void addCatalogueItem(const std::shared_ptr<DBCatalogue> &catalogue,
26 QTreeWidgetItem *parentDatabaseItem);
14 };
27 };
15
28
16 CatalogueSideBarWidget::CatalogueSideBarWidget(QWidget *parent)
29 CatalogueSideBarWidget::CatalogueSideBarWidget(QWidget *parent)
@@ -21,25 +34,73 CatalogueSideBarWidget::CatalogueSideBarWidget(QWidget *parent)
21 ui->setupUi(this);
34 ui->setupUi(this);
22 impl->configureTreeWidget(ui->treeWidget);
35 impl->configureTreeWidget(ui->treeWidget);
23
36
24 auto emitSelection = [this](auto item) {
37 ui->treeWidget->setColumnCount(2);
25 switch (item->type()) {
38 ui->treeWidget->header()->setStretchLastSection(false);
26 case CATALOGUE_ITEM_TYPE:
39 ui->treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
27 emit this->catalogueSelected(item->text(0));
40 ui->treeWidget->header()->setSectionResizeMode(0, QHeaderView::Stretch);
28 break;
41
29 case ALL_EVENT_ITEM_TYPE:
42 auto emitSelection = [this]() {
30 emit this->allEventsSelected();
43
31 break;
44 auto selectedItems = ui->treeWidget->selectedItems();
32 case TRASH_ITEM_TYPE:
45 if (selectedItems.isEmpty()) {
33 emit this->trashSelected();
46 emit this->selectionCleared();
34 break;
35 case DATABASE_ITEM_TYPE:
36 default:
37 break;
38 }
47 }
48 else {
49 QVector<std::shared_ptr<DBCatalogue> > catalogues;
50 QStringList databases;
51 int selectionType = selectedItems.first()->type();
52
53 for (auto item : ui->treeWidget->selectedItems()) {
54 if (item->type() == selectionType) {
55 switch (selectionType) {
56 case CATALOGUE_ITEM_TYPE:
57 catalogues.append(
58 static_cast<CatalogueTreeWidgetItem *>(item)->catalogue());
59 break;
60 case DATABASE_ITEM_TYPE:
61 selectionType = DATABASE_ITEM_TYPE;
62 databases.append(item->text(0));
63 case ALL_EVENT_ITEM_TYPE: // fallthrough
64 case TRASH_ITEM_TYPE: // fallthrough
65 default:
66 break;
67 }
68 }
69 else {
70 // Incoherent multi selection
71 selectionType = -1;
72 break;
73 }
74 }
75
76 switch (selectionType) {
77 case CATALOGUE_ITEM_TYPE:
78 emit this->catalogueSelected(catalogues);
79 break;
80 case DATABASE_ITEM_TYPE:
81 emit this->databaseSelected(databases);
82 break;
83 case ALL_EVENT_ITEM_TYPE:
84 emit this->allEventsSelected();
85 break;
86 case TRASH_ITEM_TYPE:
87 emit this->trashSelected();
88 break;
89 default:
90 emit this->selectionCleared();
91 break;
92 }
93 }
94
95
39 };
96 };
40
97
41 connect(ui->treeWidget, &QTreeWidget::itemClicked, emitSelection);
98 connect(ui->treeWidget, &QTreeWidget::itemClicked, emitSelection);
42 connect(ui->treeWidget, &QTreeWidget::currentItemChanged, emitSelection);
99 connect(ui->treeWidget, &QTreeWidget::currentItemChanged, emitSelection);
100
101 ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
102 connect(ui->treeWidget, &QTreeWidget::customContextMenuRequested, this,
103 &CatalogueSideBarWidget::onContextMenuRequested);
43 }
104 }
44
105
45 CatalogueSideBarWidget::~CatalogueSideBarWidget()
106 CatalogueSideBarWidget::~CatalogueSideBarWidget()
@@ -47,36 +108,58 CatalogueSideBarWidget::~CatalogueSideBarWidget()
47 delete ui;
108 delete ui;
48 }
109 }
49
110
111 void CatalogueSideBarWidget::onContextMenuRequested(const QPoint &pos)
112 {
113 QMenu menu{this};
114
115 auto currentItem = ui->treeWidget->currentItem();
116 switch (currentItem->type()) {
117 case CATALOGUE_ITEM_TYPE:
118 menu.addAction("Rename",
119 [this, currentItem]() { ui->treeWidget->editItem(currentItem); });
120 break;
121 case DATABASE_ITEM_TYPE:
122 break;
123 case ALL_EVENT_ITEM_TYPE:
124 break;
125 case TRASH_ITEM_TYPE:
126 menu.addAction("Empty Trash", []() {
127 // TODO
128 });
129 break;
130 default:
131 break;
132 }
133
134 if (!menu.isEmpty()) {
135 menu.exec(ui->treeWidget->mapToGlobal(pos));
136 }
137 }
138
50 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::configureTreeWidget(
139 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::configureTreeWidget(
51 QTreeWidget *treeWidget)
140 QTreeWidget *treeWidget)
52 {
141 {
53 auto allEventsItem = new QTreeWidgetItem({"All Events"}, ALL_EVENT_ITEM_TYPE);
142 auto allEventsItem = new QTreeWidgetItem{{"All Events"}, ALL_EVENT_ITEM_TYPE};
54 allEventsItem->setIcon(0, QIcon(":/icones/allEvents.png"));
143 allEventsItem->setIcon(0, QIcon(":/icones/allEvents.png"));
55 treeWidget->addTopLevelItem(allEventsItem);
144 treeWidget->addTopLevelItem(allEventsItem);
56
145
57 auto trashItem = new QTreeWidgetItem({"Trash"}, TRASH_ITEM_TYPE);
146 auto trashItem = new QTreeWidgetItem{{"Trash"}, TRASH_ITEM_TYPE};
58 trashItem->setIcon(0, QIcon(":/icones/trash.png"));
147 trashItem->setIcon(0, QIcon(":/icones/trash.png"));
59 treeWidget->addTopLevelItem(trashItem);
148 treeWidget->addTopLevelItem(trashItem);
60
149
61 auto separator = new QFrame(treeWidget);
150 auto separator = new QFrame{treeWidget};
62 separator->setFrameShape(QFrame::HLine);
151 separator->setFrameShape(QFrame::HLine);
63
152 auto separatorItem = new QTreeWidgetItem{};
64 auto separatorItem = new QTreeWidgetItem();
65 separatorItem->setFlags(Qt::NoItemFlags);
153 separatorItem->setFlags(Qt::NoItemFlags);
66 treeWidget->addTopLevelItem(separatorItem);
154 treeWidget->addTopLevelItem(separatorItem);
67 treeWidget->setItemWidget(separatorItem, 0, separator);
155 treeWidget->setItemWidget(separatorItem, 0, separator);
68
156
69 // Test
157 auto db = addDatabaseItem("Default", treeWidget);
70 auto db = addDatabaseItem("Database 1", treeWidget);
71 addCatalogueItem("Catalogue 1", db);
72 addCatalogueItem("Catalogue 2", db);
73 addCatalogueItem("Catalogue 3", db);
74 addCatalogueItem("Catalogue 4", db);
75
158
76 auto db2 = addDatabaseItem("Database 2", treeWidget);
159 auto catalogues = sqpApp->catalogueController().getCatalogues("Default");
77 addCatalogueItem("Catalogue A", db2);
160 for (auto catalogue : catalogues) {
78 addCatalogueItem("Catalogue B", db2);
161 addCatalogueItem(catalogue, db);
79 addCatalogueItem("Catalogue C", db2);
162 }
80
163
81 treeWidget->expandAll();
164 treeWidget->expandAll();
82 }
165 }
@@ -85,17 +168,31 QTreeWidgetItem *
85 CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::addDatabaseItem(const QString &name,
168 CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::addDatabaseItem(const QString &name,
86 QTreeWidget *treeWidget)
169 QTreeWidget *treeWidget)
87 {
170 {
88 auto databaseItem = new QTreeWidgetItem({name}, DATABASE_ITEM_TYPE);
171 auto databaseItem = new QTreeWidgetItem{{name}, DATABASE_ITEM_TYPE};
89 databaseItem->setIcon(0, QIcon(":/icones/database.png"));
172 databaseItem->setIcon(0, QIcon{":/icones/database.png"});
90 treeWidget->addTopLevelItem(databaseItem);
173 treeWidget->addTopLevelItem(databaseItem);
91
174
92 return databaseItem;
175 return databaseItem;
93 }
176 }
94
177
178 QTreeWidgetItem *
179 CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::getDatabaseItem(const QString &name,
180 QTreeWidget *treeWidget)
181 {
182 for (auto i = 0; i < treeWidget->topLevelItemCount(); ++i) {
183 auto item = treeWidget->topLevelItem(i);
184 if (item->type() == DATABASE_ITEM_TYPE && item->text(0) == name) {
185 return item;
186 }
187 }
188
189 return nullptr;
190 }
191
95 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::addCatalogueItem(
192 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::addCatalogueItem(
96 const QString &name, QTreeWidgetItem *parentDatabaseItem)
193 const std::shared_ptr<DBCatalogue> &catalogue, QTreeWidgetItem *parentDatabaseItem)
97 {
194 {
98 auto catalogueItem = new QTreeWidgetItem({name}, CATALOGUE_ITEM_TYPE);
195 auto catalogueItem = new CatalogueTreeWidgetItem{catalogue, CATALOGUE_ITEM_TYPE};
99 catalogueItem->setIcon(0, QIcon(":/icones/catalogue.png"));
196 catalogueItem->setIcon(0, QIcon{":/icones/catalogue.png"});
100 parentDatabaseItem->addChild(catalogueItem);
197 parentDatabaseItem->addChild(catalogueItem);
101 }
198 }
@@ -181,6 +181,11 VisualizationController &SqpApplication::visualizationController() noexcept
181 return *impl->m_VisualizationController;
181 return *impl->m_VisualizationController;
182 }
182 }
183
183
184 CatalogueController &SqpApplication::catalogueController() noexcept
185 {
186 return *impl->m_CatalogueController;
187 }
188
184 DragDropGuiController &SqpApplication::dragDropGuiController() noexcept
189 DragDropGuiController &SqpApplication::dragDropGuiController() noexcept
185 {
190 {
186 return *impl->m_DragDropGuiController;
191 return *impl->m_DragDropGuiController;
@@ -18,20 +18,6 Q_LOGGING_CATEGORY(LOG_VisualizationTabWidget, "VisualizationTabWidget")
18
18
19 namespace {
19 namespace {
20
20
21 /// Generates a default name for a new zone, according to the number of zones already displayed in
22 /// the tab
23 QString defaultZoneName(const QLayout &layout)
24 {
25 auto count = 0;
26 for (auto i = 0; i < layout.count(); ++i) {
27 if (dynamic_cast<VisualizationZoneWidget *>(layout.itemAt(i)->widget())) {
28 count++;
29 }
30 }
31
32 return QObject::tr("Zone %1").arg(count + 1);
33 }
34
35 /**
21 /**
36 * Applies a function to all zones of the tab represented by its layout
22 * Applies a function to all zones of the tab represented by its layout
37 * @param layout the layout that contains zones
23 * @param layout the layout that contains zones
@@ -43,13 +29,31 void processZones(QLayout &layout, Fun fun)
43 for (auto i = 0; i < layout.count(); ++i) {
29 for (auto i = 0; i < layout.count(); ++i) {
44 if (auto item = layout.itemAt(i)) {
30 if (auto item = layout.itemAt(i)) {
45 if (auto visualizationZoneWidget
31 if (auto visualizationZoneWidget
46 = dynamic_cast<VisualizationZoneWidget *>(item->widget())) {
32 = qobject_cast<VisualizationZoneWidget *>(item->widget())) {
47 fun(*visualizationZoneWidget);
33 fun(*visualizationZoneWidget);
48 }
34 }
49 }
35 }
50 }
36 }
51 }
37 }
52
38
39 /// Generates a default name for a new zone, according to the number of zones already displayed in
40 /// the tab
41 QString defaultZoneName(QLayout &layout)
42 {
43 QSet<QString> existingNames;
44 processZones(layout,
45 [&existingNames](auto &zoneWidget) { existingNames.insert(zoneWidget.name()); });
46
47 int zoneNum = 1;
48 QString name;
49 do {
50 name = QObject::tr("Zone ").append(QString::number(zoneNum));
51 ++zoneNum;
52 } while (existingNames.contains(name));
53
54 return name;
55 }
56
53 } // namespace
57 } // namespace
54
58
55 struct VisualizationTabWidget::VisualizationTabWidgetPrivate {
59 struct VisualizationTabWidget::VisualizationTabWidgetPrivate {
@@ -118,6 +122,27 void VisualizationTabWidget::insertZone(int index, VisualizationZoneWidget *zone
118 ui->dragDropContainer->insertDragWidget(index, zoneWidget);
122 ui->dragDropContainer->insertDragWidget(index, zoneWidget);
119 }
123 }
120
124
125 QStringList VisualizationTabWidget::availableZoneWidgets() const
126 {
127 QStringList zones;
128 processZones(tabLayout(),
129 [&zones](VisualizationZoneWidget &zoneWidget) { zones << zoneWidget.name(); });
130
131 return zones;
132 }
133
134 VisualizationZoneWidget *VisualizationTabWidget::getZoneWithName(const QString &zoneName)
135 {
136 VisualizationZoneWidget *result = nullptr;
137 processZones(tabLayout(), [&zoneName, &result](VisualizationZoneWidget &zoneWidget) {
138 if (!result && zoneWidget.name() == zoneName) {
139 result = &zoneWidget;
140 }
141 });
142
143 return result;
144 }
145
121 VisualizationZoneWidget *VisualizationTabWidget::createZone(std::shared_ptr<Variable> variable)
146 VisualizationZoneWidget *VisualizationTabWidget::createZone(std::shared_ptr<Variable> variable)
122 {
147 {
123 return createZone({variable}, -1);
148 return createZone({variable}, -1);
@@ -119,6 +119,15 VisualizationSelectionZoneManager &VisualizationWidget::selectionZoneManager() c
119 return *impl->m_ZoneSelectionManager.get();
119 return *impl->m_ZoneSelectionManager.get();
120 }
120 }
121
121
122 VisualizationTabWidget *VisualizationWidget::currentTabWidget() const
123 {
124 if (auto tab = qobject_cast<VisualizationTabWidget *>(ui->tabWidget->currentWidget())) {
125 return tab;
126 }
127
128 return nullptr;
129 }
130
122 void VisualizationWidget::accept(IVisualizationWidgetVisitor *visitor)
131 void VisualizationWidget::accept(IVisualizationWidgetVisitor *visitor)
123 {
132 {
124 if (visitor) {
133 if (visitor) {
@@ -27,21 +27,6 Q_LOGGING_CATEGORY(LOG_VisualizationZoneWidget, "VisualizationZoneWidget")
27
27
28 namespace {
28 namespace {
29
29
30
31 /// Generates a default name for a new graph, according to the number of graphs already displayed in
32 /// the zone
33 QString defaultGraphName(const QLayout &layout)
34 {
35 auto count = 0;
36 for (auto i = 0; i < layout.count(); ++i) {
37 if (dynamic_cast<VisualizationGraphWidget *>(layout.itemAt(i)->widget())) {
38 count++;
39 }
40 }
41
42 return QObject::tr("Graph %1").arg(count + 1);
43 }
44
45 /**
30 /**
46 * Applies a function to all graphs of the zone represented by its layout
31 * Applies a function to all graphs of the zone represented by its layout
47 * @param layout the layout that contains graphs
32 * @param layout the layout that contains graphs
@@ -60,6 +45,24 void processGraphs(QLayout &layout, Fun fun)
60 }
45 }
61 }
46 }
62
47
48 /// Generates a default name for a new graph, according to the number of graphs already displayed in
49 /// the zone
50 QString defaultGraphName(QLayout &layout)
51 {
52 QSet<QString> existingNames;
53 processGraphs(
54 layout, [&existingNames](auto &graphWidget) { existingNames.insert(graphWidget.name()); });
55
56 int zoneNum = 1;
57 QString name;
58 do {
59 name = QObject::tr("Graph ").append(QString::number(zoneNum));
60 ++zoneNum;
61 } while (existingNames.contains(name));
62
63 return name;
64 }
65
63 } // namespace
66 } // namespace
64
67
65 struct VisualizationZoneWidget::VisualizationZoneWidgetPrivate {
68 struct VisualizationZoneWidget::VisualizationZoneWidgetPrivate {
@@ -145,6 +148,17 VisualizationZoneWidget::~VisualizationZoneWidget()
145 delete ui;
148 delete ui;
146 }
149 }
147
150
151 void VisualizationZoneWidget::setZoneRange(const SqpRange &range)
152 {
153 if (auto graph = firstGraph()) {
154 graph->setGraphRange(range);
155 }
156 else {
157 qCWarning(LOG_VisualizationZoneWidget())
158 << tr("setZoneRange:Cannot set the range of an empty zone.");
159 }
160 }
161
148 void VisualizationZoneWidget::addGraph(VisualizationGraphWidget *graphWidget)
162 void VisualizationZoneWidget::addGraph(VisualizationGraphWidget *graphWidget)
149 {
163 {
150 // Synchronize new graph with others in the zone
164 // Synchronize new graph with others in the zone
@@ -34,7 +34,7
34 <string>+</string>
34 <string>+</string>
35 </property>
35 </property>
36 <property name="icon">
36 <property name="icon">
37 <iconset>
37 <iconset resource="../../resources/sqpguiresources.qrc">
38 <normaloff>:/icones/add.png</normaloff>:/icones/add.png</iconset>
38 <normaloff>:/icones/add.png</normaloff>:/icones/add.png</iconset>
39 </property>
39 </property>
40 <property name="autoRaise">
40 <property name="autoRaise">
@@ -48,7 +48,7
48 <string> - </string>
48 <string> - </string>
49 </property>
49 </property>
50 <property name="icon">
50 <property name="icon">
51 <iconset>
51 <iconset resource="../../resources/sqpguiresources.qrc">
52 <normaloff>:/icones/remove.png</normaloff>:/icones/remove.png</iconset>
52 <normaloff>:/icones/remove.png</normaloff>:/icones/remove.png</iconset>
53 </property>
53 </property>
54 <property name="autoRaise">
54 <property name="autoRaise">
@@ -69,7 +69,7
69 <string>T</string>
69 <string>T</string>
70 </property>
70 </property>
71 <property name="icon">
71 <property name="icon">
72 <iconset>
72 <iconset resource="../../resources/sqpguiresources.qrc">
73 <normaloff>:/icones/time.png</normaloff>:/icones/time.png</iconset>
73 <normaloff>:/icones/time.png</normaloff>:/icones/time.png</iconset>
74 </property>
74 </property>
75 <property name="checkable">
75 <property name="checkable">
@@ -86,7 +86,7
86 <string>G</string>
86 <string>G</string>
87 </property>
87 </property>
88 <property name="icon">
88 <property name="icon">
89 <iconset>
89 <iconset resource="../../resources/sqpguiresources.qrc">
90 <normaloff>:/icones/chart.png</normaloff>:/icones/chart.png</iconset>
90 <normaloff>:/icones/chart.png</normaloff>:/icones/chart.png</iconset>
91 </property>
91 </property>
92 <property name="checkable">
92 <property name="checkable">
@@ -114,26 +114,41
114 </layout>
114 </layout>
115 </item>
115 </item>
116 <item>
116 <item>
117 <widget class="QTableWidget" name="tableWidget">
117 <widget class="QTableView" name="tableView">
118 <property name="alternatingRowColors">
118 <property name="dragEnabled">
119 <bool>true</bool>
119 <bool>true</bool>
120 </property>
120 </property>
121 <property name="dragDropMode">
122 <enum>QAbstractItemView::DragDrop</enum>
123 </property>
121 <property name="selectionBehavior">
124 <property name="selectionBehavior">
122 <enum>QAbstractItemView::SelectRows</enum>
125 <enum>QAbstractItemView::SelectRows</enum>
123 </property>
126 </property>
127 <attribute name="horizontalHeaderVisible">
128 <bool>true</bool>
129 </attribute>
124 <attribute name="horizontalHeaderHighlightSections">
130 <attribute name="horizontalHeaderHighlightSections">
125 <bool>false</bool>
131 <bool>false</bool>
126 </attribute>
132 </attribute>
133 <attribute name="horizontalHeaderShowSortIndicator" stdset="0">
134 <bool>true</bool>
135 </attribute>
127 <attribute name="verticalHeaderVisible">
136 <attribute name="verticalHeaderVisible">
128 <bool>false</bool>
137 <bool>false</bool>
129 </attribute>
138 </attribute>
130 <attribute name="verticalHeaderDefaultSectionSize">
139 <attribute name="verticalHeaderDefaultSectionSize">
131 <number>25</number>
140 <number>25</number>
132 </attribute>
141 </attribute>
142 <attribute name="verticalHeaderHighlightSections">
143 <bool>false</bool>
144 </attribute>
133 </widget>
145 </widget>
134 </item>
146 </item>
135 </layout>
147 </layout>
136 </widget>
148 </widget>
137 <resources/>
149 <resources>
150 <include location="../../resources/sqpguiresources.qrc"/>
151 <include location="../../resources/sqpguiresources.qrc"/>
152 </resources>
138 <connections/>
153 <connections/>
139 </ui>
154 </ui>
@@ -34,7 +34,7
34 <string>+</string>
34 <string>+</string>
35 </property>
35 </property>
36 <property name="icon">
36 <property name="icon">
37 <iconset>
37 <iconset resource="../../resources/sqpguiresources.qrc">
38 <normaloff>:/icones/add.png</normaloff>:/icones/add.png</iconset>
38 <normaloff>:/icones/add.png</normaloff>:/icones/add.png</iconset>
39 </property>
39 </property>
40 <property name="autoRaise">
40 <property name="autoRaise">
@@ -48,7 +48,7
48 <string> - </string>
48 <string> - </string>
49 </property>
49 </property>
50 <property name="icon">
50 <property name="icon">
51 <iconset>
51 <iconset resource="../../resources/sqpguiresources.qrc">
52 <normaloff>:/icones/remove.png</normaloff>:/icones/remove.png</iconset>
52 <normaloff>:/icones/remove.png</normaloff>:/icones/remove.png</iconset>
53 </property>
53 </property>
54 <property name="autoRaise">
54 <property name="autoRaise">
@@ -73,6 +73,9
73 </item>
73 </item>
74 <item>
74 <item>
75 <widget class="QTreeWidget" name="treeWidget">
75 <widget class="QTreeWidget" name="treeWidget">
76 <property name="selectionMode">
77 <enum>QAbstractItemView::ExtendedSelection</enum>
78 </property>
76 <attribute name="headerVisible">
79 <attribute name="headerVisible">
77 <bool>false</bool>
80 <bool>false</bool>
78 </attribute>
81 </attribute>
@@ -85,6 +88,9
85 </item>
88 </item>
86 </layout>
89 </layout>
87 </widget>
90 </widget>
88 <resources/>
91 <resources>
92 <include location="../../resources/sqpguiresources.qrc"/>
93 <include location="../../resources/sqpguiresources.qrc"/>
94 </resources>
89 <connections/>
95 <connections/>
90 </ui>
96 </ui>
General Comments 0
You need to be logged in to leave comments. Login now