browser.cpp
53 lines
| 1.9 KiB
| text/x-c
|
CppLexer
r1408 | #include "Catalogue2/browser.h" | |||
#include "ui_browser.h" | ||||
#include <SqpApplication.h> | ||||
r1460 | CataloguesBrowser::CataloguesBrowser(QWidget* parent) | |||
: QWidget(parent, Qt::Window), ui(new Ui::Browser) | ||||
r1408 | { | |||
ui->setupUi(this); | ||||
connect(ui->repositories, &RepositoriesTreeView::repositorySelected, this, | ||||
r1460 | &CataloguesBrowser::repositorySelected); | |||
r1408 | connect(ui->repositories, &RepositoriesTreeView::catalogueSelected, this, | |||
r1460 | &CataloguesBrowser::catalogueSelected); | |||
connect(ui->events, &EventsTreeView::eventSelected, this, &CataloguesBrowser::eventSelected); | ||||
connect( | ||||
ui->events, &EventsTreeView::productSelected, this, &CataloguesBrowser::productSelected); | ||||
r1408 | } | |||
r1460 | CataloguesBrowser::~CataloguesBrowser() | |||
r1408 | { | |||
delete ui; | ||||
} | ||||
r1460 | void CataloguesBrowser::repositorySelected(const QString& repo) | |||
r1408 | { | |||
this->ui->Infos->setCurrentIndex(0); | ||||
this->ui->events->setEvents(sqpApp->catalogueController().events(repo)); | ||||
// TODO add a statistic API | ||||
this->ui->catalogues_count->setText( | ||||
QString::number(sqpApp->catalogueController().catalogues(repo).size())); | ||||
this->ui->rep_events_count->setText( | ||||
QString::number(sqpApp->catalogueController().events(repo).size())); | ||||
} | ||||
r1460 | void CataloguesBrowser::catalogueSelected(const CatalogueController::Catalogue_ptr& catalogue) | |||
r1408 | { | |||
this->ui->Infos->setCurrentIndex(1); | ||||
this->ui->events->setEvents(sqpApp->catalogueController().events(catalogue)); | ||||
this->ui->cat_events_count->setText( | ||||
QString::number(sqpApp->catalogueController().events(catalogue).size())); | ||||
} | ||||
r1460 | void CataloguesBrowser::eventSelected(const CatalogueController::Event_ptr& event) | |||
r1408 | { | |||
this->ui->Infos->setCurrentIndex(2); | ||||
this->ui->Event->setEvent(event); | ||||
} | ||||
r1460 | void CataloguesBrowser::productSelected( | |||
const CatalogueController::Product_t& product, const CatalogueController::Event_ptr& event) | ||||
r1408 | { | |||
this->ui->Infos->setCurrentIndex(2); | ||||
r1460 | this->ui->Event->setProduct(product, event); | |||
r1408 | } | |||