2021-03-16 19:59:45 +01:00
|
|
|
/*
|
|
|
|
Copyright 2006-2021 The QElectroTech Team
|
|
|
|
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 TERMINALSTRIP_H
|
|
|
|
#define TERMINALSTRIP_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QPointer>
|
2021-04-02 20:51:55 +02:00
|
|
|
#include "terminalstripdata.h"
|
2021-03-16 19:59:45 +01:00
|
|
|
|
|
|
|
class Element;
|
|
|
|
class RealTerminal;
|
|
|
|
class QETProject;
|
|
|
|
class PhysicalTerminal;
|
2021-04-29 20:31:53 +02:00
|
|
|
class TerminalStripIndex;
|
2021-03-16 19:59:45 +01:00
|
|
|
|
|
|
|
class TerminalStrip : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
TerminalStrip(const QString &name, QETProject *project);
|
|
|
|
|
|
|
|
TerminalStrip(const QString &installation,
|
2021-04-02 20:51:55 +02:00
|
|
|
const QString &location,
|
|
|
|
const QString &name,
|
|
|
|
QETProject *project);
|
2021-03-16 19:59:45 +01:00
|
|
|
|
|
|
|
void setInstallation(const QString &installation);
|
2021-04-03 15:48:07 +02:00
|
|
|
QString installation() const {return m_data.m_installation;}
|
2021-03-16 19:59:45 +01:00
|
|
|
void setLocation(const QString &location);
|
2021-04-03 15:48:07 +02:00
|
|
|
QString location() const {return m_data.m_location;}
|
2021-03-16 19:59:45 +01:00
|
|
|
void setName(const QString &name);
|
2021-04-03 15:48:07 +02:00
|
|
|
QString name() const {return m_data.m_name;}
|
2021-04-04 19:39:21 +02:00
|
|
|
void setComment(const QString &comment);
|
|
|
|
QString comment() const {return m_data.m_comment;}
|
2021-04-03 15:48:07 +02:00
|
|
|
void setDescription(const QString &description);
|
|
|
|
QString description() const {return m_data.m_description;}
|
2021-04-09 14:16:22 +02:00
|
|
|
QUuid uuid() const {return m_data.m_uuid;}
|
2021-03-16 19:59:45 +01:00
|
|
|
|
2021-04-29 20:31:53 +02:00
|
|
|
bool addTerminal (Element *terminal);
|
|
|
|
bool removeTerminal (Element *terminal);
|
|
|
|
bool haveTerminal (Element *terminal);
|
|
|
|
|
|
|
|
int physicalTerminalCount() const;
|
|
|
|
TerminalStripIndex index(int index = 0);
|
2021-03-16 19:59:45 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
QSharedPointer<RealTerminal> realTerminal(Element *terminal);
|
|
|
|
QSharedPointer<PhysicalTerminal> physicalTerminal(QSharedPointer<RealTerminal> terminal);
|
|
|
|
|
|
|
|
private:
|
2021-04-02 20:51:55 +02:00
|
|
|
TerminalStripData m_data;
|
2021-03-16 19:59:45 +01:00
|
|
|
QPointer<QETProject> m_project;
|
|
|
|
QVector<QPointer<Element>> m_terminal_elements_vector;
|
|
|
|
QVector<QSharedPointer<RealTerminal>> m_real_terminals;
|
|
|
|
QVector<QSharedPointer<PhysicalTerminal>> m_physical_terminals;
|
|
|
|
};
|
|
|
|
|
2021-04-29 20:31:53 +02:00
|
|
|
class TerminalStripIndex
|
|
|
|
{
|
|
|
|
friend class TerminalStrip;
|
2021-03-16 19:59:45 +01:00
|
|
|
|
2021-04-29 20:31:53 +02:00
|
|
|
private :
|
|
|
|
TerminalStripIndex () {}
|
|
|
|
TerminalStripIndex (TerminalStripIndex *) {}
|
2021-03-16 19:59:45 +01:00
|
|
|
|
2021-04-29 20:31:53 +02:00
|
|
|
public:
|
|
|
|
bool isValid() const;
|
|
|
|
QString label(int level = 0) const;
|
|
|
|
QUuid uuid(int level = 0) const;
|
2021-03-16 19:59:45 +01:00
|
|
|
|
2021-04-29 20:31:53 +02:00
|
|
|
private:
|
|
|
|
QVector<QString> m_label;
|
|
|
|
QVector<QUuid> m_uuid;
|
|
|
|
bool m_valid = false;
|
|
|
|
};
|
2021-03-16 19:59:45 +01:00
|
|
|
|
|
|
|
#endif // TERMINALSTRIP_H
|