@@ -5,18 +5,22 | |||
|
5 | 5 | #include <QAbstractItemModel> |
|
6 | 6 | |
|
7 | 7 | class DBEvent; |
|
8 | class DBEventProduct; | |
|
8 | 9 | |
|
9 | 10 | class CatalogueEventsModel : public QAbstractItemModel { |
|
10 | 11 | public: |
|
11 | 12 | CatalogueEventsModel(QObject *parent = nullptr); |
|
12 | 13 | |
|
13 | 14 | void setEvents(const QVector<std::shared_ptr<DBEvent> > &events); |
|
14 | std::shared_ptr<DBEvent> getEvent(int row) const; | |
|
15 | ||
|
16 | ||
|
17 | 15 | void addEvent(const std::shared_ptr<DBEvent> &event); |
|
18 | 16 | void removeEvent(const std::shared_ptr<DBEvent> &event); |
|
19 | 17 | |
|
18 | enum class ItemType { Root, Event, EventProduct }; | |
|
19 | ItemType itemTypeOf(const QModelIndex &index) const; | |
|
20 | std::shared_ptr<DBEvent> getEvent(const QModelIndex &index) const; | |
|
21 | std::shared_ptr<DBEvent> getParentEvent(const QModelIndex &index) const; | |
|
22 | std::shared_ptr<DBEventProduct> getEventProduct(const QModelIndex &index) const; | |
|
23 | ||
|
20 | 24 | void refreshEvent(const std::shared_ptr<DBEvent> &event); |
|
21 | 25 | |
|
22 | 26 | // Model |
@@ -35,8 +39,8 public: | |||
|
35 | 39 | QMimeData *mimeData(const QModelIndexList &indexes) const override; |
|
36 | 40 | |
|
37 | 41 | private: |
|
38 |
class CatalogueEvents |
|
|
39 |
spimpl::unique_impl_ptr<CatalogueEvents |
|
|
42 | class CatalogueEventsModelPrivate; | |
|
43 | spimpl::unique_impl_ptr<CatalogueEventsModelPrivate> impl; | |
|
40 | 44 | }; |
|
41 | 45 | |
|
42 | 46 | #endif // SCIQLOP_CATALOGUEEVENTSMODEL_H |
@@ -7,6 +7,7 | |||
|
7 | 7 | |
|
8 | 8 | class DBCatalogue; |
|
9 | 9 | class DBEvent; |
|
10 | class DBEventProduct; | |
|
10 | 11 | class VisualizationWidget; |
|
11 | 12 | |
|
12 | 13 | namespace Ui { |
@@ -20,6 +21,10 class CatalogueEventsWidget : public QWidget { | |||
|
20 | 21 | |
|
21 | 22 | signals: |
|
22 | 23 | void eventsSelected(const QVector<std::shared_ptr<DBEvent> > &event); |
|
24 | void eventProductsSelected( | |
|
25 | const QVector<QPair<std::shared_ptr<DBEvent>, std::shared_ptr<DBEventProduct> > > | |
|
26 | &eventproducts); | |
|
27 | void selectionCleared(); | |
|
23 | 28 | |
|
24 | 29 | public: |
|
25 | 30 | explicit CatalogueEventsWidget(QWidget *parent = 0); |
@@ -11,6 +11,7 class CatalogueInspectorWidget; | |||
|
11 | 11 | |
|
12 | 12 | class DBCatalogue; |
|
13 | 13 | class DBEvent; |
|
14 | class DBEventProduct; | |
|
14 | 15 | |
|
15 | 16 | class CatalogueInspectorWidget : public QWidget { |
|
16 | 17 | Q_OBJECT |
@@ -18,6 +19,8 class CatalogueInspectorWidget : public QWidget { | |||
|
18 | 19 | signals: |
|
19 | 20 | void catalogueUpdated(const std::shared_ptr<DBCatalogue> &catalogue); |
|
20 | 21 | void eventUpdated(const std::shared_ptr<DBEvent> &event); |
|
22 | void eventProductUpdated(const std::shared_ptr<DBEvent> &event, | |
|
23 | const std::shared_ptr<DBEventProduct> &eventProduct); | |
|
21 | 24 | |
|
22 | 25 | public: |
|
23 | 26 | explicit CatalogueInspectorWidget(QWidget *parent = 0); |
@@ -29,6 +32,8 public: | |||
|
29 | 32 | Page currentPage() const; |
|
30 | 33 | |
|
31 | 34 | void setEvent(const std::shared_ptr<DBEvent> &event); |
|
35 | void setEventProduct(const std::shared_ptr<DBEvent> &event, | |
|
36 | const std::shared_ptr<DBEventProduct> &eventProduct); | |
|
32 | 37 | void setCatalogue(const std::shared_ptr<DBCatalogue> &catalogue); |
|
33 | 38 | |
|
34 | 39 | public slots: |
@@ -18,7 +18,7 | |||
|
18 | 18 | const auto EVENT_ITEM_TYPE = 1; |
|
19 | 19 | const auto EVENT_PRODUCT_ITEM_TYPE = 2; |
|
20 | 20 | |
|
21 |
struct CatalogueEventsModel::CatalogueEvents |
|
|
21 | struct CatalogueEventsModel::CatalogueEventsModelPrivate { | |
|
22 | 22 | QVector<std::shared_ptr<DBEvent> > m_Events; |
|
23 | 23 | std::unordered_map<DBEvent *, QVector<std::shared_ptr<DBEventProduct> > > m_EventProducts; |
|
24 | 24 | |
@@ -92,32 +92,10 struct CatalogueEventsModel::CatalogueEventsTableModelPrivate { | |||
|
92 | 92 | Q_ASSERT(false); |
|
93 | 93 | return QStringLiteral("Unknown Data"); |
|
94 | 94 | } |
|
95 | ||
|
96 | enum class ItemType { Root, Event, EventProduct }; | |
|
97 | ItemType indexItemType(const QModelIndex &index) const | |
|
98 | { | |
|
99 | ||
|
100 | if (!index.isValid()) { | |
|
101 | return ItemType::Root; | |
|
102 | } | |
|
103 | else if (index.internalPointer() == nullptr) { | |
|
104 | return ItemType::Event; | |
|
105 | } | |
|
106 | else { | |
|
107 | return ItemType::EventProduct; | |
|
108 | } | |
|
109 | } | |
|
110 | ||
|
111 | std::shared_ptr<DBEventProduct> getEventProduct(const QModelIndex &index) | |
|
112 | { | |
|
113 | auto event = static_cast<DBEvent *>(index.internalPointer()); | |
|
114 | return m_EventProducts.at(event).value(index.row()); | |
|
115 | } | |
|
116 | 95 | }; |
|
117 | 96 | |
|
118 | 97 | CatalogueEventsModel::CatalogueEventsModel(QObject *parent) |
|
119 | : QAbstractItemModel(parent), | |
|
120 | impl{spimpl::make_unique_impl<CatalogueEventsTableModelPrivate>()} | |
|
98 | : QAbstractItemModel(parent), impl{spimpl::make_unique_impl<CatalogueEventsModelPrivate>()} | |
|
121 | 99 | { |
|
122 | 100 | } |
|
123 | 101 | |
@@ -126,6 +104,7 void CatalogueEventsModel::setEvents(const QVector<std::shared_ptr<DBEvent> > &e | |||
|
126 | 104 | beginResetModel(); |
|
127 | 105 | |
|
128 | 106 | impl->m_Events = events; |
|
107 | impl->m_EventProducts.clear(); | |
|
129 | 108 | for (auto event : events) { |
|
130 | 109 | impl->parseEventProduct(event); |
|
131 | 110 | } |
@@ -133,9 +112,36 void CatalogueEventsModel::setEvents(const QVector<std::shared_ptr<DBEvent> > &e | |||
|
133 | 112 | endResetModel(); |
|
134 | 113 | } |
|
135 | 114 | |
|
136 |
std::shared_ptr<DBEvent> CatalogueEventsModel::getEvent( |
|
|
115 | std::shared_ptr<DBEvent> CatalogueEventsModel::getEvent(const QModelIndex &index) const | |
|
116 | { | |
|
117 | if (itemTypeOf(index) == CatalogueEventsModel::ItemType::Event) { | |
|
118 | return impl->m_Events.value(index.row()); | |
|
119 | } | |
|
120 | else { | |
|
121 | return nullptr; | |
|
122 | } | |
|
123 | } | |
|
124 | ||
|
125 | std::shared_ptr<DBEvent> CatalogueEventsModel::getParentEvent(const QModelIndex &index) const | |
|
137 | 126 | { |
|
138 | return impl->m_Events.value(row); | |
|
127 | if (itemTypeOf(index) == CatalogueEventsModel::ItemType::EventProduct) { | |
|
128 | return getEvent(index.parent()); | |
|
129 | } | |
|
130 | else { | |
|
131 | return nullptr; | |
|
132 | } | |
|
133 | } | |
|
134 | ||
|
135 | std::shared_ptr<DBEventProduct> | |
|
136 | CatalogueEventsModel::getEventProduct(const QModelIndex &index) const | |
|
137 | { | |
|
138 | if (itemTypeOf(index) == CatalogueEventsModel::ItemType::EventProduct) { | |
|
139 | auto event = static_cast<DBEvent *>(index.internalPointer()); | |
|
140 | return impl->m_EventProducts.at(event).value(index.row()); | |
|
141 | } | |
|
142 | else { | |
|
143 | return nullptr; | |
|
144 | } | |
|
139 | 145 | } |
|
140 | 146 | |
|
141 | 147 | void CatalogueEventsModel::addEvent(const std::shared_ptr<DBEvent> &event) |
@@ -159,9 +165,14 void CatalogueEventsModel::removeEvent(const std::shared_ptr<DBEvent> &event) | |||
|
159 | 165 | |
|
160 | 166 | void CatalogueEventsModel::refreshEvent(const std::shared_ptr<DBEvent> &event) |
|
161 | 167 | { |
|
162 |
auto |
|
|
163 |
if ( |
|
|
164 | emit dataChanged(index(eventIndex, 0), index(eventIndex, columnCount())); | |
|
168 | auto i = impl->m_Events.indexOf(event); | |
|
169 | if (i >= 0) { | |
|
170 | auto eventIndex = index(i, 0); | |
|
171 | auto colCount = columnCount(); | |
|
172 | emit dataChanged(eventIndex, index(i, colCount)); | |
|
173 | ||
|
174 | auto childCount = rowCount(eventIndex); | |
|
175 | emit dataChanged(index(0, 0, eventIndex), index(childCount, colCount, eventIndex)); | |
|
165 | 176 | } |
|
166 | 177 | } |
|
167 | 178 | |
@@ -171,14 +182,14 QModelIndex CatalogueEventsModel::index(int row, int column, const QModelIndex & | |||
|
171 | 182 | return QModelIndex(); |
|
172 | 183 | } |
|
173 | 184 | |
|
174 |
switch (i |
|
|
175 |
case CatalogueEvents |
|
|
185 | switch (itemTypeOf(parent)) { | |
|
186 | case CatalogueEventsModel::ItemType::Root: | |
|
176 | 187 | return createIndex(row, column); |
|
177 |
case CatalogueEvents |
|
|
178 |
auto event = getEvent(parent |
|
|
188 | case CatalogueEventsModel::ItemType::Event: { | |
|
189 | auto event = getEvent(parent); | |
|
179 | 190 | return createIndex(row, column, event.get()); |
|
180 | 191 | } |
|
181 |
case CatalogueEvents |
|
|
192 | case CatalogueEventsModel::ItemType::EventProduct: | |
|
182 | 193 | break; |
|
183 | 194 | default: |
|
184 | 195 | break; |
@@ -189,8 +200,8 QModelIndex CatalogueEventsModel::index(int row, int column, const QModelIndex & | |||
|
189 | 200 | |
|
190 | 201 | QModelIndex CatalogueEventsModel::parent(const QModelIndex &index) const |
|
191 | 202 | { |
|
192 |
switch (i |
|
|
193 |
case CatalogueEvents |
|
|
203 | switch (itemTypeOf(index)) { | |
|
204 | case CatalogueEventsModel::ItemType::EventProduct: { | |
|
194 | 205 | auto parentEvent = static_cast<DBEvent *>(index.internalPointer()); |
|
195 | 206 | auto it |
|
196 | 207 | = std::find_if(impl->m_Events.cbegin(), impl->m_Events.cend(), |
@@ -203,9 +214,9 QModelIndex CatalogueEventsModel::parent(const QModelIndex &index) const | |||
|
203 | 214 | return QModelIndex(); |
|
204 | 215 | } |
|
205 | 216 | } |
|
206 |
case CatalogueEvents |
|
|
217 | case CatalogueEventsModel::ItemType::Root: | |
|
207 | 218 | break; |
|
208 |
case CatalogueEvents |
|
|
219 | case CatalogueEventsModel::ItemType::Event: | |
|
209 | 220 | break; |
|
210 | 221 | default: |
|
211 | 222 | break; |
@@ -220,14 +231,14 int CatalogueEventsModel::rowCount(const QModelIndex &parent) const | |||
|
220 | 231 | return 0; |
|
221 | 232 | } |
|
222 | 233 | |
|
223 |
switch (i |
|
|
224 |
case CatalogueEvents |
|
|
234 | switch (itemTypeOf(parent)) { | |
|
235 | case CatalogueEventsModel::ItemType::Root: | |
|
225 | 236 | return impl->m_Events.count(); |
|
226 |
case CatalogueEvents |
|
|
227 |
auto event = getEvent(parent |
|
|
237 | case CatalogueEventsModel::ItemType::Event: { | |
|
238 | auto event = getEvent(parent); | |
|
228 | 239 | return impl->m_EventProducts[event.get()].count(); |
|
229 | 240 | } |
|
230 |
case CatalogueEvents |
|
|
241 | case CatalogueEventsModel::ItemType::EventProduct: | |
|
231 | 242 | break; |
|
232 | 243 | default: |
|
233 | 244 | break; |
@@ -238,7 +249,7 int CatalogueEventsModel::rowCount(const QModelIndex &parent) const | |||
|
238 | 249 | |
|
239 | 250 | int CatalogueEventsModel::columnCount(const QModelIndex &parent) const |
|
240 | 251 | { |
|
241 |
return static_cast<int>(CatalogueEvents |
|
|
252 | return static_cast<int>(CatalogueEventsModelPrivate::Column::NbColumn); | |
|
242 | 253 | } |
|
243 | 254 | |
|
244 | 255 | Qt::ItemFlags CatalogueEventsModel::flags(const QModelIndex &index) const |
@@ -250,17 +261,17 QVariant CatalogueEventsModel::data(const QModelIndex &index, int role) const | |||
|
250 | 261 | { |
|
251 | 262 | if (index.isValid()) { |
|
252 | 263 | |
|
253 |
auto type = i |
|
|
254 |
if (type == CatalogueEvents |
|
|
255 |
auto event = getEvent(index |
|
|
264 | auto type = itemTypeOf(index); | |
|
265 | if (type == CatalogueEventsModel::ItemType::Event) { | |
|
266 | auto event = getEvent(index); | |
|
256 | 267 | switch (role) { |
|
257 | 268 | case Qt::DisplayRole: |
|
258 | 269 | return impl->eventData(index.column(), event); |
|
259 | 270 | break; |
|
260 | 271 | } |
|
261 | 272 | } |
|
262 |
else if (type == CatalogueEvents |
|
|
263 |
auto product = |
|
|
273 | else if (type == CatalogueEventsModel::ItemType::EventProduct) { | |
|
274 | auto product = getEventProduct(index); | |
|
264 | 275 | switch (role) { |
|
265 | 276 | case Qt::DisplayRole: |
|
266 | 277 | return impl->eventProductData(index.column(), product); |
@@ -315,7 +326,7 QMimeData *CatalogueEventsModel::mimeData(const QModelIndexList &indexes) const | |||
|
315 | 326 | SqpRange firstTimeRange; |
|
316 | 327 | for (const auto &index : indexes) { |
|
317 | 328 | if (index.column() == 0) { // only the first column |
|
318 |
auto event = getEvent(index |
|
|
329 | auto event = getEvent(index); | |
|
319 | 330 | if (eventList.isEmpty()) { |
|
320 | 331 | // Gets the range of the first variable |
|
321 | 332 | // firstTimeRange.m_TStart = event->getTStart(); |
@@ -338,3 +349,16 QMimeData *CatalogueEventsModel::mimeData(const QModelIndexList &indexes) const | |||
|
338 | 349 | |
|
339 | 350 | return mimeData; |
|
340 | 351 | } |
|
352 | ||
|
353 | CatalogueEventsModel::ItemType CatalogueEventsModel::itemTypeOf(const QModelIndex &index) const | |
|
354 | { | |
|
355 | if (!index.isValid()) { | |
|
356 | return ItemType::Root; | |
|
357 | } | |
|
358 | else if (index.internalPointer() == nullptr) { | |
|
359 | return ItemType::Event; | |
|
360 | } | |
|
361 | else { | |
|
362 | return ItemType::EventProduct; | |
|
363 | } | |
|
364 | } |
@@ -136,7 +136,7 struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate { | |||
|
136 | 136 | auto selectedRows = treeView->selectionModel()->selectedRows(); |
|
137 | 137 | |
|
138 | 138 | if (selectedRows.count() == 1) { |
|
139 |
auto event = m_Model->getEvent(selectedRows.first() |
|
|
139 | auto event = m_Model->getEvent(selectedRows.first()); | |
|
140 | 140 | if (m_VisualizationWidget) { |
|
141 | 141 | if (auto tab = m_VisualizationWidget->currentTabWidget()) { |
|
142 | 142 | |
@@ -170,7 +170,7 struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate { | |||
|
170 | 170 | auto selectedRows = treeView->selectionModel()->selectedRows(); |
|
171 | 171 | |
|
172 | 172 | if (selectedRows.count() == 1) { |
|
173 |
auto event = m_Model->getEvent(selectedRows.first() |
|
|
173 | auto event = m_Model->getEvent(selectedRows.first()); | |
|
174 | 174 | if (m_VisualizationWidget) { |
|
175 | 175 | if (auto tab = m_VisualizationWidget->currentTabWidget()) { |
|
176 | 176 | if (auto zone = tab->getZoneWithName(m_ZoneForGraphMode)) { |
@@ -233,11 +233,29 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent) | |||
|
233 | 233 | |
|
234 | 234 | auto emitSelection = [this]() { |
|
235 | 235 | QVector<std::shared_ptr<DBEvent> > events; |
|
236 | QVector<QPair<std::shared_ptr<DBEvent>, std::shared_ptr<DBEventProduct> > > eventProducts; | |
|
237 | ||
|
236 | 238 | for (auto rowIndex : ui->treeView->selectionModel()->selectedRows()) { |
|
237 | events << impl->m_Model->getEvent(rowIndex.row()); | |
|
239 | ||
|
240 | auto itemType = impl->m_Model->itemTypeOf(rowIndex); | |
|
241 | if (itemType == CatalogueEventsModel::ItemType::Event) { | |
|
242 | events << impl->m_Model->getEvent(rowIndex); | |
|
243 | } | |
|
244 | else if (itemType == CatalogueEventsModel::ItemType::EventProduct) { | |
|
245 | eventProducts << qMakePair(impl->m_Model->getParentEvent(rowIndex), | |
|
246 | impl->m_Model->getEventProduct(rowIndex)); | |
|
247 | } | |
|
238 | 248 | } |
|
239 | 249 | |
|
250 | if (!events.isEmpty() && eventProducts.isEmpty()) { | |
|
240 | 251 | emit this->eventsSelected(events); |
|
252 | } | |
|
253 | else if (events.isEmpty() && !eventProducts.isEmpty()) { | |
|
254 | emit this->eventProductsSelected(eventProducts); | |
|
255 | } | |
|
256 | else { | |
|
257 | emit this->selectionCleared(); | |
|
258 | } | |
|
241 | 259 | }; |
|
242 | 260 | |
|
243 | 261 | connect(ui->treeView, &QTreeView::clicked, emitSelection); |
@@ -49,11 +49,27 CatalogueExplorer::CatalogueExplorer(QWidget *parent) | |||
|
49 | 49 | } |
|
50 | 50 | }); |
|
51 | 51 | |
|
52 | connect(ui->events, &CatalogueEventsWidget::eventProductsSelected, [this](auto eventProducts) { | |
|
53 | if (eventProducts.count() == 1) { | |
|
54 | ui->inspector->setEventProduct(eventProducts.first().first, | |
|
55 | eventProducts.first().second); | |
|
56 | } | |
|
57 | else { | |
|
58 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | |
|
59 | } | |
|
60 | }); | |
|
61 | ||
|
62 | connect(ui->events, &CatalogueEventsWidget::selectionCleared, | |
|
63 | [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); }); | |
|
64 | ||
|
52 | 65 | connect(ui->inspector, &CatalogueInspectorWidget::catalogueUpdated, |
|
53 | 66 | [this](auto catalogue) { ui->catalogues->setCatalogueChanges(catalogue, true); }); |
|
54 | 67 | |
|
55 | 68 | connect(ui->inspector, &CatalogueInspectorWidget::eventUpdated, |
|
56 | 69 | [this](auto event) { ui->events->setEventChanges(event, true); }); |
|
70 | ||
|
71 | connect(ui->inspector, &CatalogueInspectorWidget::eventProductUpdated, | |
|
72 | [this](auto event, auto eventProduct) { ui->events->setEventChanges(event, true); }); | |
|
57 | 73 | } |
|
58 | 74 | |
|
59 | 75 | CatalogueExplorer::~CatalogueExplorer() |
@@ -4,11 +4,13 | |||
|
4 | 4 | #include <Common/DateUtils.h> |
|
5 | 5 | #include <DBCatalogue.h> |
|
6 | 6 | #include <DBEvent.h> |
|
7 | #include <DBEventProduct.h> | |
|
7 | 8 | #include <DBTag.h> |
|
8 | 9 | |
|
9 | 10 | struct CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate { |
|
10 | 11 | std::shared_ptr<DBCatalogue> m_DisplayedCatalogue = nullptr; |
|
11 | 12 | std::shared_ptr<DBEvent> m_DisplayedEvent = nullptr; |
|
13 | std::shared_ptr<DBEventProduct> m_DisplayedEventProduct = nullptr; | |
|
12 | 14 | |
|
13 | 15 | void connectCatalogueUpdateSignals(CatalogueInspectorWidget *inspector, |
|
14 | 16 | Ui::CatalogueInspectorWidget *ui); |
@@ -61,18 +63,11 void CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate::connectEventUpda | |||
|
61 | 63 | } |
|
62 | 64 | }); |
|
63 | 65 | |
|
64 | connect(ui->leEventMission, &QLineEdit::editingFinished, [ui, inspector, this]() { | |
|
65 | // if (ui->leEventMission->text() != m_DisplayedEvent->getMission()) { | |
|
66 | // m_DisplayedEvent->setMission(ui->leEventMission->text()); | |
|
67 | // emit inspector->eventUpdated(m_DisplayedEvent); | |
|
68 | // } | |
|
69 | }); | |
|
70 | ||
|
71 | 66 | connect(ui->leEventProduct, &QLineEdit::editingFinished, [ui, inspector, this]() { |
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
|
67 | if (ui->leEventProduct->text() != m_DisplayedEventProduct->getProductId()) { | |
|
68 | m_DisplayedEventProduct->setProductId(ui->leEventProduct->text()); | |
|
69 | emit inspector->eventProductUpdated(m_DisplayedEvent, m_DisplayedEventProduct); | |
|
70 | } | |
|
76 | 71 | }); |
|
77 | 72 | |
|
78 | 73 | connect(ui->leEventTags, &QLineEdit::editingFinished, [ui, inspector, this]() { |
@@ -80,19 +75,19 void CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate::connectEventUpda | |||
|
80 | 75 | }); |
|
81 | 76 | |
|
82 | 77 | connect(ui->dateTimeEventTStart, &QDateTimeEdit::editingFinished, [ui, inspector, this]() { |
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
|
78 | auto time = DateUtils::secondsSinceEpoch(ui->dateTimeEventTStart->dateTime()); | |
|
79 | if (time != m_DisplayedEventProduct->getTStart()) { | |
|
80 | m_DisplayedEventProduct->setTStart(time); | |
|
81 | emit inspector->eventProductUpdated(m_DisplayedEvent, m_DisplayedEventProduct); | |
|
82 | } | |
|
88 | 83 | }); |
|
89 | 84 | |
|
90 | 85 | connect(ui->dateTimeEventTEnd, &QDateTimeEdit::editingFinished, [ui, inspector, this]() { |
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
|
86 | auto time = DateUtils::secondsSinceEpoch(ui->dateTimeEventTEnd->dateTime()); | |
|
87 | if (time != m_DisplayedEventProduct->getTEnd()) { | |
|
88 | m_DisplayedEventProduct->setTEnd(time); | |
|
89 | emit inspector->eventProductUpdated(m_DisplayedEvent, m_DisplayedEventProduct); | |
|
90 | } | |
|
96 | 91 | }); |
|
97 | 92 | } |
|
98 | 93 | |
@@ -113,9 +108,11 void CatalogueInspectorWidget::setEvent(const std::shared_ptr<DBEvent> &event) | |||
|
113 | 108 | blockSignals(true); |
|
114 | 109 | |
|
115 | 110 | showPage(Page::EventProperties); |
|
111 | ui->leEventName->setEnabled(true); | |
|
116 | 112 | ui->leEventName->setText(event->getName()); |
|
117 | // ui->leEventMission->setText(event->getMission()); | |
|
118 |
|
|
|
113 | ui->leEventProduct->setEnabled(false); | |
|
114 | ui->leEventProduct->setText( | |
|
115 | QString::number(event->getEventProducts().size()).append(" product(s)")); | |
|
119 | 116 | |
|
120 | 117 | QString tagList; |
|
121 | 118 | auto tags = event->getTags(); |
@@ -124,14 +121,43 void CatalogueInspectorWidget::setEvent(const std::shared_ptr<DBEvent> &event) | |||
|
124 | 121 | tagList += ' '; |
|
125 | 122 | } |
|
126 | 123 | |
|
124 | ui->leEventTags->setEnabled(true); | |
|
127 | 125 | ui->leEventTags->setText(tagList); |
|
128 | 126 | |
|
127 | ui->dateTimeEventTStart->setEnabled(false); | |
|
128 | ui->dateTimeEventTEnd->setEnabled(false); | |
|
129 | ||
|
129 | 130 | // ui->dateTimeEventTStart->setDateTime(DateUtils::dateTime(event->getTStart())); |
|
130 | 131 | // ui->dateTimeEventTEnd->setDateTime(DateUtils::dateTime(event->getTEnd())); |
|
131 | 132 | |
|
132 | 133 | blockSignals(false); |
|
133 | 134 | } |
|
134 | 135 | |
|
136 | void CatalogueInspectorWidget::setEventProduct(const std::shared_ptr<DBEvent> &event, | |
|
137 | const std::shared_ptr<DBEventProduct> &eventProduct) | |
|
138 | { | |
|
139 | impl->m_DisplayedEventProduct = eventProduct; | |
|
140 | ||
|
141 | blockSignals(true); | |
|
142 | ||
|
143 | showPage(Page::EventProperties); | |
|
144 | ui->leEventName->setEnabled(false); | |
|
145 | ui->leEventName->setText(event->getName()); | |
|
146 | ui->leEventProduct->setEnabled(true); | |
|
147 | ui->leEventProduct->setText(eventProduct->getProductId()); | |
|
148 | ||
|
149 | ui->leEventTags->setEnabled(false); | |
|
150 | ui->leEventTags->clear(); | |
|
151 | ||
|
152 | ui->dateTimeEventTStart->setEnabled(true); | |
|
153 | ui->dateTimeEventTEnd->setEnabled(true); | |
|
154 | ||
|
155 | ui->dateTimeEventTStart->setDateTime(DateUtils::dateTime(eventProduct->getTStart())); | |
|
156 | ui->dateTimeEventTEnd->setDateTime(DateUtils::dateTime(eventProduct->getTEnd())); | |
|
157 | ||
|
158 | blockSignals(false); | |
|
159 | } | |
|
160 | ||
|
135 | 161 | void CatalogueInspectorWidget::setCatalogue(const std::shared_ptr<DBCatalogue> &catalogue) |
|
136 | 162 | { |
|
137 | 163 | impl->m_DisplayedCatalogue = catalogue; |
@@ -121,6 +121,9 | |||
|
121 | 121 | <property name="dragDropMode"> |
|
122 | 122 | <enum>QAbstractItemView::DragDrop</enum> |
|
123 | 123 | </property> |
|
124 | <property name="selectionMode"> | |
|
125 | <enum>QAbstractItemView::ExtendedSelection</enum> | |
|
126 | </property> | |
|
124 | 127 | <property name="selectionBehavior"> |
|
125 | 128 | <enum>QAbstractItemView::SelectRows</enum> |
|
126 | 129 | </property> |
@@ -53,7 +53,7 | |||
|
53 | 53 | <item> |
|
54 | 54 | <widget class="QStackedWidget" name="stackedWidget"> |
|
55 | 55 | <property name="currentIndex"> |
|
56 |
<number> |
|
|
56 | <number>2</number> | |
|
57 | 57 | </property> |
|
58 | 58 | <widget class="QWidget" name="emptyPage"/> |
|
59 | 59 | <widget class="QWidget" name="catalogueInspectorPage"> |
@@ -113,98 +113,95 | |||
|
113 | 113 | </widget> |
|
114 | 114 | <widget class="QWidget" name="eventInspectorPage"> |
|
115 | 115 | <layout class="QGridLayout" name="gridLayout"> |
|
116 |
<item row=" |
|
|
117 |
<widget class="Q |
|
|
118 |
<property name="t |
|
|
119 |
< |
|
|
116 | <item row="4" column="0"> | |
|
117 | <widget class="QLabel" name="label_3"> | |
|
118 | <property name="text"> | |
|
119 | <string>Product</string> | |
|
120 | 120 | </property> |
|
121 | 121 | </widget> |
|
122 | 122 | </item> |
|
123 |
<item row=" |
|
|
123 | <item row="5" column="0"> | |
|
124 | 124 | <widget class="QLabel" name="label_4"> |
|
125 | 125 | <property name="text"> |
|
126 | 126 | <string>TStart</string> |
|
127 | 127 | </property> |
|
128 | 128 | </widget> |
|
129 | 129 | </item> |
|
130 |
<item row=" |
|
|
131 |
<widget class="QLabel" name="label |
|
|
130 | <item row="1" column="0"> | |
|
131 | <widget class="QLabel" name="label"> | |
|
132 | 132 | <property name="text"> |
|
133 |
<string> |
|
|
133 | <string>Name</string> | |
|
134 | 134 | </property> |
|
135 | 135 | </widget> |
|
136 | 136 | </item> |
|
137 |
<item row=" |
|
|
138 |
<widget class="QLabel" name="label_ |
|
|
137 | <item row="0" column="0" colspan="2"> | |
|
138 | <widget class="QLabel" name="label_10"> | |
|
139 | <property name="font"> | |
|
140 | <font> | |
|
141 | <pointsize>10</pointsize> | |
|
142 | <weight>75</weight> | |
|
143 | <bold>true</bold> | |
|
144 | </font> | |
|
145 | </property> | |
|
139 | 146 | <property name="text"> |
|
140 |
<string> |
|
|
147 | <string>Event Properties</string> | |
|
141 | 148 | </property> |
|
142 | 149 | </widget> |
|
143 | 150 | </item> |
|
144 |
<item row=" |
|
|
145 | <widget class="QLineEdit" name="leEventProduct"/> | |
|
146 | </item> | |
|
147 | <item row="5" column="0"> | |
|
148 | <widget class="QLabel" name="label_5"> | |
|
149 | <property name="text"> | |
|
150 | <string>Tend</string> | |
|
151 | <item row="8" column="1"> | |
|
152 | <spacer name="verticalSpacer"> | |
|
153 | <property name="orientation"> | |
|
154 | <enum>Qt::Vertical</enum> | |
|
151 | 155 | </property> |
|
152 | </widget> | |
|
156 | <property name="sizeHint" stdset="0"> | |
|
157 | <size> | |
|
158 | <width>20</width> | |
|
159 | <height>40</height> | |
|
160 | </size> | |
|
161 | </property> | |
|
162 | </spacer> | |
|
153 | 163 | </item> |
|
154 |
<item row=" |
|
|
164 | <item row="1" column="1"> | |
|
165 | <widget class="QLineEdit" name="leEventName"/> | |
|
166 | </item> | |
|
167 | <item row="5" column="1"> | |
|
155 | 168 | <widget class="QDateTimeEdit" name="dateTimeEventTStart"> |
|
156 | 169 | <property name="timeSpec"> |
|
157 | 170 | <enum>Qt::UTC</enum> |
|
158 | 171 | </property> |
|
159 | 172 | </widget> |
|
160 | 173 | </item> |
|
161 |
<item row=" |
|
|
162 |
<widget class="QL |
|
|
174 | <item row="4" column="1"> | |
|
175 | <widget class="QLineEdit" name="leEventProduct"/> | |
|
176 | </item> | |
|
177 | <item row="6" column="0"> | |
|
178 | <widget class="QLabel" name="label_5"> | |
|
163 | 179 | <property name="text"> |
|
164 |
<string> |
|
|
180 | <string>Tend</string> | |
|
165 | 181 | </property> |
|
166 | 182 | </widget> |
|
167 | 183 | </item> |
|
168 |
<item row=" |
|
|
169 |
<widget class="Q |
|
|
170 | </item> | |
|
171 | <item row="1" column="0"> | |
|
172 | <widget class="QLabel" name="label"> | |
|
173 | <property name="text"> | |
|
174 | <string>Name</string> | |
|
184 | <item row="6" column="1"> | |
|
185 | <widget class="QDateTimeEdit" name="dateTimeEventTEnd"> | |
|
186 | <property name="timeSpec"> | |
|
187 | <enum>Qt::UTC</enum> | |
|
175 | 188 | </property> |
|
176 | 189 | </widget> |
|
177 | 190 | </item> |
|
178 | 191 | <item row="2" column="1"> |
|
179 | <widget class="QLineEdit" name="leEventMission"/> | |
|
180 | </item> | |
|
181 | <item row="6" column="1"> | |
|
182 | 192 | <widget class="QLineEdit" name="leEventTags"/> |
|
183 | 193 | </item> |
|
184 |
<item row=" |
|
|
185 | <spacer name="verticalSpacer"> | |
|
186 |
<property name=" |
|
|
187 | <enum>Qt::Vertical</enum> | |
|
188 | </property> | |
|
189 | <property name="sizeHint" stdset="0"> | |
|
190 | <size> | |
|
191 | <width>20</width> | |
|
192 | <height>40</height> | |
|
193 | </size> | |
|
194 | <item row="2" column="0"> | |
|
195 | <widget class="QLabel" name="label_6"> | |
|
196 | <property name="text"> | |
|
197 | <string>Tags</string> | |
|
194 | 198 | </property> |
|
195 |
</ |
|
|
199 | </widget> | |
|
196 | 200 | </item> |
|
197 |
<item row=" |
|
|
198 |
<widget class=" |
|
|
199 |
<property name=" |
|
|
200 |
< |
|
|
201 | <pointsize>10</pointsize> | |
|
202 | <weight>75</weight> | |
|
203 | <bold>true</bold> | |
|
204 | </font> | |
|
205 | </property> | |
|
206 | <property name="text"> | |
|
207 | <string>Event Properties</string> | |
|
201 | <item row="3" column="0" colspan="2"> | |
|
202 | <widget class="Line" name="line"> | |
|
203 | <property name="orientation"> | |
|
204 | <enum>Qt::Horizontal</enum> | |
|
208 | 205 | </property> |
|
209 | 206 | </widget> |
|
210 | 207 | </item> |
General Comments 0
You need to be logged in to leave comments.
Login now