##// END OF EJS Templates
Fix the problem of calling the zoom at wheel event on the color scale
Fix the problem of calling the zoom at wheel event on the color scale

File last commit:

r1381:07b2554d7734
r1390:ed0f1486704f
Show More
CatalogueExplorer.cpp
207 lines | 8.1 KiB | text/x-c | CppLexer
/ gui / src / Catalogue / CatalogueExplorer.cpp
Adds the new CatalogueExplorer dialog
r1128 #include "Catalogue/CatalogueExplorer.h"
#include "ui_CatalogueExplorer.h"
Zone actions to create a new event
r1195 #include <Catalogue/CatalogueActionManager.h>
Adaptation to last version of catalogue controller
r1196 #include <Catalogue/CatalogueController.h>
#include <SqpApplication.h>
Link between selection zone item and event
r1347 #include <Visualization/VisualizationGraphWidget.h>
#include <Visualization/VisualizationSelectionZoneItem.h>
Retrieves zone names from the visualization
r1169 #include <Visualization/VisualizationWidget.h>
Display catalogues and events with CatalogueAPI
r1162 #include <DBCatalogue.h>
#include <DBEvent.h>
Link between selection zone item and event
r1347 #include <DBEventProduct.h>
#include <unordered_map>
Display catalogues and events with CatalogueAPI
r1162
Retrieves zone names from the visualization
r1169 struct CatalogueExplorer::CatalogueExplorerPrivate {
Zone actions to create a new event
r1195 CatalogueActionManager m_ActionManager;
Link between selection zone item and event
r1347 std::unordered_map<std::shared_ptr<DBEvent>, QVector<VisualizationSelectionZoneItem *> >
m_SelectionZonesPerEvents;
Updates model after an event has been created through the colored zone
r1286
Link with selection zone on event creation
r1348 QMetaObject::Connection m_Conn;
Updates model after an event has been created through the colored zone
r1286 CatalogueExplorerPrivate(CatalogueExplorer *catalogueExplorer)
: m_ActionManager(catalogueExplorer)
{
}
Retrieves zone names from the visualization
r1169 };
Adds the new CatalogueExplorer dialog
r1128 CatalogueExplorer::CatalogueExplorer(QWidget *parent)
Fix window flags of the catalogue gui
r1135 : QDialog(parent, Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
Retrieves zone names from the visualization
r1169 ui(new Ui::CatalogueExplorer),
Updates model after an event has been created through the colored zone
r1286 impl{spimpl::make_unique_impl<CatalogueExplorerPrivate>(this)}
Adds the new CatalogueExplorer dialog
r1128 {
ui->setupUi(this);
Basic interactions
r1138
Zone actions to create a new event
r1195 impl->m_ActionManager.installSelectionZoneActions();
Link between selection zone item and event
r1347 // Updates events and inspector when something is selected in the catalogue widget
Multi selection of catalogues
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);
Basic interactions
r1138 });
Multi selection of catalogues
r1165 connect(ui->catalogues, &CatalogueSideBarWidget::databaseSelected, [this](auto databases) {
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
});
Handle selection of trash and repository items
r1289 connect(ui->catalogues, &CatalogueSideBarWidget::trashSelected, [this]() {
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
ui->events->clear();
});
Multi selection of catalogues
r1165
Displays all events
r1192 connect(ui->catalogues, &CatalogueSideBarWidget::allEventsSelected, [this]() {
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
ui->events->populateWithAllEvents();
});
Multi selection of catalogues
r1165
Handle selection of trash and repository items
r1289 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();
});
Multi selection of catalogues
r1165
Save a statical catalogue now remove events save gui button
r1370 connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSaved, ui->events,
&CatalogueEventsWidget::refresh);
Refresh catalogue menu when the catalogue list changed
r1381 connect(ui->catalogues, &CatalogueSideBarWidget::catalogueListChanged,
[this]() { impl->m_ActionManager.refreshCreateInCatalogueAction(); });
Link between selection zone item and event
r1347 // Updates the inspectot when something is selected in the events
Manage inspector with multiple events selected
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);
}
});
Edition of catalogues from the inspector
r1180
Edition of event products via the inspector
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); });
Link between selection zone item and event
r1347 // Manage Selection Zones associated to events
connect(ui->events, &CatalogueEventsWidget::selectionZoneAdded,
[this](auto event, auto productId, auto zone) {
Link with selection zone on event creation
r1348 this->addSelectionZoneItem(event, productId, zone);
Link between selection zone item and event
r1347 });
connect(ui->events, &CatalogueEventsWidget::eventsRemoved, [this](auto events) {
for (auto event : events) {
auto associatedSelectionZonesIt = impl->m_SelectionZonesPerEvents.find(event);
if (associatedSelectionZonesIt != impl->m_SelectionZonesPerEvents.cend()) {
for (auto selectionZone : associatedSelectionZonesIt->second) {
auto parentGraph = selectionZone->parentGraphWidget();
parentGraph->removeSelectionZone(selectionZone);
}
impl->m_SelectionZonesPerEvents.erase(event);
}
}
});
// Updates changes from the inspector
Adaptation to last version of catalogue controller
r1196 connect(ui->inspector, &CatalogueInspectorWidget::catalogueUpdated, [this](auto catalogue) {
sqpApp->catalogueController().updateCatalogue(catalogue);
ui->catalogues->setCatalogueChanges(catalogue, true);
Refresh catalogue menu when the catalogue list changed
r1381 impl->m_ActionManager.refreshCreateInCatalogueAction();
Adaptation to last version of catalogue controller
r1196 });
Edition of events from the inspector
r1181
Adaptation to last version of catalogue controller
r1196 connect(ui->inspector, &CatalogueInspectorWidget::eventUpdated, [this](auto event) {
sqpApp->catalogueController().updateEvent(event);
ui->events->setEventChanges(event, true);
});
Edition of event products via the inspector
r1183
connect(ui->inspector, &CatalogueInspectorWidget::eventProductUpdated,
Add init of DisplayedEvent. Add save on EventProduct modif
r1281 [this](auto event, auto eventProduct) {
sqpApp->catalogueController().updateEventProduct(eventProduct);
ui->events->setEventChanges(event, true);
});
Remove Event from catalogue statique only remove the reference.
r1367
connect(ui->events, &CatalogueEventsWidget::eventCataloguesModified,
[this](const QVector<std::shared_ptr<DBCatalogue> > &catalogues) {
for (auto catalogue : catalogues) {
ui->catalogues->setCatalogueChanges(catalogue, true);
}
});
Adds the new CatalogueExplorer dialog
r1128 }
CatalogueExplorer::~CatalogueExplorer()
{
Link with selection zone on event creation
r1348 disconnect(impl->m_Conn);
Adds the new CatalogueExplorer dialog
r1128 delete ui;
}
Retrieves zone names from the visualization
r1169
void CatalogueExplorer::setVisualizationWidget(VisualizationWidget *visualization)
{
ui->events->setVisualizationWidget(visualization);
}
Updates model after an event has been created through the colored zone
r1286
CatalogueEventsWidget &CatalogueExplorer::eventsWidget() const
{
return *ui->events;
}
CatalogueSideBarWidget &CatalogueExplorer::sideBarWidget() const
{
return *ui->catalogues;
}
Link with selection zone on event creation
r1348
void CatalogueExplorer::clearSelectionZones()
{
impl->m_SelectionZonesPerEvents.clear();
}
void CatalogueExplorer::addSelectionZoneItem(const std::shared_ptr<DBEvent> &event,
const QString &productId,
VisualizationSelectionZoneItem *selectionZone)
{
impl->m_SelectionZonesPerEvents[event] << selectionZone;
connect(selectionZone, &VisualizationSelectionZoneItem::rangeEdited,
[event, productId, this](auto range) {
auto productList = event->getEventProducts();
for (auto &product : productList) {
if (product.getProductId() == productId) {
product.setTStart(range.m_TStart);
product.setTEnd(range.m_TEnd);
}
}
event->setEventProducts(productList);
sqpApp->catalogueController().updateEvent(event);
ui->events->refreshEvent(event);
ui->events->setEventChanges(event, true);
ui->inspector->refresh();
});
impl->m_Conn = connect(selectionZone, &VisualizationSelectionZoneItem::destroyed,
[event, selectionZone, this]() {
if (!impl->m_SelectionZonesPerEvents.empty()) {
impl->m_SelectionZonesPerEvents[event].removeAll(selectionZone);
}
});
}