##// END OF EJS Templates
Adds read compatibility for local AMDA server...
Adds read compatibility for local AMDA server The local AMDA server uses another regex than the default server to read the units in x. We manage the compatibility by adding in the parser the possibility of testing several regexes to read a property

File last commit:

r1106:00ce9b74612e
r1121:98220c931c83
Show More
CatalogueEventsWidget.cpp
100 lines | 3.8 KiB | text/x-c | CppLexer
/ gui / src / Catalogue / CatalogueEventsWidget.cpp
Sub widget classes
r1095 #include "Catalogue/CatalogueEventsWidget.h"
#include "ui_CatalogueEventsWidget.h"
Skeleton to fill the inspector with the selection
r1105 #include <QtDebug>
Events
r1101 struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate {
void addEventItem(const QStringList &data, QTableWidget *tableWidget);
enum class Column { Event, TStart, TEnd, Tags, Product, NbColumn };
QStringList columnNames() { return QStringList{"Event", "TStart", "TEnd", "Tags", "Product"}; }
};
Sub widget classes
r1095 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
Events
r1101 : QWidget(parent),
ui(new Ui::CatalogueEventsWidget),
impl{spimpl::make_unique_impl<CatalogueEventsWidgetPrivate>()}
Sub widget classes
r1095 {
ui->setupUi(this);
Events
r1101
connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) {
if (checked) {
ui->btnChart->setChecked(false);
}
});
connect(ui->btnChart, &QToolButton::clicked, [this](auto checked) {
if (checked) {
ui->btnTime->setChecked(false);
}
});
Skeleton to fill the inspector with the selection
r1105 connect(ui->tableWidget, &QTableWidget::cellClicked, [this](auto row, auto column) {
auto event = ui->tableWidget->item(row, 0)->text();
emit this->eventSelected(event);
});
connect(ui->tableWidget, &QTableWidget::currentItemChanged,
[this](auto current, auto previous) {
if (current && current->row() >= 0) {
auto event = ui->tableWidget->item(current->row(), 0)->text();
emit this->eventSelected(event);
}
});
connect(ui->tableWidget, &QTableWidget::itemSelectionChanged, [this]() {
auto selection = ui->tableWidget->selectedRanges();
Fixes
r1106 auto isNotMultiSelection
= selection.isEmpty() || (selection.count() == 1 && selection.first().rowCount() == 1);
ui->btnChart->setEnabled(isNotMultiSelection);
ui->btnTime->setEnabled(isNotMultiSelection);
Skeleton to fill the inspector with the selection
r1105 });
Basic interactions
r1103
Events
r1101 Q_ASSERT(impl->columnNames().count() == (int)CatalogueEventsWidgetPrivate::Column::NbColumn);
ui->tableWidget->setColumnCount((int)CatalogueEventsWidgetPrivate::Column::NbColumn);
ui->tableWidget->setHorizontalHeaderLabels(impl->columnNames());
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
ui->tableWidget->horizontalHeader()->setSortIndicatorShown(true);
Sub widget classes
r1095 }
CatalogueEventsWidget::~CatalogueEventsWidget()
{
delete ui;
}
Events
r1101
Basic interactions
r1103 void CatalogueEventsWidget::populateWithCatalogue(const QString &catalogue)
{
ui->tableWidget->clearContents();
ui->tableWidget->setRowCount(0);
// TODO
impl->addEventItem(
Events sorting
r1104 {catalogue + " - Event 1", "12/12/2012 12:12", "12/12/2042 12:52", "cloud", "mfi/b_gse42"},
Basic interactions
r1103 ui->tableWidget);
impl->addEventItem(
Events sorting
r1104 {catalogue + " - Event 2", "12/12/2012 12:10", "12/12/2042 12:42", "Acloud", "mfi/b_gse1"},
Basic interactions
r1103 ui->tableWidget);
impl->addEventItem(
Events sorting
r1104 {catalogue + " - Event 3", "12/12/2012 12:22", "12/12/2042 12:12", "Gcloud", "mfi/b_gse2"},
Basic interactions
r1103 ui->tableWidget);
impl->addEventItem(
Events sorting
r1104 {catalogue + " - Event 4", "12/12/2012 12:00", "12/12/2042 12:62", "Bcloud", "mfi/b_gse3"},
Basic interactions
r1103 ui->tableWidget);
}
Events
r1101 void CatalogueEventsWidget::CatalogueEventsWidgetPrivate::addEventItem(const QStringList &data,
QTableWidget *tableWidget)
{
Events sorting
r1104 tableWidget->setSortingEnabled(false);
Events
r1101 auto row = tableWidget->rowCount();
tableWidget->setRowCount(row + 1);
for (auto i = 0; i < (int)Column::NbColumn; ++i) {
auto item = new QTableWidgetItem(data.value(i));
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
tableWidget->setItem(row, i, item);
}
Events sorting
r1104 tableWidget->setSortingEnabled(true);
Events
r1101 }