Files
MoreTore/tools/cabana/historylog.h
T
Dean Lee a02e81b710 Cabana: limit X-axis range from settings (#26213)
* limit X-axis range from settings

* continue

* update range if events merged

* update line series by range

* cleanup removeChart

* cleanup updateAxisy
old-commit-hash: 728d969249
2022-10-26 12:59:37 -07:00

40 lines
1.1 KiB
C++

#pragma once
#include <QTableView>
#include "tools/cabana/canmessages.h"
#include "tools/cabana/dbcmanager.h"
class HistoryLogModel : public QAbstractTableModel {
Q_OBJECT
public:
HistoryLogModel(QObject *parent) : QAbstractTableModel(parent) {}
void setMessage(const QString &message_id);
void updateState();
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override { return row_count; }
int columnCount(const QModelIndex &parent = QModelIndex()) const override { return column_count; }
private:
QString msg_id;
int row_count = 0;
int column_count = 2;
const Msg *dbc_msg = nullptr;
std::deque<CanData> messages;
};
class HistoryLog : public QWidget {
Q_OBJECT
public:
HistoryLog(QWidget *parent);
void setMessage(const QString &message_id) { model->setMessage(message_id); }
void updateState() { model->updateState(); }
private:
QTableView *table;
HistoryLogModel *model;
};