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