mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-28 01:52:06 +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
59 lines
1.4 KiB
C++
59 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <array>
|
|
|
|
#include <QByteArray>
|
|
#include <QColor>
|
|
#include <QFont>
|
|
#include <QRegExpValidator>
|
|
#include <QStringBuilder>
|
|
#include <QStyledItemDelegate>
|
|
#include <QToolButton>
|
|
#include <QVector>
|
|
|
|
#include "tools/cabana/dbcmanager.h"
|
|
using namespace dbcmanager;
|
|
|
|
|
|
class ChangeTracker {
|
|
public:
|
|
void compute(const QByteArray &dat, double ts, uint32_t freq);
|
|
void clear();
|
|
|
|
QVector<double> last_change_t;
|
|
QVector<QColor> colors;
|
|
QVector<std::array<uint32_t, 8>> bit_change_counts;
|
|
|
|
private:
|
|
const int periodic_threshold = 10;
|
|
const int start_alpha = 128;
|
|
const float fade_time = 2.0;
|
|
QByteArray prev_dat;
|
|
};
|
|
|
|
class MessageBytesDelegate : public QStyledItemDelegate {
|
|
Q_OBJECT
|
|
public:
|
|
MessageBytesDelegate(QObject *parent);
|
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
|
QFont fixed_font;
|
|
};
|
|
|
|
inline QString toHex(const QByteArray &dat) { return dat.toHex(' ').toUpper(); }
|
|
inline char toHex(uint value) { return "0123456789ABCDEF"[value & 0xF]; }
|
|
QColor getColor(const dbcmanager::Signal *sig);
|
|
|
|
class NameValidator : public QRegExpValidator {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
NameValidator(QObject *parent=nullptr);
|
|
QValidator::State validate(QString &input, int &pos) const override;
|
|
};
|
|
|
|
namespace utils {
|
|
QPixmap icon(const QString &id);
|
|
}
|
|
|
|
QToolButton *toolButton(const QString &icon, const QString &tooltip);
|