##// END OF EJS Templates
Fix creation of first event
trabillard -
r1257:d6548be72d76
parent child
Show More
@@ -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
@@ -383,7 +384,7 QVector<std::shared_ptr<DBCatalogue> > CatalogueEventsWidget::displayedCatalogue
383
384
384 bool CatalogueEventsWidget::isAllEventsDisplayed() const
385 bool CatalogueEventsWidget::isAllEventsDisplayed() const
385 {
386 {
386 return impl->m_DisplayedCatalogues.isEmpty() && !impl->m_Model->events().isEmpty();
387 return impl->m_AllEventDisplayed;
387 }
388 }
388
389
389 bool CatalogueEventsWidget::isEventDisplayed(const std::shared_ptr<DBEvent> &event) const
390 bool CatalogueEventsWidget::isEventDisplayed(const std::shared_ptr<DBEvent> &event) const
@@ -395,6 +396,7 void CatalogueEventsWidget::populateWithCatalogues(
395 const QVector<std::shared_ptr<DBCatalogue> > &catalogues)
396 const QVector<std::shared_ptr<DBCatalogue> > &catalogues)
396 {
397 {
397 impl->m_DisplayedCatalogues = catalogues;
398 impl->m_DisplayedCatalogues = catalogues;
399 impl->m_AllEventDisplayed = false;
398
400
399 QSet<QUuid> eventIds;
401 QSet<QUuid> eventIds;
400 QVector<std::shared_ptr<DBEvent> > events;
402 QVector<std::shared_ptr<DBEvent> > events;
@@ -415,6 +417,7 void CatalogueEventsWidget::populateWithCatalogues(
415 void CatalogueEventsWidget::populateWithAllEvents()
417 void CatalogueEventsWidget::populateWithAllEvents()
416 {
418 {
417 impl->m_DisplayedCatalogues.clear();
419 impl->m_DisplayedCatalogues.clear();
420 impl->m_AllEventDisplayed = true;
418
421
419 auto allEvents = sqpApp->catalogueController().retrieveAllEvents();
422 auto allEvents = sqpApp->catalogueController().retrieveAllEvents();
420
423
@@ -429,15 +432,16 void CatalogueEventsWidget::populateWithAllEvents()
429 void CatalogueEventsWidget::clear()
432 void CatalogueEventsWidget::clear()
430 {
433 {
431 impl->m_DisplayedCatalogues.clear();
434 impl->m_DisplayedCatalogues.clear();
435 impl->m_AllEventDisplayed = false;
432 impl->setEvents({}, this);
436 impl->setEvents({}, this);
433 }
437 }
434
438
435 void CatalogueEventsWidget::refresh()
439 void CatalogueEventsWidget::refresh()
436 {
440 {
437 if (impl->m_DisplayedCatalogues.isEmpty()) {
441 if (isAllEventsDisplayed()) {
438 populateWithAllEvents();
442 populateWithAllEvents();
439 }
443 }
440 else {
444 else if (!impl->m_DisplayedCatalogues.isEmpty()) {
441 populateWithCatalogues(impl->m_DisplayedCatalogues);
445 populateWithCatalogues(impl->m_DisplayedCatalogues);
442 }
446 }
443 }
447 }
General Comments 0
You need to be logged in to leave comments. Login now