2021-12-01 21:27:04 +01:00
|
|
|
|
/*
|
2023-01-01 17:05:57 +01:00
|
|
|
|
Copyright 2006-2023 The QElectroTech Team
|
2021-12-01 21:27:04 +01:00
|
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
#ifndef BRIDGETERMINALSCOMMAND_H
|
|
|
|
|
#define BRIDGETERMINALSCOMMAND_H
|
|
|
|
|
|
|
|
|
|
#include <QUndoCommand>
|
|
|
|
|
#include <QVector>
|
|
|
|
|
#include <QPointer>
|
|
|
|
|
#include <QMultiMap>
|
|
|
|
|
|
2021-12-19 14:55:02 +01:00
|
|
|
|
#include "../terminalstrip.h"
|
2021-12-01 21:27:04 +01:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief The BridgeTerminalsCommand class
|
2022-12-04 08:21:12 -05:00
|
|
|
|
* UndoCommand use to create bridge between terminals
|
2021-12-01 21:27:04 +01:00
|
|
|
|
* of a terminals strip
|
|
|
|
|
*/
|
|
|
|
|
class BridgeTerminalsCommand : public QUndoCommand
|
|
|
|
|
{
|
|
|
|
|
public:
|
2021-12-26 17:26:00 +01:00
|
|
|
|
BridgeTerminalsCommand(TerminalStrip *strip, QVector<QSharedPointer<RealTerminal>> real_terminal, QUndoCommand *parent = nullptr);
|
2021-12-01 21:27:04 +01:00
|
|
|
|
~BridgeTerminalsCommand() override {}
|
|
|
|
|
|
|
|
|
|
void undo() override;
|
|
|
|
|
void redo() override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QPointer<TerminalStrip> m_strip;
|
2021-12-26 17:26:00 +01:00
|
|
|
|
QVector<QSharedPointer<RealTerminal>> m_real_terminal_vector;
|
2022-01-27 20:00:46 +01:00
|
|
|
|
QSharedPointer<TerminalStripBridge> m_bridge;
|
2021-12-01 21:27:04 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief The UnBridgeTerminalsCommand class
|
2022-12-04 08:21:12 -05:00
|
|
|
|
* UndoCommand use to remove bridge between terminals
|
2021-12-01 21:27:04 +01:00
|
|
|
|
* of a terminals strip
|
|
|
|
|
*/
|
|
|
|
|
class UnBridgeTerminalsCommand : public QUndoCommand
|
|
|
|
|
{
|
|
|
|
|
public:
|
2021-12-26 17:26:00 +01:00
|
|
|
|
UnBridgeTerminalsCommand(TerminalStrip *strip, QVector<QSharedPointer<RealTerminal>> real_terminal, QUndoCommand *parent = nullptr);
|
2021-12-01 21:27:04 +01:00
|
|
|
|
~UnBridgeTerminalsCommand() override{}
|
|
|
|
|
|
|
|
|
|
void undo() override;
|
|
|
|
|
void redo() override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QPointer<TerminalStrip> m_strip;
|
2021-12-26 17:26:00 +01:00
|
|
|
|
QSharedPointer<TerminalStripBridge> m_bridge;
|
|
|
|
|
QVector<QSharedPointer<RealTerminal>> m_terminals;
|
2021-12-01 21:27:04 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // BRIDGETERMINALSCOMMAND_H
|