Files
dragonpilot/tools/cabana/commands.h
T
Dean Lee 7a485d4308 cabana: refactor and improve signal view (#26997)
* refactor and improve signal view

* cleanup undostack after save

* set clean

* fix logswidget::refresh

* fix bugs in historylog

* historylog:dont reset display_type on msg changed

* inline displaySignals

* historylog:add stretch to header

* remove sizePolicy

* always show toolbar

* add icon to tabwidget

* create new chart on top

* fix 'show plot' btn state sync issue

* rename removeSeries to removeItem

* historylog::fix displayRange

* MessageListModeL: improve setFilterString

* set as current index after expanded

* disable update during setmessage

* ChartWidget: fix issue in updateState

* skip align charts if there only one chart

* fix updateLayout

* cleanup historylog

* updateState before end reset model

* add validator

* improve sigmodel

* expand new signal

* add comment

* reserve vector

* cleanup condition

* single click on row to expand signal

* improve layout for canfd(64 bytes)

* cleanup

* return false on default

* show the latest signal value next to the signal name

* update sig value after setmessage.to make the value updated in pause mode.

* better size policy

* +1 for grid size

* better palette

* set autofillbg
2023-01-29 19:19:50 -08:00

69 lines
1.5 KiB
C++

#pragma once
#include <QUndoCommand>
#include <QUndoStack>
#include "tools/cabana/dbcmanager.h"
class EditMsgCommand : public QUndoCommand {
public:
EditMsgCommand(const QString &id, const QString &title, int size, QUndoCommand *parent = nullptr);
void undo() override;
void redo() override;
private:
const QString id;
QString old_title, new_title;
int old_size = 0, new_size = 0;
};
class RemoveMsgCommand : public QUndoCommand {
public:
RemoveMsgCommand(const QString &id, QUndoCommand *parent = nullptr);
void undo() override;
void redo() override;
private:
const QString id;
DBCMsg message;
};
class AddSigCommand : public QUndoCommand {
public:
AddSigCommand(const QString &id, const Signal &sig, QUndoCommand *parent = nullptr);
void undo() override;
void redo() override;
private:
const QString id;
Signal signal = {};
};
class RemoveSigCommand : public QUndoCommand {
public:
RemoveSigCommand(const QString &id, const Signal *sig, QUndoCommand *parent = nullptr);
void undo() override;
void redo() override;
private:
const QString id;
Signal signal = {};
};
class EditSignalCommand : public QUndoCommand {
public:
EditSignalCommand(const QString &id, const Signal *sig, const Signal &new_sig, QUndoCommand *parent = nullptr);
void undo() override;
void redo() override;
private:
const QString id;
Signal old_signal = {};
Signal new_signal = {};
};
namespace UndoStack {
QUndoStack *instance();
inline void push(QUndoCommand *cmd) { instance()->push(cmd); }
};