2 #include "ui_ulog_parameters_dialog.h" 4 #include <QTableWidget> 12 QTableWidget* table_info =
ui->tableWidgetInfo;
13 QTableWidget* table_params =
ui->tableWidgetParams;
14 QTableWidget* table_logs =
ui->tableWidgetLogs;
16 table_info->setRowCount(parser.
getInfo().size());
18 for (
const auto& it : parser.
getInfo())
20 table_info->setItem(row, 0,
new QTableWidgetItem(QString::fromStdString(it.first)));
21 table_info->setItem(row, 1,
new QTableWidgetItem(QString::fromStdString(it.second)));
24 table_info->sortItems(0);
30 table_params->setItem(row, 0,
new QTableWidgetItem(QString::fromStdString(param.name)));
33 table_params->setItem(row, 1,
new QTableWidgetItem(QString::number(param.value.val_real)));
37 table_params->setItem(row, 1,
new QTableWidgetItem(QString::number(param.value.val_int)));
41 table_params->sortItems(0);
43 table_logs->setRowCount(parser.
getLogs().size());
45 for (
const auto& log_msg : parser.
getLogs())
47 QString
time = QString::number(0.001 *
double(log_msg.timestamp / 1000),
'f', 2);
48 table_logs->setItem(row, 0,
new QTableWidgetItem(time));
50 switch (log_msg.level)
53 table_logs->setItem(row, 1,
new QTableWidgetItem(
"EMERGENCY"));
56 table_logs->setItem(row, 1,
new QTableWidgetItem(
"ALERT"));
59 table_logs->setItem(row, 1,
new QTableWidgetItem(
"CRITICAL"));
62 table_logs->setItem(row, 1,
new QTableWidgetItem(
"ERROR"));
65 table_logs->setItem(row, 1,
new QTableWidgetItem(
"WARNING"));
68 table_logs->setItem(row, 1,
new QTableWidgetItem(
"NOTICE"));
71 table_logs->setItem(row, 1,
new QTableWidgetItem(
"INFO"));
74 table_logs->setItem(row, 1,
new QTableWidgetItem(
"DEBUG"));
77 table_logs->setItem(row, 1,
new QTableWidgetItem(QString::number(log_msg.level)));
79 table_logs->setItem(row, 2,
new QTableWidgetItem(QString::fromStdString(log_msg.msg)));
86 QTableWidget* table_info =
ui->tableWidgetInfo;
87 QTableWidget* table_params =
ui->tableWidgetParams;
90 restoreGeometry(settings.value(
"ULogParametersDialog/geometry").toByteArray());
91 table_info->horizontalHeader()->restoreState(settings.value(
"ULogParametersDialog/info/state").toByteArray());
92 table_params->horizontalHeader()->restoreState(settings.value(
"ULogParametersDialog/params/state").toByteArray());
94 table_info->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Interactive);
95 table_info->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Interactive);
97 table_params->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Interactive);
98 table_params->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Interactive);
103 QTableWidget* table_info =
ui->tableWidgetInfo;
104 QTableWidget* table_params =
ui->tableWidgetParams;
107 settings.setValue(
"ULogParametersDialog/geometry", this->saveGeometry());
108 settings.setValue(
"ULogParametersDialog/info/state", table_info->horizontalHeader()->saveState());
109 settings.setValue(
"ULogParametersDialog/params/state", table_params->horizontalHeader()->saveState());
const std::vector< MessageLog > & getLogs() const
ULogParametersDialog(const ULogParser &parser, QWidget *parent=nullptr)
const std::vector< Parameter > & getParameters() const
Ui::ULogParametersDialog * ui
const std::map< std::string, std::string > & getInfo() const