@@ -11,10 +11,16 class CatalogueEventsWidget; | |||
|
11 | 11 | class CatalogueEventsWidget : public QWidget { |
|
12 | 12 | Q_OBJECT |
|
13 | 13 | |
|
14 | signals: | |
|
15 | void eventSelected(); | |
|
16 | ||
|
14 | 17 | public: |
|
15 | 18 | explicit CatalogueEventsWidget(QWidget *parent = 0); |
|
16 | 19 | virtual ~CatalogueEventsWidget(); |
|
17 | 20 | |
|
21 | public slots: | |
|
22 | void populateWithCatalogue(const QString &catalogue); | |
|
23 | ||
|
18 | 24 | private: |
|
19 | 25 | Ui::CatalogueEventsWidget *ui; |
|
20 | 26 |
@@ -2,6 +2,7 | |||
|
2 | 2 | #define SCIQLOP_CATALOGUESIDEBARWIDGET_H |
|
3 | 3 | |
|
4 | 4 | #include <Common/spimpl.h> |
|
5 | #include <QTreeWidgetItem> | |
|
5 | 6 | #include <QWidget> |
|
6 | 7 | |
|
7 | 8 | namespace Ui { |
@@ -11,6 +12,11 class CatalogueSideBarWidget; | |||
|
11 | 12 | class CatalogueSideBarWidget : public QWidget { |
|
12 | 13 | Q_OBJECT |
|
13 | 14 | |
|
15 | signals: | |
|
16 | void catalogueSelected(const QString &catalogue); | |
|
17 | void allEventsSelected(); | |
|
18 | void trashSelected(); | |
|
19 | ||
|
14 | 20 | public: |
|
15 | 21 | explicit CatalogueSideBarWidget(QWidget *parent = 0); |
|
16 | 22 | virtual ~CatalogueSideBarWidget(); |
@@ -28,30 +28,42 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent) | |||
|
28 | 28 | } |
|
29 | 29 | }); |
|
30 | 30 | |
|
31 | connect(ui->tableWidget, &QTableWidget::cellClicked, | |
|
32 | [this](auto row, auto column) { emit this->eventSelected(); }); | |
|
33 | ||
|
31 | 34 | Q_ASSERT(impl->columnNames().count() == (int)CatalogueEventsWidgetPrivate::Column::NbColumn); |
|
32 | 35 | ui->tableWidget->setColumnCount((int)CatalogueEventsWidgetPrivate::Column::NbColumn); |
|
33 | 36 | ui->tableWidget->setHorizontalHeaderLabels(impl->columnNames()); |
|
34 | 37 | ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); |
|
35 | 38 | ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); |
|
36 | 39 | ui->tableWidget->horizontalHeader()->setSortIndicatorShown(true); |
|
40 | } | |
|
37 | 41 | |
|
42 | CatalogueEventsWidget::~CatalogueEventsWidget() | |
|
43 | { | |
|
44 | delete ui; | |
|
45 | } | |
|
38 | 46 | |
|
39 | // test | |
|
40 | impl->addEventItem({"Event 1", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"}, | |
|
47 | void CatalogueEventsWidget::populateWithCatalogue(const QString &catalogue) | |
|
48 | { | |
|
49 | ui->tableWidget->clearContents(); | |
|
50 | ui->tableWidget->setRowCount(0); | |
|
51 | ||
|
52 | // TODO | |
|
53 | impl->addEventItem( | |
|
54 | {catalogue + " - Event 1", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"}, | |
|
41 | 55 |
|
|
42 | impl->addEventItem({"Event 2", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"}, | |
|
56 | impl->addEventItem( | |
|
57 | {catalogue + " - Event 2", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"}, | |
|
43 | 58 |
|
|
44 | impl->addEventItem({"Event 3", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"}, | |
|
59 | impl->addEventItem( | |
|
60 | {catalogue + " - Event 3", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"}, | |
|
45 | 61 |
|
|
46 | impl->addEventItem({"Event 4", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"}, | |
|
62 | impl->addEventItem( | |
|
63 | {catalogue + " - Event 4", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"}, | |
|
47 | 64 |
|
|
48 | 65 | } |
|
49 | 66 | |
|
50 | CatalogueEventsWidget::~CatalogueEventsWidget() | |
|
51 | { | |
|
52 | delete ui; | |
|
53 | } | |
|
54 | ||
|
55 | 67 | void CatalogueEventsWidget::CatalogueEventsWidgetPrivate::addEventItem(const QStringList &data, |
|
56 | 68 | QTableWidget *tableWidget) |
|
57 | 69 | { |
@@ -6,6 +6,14 CatalogueExplorer::CatalogueExplorer(QWidget *parent) | |||
|
6 | 6 | ui(new Ui::CatalogueExplorer) |
|
7 | 7 | { |
|
8 | 8 | ui->setupUi(this); |
|
9 | ||
|
10 | connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSelected, [this](auto name) { | |
|
11 | ui->inspector->showPage(CatalogueInspectorWidget::Page::CatalogueProperties); | |
|
12 | ui->events->populateWithCatalogue(name); | |
|
13 | }); | |
|
14 | ||
|
15 | connect(ui->events, &CatalogueEventsWidget::eventSelected, | |
|
16 | [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::EventProperties); }); | |
|
9 | 17 | } |
|
10 | 18 | |
|
11 | 19 | CatalogueExplorer::~CatalogueExplorer() |
@@ -1,10 +1,10 | |||
|
1 | 1 | #include "Catalogue/CatalogueSideBarWidget.h" |
|
2 | 2 | #include "ui_CatalogueSideBarWidget.h" |
|
3 | 3 | |
|
4 | auto ALL_EVENT_ITEM_TYPE = QTreeWidgetItem::UserType; | |
|
5 | auto TRASH_ITEM_TYPE = QTreeWidgetItem::UserType + 1; | |
|
6 | auto CATALOGUE_ITEM_TYPE = QTreeWidgetItem::UserType + 2; | |
|
7 | auto DATABASE_ITEM_TYPE = QTreeWidgetItem::UserType + 3; | |
|
4 | constexpr auto ALL_EVENT_ITEM_TYPE = QTreeWidgetItem::UserType; | |
|
5 | constexpr auto TRASH_ITEM_TYPE = QTreeWidgetItem::UserType + 1; | |
|
6 | constexpr auto CATALOGUE_ITEM_TYPE = QTreeWidgetItem::UserType + 2; | |
|
7 | constexpr auto DATABASE_ITEM_TYPE = QTreeWidgetItem::UserType + 3; | |
|
8 | 8 | |
|
9 | 9 | |
|
10 | 10 | struct CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate { |
@@ -20,6 +20,23 CatalogueSideBarWidget::CatalogueSideBarWidget(QWidget *parent) | |||
|
20 | 20 | { |
|
21 | 21 | ui->setupUi(this); |
|
22 | 22 | impl->configureTreeWidget(ui->treeWidget); |
|
23 | ||
|
24 | connect(ui->treeWidget, &QTreeWidget::itemClicked, [this](auto item) { | |
|
25 | switch (item->type()) { | |
|
26 | case CATALOGUE_ITEM_TYPE: | |
|
27 | emit this->catalogueSelected(item->text(0)); | |
|
28 | break; | |
|
29 | case ALL_EVENT_ITEM_TYPE: | |
|
30 | emit this->allEventsSelected(); | |
|
31 | break; | |
|
32 | case TRASH_ITEM_TYPE: | |
|
33 | emit this->trashSelected(); | |
|
34 | break; | |
|
35 | case DATABASE_ITEM_TYPE: | |
|
36 | default: | |
|
37 | break; | |
|
38 | } | |
|
39 | }); | |
|
23 | 40 | } |
|
24 | 41 | |
|
25 | 42 | CatalogueSideBarWidget::~CatalogueSideBarWidget() |
General Comments 0
You need to be logged in to leave comments.
Login now