QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
terminalstripbridge.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 TERMINALSTRIPBRIDGE_H
19#define TERMINALSTRIPBRIDGE_H
20
21#include <QSharedPointer>
22#include <QUuid>
23#include <QPointer>
24#include <QColor>
25#include <QDomDocument>
26#include <QVector>
27
28class RealTerminal;
29class TerminalStrip;
30
32{
33 friend class TerminalStrip;
34
35 public:
36 static QVector<QColor> bridgeColor() {return QVector<QColor>{Qt::red, Qt::blue, Qt::white, Qt::darkGray, Qt::black};}
37
38 TerminalStripBridge(TerminalStrip *parent_strip = nullptr);
39 QSharedPointer<TerminalStripBridge> sharedRef();
40 QWeakPointer<TerminalStripBridge> weakRef();
41
42 QColor color() const;
43 void setColor(const QColor &color);
44 QVector<QSharedPointer<RealTerminal>> realTerminals() const;
45
46 static QString xmlTagName() {return QStringLiteral("terminal_strip_bridge");}
47 QDomElement toXml(QDomDocument &parent_document) const;
48 void fromXml(const QDomElement &dom_element);
49 QUuid uuid() const noexcept;
50
51 private:
52 bool addTerminals(const QVector<QSharedPointer<RealTerminal>> &real_terminals);
53 void removeTerminals(const QVector<QSharedPointer<RealTerminal>> &real_terminals);
54 void removeTerminal(const QSharedPointer<RealTerminal> &real_terminal);
55
56
57 private:
59 QVector<QSharedPointer<RealTerminal>> m_real_terminals;
60 QColor m_color = Qt::darkGray;
61 QUuid m_uuid = QUuid::createUuid();
63};
64
65
66
67#endif // TERMINALSTRIPBRIDGE_H
The RealTerminal class Represent a real terminal. A real terminal can be a drawn terminal in a folio ...
Definition realterminal.h:43
Definition terminalstripbridge.h:32
static QString xmlTagName()
Definition terminalstripbridge.h:46
void removeTerminals(const QVector< QSharedPointer< RealTerminal > > &real_terminals)
TerminalStripBridge::removeTerminals.
Definition terminalstripbridge.cpp:168
QColor m_color
Definition terminalstripbridge.h:60
void fromXml(const QDomElement &dom_element)
Definition terminalstripbridge.cpp:102
QPointer< TerminalStrip > m_strip
Definition terminalstripbridge.h:58
QWeakPointer< TerminalStripBridge > m_this_weak
Definition terminalstripbridge.h:62
void removeTerminal(const QSharedPointer< RealTerminal > &real_terminal)
Definition terminalstripbridge.cpp:175
bool addTerminals(const QVector< QSharedPointer< RealTerminal > > &real_terminals)
TerminalStripBridge::addTerminals.
Definition terminalstripbridge.cpp:139
QWeakPointer< TerminalStripBridge > weakRef()
TerminalStripBridge::weakRef.
Definition terminalstripbridge.cpp:47
QUuid m_uuid
Definition terminalstripbridge.h:61
QSharedPointer< TerminalStripBridge > sharedRef()
TerminalStripBridge::sharedRef.
Definition terminalstripbridge.cpp:31
void setColor(const QColor &color)
Definition terminalstripbridge.cpp:59
QDomElement toXml(QDomDocument &parent_document) const
TerminalStripBridge::toXml Save this bridge into a QDomElement and return it.
Definition terminalstripbridge.cpp:80
QUuid uuid() const noexcept
TerminalStripBridge::uuid.
Definition terminalstripbridge.cpp:127
QColor color() const
TerminalStripBridge::color.
Definition terminalstripbridge.cpp:55
QVector< QSharedPointer< RealTerminal > > m_real_terminals
Definition terminalstripbridge.h:59
QVector< QSharedPointer< RealTerminal > > realTerminals() const
TerminalStripBridge::realTerminals.
Definition terminalstripbridge.cpp:70
static QVector< QColor > bridgeColor()
Definition terminalstripbridge.h:36
The TerminalStrip class This class hold all the datas and configurations of a terminal strip (but the...
Definition terminalstrip.h:45