From 7185ea8182daaa0ab656c035586cd096e095870c 2017-12-20 16:58:18 From: mperrinel Date: 2017-12-20 16:58:18 Subject: [PATCH] Merge branch 'develop' of https://perrinel@hephaistos.lpp.polytechnique.fr/rhodecode/GIT_REPOSITORIES/LPP/Users/mperrinel/SciQLop-fork into develop Conflicts: core/src/Catalogue/CatalogueController.cpp --- diff --git a/core/src/Catalogue/CatalogueController.cpp b/core/src/Catalogue/CatalogueController.cpp index af80207..cf5d9e9 100644 --- a/core/src/Catalogue/CatalogueController.cpp +++ b/core/src/Catalogue/CatalogueController.cpp @@ -184,7 +184,6 @@ void CatalogueController::addEvent(std::shared_ptr event) impl->m_CatalogueDao.updateEvent(eventTemp); } - // update event parameter auto uniqIdPredicate = std::make_shared( QString{"uniqId"}, event->getUniqId(), ComparaisonOperation::EQUALEQUAL); @@ -197,9 +196,11 @@ void CatalogueController::addEvent(std::shared_ptr event) workPred->AddRequestPredicate(uniqIdPredicate); workPred->AddRequestPredicate(workRepositoryPredicate); - auto workEvent = impl->m_CatalogueDao.getEvent(workPred); *event = workEvent; + + auto uniqueId = impl->eventUniqueKey(event); + impl->m_EventKeysWithChanges.insert(uniqueId); } void CatalogueController::saveEvent(std::shared_ptr event) diff --git a/gui/src/Catalogue/CatalogueActionManager.cpp b/gui/src/Catalogue/CatalogueActionManager.cpp index 685b679..398c83d 100644 --- a/gui/src/Catalogue/CatalogueActionManager.cpp +++ b/gui/src/Catalogue/CatalogueActionManager.cpp @@ -90,14 +90,21 @@ void CatalogueActionManager::installSelectionZoneActions() auto &actionController = sqpApp->actionsGuiController(); auto createEventEnableFuntion = [](auto zones) { - QSet usedGraphs; + + // Checks that all variables in the zones doesn't refer to the same product + QSet usedDatasource; for (auto zone : zones) { auto graph = zone->parentGraphWidget(); - if (!usedGraphs.contains(graph)) { - usedGraphs.insert(graph); - } - else { - return false; + auto variables = graph->variables(); + + for (auto var : variables) { + auto datasourceId = var->metadata().value(DataSourceItem::ID_DATA_KEY).toString(); + if (!usedDatasource.contains(datasourceId)) { + usedDatasource.insert(datasourceId); + } + else { + return false; + } } } diff --git a/gui/src/Catalogue/CatalogueEventsWidget.cpp b/gui/src/Catalogue/CatalogueEventsWidget.cpp index 806abd1..d55ec11 100644 --- a/gui/src/Catalogue/CatalogueEventsWidget.cpp +++ b/gui/src/Catalogue/CatalogueEventsWidget.cpp @@ -27,6 +27,7 @@ struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate { QStringList m_ZonesForTimeMode; QString m_ZoneForGraphMode; QVector > m_DisplayedCatalogues; + bool m_AllEventDisplayed = false; VisualizationWidget *m_VisualizationWidget = nullptr; @@ -389,7 +390,7 @@ QVector > CatalogueEventsWidget::displayedCatalogue bool CatalogueEventsWidget::isAllEventsDisplayed() const { - return impl->m_DisplayedCatalogues.isEmpty() && !impl->m_Model->events().isEmpty(); + return impl->m_AllEventDisplayed; } bool CatalogueEventsWidget::isEventDisplayed(const std::shared_ptr &event) const @@ -401,6 +402,7 @@ void CatalogueEventsWidget::populateWithCatalogues( const QVector > &catalogues) { impl->m_DisplayedCatalogues = catalogues; + impl->m_AllEventDisplayed = false; QSet eventIds; QVector > events; @@ -421,6 +423,7 @@ void CatalogueEventsWidget::populateWithCatalogues( void CatalogueEventsWidget::populateWithAllEvents() { impl->m_DisplayedCatalogues.clear(); + impl->m_AllEventDisplayed = true; auto allEvents = sqpApp->catalogueController().retrieveAllEvents(); @@ -435,15 +438,16 @@ void CatalogueEventsWidget::populateWithAllEvents() void CatalogueEventsWidget::clear() { impl->m_DisplayedCatalogues.clear(); + impl->m_AllEventDisplayed = false; impl->setEvents({}, this); } void CatalogueEventsWidget::refresh() { - if (impl->m_DisplayedCatalogues.isEmpty()) { + if (isAllEventsDisplayed()) { populateWithAllEvents(); } - else { + else if (!impl->m_DisplayedCatalogues.isEmpty()) { populateWithCatalogues(impl->m_DisplayedCatalogues); } }