##// END OF EJS Templates
Remove Event from catalogue statique only remove the reference.
perrinel -
r1313:db186fab48c0
parent child
Show More
@@ -30,6 +30,8 signals:
30 void selectionZoneAdded(const std::shared_ptr<DBEvent> &event, const QString &productId,
30 void selectionZoneAdded(const std::shared_ptr<DBEvent> &event, const QString &productId,
31 VisualizationSelectionZoneItem *selectionZone);
31 VisualizationSelectionZoneItem *selectionZone);
32
32
33 void eventCataloguesModified(const QVector<std::shared_ptr<DBCatalogue> > &catalogues);
34
33 public:
35 public:
34 explicit CatalogueEventsWidget(QWidget *parent = 0);
36 explicit CatalogueEventsWidget(QWidget *parent = 0);
35 virtual ~CatalogueEventsWidget();
37 virtual ~CatalogueEventsWidget();
@@ -396,12 +396,19 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
396 if (canRemoveEvent) {
396 if (canRemoveEvent) {
397 for (auto event : events) {
397 for (auto event : events) {
398 if (this->isAllEventsDisplayed()) {
398 if (this->isAllEventsDisplayed()) {
399 sqpApp->catalogueController().removeEvent(event);
399 impl->removeEvent(event, ui->treeView);
400 impl->removeEvent(event, ui->treeView);
400 }
401 }
401 else {
402 else {
403 QVector<std::shared_ptr<DBCatalogue> > modifiedCatalogues;
402 for (auto catalogue : this->displayedCatalogues()) {
404 for (auto catalogue : this->displayedCatalogues()) {
403 catalogue->removeEvent(event->getUniqId());
405 if (catalogue->removeEvent(event->getUniqId())) {
404 sqpApp->catalogueController().updateCatalogue(catalogue);
406 sqpApp->catalogueController().updateCatalogue(catalogue);
407 modifiedCatalogues << catalogue;
408 }
409 }
410 if (!modifiedCatalogues.empty()) {
411 emit eventCataloguesModified(modifiedCatalogues);
405 }
412 }
406 }
413 }
407 impl->m_Model->removeEvent(event);
414 impl->m_Model->removeEvent(event);
@@ -135,6 +135,13 CatalogueExplorer::CatalogueExplorer(QWidget *parent)
135 sqpApp->catalogueController().updateEventProduct(eventProduct);
135 sqpApp->catalogueController().updateEventProduct(eventProduct);
136 ui->events->setEventChanges(event, true);
136 ui->events->setEventChanges(event, true);
137 });
137 });
138
139 connect(ui->events, &CatalogueEventsWidget::eventCataloguesModified,
140 [this](const QVector<std::shared_ptr<DBCatalogue> > &catalogues) {
141 for (auto catalogue : catalogues) {
142 ui->catalogues->setCatalogueChanges(catalogue, true);
143 }
144 });
138 }
145 }
139
146
140 CatalogueExplorer::~CatalogueExplorer()
147 CatalogueExplorer::~CatalogueExplorer()
@@ -111,16 +111,13 bool CatalogueTreeItem::dropMimeData(const QMimeData *data, Qt::DropAction actio
111 if (action == Qt::MoveAction) {
111 if (action == Qt::MoveAction) {
112 for (auto catalogue : sourceCatalogues) {
112 for (auto catalogue : sourceCatalogues) {
113 catalogue->removeEvent(event->getUniqId());
113 catalogue->removeEvent(event->getUniqId());
114 sqpApp->catalogueController().updateCatalogue(catalogue);
114 }
115 }
115 }
116 }
116
117
117 impl->m_Catalogue->addEvent(event->getUniqId());
118 impl->m_Catalogue->addEvent(event->getUniqId());
119 sqpApp->catalogueController().updateCatalogue(impl->m_Catalogue);
118 }
120 }
119
120 for (auto catalogue : sourceCatalogues) {
121 sqpApp->catalogueController().updateCatalogue(catalogue);
122 }
123 sqpApp->catalogueController().updateCatalogue(impl->m_Catalogue);
124 }
121 }
125
122
126 std::shared_ptr<DBCatalogue> CatalogueTreeItem::catalogue() const
123 std::shared_ptr<DBCatalogue> CatalogueTreeItem::catalogue() const
General Comments 0
You need to be logged in to leave comments. Login now