@@ -184,7 +184,6 void CatalogueController::addEvent(std::shared_ptr<DBEvent> event) | |||||
184 | impl->m_CatalogueDao.updateEvent(eventTemp); |
|
184 | impl->m_CatalogueDao.updateEvent(eventTemp); | |
185 | } |
|
185 | } | |
186 |
|
186 | |||
187 |
|
||||
188 | // update event parameter |
|
187 | // update event parameter | |
189 | auto uniqIdPredicate = std::make_shared<ComparaisonPredicate>( |
|
188 | auto uniqIdPredicate = std::make_shared<ComparaisonPredicate>( | |
190 | QString{"uniqId"}, event->getUniqId(), ComparaisonOperation::EQUALEQUAL); |
|
189 | QString{"uniqId"}, event->getUniqId(), ComparaisonOperation::EQUALEQUAL); | |
@@ -197,9 +196,11 void CatalogueController::addEvent(std::shared_ptr<DBEvent> event) | |||||
197 | workPred->AddRequestPredicate(uniqIdPredicate); |
|
196 | workPred->AddRequestPredicate(uniqIdPredicate); | |
198 | workPred->AddRequestPredicate(workRepositoryPredicate); |
|
197 | workPred->AddRequestPredicate(workRepositoryPredicate); | |
199 |
|
198 | |||
200 |
|
||||
201 | auto workEvent = impl->m_CatalogueDao.getEvent(workPred); |
|
199 | auto workEvent = impl->m_CatalogueDao.getEvent(workPred); | |
202 | *event = workEvent; |
|
200 | *event = workEvent; | |
|
201 | ||||
|
202 | auto uniqueId = impl->eventUniqueKey(event); | |||
|
203 | impl->m_EventKeysWithChanges.insert(uniqueId); | |||
203 | } |
|
204 | } | |
204 |
|
205 | |||
205 | void CatalogueController::saveEvent(std::shared_ptr<DBEvent> event) |
|
206 | void CatalogueController::saveEvent(std::shared_ptr<DBEvent> event) |
@@ -90,14 +90,21 void CatalogueActionManager::installSelectionZoneActions() | |||||
90 | auto &actionController = sqpApp->actionsGuiController(); |
|
90 | auto &actionController = sqpApp->actionsGuiController(); | |
91 |
|
91 | |||
92 | auto createEventEnableFuntion = [](auto zones) { |
|
92 | auto createEventEnableFuntion = [](auto zones) { | |
93 | QSet<VisualizationGraphWidget *> usedGraphs; |
|
93 | ||
|
94 | // Checks that all variables in the zones doesn't refer to the same product | |||
|
95 | QSet<QString> usedDatasource; | |||
94 | for (auto zone : zones) { |
|
96 | for (auto zone : zones) { | |
95 | auto graph = zone->parentGraphWidget(); |
|
97 | auto graph = zone->parentGraphWidget(); | |
96 | if (!usedGraphs.contains(graph)) { |
|
98 | auto variables = graph->variables(); | |
97 | usedGraphs.insert(graph); |
|
99 | ||
98 | } |
|
100 | for (auto var : variables) { | |
99 | else { |
|
101 | auto datasourceId = var->metadata().value(DataSourceItem::ID_DATA_KEY).toString(); | |
100 | return false; |
|
102 | if (!usedDatasource.contains(datasourceId)) { | |
|
103 | usedDatasource.insert(datasourceId); | |||
|
104 | } | |||
|
105 | else { | |||
|
106 | return false; | |||
|
107 | } | |||
101 | } |
|
108 | } | |
102 | } |
|
109 | } | |
103 |
|
110 |
@@ -27,6 +27,7 struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate { | |||||
27 | QStringList m_ZonesForTimeMode; |
|
27 | QStringList m_ZonesForTimeMode; | |
28 | QString m_ZoneForGraphMode; |
|
28 | QString m_ZoneForGraphMode; | |
29 | QVector<std::shared_ptr<DBCatalogue> > m_DisplayedCatalogues; |
|
29 | QVector<std::shared_ptr<DBCatalogue> > m_DisplayedCatalogues; | |
|
30 | bool m_AllEventDisplayed = false; | |||
30 |
|
31 | |||
31 | VisualizationWidget *m_VisualizationWidget = nullptr; |
|
32 | VisualizationWidget *m_VisualizationWidget = nullptr; | |
32 |
|
33 | |||
@@ -389,7 +390,7 QVector<std::shared_ptr<DBCatalogue> > CatalogueEventsWidget::displayedCatalogue | |||||
389 |
|
390 | |||
390 | bool CatalogueEventsWidget::isAllEventsDisplayed() const |
|
391 | bool CatalogueEventsWidget::isAllEventsDisplayed() const | |
391 | { |
|
392 | { | |
392 | return impl->m_DisplayedCatalogues.isEmpty() && !impl->m_Model->events().isEmpty(); |
|
393 | return impl->m_AllEventDisplayed; | |
393 | } |
|
394 | } | |
394 |
|
395 | |||
395 | bool CatalogueEventsWidget::isEventDisplayed(const std::shared_ptr<DBEvent> &event) const |
|
396 | bool CatalogueEventsWidget::isEventDisplayed(const std::shared_ptr<DBEvent> &event) const | |
@@ -401,6 +402,7 void CatalogueEventsWidget::populateWithCatalogues( | |||||
401 | const QVector<std::shared_ptr<DBCatalogue> > &catalogues) |
|
402 | const QVector<std::shared_ptr<DBCatalogue> > &catalogues) | |
402 | { |
|
403 | { | |
403 | impl->m_DisplayedCatalogues = catalogues; |
|
404 | impl->m_DisplayedCatalogues = catalogues; | |
|
405 | impl->m_AllEventDisplayed = false; | |||
404 |
|
406 | |||
405 | QSet<QUuid> eventIds; |
|
407 | QSet<QUuid> eventIds; | |
406 | QVector<std::shared_ptr<DBEvent> > events; |
|
408 | QVector<std::shared_ptr<DBEvent> > events; | |
@@ -421,6 +423,7 void CatalogueEventsWidget::populateWithCatalogues( | |||||
421 | void CatalogueEventsWidget::populateWithAllEvents() |
|
423 | void CatalogueEventsWidget::populateWithAllEvents() | |
422 | { |
|
424 | { | |
423 | impl->m_DisplayedCatalogues.clear(); |
|
425 | impl->m_DisplayedCatalogues.clear(); | |
|
426 | impl->m_AllEventDisplayed = true; | |||
424 |
|
427 | |||
425 | auto allEvents = sqpApp->catalogueController().retrieveAllEvents(); |
|
428 | auto allEvents = sqpApp->catalogueController().retrieveAllEvents(); | |
426 |
|
429 | |||
@@ -435,15 +438,16 void CatalogueEventsWidget::populateWithAllEvents() | |||||
435 | void CatalogueEventsWidget::clear() |
|
438 | void CatalogueEventsWidget::clear() | |
436 | { |
|
439 | { | |
437 | impl->m_DisplayedCatalogues.clear(); |
|
440 | impl->m_DisplayedCatalogues.clear(); | |
|
441 | impl->m_AllEventDisplayed = false; | |||
438 | impl->setEvents({}, this); |
|
442 | impl->setEvents({}, this); | |
439 | } |
|
443 | } | |
440 |
|
444 | |||
441 | void CatalogueEventsWidget::refresh() |
|
445 | void CatalogueEventsWidget::refresh() | |
442 | { |
|
446 | { | |
443 | if (impl->m_DisplayedCatalogues.isEmpty()) { |
|
447 | if (isAllEventsDisplayed()) { | |
444 | populateWithAllEvents(); |
|
448 | populateWithAllEvents(); | |
445 | } |
|
449 | } | |
446 | else { |
|
450 | else if (!impl->m_DisplayedCatalogues.isEmpty()) { | |
447 | populateWithCatalogues(impl->m_DisplayedCatalogues); |
|
451 | populateWithCatalogues(impl->m_DisplayedCatalogues); | |
448 | } |
|
452 | } | |
449 | } |
|
453 | } |
General Comments 0
You need to be logged in to leave comments.
Login now