2 #include "ui_ulog_parameters_dialog.h" 4 #include <QTableWidget> 14 QTableWidget* table_info =
ui->tableWidgetInfo;
15 QTableWidget* table_params =
ui->tableWidgetParams;
16 QTableWidget* table_logs =
ui->tableWidgetLogs;
18 table_info->setRowCount( parser.
getInfo().size() );
20 for(
const auto& it: parser.
getInfo() )
22 table_info->setItem( row, 0,
new QTableWidgetItem( QString::fromStdString(it.first) ) );
23 table_info->setItem( row, 1,
new QTableWidgetItem( QString::fromStdString(it.second) ) );
26 table_info->sortItems(0);
32 table_params->setItem( row, 0,
new QTableWidgetItem( QString::fromStdString(
param.name) ) );
35 table_params->setItem( row, 1,
new QTableWidgetItem( QString::number(
param.value.val_real ) ) );
38 table_params->setItem( row, 1,
new QTableWidgetItem( QString::number(
param.value.val_int ) ) );
42 table_params->sortItems(0);
44 table_logs->setRowCount( parser.
getLogs().size() );
46 for(
const auto& log_msg: parser.
getLogs() )
48 QString time = QString::number( 0.001 *
double(log_msg.timestamp /1000),
'f', 2);
49 table_logs->setItem( row, 0,
new QTableWidgetItem(time) );
53 case '0': table_logs->setItem( row, 1,
new QTableWidgetItem(
"EMERGENCY") );
break;
54 case '1': table_logs->setItem( row, 1,
new QTableWidgetItem(
"ALERT") );
break;
55 case '2': table_logs->setItem( row, 1,
new QTableWidgetItem(
"CRITICAL") );
break;
56 case '3': table_logs->setItem( row, 1,
new QTableWidgetItem(
"ERROR") );
break;
57 case '4': table_logs->setItem( row, 1,
new QTableWidgetItem(
"WARNING") );
break;
58 case '5': table_logs->setItem( row, 1,
new QTableWidgetItem(
"NOTICE") );
break;
59 case '6': table_logs->setItem( row, 1,
new QTableWidgetItem(
"INFO") );
break;
60 case '7': table_logs->setItem( row, 1,
new QTableWidgetItem(
"DEBUG") );
break;
62 table_logs->setItem( row, 1,
new QTableWidgetItem( QString::number( log_msg.level )) );
64 table_logs->setItem( row, 2,
new QTableWidgetItem( QString::fromStdString( log_msg.msg ) ) );
71 QTableWidget* table_info =
ui->tableWidgetInfo;
72 QTableWidget* table_params =
ui->tableWidgetParams;
75 restoreGeometry(settings.value(
"ULogParametersDialog/geometry").toByteArray());
76 table_info->horizontalHeader()->restoreState(settings.value(
"ULogParametersDialog/info/state").toByteArray());
77 table_params->horizontalHeader()->restoreState(settings.value(
"ULogParametersDialog/params/state").toByteArray());
79 table_info->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Interactive);
80 table_info->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Interactive);
82 table_params->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Interactive);
83 table_params->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Interactive);
88 QTableWidget* table_info =
ui->tableWidgetInfo;
89 QTableWidget* table_params =
ui->tableWidgetParams;
92 settings.setValue(
"ULogParametersDialog/geometry", this->saveGeometry() );
93 settings.setValue(
"ULogParametersDialog/info/state",
94 table_info->horizontalHeader()->saveState() );
95 settings.setValue(
"ULogParametersDialog/params/state",
96 table_params->horizontalHeader()->saveState() );
const std::vector< MessageLog > & getLogs() const
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val)
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