Auto status change to "Under Review"
@@ -1,54 +1,55 | |||||
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 <QLoggingCategory> |
|
5 | #include <QLoggingCategory> | |
6 | #include <QWidget> |
|
6 | #include <QWidget> | |
7 |
|
7 | |||
8 | class DBCatalogue; |
|
8 | class DBCatalogue; | |
9 | class DBEvent; |
|
9 | class DBEvent; | |
10 | class DBEventProduct; |
|
10 | class DBEventProduct; | |
11 | class VisualizationWidget; |
|
11 | class VisualizationWidget; | |
12 |
|
12 | |||
13 | namespace Ui { |
|
13 | namespace Ui { | |
14 | class CatalogueEventsWidget; |
|
14 | class CatalogueEventsWidget; | |
15 | } |
|
15 | } | |
16 |
|
16 | |||
17 | Q_DECLARE_LOGGING_CATEGORY(LOG_CatalogueEventsWidget) |
|
17 | Q_DECLARE_LOGGING_CATEGORY(LOG_CatalogueEventsWidget) | |
18 |
|
18 | |||
19 | class CatalogueEventsWidget : public QWidget { |
|
19 | class CatalogueEventsWidget : public QWidget { | |
20 | Q_OBJECT |
|
20 | Q_OBJECT | |
21 |
|
21 | |||
22 | signals: |
|
22 | signals: | |
23 | void eventsSelected(const QVector<std::shared_ptr<DBEvent> > &event); |
|
23 | void eventsSelected(const QVector<std::shared_ptr<DBEvent> > &event); | |
24 | void eventProductsSelected( |
|
24 | void eventProductsSelected( | |
25 | const QVector<QPair<std::shared_ptr<DBEvent>, std::shared_ptr<DBEventProduct> > > |
|
25 | const QVector<QPair<std::shared_ptr<DBEvent>, std::shared_ptr<DBEventProduct> > > | |
26 | &eventproducts); |
|
26 | &eventproducts); | |
27 | void selectionCleared(); |
|
27 | void selectionCleared(); | |
28 |
|
28 | |||
29 | public: |
|
29 | public: | |
30 | explicit CatalogueEventsWidget(QWidget *parent = 0); |
|
30 | explicit CatalogueEventsWidget(QWidget *parent = 0); | |
31 | virtual ~CatalogueEventsWidget(); |
|
31 | virtual ~CatalogueEventsWidget(); | |
32 |
|
32 | |||
33 | void setVisualizationWidget(VisualizationWidget *visualization); |
|
33 | void setVisualizationWidget(VisualizationWidget *visualization); | |
34 |
|
34 | |||
35 | void addEvent(const std::shared_ptr<DBEvent> &event); |
|
35 | void addEvent(const std::shared_ptr<DBEvent> &event); | |
36 | void setEventChanges(const std::shared_ptr<DBEvent> &event, bool hasChanges); |
|
36 | void setEventChanges(const std::shared_ptr<DBEvent> &event, bool hasChanges); | |
37 |
|
37 | |||
38 | QVector<std::shared_ptr<DBCatalogue> > displayedCatalogues() const; |
|
38 | QVector<std::shared_ptr<DBCatalogue> > displayedCatalogues() const; | |
39 | bool isAllEventsDisplayed() const; |
|
39 | bool isAllEventsDisplayed() const; | |
40 | bool isEventDisplayed(const std::shared_ptr<DBEvent> &event) const; |
|
40 | bool isEventDisplayed(const std::shared_ptr<DBEvent> &event) const; | |
41 |
|
41 | |||
42 | public slots: |
|
42 | public slots: | |
43 | void populateWithCatalogues(const QVector<std::shared_ptr<DBCatalogue> > &catalogues); |
|
43 | void populateWithCatalogues(const QVector<std::shared_ptr<DBCatalogue> > &catalogues); | |
44 | void populateWithAllEvents(); |
|
44 | void populateWithAllEvents(); | |
|
45 | void clear(); | |||
45 | void refresh(); |
|
46 | void refresh(); | |
46 |
|
47 | |||
47 | private: |
|
48 | private: | |
48 | Ui::CatalogueEventsWidget *ui; |
|
49 | Ui::CatalogueEventsWidget *ui; | |
49 |
|
50 | |||
50 | class CatalogueEventsWidgetPrivate; |
|
51 | class CatalogueEventsWidgetPrivate; | |
51 | spimpl::unique_impl_ptr<CatalogueEventsWidgetPrivate> impl; |
|
52 | spimpl::unique_impl_ptr<CatalogueEventsWidgetPrivate> impl; | |
52 | }; |
|
53 | }; | |
53 |
|
54 | |||
54 | #endif // SCIQLOP_CATALOGUEEVENTSWIDGET_H |
|
55 | #endif // SCIQLOP_CATALOGUEEVENTSWIDGET_H |
@@ -1,399 +1,407 | |||||
1 | #include "Catalogue/CatalogueEventsWidget.h" |
|
1 | #include "Catalogue/CatalogueEventsWidget.h" | |
2 | #include "ui_CatalogueEventsWidget.h" |
|
2 | #include "ui_CatalogueEventsWidget.h" | |
3 |
|
3 | |||
4 | #include <Catalogue/CatalogueController.h> |
|
4 | #include <Catalogue/CatalogueController.h> | |
5 | #include <Catalogue/CatalogueEventsModel.h> |
|
5 | #include <Catalogue/CatalogueEventsModel.h> | |
6 | #include <Catalogue/CatalogueExplorerHelper.h> |
|
6 | #include <Catalogue/CatalogueExplorerHelper.h> | |
7 | #include <CatalogueDao.h> |
|
7 | #include <CatalogueDao.h> | |
8 | #include <DBCatalogue.h> |
|
8 | #include <DBCatalogue.h> | |
9 | #include <SqpApplication.h> |
|
9 | #include <SqpApplication.h> | |
10 | #include <Visualization/VisualizationTabWidget.h> |
|
10 | #include <Visualization/VisualizationTabWidget.h> | |
11 | #include <Visualization/VisualizationWidget.h> |
|
11 | #include <Visualization/VisualizationWidget.h> | |
12 | #include <Visualization/VisualizationZoneWidget.h> |
|
12 | #include <Visualization/VisualizationZoneWidget.h> | |
13 |
|
13 | |||
14 | #include <QDialog> |
|
14 | #include <QDialog> | |
15 | #include <QDialogButtonBox> |
|
15 | #include <QDialogButtonBox> | |
16 | #include <QListWidget> |
|
16 | #include <QListWidget> | |
17 |
|
17 | |||
18 | Q_LOGGING_CATEGORY(LOG_CatalogueEventsWidget, "CatalogueEventsWidget") |
|
18 | Q_LOGGING_CATEGORY(LOG_CatalogueEventsWidget, "CatalogueEventsWidget") | |
19 |
|
19 | |||
20 | /// Fixed size of the validation column |
|
20 | /// Fixed size of the validation column | |
21 | const auto VALIDATION_COLUMN_SIZE = 35; |
|
21 | const auto VALIDATION_COLUMN_SIZE = 35; | |
22 |
|
22 | |||
23 | struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate { |
|
23 | struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate { | |
24 |
|
24 | |||
25 | CatalogueEventsModel *m_Model = nullptr; |
|
25 | CatalogueEventsModel *m_Model = nullptr; | |
26 | QStringList m_ZonesForTimeMode; |
|
26 | QStringList m_ZonesForTimeMode; | |
27 | QString m_ZoneForGraphMode; |
|
27 | QString m_ZoneForGraphMode; | |
28 | QVector<std::shared_ptr<DBCatalogue> > m_DisplayedCatalogues; |
|
28 | QVector<std::shared_ptr<DBCatalogue> > m_DisplayedCatalogues; | |
29 |
|
29 | |||
30 | VisualizationWidget *m_VisualizationWidget = nullptr; |
|
30 | VisualizationWidget *m_VisualizationWidget = nullptr; | |
31 |
|
31 | |||
32 | void setEvents(const QVector<std::shared_ptr<DBEvent> > &events, QTreeView *treeView) |
|
32 | void setEvents(const QVector<std::shared_ptr<DBEvent> > &events, QTreeView *treeView) | |
33 | { |
|
33 | { | |
34 | treeView->setSortingEnabled(false); |
|
34 | treeView->setSortingEnabled(false); | |
35 | m_Model->setEvents(events); |
|
35 | m_Model->setEvents(events); | |
36 | treeView->setSortingEnabled(true); |
|
36 | treeView->setSortingEnabled(true); | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | void addEvent(const std::shared_ptr<DBEvent> &event, QTreeView *treeView) |
|
39 | void addEvent(const std::shared_ptr<DBEvent> &event, QTreeView *treeView) | |
40 | { |
|
40 | { | |
41 | treeView->setSortingEnabled(false); |
|
41 | treeView->setSortingEnabled(false); | |
42 | m_Model->addEvent(event); |
|
42 | m_Model->addEvent(event); | |
43 | treeView->setSortingEnabled(true); |
|
43 | treeView->setSortingEnabled(true); | |
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 | void removeEvent(const std::shared_ptr<DBEvent> &event, QTreeView *treeView) |
|
46 | void removeEvent(const std::shared_ptr<DBEvent> &event, QTreeView *treeView) | |
47 | { |
|
47 | { | |
48 | treeView->setSortingEnabled(false); |
|
48 | treeView->setSortingEnabled(false); | |
49 | m_Model->removeEvent(event); |
|
49 | m_Model->removeEvent(event); | |
50 | treeView->setSortingEnabled(true); |
|
50 | treeView->setSortingEnabled(true); | |
51 | } |
|
51 | } | |
52 |
|
52 | |||
53 | QStringList getAvailableVisualizationZoneList() const |
|
53 | QStringList getAvailableVisualizationZoneList() const | |
54 | { |
|
54 | { | |
55 | if (m_VisualizationWidget) { |
|
55 | if (m_VisualizationWidget) { | |
56 | if (auto tab = m_VisualizationWidget->currentTabWidget()) { |
|
56 | if (auto tab = m_VisualizationWidget->currentTabWidget()) { | |
57 | return tab->availableZoneWidgets(); |
|
57 | return tab->availableZoneWidgets(); | |
58 | } |
|
58 | } | |
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 | return QStringList{}; |
|
61 | return QStringList{}; | |
62 | } |
|
62 | } | |
63 |
|
63 | |||
64 | QStringList selectZone(QWidget *parent, const QStringList &selectedZones, |
|
64 | QStringList selectZone(QWidget *parent, const QStringList &selectedZones, | |
65 | bool allowMultiSelection, const QPoint &location) |
|
65 | bool allowMultiSelection, const QPoint &location) | |
66 | { |
|
66 | { | |
67 | auto availableZones = getAvailableVisualizationZoneList(); |
|
67 | auto availableZones = getAvailableVisualizationZoneList(); | |
68 | if (availableZones.isEmpty()) { |
|
68 | if (availableZones.isEmpty()) { | |
69 | return QStringList{}; |
|
69 | return QStringList{}; | |
70 | } |
|
70 | } | |
71 |
|
71 | |||
72 | QDialog d(parent, Qt::Tool); |
|
72 | QDialog d(parent, Qt::Tool); | |
73 | d.setWindowTitle("Choose a zone"); |
|
73 | d.setWindowTitle("Choose a zone"); | |
74 | auto layout = new QVBoxLayout{&d}; |
|
74 | auto layout = new QVBoxLayout{&d}; | |
75 | layout->setContentsMargins(0, 0, 0, 0); |
|
75 | layout->setContentsMargins(0, 0, 0, 0); | |
76 | auto listWidget = new QListWidget{&d}; |
|
76 | auto listWidget = new QListWidget{&d}; | |
77 | layout->addWidget(listWidget); |
|
77 | layout->addWidget(listWidget); | |
78 |
|
78 | |||
79 | QSet<QListWidgetItem *> checkedItems; |
|
79 | QSet<QListWidgetItem *> checkedItems; | |
80 | for (auto zone : availableZones) { |
|
80 | for (auto zone : availableZones) { | |
81 | auto item = new QListWidgetItem{zone}; |
|
81 | auto item = new QListWidgetItem{zone}; | |
82 | item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); |
|
82 | item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); | |
83 | if (selectedZones.contains(zone)) { |
|
83 | if (selectedZones.contains(zone)) { | |
84 | item->setCheckState(Qt::Checked); |
|
84 | item->setCheckState(Qt::Checked); | |
85 | checkedItems << item; |
|
85 | checkedItems << item; | |
86 | } |
|
86 | } | |
87 | else { |
|
87 | else { | |
88 | item->setCheckState(Qt::Unchecked); |
|
88 | item->setCheckState(Qt::Unchecked); | |
89 | } |
|
89 | } | |
90 |
|
90 | |||
91 | listWidget->addItem(item); |
|
91 | listWidget->addItem(item); | |
92 | } |
|
92 | } | |
93 |
|
93 | |||
94 | auto buttonBox = new QDialogButtonBox{QDialogButtonBox::Ok, &d}; |
|
94 | auto buttonBox = new QDialogButtonBox{QDialogButtonBox::Ok, &d}; | |
95 | layout->addWidget(buttonBox); |
|
95 | layout->addWidget(buttonBox); | |
96 |
|
96 | |||
97 | QObject::connect(buttonBox, &QDialogButtonBox::accepted, &d, &QDialog::accept); |
|
97 | QObject::connect(buttonBox, &QDialogButtonBox::accepted, &d, &QDialog::accept); | |
98 | QObject::connect(buttonBox, &QDialogButtonBox::rejected, &d, &QDialog::reject); |
|
98 | QObject::connect(buttonBox, &QDialogButtonBox::rejected, &d, &QDialog::reject); | |
99 |
|
99 | |||
100 | QObject::connect(listWidget, &QListWidget::itemChanged, |
|
100 | QObject::connect(listWidget, &QListWidget::itemChanged, | |
101 | [&checkedItems, allowMultiSelection, listWidget](auto item) { |
|
101 | [&checkedItems, allowMultiSelection, listWidget](auto item) { | |
102 | if (item->checkState() == Qt::Checked) { |
|
102 | if (item->checkState() == Qt::Checked) { | |
103 | if (!allowMultiSelection) { |
|
103 | if (!allowMultiSelection) { | |
104 | for (auto checkedItem : checkedItems) { |
|
104 | for (auto checkedItem : checkedItems) { | |
105 | listWidget->blockSignals(true); |
|
105 | listWidget->blockSignals(true); | |
106 | checkedItem->setCheckState(Qt::Unchecked); |
|
106 | checkedItem->setCheckState(Qt::Unchecked); | |
107 | listWidget->blockSignals(false); |
|
107 | listWidget->blockSignals(false); | |
108 | } |
|
108 | } | |
109 |
|
109 | |||
110 | checkedItems.clear(); |
|
110 | checkedItems.clear(); | |
111 | } |
|
111 | } | |
112 | checkedItems << item; |
|
112 | checkedItems << item; | |
113 | } |
|
113 | } | |
114 | else { |
|
114 | else { | |
115 | checkedItems.remove(item); |
|
115 | checkedItems.remove(item); | |
116 | } |
|
116 | } | |
117 | }); |
|
117 | }); | |
118 |
|
118 | |||
119 | QStringList result; |
|
119 | QStringList result; | |
120 |
|
120 | |||
121 | d.setMinimumWidth(120); |
|
121 | d.setMinimumWidth(120); | |
122 | d.resize(d.minimumSizeHint()); |
|
122 | d.resize(d.minimumSizeHint()); | |
123 | d.move(location); |
|
123 | d.move(location); | |
124 | if (d.exec() == QDialog::Accepted) { |
|
124 | if (d.exec() == QDialog::Accepted) { | |
125 | for (auto item : checkedItems) { |
|
125 | for (auto item : checkedItems) { | |
126 | result += item->text(); |
|
126 | result += item->text(); | |
127 | } |
|
127 | } | |
128 | } |
|
128 | } | |
129 | else { |
|
129 | else { | |
130 | result = selectedZones; |
|
130 | result = selectedZones; | |
131 | } |
|
131 | } | |
132 |
|
132 | |||
133 | return result; |
|
133 | return result; | |
134 | } |
|
134 | } | |
135 |
|
135 | |||
136 | void updateForTimeMode(QTreeView *treeView) |
|
136 | void updateForTimeMode(QTreeView *treeView) | |
137 | { |
|
137 | { | |
138 | auto selectedRows = treeView->selectionModel()->selectedRows(); |
|
138 | auto selectedRows = treeView->selectionModel()->selectedRows(); | |
139 |
|
139 | |||
140 | if (selectedRows.count() == 1) { |
|
140 | if (selectedRows.count() == 1) { | |
141 | auto event = m_Model->getEvent(selectedRows.first()); |
|
141 | auto event = m_Model->getEvent(selectedRows.first()); | |
142 | if (event) { |
|
142 | if (event) { | |
143 | if (m_VisualizationWidget) { |
|
143 | if (m_VisualizationWidget) { | |
144 | if (auto tab = m_VisualizationWidget->currentTabWidget()) { |
|
144 | if (auto tab = m_VisualizationWidget->currentTabWidget()) { | |
145 |
|
145 | |||
146 | for (auto zoneName : m_ZonesForTimeMode) { |
|
146 | for (auto zoneName : m_ZonesForTimeMode) { | |
147 | if (auto zone = tab->getZoneWithName(zoneName)) { |
|
147 | if (auto zone = tab->getZoneWithName(zoneName)) { | |
148 | SqpRange eventRange; |
|
148 | SqpRange eventRange; | |
149 | eventRange.m_TStart = event->getTStart(); |
|
149 | eventRange.m_TStart = event->getTStart(); | |
150 | eventRange.m_TEnd = event->getTEnd(); |
|
150 | eventRange.m_TEnd = event->getTEnd(); | |
151 | zone->setZoneRange(eventRange); |
|
151 | zone->setZoneRange(eventRange); | |
152 | } |
|
152 | } | |
153 | } |
|
153 | } | |
154 | } |
|
154 | } | |
155 | else { |
|
155 | else { | |
156 | qCWarning(LOG_CatalogueEventsWidget()) |
|
156 | qCWarning(LOG_CatalogueEventsWidget()) | |
157 | << "updateTimeZone: no tab found in the visualization"; |
|
157 | << "updateTimeZone: no tab found in the visualization"; | |
158 | } |
|
158 | } | |
159 | } |
|
159 | } | |
160 | else { |
|
160 | else { | |
161 | qCWarning(LOG_CatalogueEventsWidget()) |
|
161 | qCWarning(LOG_CatalogueEventsWidget()) | |
162 | << "updateTimeZone: visualization widget not found"; |
|
162 | << "updateTimeZone: visualization widget not found"; | |
163 | } |
|
163 | } | |
164 | } |
|
164 | } | |
165 | } |
|
165 | } | |
166 | else { |
|
166 | else { | |
167 | qCWarning(LOG_CatalogueEventsWidget()) |
|
167 | qCWarning(LOG_CatalogueEventsWidget()) | |
168 | << "updateTimeZone: not compatible with multiple events selected"; |
|
168 | << "updateTimeZone: not compatible with multiple events selected"; | |
169 | } |
|
169 | } | |
170 | } |
|
170 | } | |
171 |
|
171 | |||
172 | void updateForGraphMode(QTreeView *treeView) |
|
172 | void updateForGraphMode(QTreeView *treeView) | |
173 | { |
|
173 | { | |
174 | auto selectedRows = treeView->selectionModel()->selectedRows(); |
|
174 | auto selectedRows = treeView->selectionModel()->selectedRows(); | |
175 |
|
175 | |||
176 | if (selectedRows.count() == 1) { |
|
176 | if (selectedRows.count() == 1) { | |
177 | auto event = m_Model->getEvent(selectedRows.first()); |
|
177 | auto event = m_Model->getEvent(selectedRows.first()); | |
178 | if (m_VisualizationWidget) { |
|
178 | if (m_VisualizationWidget) { | |
179 | if (auto tab = m_VisualizationWidget->currentTabWidget()) { |
|
179 | if (auto tab = m_VisualizationWidget->currentTabWidget()) { | |
180 | if (auto zone = tab->getZoneWithName(m_ZoneForGraphMode)) { |
|
180 | if (auto zone = tab->getZoneWithName(m_ZoneForGraphMode)) { | |
181 | // TODO |
|
181 | // TODO | |
182 | } |
|
182 | } | |
183 | } |
|
183 | } | |
184 | else { |
|
184 | else { | |
185 | qCWarning(LOG_CatalogueEventsWidget()) |
|
185 | qCWarning(LOG_CatalogueEventsWidget()) | |
186 | << "updateGraphMode: no tab found in the visualization"; |
|
186 | << "updateGraphMode: no tab found in the visualization"; | |
187 | } |
|
187 | } | |
188 | } |
|
188 | } | |
189 | else { |
|
189 | else { | |
190 | qCWarning(LOG_CatalogueEventsWidget()) |
|
190 | qCWarning(LOG_CatalogueEventsWidget()) | |
191 | << "updateGraphMode: visualization widget not found"; |
|
191 | << "updateGraphMode: visualization widget not found"; | |
192 | } |
|
192 | } | |
193 | } |
|
193 | } | |
194 | else { |
|
194 | else { | |
195 | qCWarning(LOG_CatalogueEventsWidget()) |
|
195 | qCWarning(LOG_CatalogueEventsWidget()) | |
196 | << "updateGraphMode: not compatible with multiple events selected"; |
|
196 | << "updateGraphMode: not compatible with multiple events selected"; | |
197 | } |
|
197 | } | |
198 | } |
|
198 | } | |
199 | }; |
|
199 | }; | |
200 |
|
200 | |||
201 | CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent) |
|
201 | CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent) | |
202 | : QWidget(parent), |
|
202 | : QWidget(parent), | |
203 | ui(new Ui::CatalogueEventsWidget), |
|
203 | ui(new Ui::CatalogueEventsWidget), | |
204 | impl{spimpl::make_unique_impl<CatalogueEventsWidgetPrivate>()} |
|
204 | impl{spimpl::make_unique_impl<CatalogueEventsWidgetPrivate>()} | |
205 | { |
|
205 | { | |
206 | ui->setupUi(this); |
|
206 | ui->setupUi(this); | |
207 |
|
207 | |||
208 | impl->m_Model = new CatalogueEventsModel{this}; |
|
208 | impl->m_Model = new CatalogueEventsModel{this}; | |
209 | ui->treeView->setModel(impl->m_Model); |
|
209 | ui->treeView->setModel(impl->m_Model); | |
210 |
|
210 | |||
211 | ui->treeView->setSortingEnabled(true); |
|
211 | ui->treeView->setSortingEnabled(true); | |
212 | ui->treeView->setDragDropMode(QAbstractItemView::DragDrop); |
|
212 | ui->treeView->setDragDropMode(QAbstractItemView::DragDrop); | |
213 | ui->treeView->setDragEnabled(true); |
|
213 | ui->treeView->setDragEnabled(true); | |
214 |
|
214 | |||
215 | connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) { |
|
215 | connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) { | |
216 | if (checked) { |
|
216 | if (checked) { | |
217 | ui->btnChart->setChecked(false); |
|
217 | ui->btnChart->setChecked(false); | |
218 | impl->m_ZonesForTimeMode |
|
218 | impl->m_ZonesForTimeMode | |
219 | = impl->selectZone(this, impl->m_ZonesForTimeMode, true, |
|
219 | = impl->selectZone(this, impl->m_ZonesForTimeMode, true, | |
220 | this->mapToGlobal(ui->btnTime->frameGeometry().center())); |
|
220 | this->mapToGlobal(ui->btnTime->frameGeometry().center())); | |
221 |
|
221 | |||
222 | impl->updateForTimeMode(ui->treeView); |
|
222 | impl->updateForTimeMode(ui->treeView); | |
223 | } |
|
223 | } | |
224 | }); |
|
224 | }); | |
225 |
|
225 | |||
226 | connect(ui->btnChart, &QToolButton::clicked, [this](auto checked) { |
|
226 | connect(ui->btnChart, &QToolButton::clicked, [this](auto checked) { | |
227 | if (checked) { |
|
227 | if (checked) { | |
228 | ui->btnTime->setChecked(false); |
|
228 | ui->btnTime->setChecked(false); | |
229 | impl->m_ZoneForGraphMode |
|
229 | impl->m_ZoneForGraphMode | |
230 | = impl->selectZone(this, {impl->m_ZoneForGraphMode}, false, |
|
230 | = impl->selectZone(this, {impl->m_ZoneForGraphMode}, false, | |
231 | this->mapToGlobal(ui->btnChart->frameGeometry().center())) |
|
231 | this->mapToGlobal(ui->btnChart->frameGeometry().center())) | |
232 | .value(0); |
|
232 | .value(0); | |
233 |
|
233 | |||
234 | impl->updateForGraphMode(ui->treeView); |
|
234 | impl->updateForGraphMode(ui->treeView); | |
235 | } |
|
235 | } | |
236 | }); |
|
236 | }); | |
237 |
|
237 | |||
238 | auto emitSelection = [this]() { |
|
238 | auto emitSelection = [this]() { | |
239 | QVector<std::shared_ptr<DBEvent> > events; |
|
239 | QVector<std::shared_ptr<DBEvent> > events; | |
240 | QVector<QPair<std::shared_ptr<DBEvent>, std::shared_ptr<DBEventProduct> > > eventProducts; |
|
240 | QVector<QPair<std::shared_ptr<DBEvent>, std::shared_ptr<DBEventProduct> > > eventProducts; | |
241 |
|
241 | |||
242 | for (auto rowIndex : ui->treeView->selectionModel()->selectedRows()) { |
|
242 | for (auto rowIndex : ui->treeView->selectionModel()->selectedRows()) { | |
243 |
|
243 | |||
244 | auto itemType = impl->m_Model->itemTypeOf(rowIndex); |
|
244 | auto itemType = impl->m_Model->itemTypeOf(rowIndex); | |
245 | if (itemType == CatalogueEventsModel::ItemType::Event) { |
|
245 | if (itemType == CatalogueEventsModel::ItemType::Event) { | |
246 | events << impl->m_Model->getEvent(rowIndex); |
|
246 | events << impl->m_Model->getEvent(rowIndex); | |
247 | } |
|
247 | } | |
248 | else if (itemType == CatalogueEventsModel::ItemType::EventProduct) { |
|
248 | else if (itemType == CatalogueEventsModel::ItemType::EventProduct) { | |
249 | eventProducts << qMakePair(impl->m_Model->getParentEvent(rowIndex), |
|
249 | eventProducts << qMakePair(impl->m_Model->getParentEvent(rowIndex), | |
250 | impl->m_Model->getEventProduct(rowIndex)); |
|
250 | impl->m_Model->getEventProduct(rowIndex)); | |
251 | } |
|
251 | } | |
252 | } |
|
252 | } | |
253 |
|
253 | |||
254 | if (!events.isEmpty() && eventProducts.isEmpty()) { |
|
254 | if (!events.isEmpty() && eventProducts.isEmpty()) { | |
255 | emit this->eventsSelected(events); |
|
255 | emit this->eventsSelected(events); | |
256 | } |
|
256 | } | |
257 | else if (events.isEmpty() && !eventProducts.isEmpty()) { |
|
257 | else if (events.isEmpty() && !eventProducts.isEmpty()) { | |
258 | emit this->eventProductsSelected(eventProducts); |
|
258 | emit this->eventProductsSelected(eventProducts); | |
259 | } |
|
259 | } | |
260 | else { |
|
260 | else { | |
261 | emit this->selectionCleared(); |
|
261 | emit this->selectionCleared(); | |
262 | } |
|
262 | } | |
263 | }; |
|
263 | }; | |
264 |
|
264 | |||
265 | connect(ui->treeView, &QTreeView::clicked, emitSelection); |
|
265 | connect(ui->treeView, &QTreeView::clicked, emitSelection); | |
266 | connect(ui->treeView->selectionModel(), &QItemSelectionModel::selectionChanged, emitSelection); |
|
266 | connect(ui->treeView->selectionModel(), &QItemSelectionModel::selectionChanged, emitSelection); | |
267 |
|
267 | |||
268 | connect(ui->treeView->selectionModel(), &QItemSelectionModel::selectionChanged, [this]() { |
|
268 | connect(ui->treeView->selectionModel(), &QItemSelectionModel::selectionChanged, [this]() { | |
269 | auto isNotMultiSelection = ui->treeView->selectionModel()->selectedRows().count() <= 1; |
|
269 | auto isNotMultiSelection = ui->treeView->selectionModel()->selectedRows().count() <= 1; | |
270 | ui->btnChart->setEnabled(isNotMultiSelection); |
|
270 | ui->btnChart->setEnabled(isNotMultiSelection); | |
271 | ui->btnTime->setEnabled(isNotMultiSelection); |
|
271 | ui->btnTime->setEnabled(isNotMultiSelection); | |
272 |
|
272 | |||
273 | if (isNotMultiSelection && ui->btnTime->isChecked()) { |
|
273 | if (isNotMultiSelection && ui->btnTime->isChecked()) { | |
274 | impl->updateForTimeMode(ui->treeView); |
|
274 | impl->updateForTimeMode(ui->treeView); | |
275 | } |
|
275 | } | |
276 | else if (isNotMultiSelection && ui->btnChart->isChecked()) { |
|
276 | else if (isNotMultiSelection && ui->btnChart->isChecked()) { | |
277 | impl->updateForGraphMode(ui->treeView); |
|
277 | impl->updateForGraphMode(ui->treeView); | |
278 | } |
|
278 | } | |
279 | }); |
|
279 | }); | |
280 |
|
280 | |||
281 | ui->treeView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); |
|
281 | ui->treeView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); | |
282 | ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::Name, |
|
282 | ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::Name, | |
283 | QHeaderView::Stretch); |
|
283 | QHeaderView::Stretch); | |
284 | ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::Validation, |
|
284 | ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::Validation, | |
285 | QHeaderView::Fixed); |
|
285 | QHeaderView::Fixed); | |
286 | ui->treeView->header()->resizeSection((int)CatalogueEventsModel::Column::Validation, |
|
286 | ui->treeView->header()->resizeSection((int)CatalogueEventsModel::Column::Validation, | |
287 | VALIDATION_COLUMN_SIZE); |
|
287 | VALIDATION_COLUMN_SIZE); | |
288 | ui->treeView->header()->setSortIndicatorShown(true); |
|
288 | ui->treeView->header()->setSortIndicatorShown(true); | |
289 |
|
289 | |||
290 | connect(impl->m_Model, &CatalogueEventsModel::modelSorted, [this]() { |
|
290 | connect(impl->m_Model, &CatalogueEventsModel::modelSorted, [this]() { | |
291 | auto allEvents = impl->m_Model->events(); |
|
291 | auto allEvents = impl->m_Model->events(); | |
292 | for (auto event : allEvents) { |
|
292 | for (auto event : allEvents) { | |
293 | setEventChanges(event, impl->m_Model->eventsHasChanges(event)); |
|
293 | setEventChanges(event, impl->m_Model->eventsHasChanges(event)); | |
294 | } |
|
294 | } | |
295 | }); |
|
295 | }); | |
|
296 | ||||
|
297 | populateWithAllEvents(); | |||
296 | } |
|
298 | } | |
297 |
|
299 | |||
298 | CatalogueEventsWidget::~CatalogueEventsWidget() |
|
300 | CatalogueEventsWidget::~CatalogueEventsWidget() | |
299 | { |
|
301 | { | |
300 | delete ui; |
|
302 | delete ui; | |
301 | } |
|
303 | } | |
302 |
|
304 | |||
303 | void CatalogueEventsWidget::setVisualizationWidget(VisualizationWidget *visualization) |
|
305 | void CatalogueEventsWidget::setVisualizationWidget(VisualizationWidget *visualization) | |
304 | { |
|
306 | { | |
305 | impl->m_VisualizationWidget = visualization; |
|
307 | impl->m_VisualizationWidget = visualization; | |
306 | } |
|
308 | } | |
307 |
|
309 | |||
308 | void CatalogueEventsWidget::addEvent(const std::shared_ptr<DBEvent> &event) |
|
310 | void CatalogueEventsWidget::addEvent(const std::shared_ptr<DBEvent> &event) | |
309 | { |
|
311 | { | |
310 | impl->addEvent(event, ui->treeView); |
|
312 | impl->addEvent(event, ui->treeView); | |
311 | } |
|
313 | } | |
312 |
|
314 | |||
313 | void CatalogueEventsWidget::setEventChanges(const std::shared_ptr<DBEvent> &event, bool hasChanges) |
|
315 | void CatalogueEventsWidget::setEventChanges(const std::shared_ptr<DBEvent> &event, bool hasChanges) | |
314 | { |
|
316 | { | |
315 | impl->m_Model->refreshEvent(event); |
|
317 | impl->m_Model->refreshEvent(event); | |
316 |
|
318 | |||
317 | auto eventIndex = impl->m_Model->indexOf(event); |
|
319 | auto eventIndex = impl->m_Model->indexOf(event); | |
318 | auto validationIndex |
|
320 | auto validationIndex | |
319 | = eventIndex.sibling(eventIndex.row(), (int)CatalogueEventsModel::Column::Validation); |
|
321 | = eventIndex.sibling(eventIndex.row(), (int)CatalogueEventsModel::Column::Validation); | |
320 |
|
322 | |||
321 | if (hasChanges) { |
|
323 | if (hasChanges) { | |
322 | if (ui->treeView->indexWidget(validationIndex) == nullptr) { |
|
324 | if (ui->treeView->indexWidget(validationIndex) == nullptr) { | |
323 | auto widget = CatalogueExplorerHelper::buildValidationWidget( |
|
325 | auto widget = CatalogueExplorerHelper::buildValidationWidget( | |
324 | ui->treeView, |
|
326 | ui->treeView, | |
325 | [this, event]() { |
|
327 | [this, event]() { | |
326 | sqpApp->catalogueController().saveEvent(event); |
|
328 | sqpApp->catalogueController().saveEvent(event); | |
327 | setEventChanges(event, false); |
|
329 | setEventChanges(event, false); | |
328 | }, |
|
330 | }, | |
329 | [this, event]() { setEventChanges(event, false); }); |
|
331 | [this, event]() { setEventChanges(event, false); }); | |
330 | ui->treeView->setIndexWidget(validationIndex, widget); |
|
332 | ui->treeView->setIndexWidget(validationIndex, widget); | |
331 | } |
|
333 | } | |
332 |
|
334 | |||
333 | impl->m_Model->setEventHasChanges(event, hasChanges); |
|
335 | impl->m_Model->setEventHasChanges(event, hasChanges); | |
334 | } |
|
336 | } | |
335 | else { |
|
337 | else { | |
336 | qCWarning(LOG_CatalogueEventsWidget()) |
|
338 | qCWarning(LOG_CatalogueEventsWidget()) | |
337 | << "setEventChanges: the event is not displayed in the model."; |
|
339 | << "setEventChanges: the event is not displayed in the model."; | |
338 | } |
|
340 | } | |
339 | } |
|
341 | } | |
340 |
|
342 | |||
341 | QVector<std::shared_ptr<DBCatalogue> > CatalogueEventsWidget::displayedCatalogues() const |
|
343 | QVector<std::shared_ptr<DBCatalogue> > CatalogueEventsWidget::displayedCatalogues() const | |
342 | { |
|
344 | { | |
343 | return impl->m_DisplayedCatalogues; |
|
345 | return impl->m_DisplayedCatalogues; | |
344 | } |
|
346 | } | |
345 |
|
347 | |||
346 | bool CatalogueEventsWidget::isAllEventsDisplayed() const |
|
348 | bool CatalogueEventsWidget::isAllEventsDisplayed() const | |
347 | { |
|
349 | { | |
348 | return impl->m_DisplayedCatalogues.isEmpty(); |
|
350 | return impl->m_DisplayedCatalogues.isEmpty() && !impl->m_Model->events().isEmpty(); | |
349 | } |
|
351 | } | |
350 |
|
352 | |||
351 | bool CatalogueEventsWidget::isEventDisplayed(const std::shared_ptr<DBEvent> &event) const |
|
353 | bool CatalogueEventsWidget::isEventDisplayed(const std::shared_ptr<DBEvent> &event) const | |
352 | { |
|
354 | { | |
353 | return impl->m_Model->indexOf(event).isValid(); |
|
355 | return impl->m_Model->indexOf(event).isValid(); | |
354 | } |
|
356 | } | |
355 |
|
357 | |||
356 | void CatalogueEventsWidget::populateWithCatalogues( |
|
358 | void CatalogueEventsWidget::populateWithCatalogues( | |
357 | const QVector<std::shared_ptr<DBCatalogue> > &catalogues) |
|
359 | const QVector<std::shared_ptr<DBCatalogue> > &catalogues) | |
358 | { |
|
360 | { | |
359 | impl->m_DisplayedCatalogues = catalogues; |
|
361 | impl->m_DisplayedCatalogues = catalogues; | |
360 |
|
362 | |||
361 | QSet<QUuid> eventIds; |
|
363 | QSet<QUuid> eventIds; | |
362 | QVector<std::shared_ptr<DBEvent> > events; |
|
364 | QVector<std::shared_ptr<DBEvent> > events; | |
363 |
|
365 | |||
364 | for (auto catalogue : catalogues) { |
|
366 | for (auto catalogue : catalogues) { | |
365 | auto catalogueEvents = sqpApp->catalogueController().retrieveEventsFromCatalogue(catalogue); |
|
367 | auto catalogueEvents = sqpApp->catalogueController().retrieveEventsFromCatalogue(catalogue); | |
366 | for (auto event : catalogueEvents) { |
|
368 | for (auto event : catalogueEvents) { | |
367 | if (!eventIds.contains(event->getUniqId())) { |
|
369 | if (!eventIds.contains(event->getUniqId())) { | |
368 | events << event; |
|
370 | events << event; | |
369 | eventIds.insert(event->getUniqId()); |
|
371 | eventIds.insert(event->getUniqId()); | |
370 | } |
|
372 | } | |
371 | } |
|
373 | } | |
372 | } |
|
374 | } | |
373 |
|
375 | |||
374 | impl->setEvents(events, ui->treeView); |
|
376 | impl->setEvents(events, ui->treeView); | |
375 | } |
|
377 | } | |
376 |
|
378 | |||
377 | void CatalogueEventsWidget::populateWithAllEvents() |
|
379 | void CatalogueEventsWidget::populateWithAllEvents() | |
378 | { |
|
380 | { | |
379 | impl->m_DisplayedCatalogues.clear(); |
|
381 | impl->m_DisplayedCatalogues.clear(); | |
380 |
|
382 | |||
381 | auto allEvents = sqpApp->catalogueController().retrieveAllEvents(); |
|
383 | auto allEvents = sqpApp->catalogueController().retrieveAllEvents(); | |
382 |
|
384 | |||
383 | QVector<std::shared_ptr<DBEvent> > events; |
|
385 | QVector<std::shared_ptr<DBEvent> > events; | |
384 | for (auto event : allEvents) { |
|
386 | for (auto event : allEvents) { | |
385 | events << event; |
|
387 | events << event; | |
386 | } |
|
388 | } | |
387 |
|
389 | |||
388 | impl->setEvents(events, ui->treeView); |
|
390 | impl->setEvents(events, ui->treeView); | |
389 | } |
|
391 | } | |
390 |
|
392 | |||
|
393 | void CatalogueEventsWidget::clear() | |||
|
394 | { | |||
|
395 | impl->m_DisplayedCatalogues.clear(); | |||
|
396 | impl->setEvents({}, ui->treeView); | |||
|
397 | } | |||
|
398 | ||||
391 | void CatalogueEventsWidget::refresh() |
|
399 | void CatalogueEventsWidget::refresh() | |
392 | { |
|
400 | { | |
393 | if (impl->m_DisplayedCatalogues.isEmpty()) { |
|
401 | if (impl->m_DisplayedCatalogues.isEmpty()) { | |
394 | populateWithAllEvents(); |
|
402 | populateWithAllEvents(); | |
395 | } |
|
403 | } | |
396 | else { |
|
404 | else { | |
397 | populateWithCatalogues(impl->m_DisplayedCatalogues); |
|
405 | populateWithCatalogues(impl->m_DisplayedCatalogues); | |
398 | } |
|
406 | } | |
399 | } |
|
407 | } |
@@ -1,113 +1,126 | |||||
1 | #include "Catalogue/CatalogueExplorer.h" |
|
1 | #include "Catalogue/CatalogueExplorer.h" | |
2 | #include "ui_CatalogueExplorer.h" |
|
2 | #include "ui_CatalogueExplorer.h" | |
3 |
|
3 | |||
4 | #include <Catalogue/CatalogueActionManager.h> |
|
4 | #include <Catalogue/CatalogueActionManager.h> | |
5 | #include <Catalogue/CatalogueController.h> |
|
5 | #include <Catalogue/CatalogueController.h> | |
6 | #include <SqpApplication.h> |
|
6 | #include <SqpApplication.h> | |
7 | #include <Visualization/VisualizationWidget.h> |
|
7 | #include <Visualization/VisualizationWidget.h> | |
8 |
|
8 | |||
9 | #include <DBCatalogue.h> |
|
9 | #include <DBCatalogue.h> | |
10 | #include <DBEvent.h> |
|
10 | #include <DBEvent.h> | |
11 |
|
11 | |||
12 | struct CatalogueExplorer::CatalogueExplorerPrivate { |
|
12 | struct CatalogueExplorer::CatalogueExplorerPrivate { | |
13 | CatalogueActionManager m_ActionManager; |
|
13 | CatalogueActionManager m_ActionManager; | |
14 |
|
14 | |||
15 | CatalogueExplorerPrivate(CatalogueExplorer *catalogueExplorer) |
|
15 | CatalogueExplorerPrivate(CatalogueExplorer *catalogueExplorer) | |
16 | : m_ActionManager(catalogueExplorer) |
|
16 | : m_ActionManager(catalogueExplorer) | |
17 | { |
|
17 | { | |
18 | } |
|
18 | } | |
19 | }; |
|
19 | }; | |
20 |
|
20 | |||
21 | CatalogueExplorer::CatalogueExplorer(QWidget *parent) |
|
21 | CatalogueExplorer::CatalogueExplorer(QWidget *parent) | |
22 | : QDialog(parent, Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), |
|
22 | : QDialog(parent, Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), | |
23 | ui(new Ui::CatalogueExplorer), |
|
23 | ui(new Ui::CatalogueExplorer), | |
24 | impl{spimpl::make_unique_impl<CatalogueExplorerPrivate>(this)} |
|
24 | impl{spimpl::make_unique_impl<CatalogueExplorerPrivate>(this)} | |
25 | { |
|
25 | { | |
26 | ui->setupUi(this); |
|
26 | ui->setupUi(this); | |
27 |
|
27 | |||
28 | impl->m_ActionManager.installSelectionZoneActions(); |
|
28 | impl->m_ActionManager.installSelectionZoneActions(); | |
29 |
|
29 | |||
30 | connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSelected, [this](auto catalogues) { |
|
30 | connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSelected, [this](auto catalogues) { | |
31 | if (catalogues.count() == 1) { |
|
31 | if (catalogues.count() == 1) { | |
32 | ui->inspector->setCatalogue(catalogues.first()); |
|
32 | ui->inspector->setCatalogue(catalogues.first()); | |
33 | } |
|
33 | } | |
34 | else { |
|
34 | else { | |
35 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); |
|
35 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | |
36 | } |
|
36 | } | |
37 |
|
37 | |||
38 | ui->events->populateWithCatalogues(catalogues); |
|
38 | ui->events->populateWithCatalogues(catalogues); | |
39 | }); |
|
39 | }); | |
40 |
|
40 | |||
41 | connect(ui->catalogues, &CatalogueSideBarWidget::databaseSelected, [this](auto databases) { |
|
41 | connect(ui->catalogues, &CatalogueSideBarWidget::databaseSelected, [this](auto databases) { | |
42 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); |
|
42 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | |
43 | }); |
|
43 | }); | |
44 |
|
44 | |||
45 | connect(ui->catalogues, &CatalogueSideBarWidget::trashSelected, |
|
45 | connect(ui->catalogues, &CatalogueSideBarWidget::trashSelected, [this]() { | |
46 |
|
|
46 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | |
|
47 | ui->events->clear(); | |||
|
48 | }); | |||
47 |
|
49 | |||
48 | connect(ui->catalogues, &CatalogueSideBarWidget::allEventsSelected, [this]() { |
|
50 | connect(ui->catalogues, &CatalogueSideBarWidget::allEventsSelected, [this]() { | |
49 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); |
|
51 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | |
50 | ui->events->populateWithAllEvents(); |
|
52 | ui->events->populateWithAllEvents(); | |
51 | }); |
|
53 | }); | |
52 |
|
54 | |||
53 |
connect(ui->catalogues, &CatalogueSideBarWidget::select |
|
55 | connect(ui->catalogues, &CatalogueSideBarWidget::databaseSelected, [this](auto databaseList) { | |
54 | [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); }); |
|
56 | QVector<std::shared_ptr<DBCatalogue> > catalogueList; | |
|
57 | for (auto database : databaseList) { | |||
|
58 | catalogueList.append(ui->catalogues->getCatalogues(database)); | |||
|
59 | } | |||
|
60 | ui->events->populateWithCatalogues(catalogueList); | |||
|
61 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | |||
|
62 | }); | |||
|
63 | ||||
|
64 | connect(ui->catalogues, &CatalogueSideBarWidget::selectionCleared, [this]() { | |||
|
65 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | |||
|
66 | ui->events->clear(); | |||
|
67 | }); | |||
55 |
|
68 | |||
56 | connect(ui->events, &CatalogueEventsWidget::eventsSelected, [this](auto events) { |
|
69 | connect(ui->events, &CatalogueEventsWidget::eventsSelected, [this](auto events) { | |
57 | if (events.count() == 1) { |
|
70 | if (events.count() == 1) { | |
58 | ui->inspector->setEvent(events.first()); |
|
71 | ui->inspector->setEvent(events.first()); | |
59 | } |
|
72 | } | |
60 | else { |
|
73 | else { | |
61 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); |
|
74 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | |
62 | } |
|
75 | } | |
63 | }); |
|
76 | }); | |
64 |
|
77 | |||
65 | connect(ui->events, &CatalogueEventsWidget::eventProductsSelected, [this](auto eventProducts) { |
|
78 | connect(ui->events, &CatalogueEventsWidget::eventProductsSelected, [this](auto eventProducts) { | |
66 | if (eventProducts.count() == 1) { |
|
79 | if (eventProducts.count() == 1) { | |
67 | ui->inspector->setEventProduct(eventProducts.first().first, |
|
80 | ui->inspector->setEventProduct(eventProducts.first().first, | |
68 | eventProducts.first().second); |
|
81 | eventProducts.first().second); | |
69 | } |
|
82 | } | |
70 | else { |
|
83 | else { | |
71 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); |
|
84 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | |
72 | } |
|
85 | } | |
73 | }); |
|
86 | }); | |
74 |
|
87 | |||
75 | connect(ui->events, &CatalogueEventsWidget::selectionCleared, |
|
88 | connect(ui->events, &CatalogueEventsWidget::selectionCleared, | |
76 | [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); }); |
|
89 | [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); }); | |
77 |
|
90 | |||
78 | connect(ui->inspector, &CatalogueInspectorWidget::catalogueUpdated, [this](auto catalogue) { |
|
91 | connect(ui->inspector, &CatalogueInspectorWidget::catalogueUpdated, [this](auto catalogue) { | |
79 | sqpApp->catalogueController().updateCatalogue(catalogue); |
|
92 | sqpApp->catalogueController().updateCatalogue(catalogue); | |
80 | ui->catalogues->setCatalogueChanges(catalogue, true); |
|
93 | ui->catalogues->setCatalogueChanges(catalogue, true); | |
81 | }); |
|
94 | }); | |
82 |
|
95 | |||
83 | connect(ui->inspector, &CatalogueInspectorWidget::eventUpdated, [this](auto event) { |
|
96 | connect(ui->inspector, &CatalogueInspectorWidget::eventUpdated, [this](auto event) { | |
84 | sqpApp->catalogueController().updateEvent(event); |
|
97 | sqpApp->catalogueController().updateEvent(event); | |
85 | ui->events->setEventChanges(event, true); |
|
98 | ui->events->setEventChanges(event, true); | |
86 | }); |
|
99 | }); | |
87 |
|
100 | |||
88 | connect(ui->inspector, &CatalogueInspectorWidget::eventProductUpdated, |
|
101 | connect(ui->inspector, &CatalogueInspectorWidget::eventProductUpdated, | |
89 | [this](auto event, auto eventProduct) { |
|
102 | [this](auto event, auto eventProduct) { | |
90 | sqpApp->catalogueController().updateEventProduct(eventProduct); |
|
103 | sqpApp->catalogueController().updateEventProduct(eventProduct); | |
91 | ui->events->setEventChanges(event, true); |
|
104 | ui->events->setEventChanges(event, true); | |
92 | }); |
|
105 | }); | |
93 | } |
|
106 | } | |
94 |
|
107 | |||
95 | CatalogueExplorer::~CatalogueExplorer() |
|
108 | CatalogueExplorer::~CatalogueExplorer() | |
96 | { |
|
109 | { | |
97 | delete ui; |
|
110 | delete ui; | |
98 | } |
|
111 | } | |
99 |
|
112 | |||
100 | void CatalogueExplorer::setVisualizationWidget(VisualizationWidget *visualization) |
|
113 | void CatalogueExplorer::setVisualizationWidget(VisualizationWidget *visualization) | |
101 | { |
|
114 | { | |
102 | ui->events->setVisualizationWidget(visualization); |
|
115 | ui->events->setVisualizationWidget(visualization); | |
103 | } |
|
116 | } | |
104 |
|
117 | |||
105 | CatalogueEventsWidget &CatalogueExplorer::eventsWidget() const |
|
118 | CatalogueEventsWidget &CatalogueExplorer::eventsWidget() const | |
106 | { |
|
119 | { | |
107 | return *ui->events; |
|
120 | return *ui->events; | |
108 | } |
|
121 | } | |
109 |
|
122 | |||
110 | CatalogueSideBarWidget &CatalogueExplorer::sideBarWidget() const |
|
123 | CatalogueSideBarWidget &CatalogueExplorer::sideBarWidget() const | |
111 | { |
|
124 | { | |
112 | return *ui->catalogues; |
|
125 | return *ui->catalogues; | |
113 | } |
|
126 | } |
General Comments 3
Status change > Approved
You need to be logged in to leave comments.
Login now