openpilot is an open source driver assistance system. openpilot performs the functions of Automated Lane Centering and Adaptive Cruise Control for over 200 supported car makes and models.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

41 lines
1.2 KiB

#pragma once
#include <QAbstractTableModel>
#include <QTableView>
#include "tools/cabana/canmessages.h"
class MessageListModel : public QAbstractTableModel {
Q_OBJECT
public:
MessageListModel(QObject *parent) : QAbstractTableModel(parent) {}
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override { return 5; }
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const override { return msgs.size(); }
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
void setFilterString(const QString &string);
void msgsReceived(const QHash<QString, CanData> *new_msgs = nullptr);
void sortMessages();
QStringList msgs;
private:
QString filter_str;
int sort_column = 0;
Qt::SortOrder sort_order = Qt::AscendingOrder;
};
class MessagesWidget : public QWidget {
Q_OBJECT
public:
MessagesWidget(QWidget *parent);
signals:
void msgSelectionChanged(const QString &message_id);
protected:
QTableView *table_widget;
QString current_msg_id;
MessageListModel *model;
};