##// END OF EJS Templates
Separate the initialization of the properties of the graph of the update of the units of the graph....
Separate the initialization of the properties of the graph of the update of the units of the graph. The initialization of the properties is carried out when adding a variable in the graph, the update of the units is carried out when loading the data of this variable

File last commit:

r1289:f48f3e7d295f
r1337:3acf26407503
Show More
CatalogueExplorer.cpp
126 lines | 4.4 KiB | text/x-c | CppLexer
/ gui / src / Catalogue / CatalogueExplorer.cpp
#include "Catalogue/CatalogueExplorer.h"
#include "ui_CatalogueExplorer.h"
#include <Catalogue/CatalogueActionManager.h>
#include <Catalogue/CatalogueController.h>
#include <SqpApplication.h>
#include <Visualization/VisualizationWidget.h>
#include <DBCatalogue.h>
#include <DBEvent.h>
struct CatalogueExplorer::CatalogueExplorerPrivate {
CatalogueActionManager m_ActionManager;
CatalogueExplorerPrivate(CatalogueExplorer *catalogueExplorer)
: m_ActionManager(catalogueExplorer)
{
}
};
CatalogueExplorer::CatalogueExplorer(QWidget *parent)
: QDialog(parent, Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
ui(new Ui::CatalogueExplorer),
impl{spimpl::make_unique_impl<CatalogueExplorerPrivate>(this)}
{
ui->setupUi(this);
impl->m_ActionManager.installSelectionZoneActions();
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);
});
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);
ui->events->clear();
});
connect(ui->catalogues, &CatalogueSideBarWidget::allEventsSelected, [this]() {
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
ui->events->populateWithAllEvents();
});
connect(ui->catalogues, &CatalogueSideBarWidget::databaseSelected, [this](auto databaseList) {
QVector<std::shared_ptr<DBCatalogue> > catalogueList;
for (auto database : databaseList) {
catalogueList.append(ui->catalogues->getCatalogues(database));
}
ui->events->populateWithCatalogues(catalogueList);
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
});
connect(ui->catalogues, &CatalogueSideBarWidget::selectionCleared, [this]() {
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
ui->events->clear();
});
connect(ui->events, &CatalogueEventsWidget::eventsSelected, [this](auto events) {
if (events.count() == 1) {
ui->inspector->setEvent(events.first());
}
else {
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
}
});
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); });
connect(ui->inspector, &CatalogueInspectorWidget::catalogueUpdated, [this](auto catalogue) {
sqpApp->catalogueController().updateCatalogue(catalogue);
ui->catalogues->setCatalogueChanges(catalogue, true);
});
connect(ui->inspector, &CatalogueInspectorWidget::eventUpdated, [this](auto event) {
sqpApp->catalogueController().updateEvent(event);
ui->events->setEventChanges(event, true);
});
connect(ui->inspector, &CatalogueInspectorWidget::eventProductUpdated,
[this](auto event, auto eventProduct) {
sqpApp->catalogueController().updateEventProduct(eventProduct);
ui->events->setEventChanges(event, true);
});
}
CatalogueExplorer::~CatalogueExplorer()
{
delete ui;
}
void CatalogueExplorer::setVisualizationWidget(VisualizationWidget *visualization)
{
ui->events->setVisualizationWidget(visualization);
}
CatalogueEventsWidget &CatalogueExplorer::eventsWidget() const
{
return *ui->events;
}
CatalogueSideBarWidget &CatalogueExplorer::sideBarWidget() const
{
return *ui->catalogues;
}