mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-10 11:52:10 +08:00
2aafd3bf01
* improve ui * keep splitter size after msg changed * no leading spaces allowed in msg filter and signal filter * draw color byte AlignCenter * always set as current index * reduce chart flickers while resizing * dispaly more info in tooltip for signal * narrow combobox * use * typo * private sigs,fix bugs * merge #27383 * no expanding after undo/redo * gray color in tooltip * clear current_msg_id before reset model * dont call setmeesage if id is the same * fix bugs * cleanup * dont fetch logs if invisible * add new CenterWidget, make sure msg_id is always valid * cache icons * cleanup paint byte color * merge #27385 implement sizeHint * cleanup code * fillrect if alpha>0 old-commit-hash: 4efd246bac004f3b6f1f7d733e6e285b3fdc8322
61 lines
1.9 KiB
C++
61 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include <QAbstractTableModel>
|
|
#include <QHeaderView>
|
|
#include <QLineEdit>
|
|
#include <QSet>
|
|
#include <QTableView>
|
|
|
|
#include "tools/cabana/dbcmanager.h"
|
|
#include "tools/cabana/streams/abstractstream.h"
|
|
using namespace dbcmanager;
|
|
|
|
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<MessageId, CanData> *new_msgs = nullptr);
|
|
void sortMessages();
|
|
void suppress();
|
|
void clearSuppress();
|
|
void reset();
|
|
QList<MessageId> msgs;
|
|
QSet<std::pair<MessageId, int>> suppressed_bytes;
|
|
|
|
private:
|
|
QString filter_str;
|
|
int sort_column = 0;
|
|
Qt::SortOrder sort_order = Qt::AscendingOrder;
|
|
};
|
|
|
|
class MessagesWidget : public QWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
MessagesWidget(QWidget *parent);
|
|
void selectMessage(const MessageId &message_id);
|
|
QByteArray saveHeaderState() const { return table_widget->horizontalHeader()->saveState(); }
|
|
bool restoreHeaderState(const QByteArray &state) const { return table_widget->horizontalHeader()->restoreState(state); }
|
|
void updateSuppressedButtons();
|
|
void reset();
|
|
|
|
signals:
|
|
void msgSelectionChanged(const MessageId &message_id);
|
|
|
|
protected:
|
|
QTableView *table_widget;
|
|
std::optional<MessageId> current_msg_id;
|
|
QLineEdit *filter;
|
|
MessageListModel *model;
|
|
QPushButton *suppress_add;
|
|
QPushButton *suppress_clear;
|
|
|
|
};
|