@@ -81,7 +81,10 CatalogueExplorer::CatalogueExplorer(QWidget *parent) | |||
|
81 | 81 | }); |
|
82 | 82 | |
|
83 | 83 | connect(ui->inspector, &CatalogueInspectorWidget::eventProductUpdated, |
|
84 |
[this](auto event, auto eventProduct) { |
|
|
84 | [this](auto event, auto eventProduct) { | |
|
85 | sqpApp->catalogueController().updateEventProduct(eventProduct); | |
|
86 | ui->events->setEventChanges(event, true); | |
|
87 | }); | |
|
85 | 88 | } |
|
86 | 89 | |
|
87 | 90 | CatalogueExplorer::~CatalogueExplorer() |
@@ -78,8 +78,18 void CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate::connectEventUpda | |||
|
78 | 78 | |
|
79 | 79 | connect(ui->leEventProduct, &QLineEdit::editingFinished, [ui, inspector, this]() { |
|
80 | 80 | if (ui->leEventProduct->text() != m_DisplayedEventProduct->getProductId()) { |
|
81 | auto oldProductId = m_DisplayedEventProduct->getProductId(); | |
|
81 | 82 | m_DisplayedEventProduct->setProductId(ui->leEventProduct->text()); |
|
82 | emit inspector->eventProductUpdated(m_DisplayedEvent, m_DisplayedEventProduct); | |
|
83 | ||
|
84 | auto eventProducts = m_DisplayedEvent->getEventProducts(); | |
|
85 | for (auto &eventProduct : eventProducts) { | |
|
86 | if (eventProduct.getProductId() == oldProductId) { | |
|
87 | eventProduct.setProductId(m_DisplayedEventProduct->getProductId()); | |
|
88 | } | |
|
89 | } | |
|
90 | m_DisplayedEvent->setEventProducts(eventProducts); | |
|
91 | ||
|
92 | emit inspector->eventUpdated(m_DisplayedEvent); | |
|
83 | 93 | } |
|
84 | 94 | }); |
|
85 | 95 | |
@@ -87,7 +97,16 void CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate::connectEventUpda | |||
|
87 | 97 | auto time = DateUtils::secondsSinceEpoch(ui->dateTimeEventTStart->dateTime()); |
|
88 | 98 | if (time != m_DisplayedEventProduct->getTStart()) { |
|
89 | 99 | m_DisplayedEventProduct->setTStart(time); |
|
90 | emit inspector->eventProductUpdated(m_DisplayedEvent, m_DisplayedEventProduct); | |
|
100 | ||
|
101 | auto eventProducts = m_DisplayedEvent->getEventProducts(); | |
|
102 | for (auto &eventProduct : eventProducts) { | |
|
103 | if (eventProduct.getProductId() == m_DisplayedEventProduct->getProductId()) { | |
|
104 | eventProduct.setTStart(m_DisplayedEventProduct->getTStart()); | |
|
105 | } | |
|
106 | } | |
|
107 | m_DisplayedEvent->setEventProducts(eventProducts); | |
|
108 | ||
|
109 | emit inspector->eventUpdated(m_DisplayedEvent); | |
|
91 | 110 | } |
|
92 | 111 | }); |
|
93 | 112 | |
@@ -95,7 +114,16 void CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate::connectEventUpda | |||
|
95 | 114 | auto time = DateUtils::secondsSinceEpoch(ui->dateTimeEventTEnd->dateTime()); |
|
96 | 115 | if (time != m_DisplayedEventProduct->getTEnd()) { |
|
97 | 116 | m_DisplayedEventProduct->setTEnd(time); |
|
98 | emit inspector->eventProductUpdated(m_DisplayedEvent, m_DisplayedEventProduct); | |
|
117 | ||
|
118 | auto eventProducts = m_DisplayedEvent->getEventProducts(); | |
|
119 | for (auto &eventProduct : eventProducts) { | |
|
120 | if (eventProduct.getProductId() == m_DisplayedEventProduct->getProductId()) { | |
|
121 | eventProduct.setTEnd(m_DisplayedEventProduct->getTEnd()); | |
|
122 | } | |
|
123 | } | |
|
124 | m_DisplayedEvent->setEventProducts(eventProducts); | |
|
125 | ||
|
126 | emit inspector->eventUpdated(m_DisplayedEvent); | |
|
99 | 127 | } |
|
100 | 128 | }); |
|
101 | 129 | } |
@@ -145,6 +173,8 void CatalogueInspectorWidget::setEvent(const std::shared_ptr<DBEvent> &event) | |||
|
145 | 173 | void CatalogueInspectorWidget::setEventProduct(const std::shared_ptr<DBEvent> &event, |
|
146 | 174 | const std::shared_ptr<DBEventProduct> &eventProduct) |
|
147 | 175 | { |
|
176 | ||
|
177 | impl->m_DisplayedEvent = event; | |
|
148 | 178 | impl->m_DisplayedEventProduct = eventProduct; |
|
149 | 179 | |
|
150 | 180 | blockSignals(true); |
General Comments 0
You need to be logged in to leave comments.
Login now