QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
addterminaltostripcommand.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 The QElectroTech Team
3 This file is part of QElectroTech.
4
5 QElectroTech is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9
10 QElectroTech is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef ADDTERMINALTOSTRIPCOMMAND_H
19#define ADDTERMINALTOSTRIPCOMMAND_H
20
21#include <QUndoCommand>
22#include <QPointer>
23#include <QVector>
24
25class TerminalElement;
26class TerminalStrip;
27class RealTerminal;
29
37class AddTerminalToStripCommand : public QUndoCommand
38{
39 public:
40 AddTerminalToStripCommand(QSharedPointer<RealTerminal> terminal, TerminalStrip *strip, QUndoCommand *parent = nullptr);
41 AddTerminalToStripCommand(QVector<QSharedPointer<RealTerminal>> terminals, TerminalStrip *strip, QUndoCommand *parent = nullptr);
43
44 void undo() override;
45 void redo() override;
46
47 private:
48 QVector<QSharedPointer<RealTerminal>> m_terminal;
49 QPointer<TerminalStrip> m_new_strip;
50};
51
57class RemoveTerminalFromStripCommand : public QUndoCommand
58{
59 public:
60 RemoveTerminalFromStripCommand (QSharedPointer<PhysicalTerminal> terminal, TerminalStrip *strip, QUndoCommand *parent = nullptr);
61 RemoveTerminalFromStripCommand (const QVector<QSharedPointer<PhysicalTerminal>> &phy_t_vector, TerminalStrip *strip, QUndoCommand *parent = nullptr);
63
64 void undo() override;
65 void redo() override;
66
67 private:
68 void setCommandTitle();
69
70 private:
71 QVector<QVector<QSharedPointer<RealTerminal>>> m_terminals;
72 QPointer<TerminalStrip> m_strip;
73};
74
75class MoveTerminalCommand : public QUndoCommand
76{
77 public:
78 MoveTerminalCommand (QSharedPointer<PhysicalTerminal> terminal, TerminalStrip *old_strip,
79 TerminalStrip *new_strip, QUndoCommand *parent = nullptr);
80 MoveTerminalCommand (QVector<QSharedPointer<PhysicalTerminal>> terminals, TerminalStrip *old_strip,
81 TerminalStrip *new_strip, QUndoCommand *parent = nullptr);
82
83 void undo() override;
84 void redo() override;
85
86 private:
87 const QVector<QSharedPointer<PhysicalTerminal>> m_terminal;
88 QPointer<TerminalStrip> m_old_strip, m_new_strip;
89
90};
91
92#endif // ADDTERMINALTOSTRIPCOMMAND_H
The AddTerminalToStripCommand class Add a terminal element to a terminal strip Two cases are handled ...
Definition addterminaltostripcommand.h:38
~AddTerminalToStripCommand() override
Definition addterminaltostripcommand.cpp:64
void undo() override
AddTerminalToStripCommand::undo Reimplemented from QUndoCommand.
Definition addterminaltostripcommand.cpp:71
QPointer< TerminalStrip > m_new_strip
Definition addterminaltostripcommand.h:49
QVector< QSharedPointer< RealTerminal > > m_terminal
Definition addterminaltostripcommand.h:48
void redo() override
AddTerminalToStripCommand::redo Reimplemented from QUndoCommand.
Definition addterminaltostripcommand.cpp:82
Definition addterminaltostripcommand.h:76
QPointer< TerminalStrip > m_new_strip
Definition addterminaltostripcommand.h:88
void redo() override
Definition addterminaltostripcommand.cpp:217
QPointer< TerminalStrip > m_old_strip
Definition addterminaltostripcommand.h:88
void undo() override
Definition addterminaltostripcommand.cpp:207
const QVector< QSharedPointer< PhysicalTerminal > > m_terminal
Definition addterminaltostripcommand.h:87
The PhysicalTerminal class Represent a physical terminal. A physical terminal is composed a least by ...
Definition physicalterminal.h:62
The RealTerminal class Represent a real terminal. A real terminal can be a drawn terminal in a folio ...
Definition realterminal.h:43
The RemoveTerminalFromStripCommand class Remove a terminal from a terminal strip. The removed termina...
Definition addterminaltostripcommand.h:58
void undo() override
Definition addterminaltostripcommand.cpp:117
QPointer< TerminalStrip > m_strip
Definition addterminaltostripcommand.h:72
void redo() override
Definition addterminaltostripcommand.cpp:124
~RemoveTerminalFromStripCommand() override
Definition addterminaltostripcommand.h:62
QVector< QVector< QSharedPointer< RealTerminal > > > m_terminals
Definition addterminaltostripcommand.h:71
void setCommandTitle()
Definition addterminaltostripcommand.cpp:137
The TerminalElement class.
Definition terminalelement.h:31
The TerminalStrip class This class hold all the datas and configurations of a terminal strip (but the...
Definition terminalstrip.h:45