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.
64 lines
1.4 KiB
64 lines
1.4 KiB
2 years ago
|
#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 = {};
|
||
|
};
|