CatalogueExplorer.cpp
98 lines
| 3.6 KiB
| text/x-c
|
CppLexer
r1128 | #include "Catalogue/CatalogueExplorer.h" | |||
#include "ui_CatalogueExplorer.h" | ||||
r1195 | #include <Catalogue/CatalogueActionManager.h> | |||
r1196 | #include <Catalogue/CatalogueController.h> | |||
#include <SqpApplication.h> | ||||
r1169 | #include <Visualization/VisualizationWidget.h> | |||
r1162 | #include <DBCatalogue.h> | |||
#include <DBEvent.h> | ||||
r1169 | struct CatalogueExplorer::CatalogueExplorerPrivate { | |||
r1195 | CatalogueActionManager m_ActionManager; | |||
r1169 | }; | |||
r1128 | CatalogueExplorer::CatalogueExplorer(QWidget *parent) | |||
r1135 | : QDialog(parent, Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), | |||
r1169 | ui(new Ui::CatalogueExplorer), | |||
impl{spimpl::make_unique_impl<CatalogueExplorerPrivate>()} | ||||
r1128 | { | |||
ui->setupUi(this); | ||||
r1138 | ||||
r1195 | impl->m_ActionManager.installSelectionZoneActions(); | |||
r1165 | connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSelected, [this](auto catalogues) { | |||
if (catalogues.count() == 1) { | ||||
ui->inspector->setCatalogue(catalogues.first()); | ||||
} | ||||
else { | ||||
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | ||||
} | ||||
ui->events->populateWithCatalogues(catalogues); | ||||
r1138 | }); | |||
r1165 | connect(ui->catalogues, &CatalogueSideBarWidget::databaseSelected, [this](auto databases) { | |||
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | ||||
}); | ||||
connect(ui->catalogues, &CatalogueSideBarWidget::trashSelected, | ||||
[this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); }); | ||||
r1192 | connect(ui->catalogues, &CatalogueSideBarWidget::allEventsSelected, [this]() { | |||
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | ||||
ui->events->populateWithAllEvents(); | ||||
}); | ||||
r1165 | ||||
connect(ui->catalogues, &CatalogueSideBarWidget::selectionCleared, | ||||
[this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); }); | ||||
r1164 | connect(ui->events, &CatalogueEventsWidget::eventsSelected, [this](auto events) { | |||
if (events.count() == 1) { | ||||
ui->inspector->setEvent(events.first()); | ||||
} | ||||
else { | ||||
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | ||||
} | ||||
}); | ||||
r1180 | ||||
r1183 | connect(ui->events, &CatalogueEventsWidget::eventProductsSelected, [this](auto eventProducts) { | |||
if (eventProducts.count() == 1) { | ||||
ui->inspector->setEventProduct(eventProducts.first().first, | ||||
eventProducts.first().second); | ||||
} | ||||
else { | ||||
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | ||||
} | ||||
}); | ||||
connect(ui->events, &CatalogueEventsWidget::selectionCleared, | ||||
[this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); }); | ||||
r1196 | connect(ui->inspector, &CatalogueInspectorWidget::catalogueUpdated, [this](auto catalogue) { | |||
sqpApp->catalogueController().updateCatalogue(catalogue); | ||||
ui->catalogues->setCatalogueChanges(catalogue, true); | ||||
}); | ||||
r1181 | ||||
r1196 | connect(ui->inspector, &CatalogueInspectorWidget::eventUpdated, [this](auto event) { | |||
sqpApp->catalogueController().updateEvent(event); | ||||
ui->events->setEventChanges(event, true); | ||||
}); | ||||
r1183 | ||||
connect(ui->inspector, &CatalogueInspectorWidget::eventProductUpdated, | ||||
r1257 | [this](auto event, auto eventProduct) { | |||
sqpApp->catalogueController().updateEventProduct(eventProduct); | ||||
ui->events->setEventChanges(event, true); | ||||
}); | ||||
r1128 | } | |||
CatalogueExplorer::~CatalogueExplorer() | ||||
{ | ||||
delete ui; | ||||
} | ||||
r1169 | ||||
void CatalogueExplorer::setVisualizationWidget(VisualizationWidget *visualization) | ||||
{ | ||||
ui->events->setVisualizationWidget(visualization); | ||||
} | ||||