##// END OF EJS Templates
Adaptation to last version of catalogue controller
trabillard -
r1164:b6390f556418
parent child
Show More
@@ -52,7 +52,8 public:
52 // Catalogue
52 // Catalogue
53 // bool createCatalogue(const QString &name, QVector<QUuid> eventList);
53 // bool createCatalogue(const QString &name, QVector<QUuid> eventList);
54 /// retrieveEvents with empty repository retrieve them from the default repository
54 /// retrieveEvents with empty repository retrieve them from the default repository
55 std::list<std::shared_ptr<DBCatalogue> > retrieveCatalogues(const QString &repository) const;
55 std::list<std::shared_ptr<DBCatalogue> > retrieveCatalogues(const QString &repository
56 = QString()) const;
56 void updateCatalogue(std::shared_ptr<DBCatalogue> catalogue);
57 void updateCatalogue(std::shared_ptr<DBCatalogue> catalogue);
57 void removeCatalogue(std::shared_ptr<DBCatalogue> catalogue);
58 void removeCatalogue(std::shared_ptr<DBCatalogue> catalogue);
58 void saveCatalogue(std::shared_ptr<DBCatalogue> catalogue);
59 void saveCatalogue(std::shared_ptr<DBCatalogue> catalogue);
@@ -148,7 +148,7 void CatalogueController::removeEvent(std::shared_ptr<DBEvent> event)
148
148
149 void CatalogueController::addEvent(std::shared_ptr<DBEvent> event)
149 void CatalogueController::addEvent(std::shared_ptr<DBEvent> event)
150 {
150 {
151 event->setRepository(impl->toSyncRepository(event->getRepository()));
151 event->setRepository(impl->toWorkRepository(event->getRepository()));
152
152
153 impl->m_CatalogueDao.addEvent(*event);
153 impl->m_CatalogueDao.addEvent(*event);
154
154
@@ -255,14 +255,23 void CatalogueController::waitForFinish()
255 void CatalogueController::CatalogueControllerPrivate::copyDBtoDB(const QString &dbFrom,
255 void CatalogueController::CatalogueControllerPrivate::copyDBtoDB(const QString &dbFrom,
256 const QString &dbTo)
256 const QString &dbTo)
257 {
257 {
258 auto catalogues = m_Q->retrieveCatalogues(dbFrom);
258 auto cataloguesShared = std::list<std::shared_ptr<DBCatalogue> >{};
259 auto events = m_Q->retrieveEvents(dbFrom);
259 auto catalogues = m_CatalogueDao.getCatalogues(dbFrom);
260
261 for (auto catalogue : catalogues) {
260 for (auto catalogue : catalogues) {
262 m_CatalogueDao.copyCatalogue(*catalogue, dbTo, true);
261 cataloguesShared.push_back(std::make_shared<DBCatalogue>(catalogue));
263 }
262 }
264
263
264 auto eventsShared = std::list<std::shared_ptr<DBEvent> >{};
265 auto events = m_CatalogueDao.getEvents(dbFrom);
265 for (auto event : events) {
266 for (auto event : events) {
267 eventsShared.push_back(std::make_shared<DBEvent>(event));
268 }
269
270 for (auto catalogue : cataloguesShared) {
271 m_CatalogueDao.copyCatalogue(*catalogue, dbTo, true);
272 }
273
274 for (auto event : eventsShared) {
266 m_CatalogueDao.copyEvent(*event, dbTo, true);
275 m_CatalogueDao.copyEvent(*event, dbTo, true);
267 }
276 }
268 }
277 }
@@ -47,12 +47,12 struct CatalogueActionManager::CatalogueActionManagerPrivate {
47
47
48 event->setEventProducts(productList);
48 event->setEventProducts(productList);
49
49
50 // TODO
50 sqpApp->catalogueController().addEvent(event);
51
51 if (catalogue) {
52 if (catalogue) {
53 // TODO
52 // catalogue->addEvent(event);
54 // catalogue->addEvent(event);
53 }
55 }
54 else {
55 }
56 }
56 }
57 };
57 };
58
58
@@ -2,6 +2,8
2 #include "ui_CatalogueExplorer.h"
2 #include "ui_CatalogueExplorer.h"
3
3
4 #include <Catalogue/CatalogueActionManager.h>
4 #include <Catalogue/CatalogueActionManager.h>
5 #include <Catalogue/CatalogueController.h>
6 #include <SqpApplication.h>
5 #include <Visualization/VisualizationWidget.h>
7 #include <Visualization/VisualizationWidget.h>
6
8
7 #include <DBCatalogue.h>
9 #include <DBCatalogue.h>
@@ -68,11 +70,15 CatalogueExplorer::CatalogueExplorer(QWidget *parent)
68 connect(ui->events, &CatalogueEventsWidget::selectionCleared,
70 connect(ui->events, &CatalogueEventsWidget::selectionCleared,
69 [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); });
71 [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); });
70
72
71 connect(ui->inspector, &CatalogueInspectorWidget::catalogueUpdated,
73 connect(ui->inspector, &CatalogueInspectorWidget::catalogueUpdated, [this](auto catalogue) {
72 [this](auto catalogue) { ui->catalogues->setCatalogueChanges(catalogue, true); });
74 sqpApp->catalogueController().updateCatalogue(catalogue);
75 ui->catalogues->setCatalogueChanges(catalogue, true);
76 });
73
77
74 connect(ui->inspector, &CatalogueInspectorWidget::eventUpdated,
78 connect(ui->inspector, &CatalogueInspectorWidget::eventUpdated, [this](auto event) {
75 [this](auto event) { ui->events->setEventChanges(event, true); });
79 sqpApp->catalogueController().updateEvent(event);
80 ui->events->setEventChanges(event, true);
81 });
76
82
77 connect(ui->inspector, &CatalogueInspectorWidget::eventProductUpdated,
83 connect(ui->inspector, &CatalogueInspectorWidget::eventProductUpdated,
78 [this](auto event, auto eventProduct) { ui->events->setEventChanges(event, true); });
84 [this](auto event, auto eventProduct) { ui->events->setEventChanges(event, true); });
@@ -176,11 +176,14 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::configureTreeWidget(
176 treeWidget->addTopLevelItem(separatorItem);
176 treeWidget->addTopLevelItem(separatorItem);
177 treeWidget->setItemWidget(separatorItem, 0, separator);
177 treeWidget->setItemWidget(separatorItem, 0, separator);
178
178
179 auto db = addDatabaseItem("Default", treeWidget);
179 auto repositories = sqpApp->catalogueController().getRepositories();
180 for (auto dbname : repositories) {
181 auto db = addDatabaseItem(dbname, treeWidget);
180
182
181 auto catalogues = sqpApp->catalogueController().retrieveCatalogues("Default");
183 auto catalogues = sqpApp->catalogueController().retrieveCatalogues(dbname);
182 for (auto catalogue : catalogues) {
184 for (auto catalogue : catalogues) {
183 addCatalogueItem(catalogue, db);
185 addCatalogueItem(catalogue, db);
186 }
184 }
187 }
185
188
186 treeWidget->expandAll();
189 treeWidget->expandAll();
@@ -1,6 +1,9
1 #include "Catalogue/CatalogueTreeWidgetItem.h"
1 #include "Catalogue/CatalogueTreeWidgetItem.h"
2 #include <Catalogue/CatalogueExplorerHelper.h>
2 #include <Catalogue/CatalogueExplorerHelper.h>
3
3
4 #include <Catalogue/CatalogueController.h>
5 #include <SqpApplication.h>
6
4 #include <memory>
7 #include <memory>
5
8
6 #include <DBCatalogue.h>
9 #include <DBCatalogue.h>
@@ -47,6 +50,7 void CatalogueTreeWidgetItem::setData(int column, int role, const QVariant &valu
47 if (newName != impl->m_Catalogue->getName()) {
50 if (newName != impl->m_Catalogue->getName()) {
48 setText(0, newName);
51 setText(0, newName);
49 impl->m_Catalogue->setName(newName);
52 impl->m_Catalogue->setName(newName);
53 sqpApp->catalogueController().updateCatalogue(impl->m_Catalogue);
50 setHasChanges(true);
54 setHasChanges(true);
51 }
55 }
52 }
56 }
@@ -20,7 +20,7 CreateEventDialog::CreateEventDialog(QWidget *parent)
20 connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
20 connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
21 connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
21 connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
22
22
23 auto catalogues = sqpApp->catalogueController().getCatalogues("Default");
23 auto catalogues = sqpApp->catalogueController().retrieveCatalogues();
24 for (auto cat : catalogues) {
24 for (auto cat : catalogues) {
25 ui->cbCatalogue->addItem(cat->getName());
25 ui->cbCatalogue->addItem(cat->getName());
26 impl->m_DisplayedCatalogues << cat;
26 impl->m_DisplayedCatalogues << cat;
General Comments 0
You need to be logged in to leave comments. Login now