CatalogueInspectorWidget.cpp
56 lines
| 1.6 KiB
| text/x-c
|
CppLexer
r1130 | #include "Catalogue/CatalogueInspectorWidget.h" | |||
#include "ui_CatalogueInspectorWidget.h" | ||||
r1162 | #include <Common/DateUtils.h> | |||
#include <DBCatalogue.h> | ||||
#include <DBEvent.h> | ||||
#include <DBTag.h> | ||||
r1130 | CatalogueInspectorWidget::CatalogueInspectorWidget(QWidget *parent) | |||
: QWidget(parent), ui(new Ui::CatalogueInspectorWidget) | ||||
{ | ||||
ui->setupUi(this); | ||||
r1134 | showPage(Page::Empty); | |||
r1130 | } | |||
CatalogueInspectorWidget::~CatalogueInspectorWidget() | ||||
{ | ||||
delete ui; | ||||
} | ||||
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()); | ||||
} | ||||
r1140 | ||||
r1162 | void CatalogueInspectorWidget::setEvent(const DBEvent &event) | |||
r1140 | { | |||
showPage(Page::EventProperties); | ||||
r1162 | ui->leEventName->setText(event.getName()); | |||
ui->leEventMission->setText(event.getMission()); | ||||
ui->leEventProduct->setText(event.getProduct()); | ||||
QString tagList; | ||||
auto tags = const_cast<DBEvent *>(&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())); | ||||
r1140 | } | |||
r1162 | void CatalogueInspectorWidget::setCatalogue(const DBCatalogue &catalogue) | |||
r1140 | { | |||
showPage(Page::CatalogueProperties); | ||||
r1162 | ui->leCatalogueName->setText(catalogue.getName()); | |||
ui->leCatalogueAuthor->setText(catalogue.getAuthor()); | ||||
r1140 | } | |||