QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
groupterminalscommand.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 GROUPTERMINALSCOMMAND_H
19#define GROUPTERMINALSCOMMAND_H
20
21#include <QUndoCommand>
22#include <QPointer>
23#include <QVector>
24#include "../terminalstrip.h"
25
30class GroupTerminalsCommand : public QUndoCommand
31{
32 public:
34 const QSharedPointer<PhysicalTerminal> &receiver_,
35 const QVector<QSharedPointer<RealTerminal>> &to_group,
36 QUndoCommand *parent = nullptr);
37
38 void undo() override;
39 void redo() override;
40
41 private:
42 QPointer<TerminalStrip> m_terminal_strip;
43 QSharedPointer<PhysicalTerminal> m_receiver;
44 QVector<QSharedPointer<RealTerminal>> m_to_group;
45};
46
51class UnGroupTerminalsCommand : public QUndoCommand
52{
53 public:
55 const QVector<QSharedPointer<RealTerminal>> &to_ungroup,
56 QUndoCommand *parent = nullptr);
57
58 void undo() override;
59 void redo() override;
60
61 private:
62 void setUp(const QVector<QSharedPointer<RealTerminal>> &to_ungroup);
63
64 private:
65 QPointer<TerminalStrip> m_terminal_strip;
66 QHash <QSharedPointer<PhysicalTerminal>, QVector<QSharedPointer<RealTerminal>>> m_physical_real_H;
67 QVector<QPair<QSharedPointer<RealTerminal>, int>> m_real_t_level;
68};
69
70#endif // GROUPTERMINALSCOMMAND_H
The GroupTerminalsCommand class Class used to group (make level terminal) together.
Definition groupterminalscommand.h:31
void undo() override
Definition groupterminalscommand.cpp:40
QVector< QSharedPointer< RealTerminal > > m_to_group
Definition groupterminalscommand.h:44
QPointer< TerminalStrip > m_terminal_strip
Definition groupterminalscommand.h:42
void redo() override
Definition groupterminalscommand.cpp:46
QSharedPointer< PhysicalTerminal > m_receiver
Definition groupterminalscommand.h:43
The TerminalStrip class This class hold all the datas and configurations of a terminal strip (but the...
Definition terminalstrip.h:45
The UnGroupTerminalsCommand class This class is used to ungroup terminal (remove level of multi level...
Definition groupterminalscommand.h:52
void redo() override
Definition groupterminalscommand.cpp:77
QVector< QPair< QSharedPointer< RealTerminal >, int > > m_real_t_level
Definition groupterminalscommand.h:67
QHash< QSharedPointer< PhysicalTerminal >, QVector< QSharedPointer< RealTerminal > > > m_physical_real_H
Definition groupterminalscommand.h:66
void setUp(const QVector< QSharedPointer< RealTerminal > > &to_ungroup)
Definition groupterminalscommand.cpp:87
QPointer< TerminalStrip > m_terminal_strip
Definition groupterminalscommand.h:65
void undo() override
Definition groupterminalscommand.cpp:62