mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-28 09:23:56 +08:00
* undo/redo
* display command list to rolling the state backwards or forward
* update detailview after rolling states
* add * to title bar to indicate dbc has changed
* fix signal pointer address changed after removed
* cleanup
* fix id error
* clear undo stack after dbc file changed
* cleanup
* use map
* cleanup
* typo
old-commit-hash: 7c922eafe9
64 lines
1.4 KiB
C++
64 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <QUndoCommand>
|
|
|
|
#include "tools/cabana/canmessages.h"
|
|
#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 = {};
|
|
};
|