##// END OF EJS Templates
Merge branch 'feature/CatalogueGui' into develop
Merge branch 'feature/CatalogueGui' into develop

File last commit:

r1143:20294bb49a24
r1145:d65e500c483d merge
Show More
CatalogueInspectorWidget.cpp
56 lines | 1.6 KiB | text/x-c | CppLexer
/ gui / src / Catalogue / CatalogueInspectorWidget.cpp
#include "Catalogue/CatalogueInspectorWidget.h"
#include "ui_CatalogueInspectorWidget.h"
#include <Common/DateUtils.h>
#include <DBCatalogue.h>
#include <DBEvent.h>
#include <DBTag.h>
CatalogueInspectorWidget::CatalogueInspectorWidget(QWidget *parent)
: QWidget(parent), ui(new Ui::CatalogueInspectorWidget)
{
ui->setupUi(this);
showPage(Page::Empty);
}
CatalogueInspectorWidget::~CatalogueInspectorWidget()
{
delete ui;
}
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());
}
void CatalogueInspectorWidget::setEvent(const std::shared_ptr<DBEvent> &event)
{
showPage(Page::EventProperties);
ui->leEventName->setText(event->getName());
ui->leEventMission->setText(event->getMission());
ui->leEventProduct->setText(event->getProduct());
QString tagList;
auto tags = event->getTags();
for (auto tag : tags) {
tagList += tag.getName();
tagList += ' ';
}
ui->leEventTags->setText(tagList);
ui->dateTimeEventTStart->setDateTime(DateUtils::dateTime(event->getTStart()));
ui->dateTimeEventTEnd->setDateTime(DateUtils::dateTime(event->getTEnd()));
}
void CatalogueInspectorWidget::setCatalogue(const std::shared_ptr<DBCatalogue> &catalogue)
{
showPage(Page::CatalogueProperties);
ui->leCatalogueName->setText(catalogue->getName());
ui->leCatalogueAuthor->setText(catalogue->getAuthor());
}