##// END OF EJS Templates
Edition of catalogues from the inspector
Edition of catalogues from the inspector

File last commit:

r1180:938a31670f5f
r1180:938a31670f5f
Show More
CatalogueInspectorWidget.cpp
89 lines | 2.8 KiB | text/x-c | CppLexer
/ gui / src / Catalogue / CatalogueInspectorWidget.cpp
Sub widget classes
r1130 #include "Catalogue/CatalogueInspectorWidget.h"
#include "ui_CatalogueInspectorWidget.h"
Display catalogues and events with CatalogueAPI
r1162 #include <Common/DateUtils.h>
#include <DBCatalogue.h>
#include <DBEvent.h>
#include <DBTag.h>
Edition of catalogues from the inspector
r1180 struct CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate {
std::shared_ptr<DBCatalogue> m_DisplayedCatalogue = nullptr;
std::shared_ptr<DBEvent> m_DisplayedEvent = nullptr;
};
Sub widget classes
r1130 CatalogueInspectorWidget::CatalogueInspectorWidget(QWidget *parent)
Edition of catalogues from the inspector
r1180 : QWidget(parent),
ui(new Ui::CatalogueInspectorWidget),
impl{spimpl::make_unique_impl<CatalogueInspectorWidgetPrivate>()}
Sub widget classes
r1130 {
ui->setupUi(this);
Inspector
r1134 showPage(Page::Empty);
Edition of catalogues from the inspector
r1180
connect(ui->leCatalogueName, &QLineEdit::editingFinished, [this]() {
if (ui->leCatalogueName->text() != impl->m_DisplayedCatalogue->getName()) {
impl->m_DisplayedCatalogue->setName(ui->leCatalogueName->text());
emit this->catalogueUpdated(impl->m_DisplayedCatalogue);
}
});
connect(ui->leCatalogueAuthor, &QLineEdit::editingFinished, [this]() {
if (ui->leCatalogueAuthor->text() != impl->m_DisplayedCatalogue->getAuthor()) {
impl->m_DisplayedCatalogue->setAuthor(ui->leCatalogueAuthor->text());
emit this->catalogueUpdated(impl->m_DisplayedCatalogue);
}
});
Sub widget classes
r1130 }
CatalogueInspectorWidget::~CatalogueInspectorWidget()
{
delete ui;
}
Inspector
r1134
void CatalogueInspectorWidget::showPage(CatalogueInspectorWidget::Page page)
{
ui->stackedWidget->setCurrentIndex(static_cast<int>(page));
}
CatalogueInspectorWidget::Page CatalogueInspectorWidget::currentPage() const
{
return static_cast<Page>(ui->stackedWidget->currentIndex());
}
Skeleton to fill the inspector with the selection
r1140
Adaptation to the shared pointers of catalogue controller
r1176 void CatalogueInspectorWidget::setEvent(const std::shared_ptr<DBEvent> &event)
Skeleton to fill the inspector with the selection
r1140 {
Edition of catalogues from the inspector
r1180 impl->m_DisplayedEvent = event;
blockSignals(true);
Skeleton to fill the inspector with the selection
r1140 showPage(Page::EventProperties);
Adaptation to the shared pointers of catalogue controller
r1176 ui->leEventName->setText(event->getName());
ui->leEventMission->setText(event->getMission());
ui->leEventProduct->setText(event->getProduct());
Display catalogues and events with CatalogueAPI
r1162
QString tagList;
Adaptation to the shared pointers of catalogue controller
r1176 auto tags = event->getTags();
Display catalogues and events with CatalogueAPI
r1162 for (auto tag : tags) {
tagList += tag.getName();
tagList += ' ';
}
ui->leEventTags->setText(tagList);
Adaptation to the shared pointers of catalogue controller
r1176 ui->dateTimeEventTStart->setDateTime(DateUtils::dateTime(event->getTStart()));
ui->dateTimeEventTEnd->setDateTime(DateUtils::dateTime(event->getTEnd()));
Edition of catalogues from the inspector
r1180
blockSignals(false);
Skeleton to fill the inspector with the selection
r1140 }
Adaptation to the shared pointers of catalogue controller
r1176 void CatalogueInspectorWidget::setCatalogue(const std::shared_ptr<DBCatalogue> &catalogue)
Skeleton to fill the inspector with the selection
r1140 {
Edition of catalogues from the inspector
r1180 impl->m_DisplayedCatalogue = catalogue;
blockSignals(true);
Skeleton to fill the inspector with the selection
r1140 showPage(Page::CatalogueProperties);
Adaptation to the shared pointers of catalogue controller
r1176 ui->leCatalogueName->setText(catalogue->getName());
ui->leCatalogueAuthor->setText(catalogue->getAuthor());
Edition of catalogues from the inspector
r1180
blockSignals(false);
Skeleton to fill the inspector with the selection
r1140 }