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);
26 table_params->setRowCount(
parser.getParameters().size());
30 table_params->setItem(row, 0,
31 new QTableWidgetItem(QString::fromStdString(
param.name)));
33 QString::number(
param.value.val_real) :
34 QString::number(
param.value.val_int);
35 table_params->setItem(row, 1,
new QTableWidgetItem(value_str));
38 table_params->sortItems(0);
40 table_logs->setRowCount(
parser.getLogs().size());
42 for (
const auto& log_msg :
parser.getLogs())
44 QString
time = QString::number(0.001 *
double(log_msg.timestamp / 1000),
'f', 2);
45 table_logs->setItem(row, 0,
new QTableWidgetItem(
time));
47 switch (log_msg.level)
50 table_logs->setItem(row, 1,
new QTableWidgetItem(
"EMERGENCY"));
53 table_logs->setItem(row, 1,
new QTableWidgetItem(
"ALERT"));
56 table_logs->setItem(row, 1,
new QTableWidgetItem(
"CRITICAL"));
59 table_logs->setItem(row, 1,
new QTableWidgetItem(
"ERROR"));
62 table_logs->setItem(row, 1,
new QTableWidgetItem(
"WARNING"));
65 table_logs->setItem(row, 1,
new QTableWidgetItem(
"NOTICE"));
68 table_logs->setItem(row, 1,
new QTableWidgetItem(
"INFO"));
71 table_logs->setItem(row, 1,
new QTableWidgetItem(
"DEBUG"));
74 table_logs->setItem(row, 1,
new QTableWidgetItem(QString::number(log_msg.level)));
76 table_logs->setItem(row, 2,
77 new QTableWidgetItem(QString::fromStdString(log_msg.msg)));
84 QTableWidget* table_info =
ui->tableWidgetInfo;
85 QTableWidget* table_params =
ui->tableWidgetParams;
88 restoreGeometry(settings.value(
"ULogParametersDialog/geometry").toByteArray());
89 table_info->horizontalHeader()->restoreState(
90 settings.value(
"ULogParametersDialog/info/state").toByteArray());
91 table_params->horizontalHeader()->restoreState(
92 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",
109 table_info->horizontalHeader()->saveState());
110 settings.setValue(
"ULogParametersDialog/params/state",
111 table_params->horizontalHeader()->saveState());