##// END OF EJS Templates
Basic interactions
trabillard -
r1103:dbebdcd0984a
parent child
Show More
@@ -11,10 +11,16 class CatalogueEventsWidget;
11 class CatalogueEventsWidget : public QWidget {
11 class CatalogueEventsWidget : public QWidget {
12 Q_OBJECT
12 Q_OBJECT
13
13
14 signals:
15 void eventSelected();
16
14 public:
17 public:
15 explicit CatalogueEventsWidget(QWidget *parent = 0);
18 explicit CatalogueEventsWidget(QWidget *parent = 0);
16 virtual ~CatalogueEventsWidget();
19 virtual ~CatalogueEventsWidget();
17
20
21 public slots:
22 void populateWithCatalogue(const QString &catalogue);
23
18 private:
24 private:
19 Ui::CatalogueEventsWidget *ui;
25 Ui::CatalogueEventsWidget *ui;
20
26
@@ -2,6 +2,7
2 #define SCIQLOP_CATALOGUESIDEBARWIDGET_H
2 #define SCIQLOP_CATALOGUESIDEBARWIDGET_H
3
3
4 #include <Common/spimpl.h>
4 #include <Common/spimpl.h>
5 #include <QTreeWidgetItem>
5 #include <QWidget>
6 #include <QWidget>
6
7
7 namespace Ui {
8 namespace Ui {
@@ -11,6 +12,11 class CatalogueSideBarWidget;
11 class CatalogueSideBarWidget : public QWidget {
12 class CatalogueSideBarWidget : public QWidget {
12 Q_OBJECT
13 Q_OBJECT
13
14
15 signals:
16 void catalogueSelected(const QString &catalogue);
17 void allEventsSelected();
18 void trashSelected();
19
14 public:
20 public:
15 explicit CatalogueSideBarWidget(QWidget *parent = 0);
21 explicit CatalogueSideBarWidget(QWidget *parent = 0);
16 virtual ~CatalogueSideBarWidget();
22 virtual ~CatalogueSideBarWidget();
@@ -28,23 +28,15 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 Q_ASSERT(impl->columnNames().count() == (int)CatalogueEventsWidgetPrivate::Column::NbColumn);
34 Q_ASSERT(impl->columnNames().count() == (int)CatalogueEventsWidgetPrivate::Column::NbColumn);
32 ui->tableWidget->setColumnCount((int)CatalogueEventsWidgetPrivate::Column::NbColumn);
35 ui->tableWidget->setColumnCount((int)CatalogueEventsWidgetPrivate::Column::NbColumn);
33 ui->tableWidget->setHorizontalHeaderLabels(impl->columnNames());
36 ui->tableWidget->setHorizontalHeaderLabels(impl->columnNames());
34 ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
37 ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
35 ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
38 ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
36 ui->tableWidget->horizontalHeader()->setSortIndicatorShown(true);
39 ui->tableWidget->horizontalHeader()->setSortIndicatorShown(true);
37
38
39 // test
40 impl->addEventItem({"Event 1", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"},
41 ui->tableWidget);
42 impl->addEventItem({"Event 2", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"},
43 ui->tableWidget);
44 impl->addEventItem({"Event 3", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"},
45 ui->tableWidget);
46 impl->addEventItem({"Event 4", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"},
47 ui->tableWidget);
48 }
40 }
49
41
50 CatalogueEventsWidget::~CatalogueEventsWidget()
42 CatalogueEventsWidget::~CatalogueEventsWidget()
@@ -52,6 +44,26 CatalogueEventsWidget::~CatalogueEventsWidget()
52 delete ui;
44 delete ui;
53 }
45 }
54
46
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"},
55 ui->tableWidget);
56 impl->addEventItem(
57 {catalogue + " - Event 2", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"},
58 ui->tableWidget);
59 impl->addEventItem(
60 {catalogue + " - Event 3", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"},
61 ui->tableWidget);
62 impl->addEventItem(
63 {catalogue + " - Event 4", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"},
64 ui->tableWidget);
65 }
66
55 void CatalogueEventsWidget::CatalogueEventsWidgetPrivate::addEventItem(const QStringList &data,
67 void CatalogueEventsWidget::CatalogueEventsWidgetPrivate::addEventItem(const QStringList &data,
56 QTableWidget *tableWidget)
68 QTableWidget *tableWidget)
57 {
69 {
@@ -6,6 +6,14 CatalogueExplorer::CatalogueExplorer(QWidget *parent)
6 ui(new Ui::CatalogueExplorer)
6 ui(new Ui::CatalogueExplorer)
7 {
7 {
8 ui->setupUi(this);
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 CatalogueExplorer::~CatalogueExplorer()
19 CatalogueExplorer::~CatalogueExplorer()
@@ -1,10 +1,10
1 #include "Catalogue/CatalogueSideBarWidget.h"
1 #include "Catalogue/CatalogueSideBarWidget.h"
2 #include "ui_CatalogueSideBarWidget.h"
2 #include "ui_CatalogueSideBarWidget.h"
3
3
4 auto ALL_EVENT_ITEM_TYPE = QTreeWidgetItem::UserType;
4 constexpr auto ALL_EVENT_ITEM_TYPE = QTreeWidgetItem::UserType;
5 auto TRASH_ITEM_TYPE = QTreeWidgetItem::UserType + 1;
5 constexpr auto TRASH_ITEM_TYPE = QTreeWidgetItem::UserType + 1;
6 auto CATALOGUE_ITEM_TYPE = QTreeWidgetItem::UserType + 2;
6 constexpr auto CATALOGUE_ITEM_TYPE = QTreeWidgetItem::UserType + 2;
7 auto DATABASE_ITEM_TYPE = QTreeWidgetItem::UserType + 3;
7 constexpr auto DATABASE_ITEM_TYPE = QTreeWidgetItem::UserType + 3;
8
8
9
9
10 struct CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate {
10 struct CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate {
@@ -20,6 +20,23 CatalogueSideBarWidget::CatalogueSideBarWidget(QWidget *parent)
20 {
20 {
21 ui->setupUi(this);
21 ui->setupUi(this);
22 impl->configureTreeWidget(ui->treeWidget);
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 CatalogueSideBarWidget::~CatalogueSideBarWidget()
42 CatalogueSideBarWidget::~CatalogueSideBarWidget()
General Comments 0
You need to be logged in to leave comments. Login now